Separated public and private config.h

This commit is contained in:
Tsuda Kageyu
2013-05-03 11:44:36 +09:00
parent 8f8ef3788f
commit 23bd3784a1
10 changed files with 154 additions and 106 deletions

View File

@ -23,9 +23,10 @@
* http://www.mozilla.org/MPL/ *
***************************************************************************/
#include "config.h"
#include "taglib_config.h"
#if TAGLIB_HAVE_ZLIB
#if HAVE_ZLIB
#include <zlib.h>
#endif
@ -248,7 +249,7 @@ ByteVector Frame::fieldData(const ByteVector &frameData) const
frameDataOffset += 4;
}
#if TAGLIB_HAVE_ZLIB
#if HAVE_ZLIB
if(d->header->compression() &&
!d->header->encryption())
{

View File

@ -23,6 +23,7 @@
* http://www.mozilla.org/MPL/ *
***************************************************************************/
#include "config.h"
#include "taglib_config.h"
#include <tdebug.h>
@ -133,7 +134,7 @@ Frame *FrameFactory::createFrame(const ByteVector &origData, Header *tagHeader)
// TagLib doesn't mess with encrypted frames, so just treat them
// as unknown frames.
#if !defined(TAGLIB_HAVE_ZLIB) || TAGLIB_HAVE_ZLIB == 0
#if !defined(HAVE_ZLIB) || HAVE_ZLIB == 0
if(header->compression()) {
debug("Compressed frames are currently not supported.");
return new UnknownFrame(data, header);

View File

@ -1,9 +1,5 @@
/* taglib_config.h. Generated by cmake from taglib_config.h.cmake */
/* Indicates the endianness of your target system */
#cmakedefine TAGLIB_LITTLE_ENDIAN 1
#cmakedefine TAGLIB_BIG_ENDIAN 1
/* Defined if your compiler supports std::wstring */
#cmakedefine TAGLIB_HAVE_STD_WSTRING 1
@ -15,22 +11,6 @@
#cmakedefine TAGLIB_HAVE_WIN_ATOMIC 1
#cmakedefine TAGLIB_HAVE_IA64_ATOMIC 1
/* Defined if your compiler supports some byte swap functions */
#cmakedefine TAGLIB_HAVE_GCC_BYTESWAP_16 1
#cmakedefine TAGLIB_HAVE_GCC_BYTESWAP_32 1
#cmakedefine TAGLIB_HAVE_GCC_BYTESWAP_64 1
#cmakedefine TAGLIB_HAVE_GLIBC_BYTESWAP 1
#cmakedefine TAGLIB_HAVE_MSC_BYTESWAP 1
#cmakedefine TAGLIB_HAVE_MAC_BYTESWAP 1
#cmakedefine TAGLIB_HAVE_OPENBSD_BYTESWAP 1
/* Defined if your compiler supports codecvt */
#cmakedefine TAGLIB_HAVE_STD_CODECVT 1
/* Defined if you have libz */
#cmakedefine TAGLIB_HAVE_ZLIB 1
#define TAGLIB_WITH_ASF 1
#define TAGLIB_WITH_MP4 1
#cmakedefine TAGLIB_TESTS_DIR "@TESTS_DIR@"

View File

@ -86,54 +86,6 @@
# define TAGLIB_ATOMIC_DEC(x) (--x)
#endif
// Optimized byte swap functions.
#if defined(TAGLIB_HAVE_MSC_BYTESWAP)
# include <stdlib.h>
#elif defined(TAGLIB_HAVE_GLIBC_BYTESWAP)
# include <byteswap.h>
#elif defined(TAGLIB_HAVE_MAC_BYTESWAP)
# include <libkern/OSByteOrder.h>
#elif defined(TAGLIB_HAVE_OPENBSD_BYTESWAP)
# include <sys/endian.h>
#endif
#if defined(TAGLIB_HAVE_GCC_BYTESWAP_16)
# define TAGLIB_BYTESWAP_16(x) __builtin_bswap16(x)
#elif defined(TAGLIB_HAVE_MSC_BYTESWAP)
# define TAGLIB_BYTESWAP_16(x) _byteswap_ushort(x)
#elif defined(TAGLIB_HAVE_GLIBC_BYTESWAP)
# define TAGLIB_BYTESWAP_16(x) __bswap_16(x)
#elif defined(TAGLIB_HAVE_MAC_BYTESWAP)
# define TAGLIB_BYTESWAP_16(x) OSSwapInt16(x)
#elif defined(TAGLIB_HAVE_OPENBSD_BYTESWAP)
# define TAGLIB_BYTESWAP_16(x) swap16(x)
#endif
#if defined(TAGLIB_HAVE_GCC_BYTESWAP_32)
# define TAGLIB_BYTESWAP_32(x) __builtin_bswap32(x)
#elif defined(TAGLIB_HAVE_MSC_BYTESWAP)
# define TAGLIB_BYTESWAP_32(x) _byteswap_ulong(x)
#elif defined(TAGLIB_HAVE_GLIBC_BYTESWAP)
# define TAGLIB_BYTESWAP_32(x) __bswap_32(x)
#elif defined(TAGLIB_HAVE_MAC_BYTESWAP)
# define TAGLIB_BYTESWAP_32(x) OSSwapInt32(x)
#elif defined(TAGLIB_HAVE_OPENBSD_BYTESWAP)
# define TAGLIB_BYTESWAP_32(x) swap32(x)
#endif
#if defined(TAGLIB_HAVE_GCC_BYTESWAP_64)
# define TAGLIB_BYTESWAP_64(x) __builtin_bswap64(x)
#elif defined(TAGLIB_HAVE_MSC_BYTESWAP)
# define TAGLIB_BYTESWAP_64(x) _byteswap_uint64(x)
#elif defined(TAGLIB_HAVE_GLIBC_BYTESWAP)
# define TAGLIB_BYTESWAP_64(x) __bswap_64(x)
#elif defined(TAGLIB_HAVE_MAC_BYTESWAP)
# define TAGLIB_BYTESWAP_64(x) OSSwapInt64(x)
#elif defined(TAGLIB_HAVE_OPENBSD_BYTESWAP)
# define TAGLIB_BYTESWAP_64(x) swap64(x)
#endif
//! A namespace for all TagLib related classes and functions
/*!

View File

@ -23,9 +23,22 @@
* http://www.mozilla.org/MPL/ *
***************************************************************************/
#include "config.h"
#include <iostream>
#include <cstdio>
#include <cstring>
#if defined(HAVE_MSC_BYTESWAP)
# include <stdlib.h>
#elif defined(HAVE_GLIBC_BYTESWAP)
# include <byteswap.h>
#elif defined(HAVE_MAC_BYTESWAP)
# include <libkern/OSByteOrder.h>
#elif defined(HAVE_OPENBSD_BYTESWAP)
# include <sys/endian.h>
#endif
#include <tstring.h>
#include <tdebug.h>
@ -185,9 +198,25 @@ T byteSwap(T x)
template <>
ushort byteSwap<ushort>(ushort x)
{
#ifdef TAGLIB_BYTESWAP_16
#if defined(HAVE_GCC_BYTESWAP_16)
return TAGLIB_BYTESWAP_16(x);
return __builtin_bswap16(x);
#elif defined(HAVE_MSC_BYTESWAP)
return _byteswap_ushort(x);
#elif defined(HAVE_GLIBC_BYTESWAP)
return __bswap_16(x);
#elif defined(HAVE_MAC_BYTESWAP)
return OSSwapInt16(x);
#elif defined(HAVE_OPENBSD_BYTESWAP)
return swap16(x);
#else
@ -199,9 +228,25 @@ ushort byteSwap<ushort>(ushort x)
template <>
uint byteSwap<uint>(uint x)
{
#ifdef TAGLIB_BYTESWAP_32
#if defined(HAVE_GCC_BYTESWAP_32)
return TAGLIB_BYTESWAP_32(x);
return __builtin_bswap32(x);
#elif defined(HAVE_MSC_BYTESWAP)
return _byteswap_ulong(x);
#elif defined(HAVE_GLIBC_BYTESWAP)
return __bswap_32(x);
#elif defined(HAVE_MAC_BYTESWAP)
return OSSwapInt32(x);
#elif defined(HAVE_OPENBSD_BYTESWAP)
return swap32(x);
#else
@ -216,9 +261,25 @@ uint byteSwap<uint>(uint x)
template <>
ulonglong byteSwap<ulonglong>(ulonglong x)
{
#ifdef TAGLIB_BYTESWAP_64
#if defined(HAVE_GCC_BYTESWAP_64)
return TAGLIB_BYTESWAP_64(x);
return __builtin_bswap64(x);
#elif defined(HAVE_MSC_BYTESWAP)
return _byteswap_uint64(x);
#elif defined(HAVE_GLIBC_BYTESWAP)
return __bswap_64(x);
#elif defined(HAVE_MAC_BYTESWAP)
return OSSwapInt64(x);
#elif defined(HAVE_OPENBSD_BYTESWAP)
return swap64(x);
#else
@ -246,7 +307,7 @@ T toNumber(const ByteVector &v, size_t offset, bool mostSignificantByteFirst)
T tmp;
::memcpy(&tmp, v.data() + offset, sizeof(T));
#ifdef TAGLIB_LITTLE_ENDIAN
#if SYSTEM_BYTEORDER == 1
const bool swap = mostSignificantByteFirst;
#else
const bool swap != mostSignificantByteFirst;
@ -279,7 +340,7 @@ ByteVector fromNumber(T value, bool mostSignificantByteFirst)
{
const size_t size = sizeof(T);
#ifdef TAGLIB_LITTLE_ENDIAN
#if SYSTEM_BYTEORDER == 1
const bool swap = mostSignificantByteFirst;
#else
const bool swap != mostSignificantByteFirst;

View File

@ -25,6 +25,8 @@
// This class assumes that std::basic_string<T> has a contiguous and null-terminated buffer.
#include "config.h"
#include "tstring.h"
#include "tdebug.h"
#include "tstringlist.h"
@ -32,7 +34,17 @@
#include <iostream>
#include <string.h>
#ifdef TAGLIB_HAVE_STD_CODECVT
#if defined(HAVE_MSC_BYTESWAP)
# include <stdlib.h>
#elif defined(HAVE_GLIBC_BYTESWAP)
# include <byteswap.h>
#elif defined(HAVE_MAC_BYTESWAP)
# include <libkern/OSByteOrder.h>
#elif defined(HAVE_OPENBSD_BYTESWAP)
# include <sys/endian.h>
#endif
#ifdef HAVE_STD_CODECVT
# include <codecvt>
#else
# include "unicode.h"
@ -42,13 +54,29 @@ namespace
{
inline TagLib::ushort byteSwap(TagLib::ushort x)
{
#ifdef TAGLIB_BYTESWAP_16
#if defined(HAVE_GCC_BYTESWAP_16)
return TAGLIB_BYTESWAP_16(x);
return __builtin_bswap16(x);
#elif defined(HAVE_MSC_BYTESWAP)
return _byteswap_ushort(x);
#elif defined(HAVE_GLIBC_BYTESWAP)
return __bswap_16(x);
#elif defined(HAVE_MAC_BYTESWAP)
return OSSwapInt16(x);
#elif defined(HAVE_OPENBSD_BYTESWAP)
return swap16(x);
#else
return((x >> 8) & 0xff) | ((x & 0xff) << 8);
return ((x >> 8) & 0xff) | ((x & 0xff) << 8);
#endif
}
@ -60,7 +88,7 @@ namespace
void UTF16toUTF8(const wchar_t *src, size_t srcLength, char *dst, size_t dstLength)
{
#ifdef TAGLIB_HAVE_STD_CODECVT
#ifdef HAVE_STD_CODECVT
typedef std::codecvt_utf8_utf16<wchar_t> utf8_utf16_t;
@ -106,7 +134,7 @@ namespace
void UTF8toUTF16(const char *src, size_t srcLength, wchar_t *dst, size_t dstLength)
{
#ifdef TAGLIB_HAVE_STD_CODECVT
#ifdef HAVE_STD_CODECVT
typedef std::codecvt_utf8_utf16<wchar_t> utf8_utf16_t;
@ -840,7 +868,7 @@ void String::copyFromUTF16(const char *s, size_t length, Type t)
}
}
#ifdef TAGLIB_LITTLE_ENDIAN
#if SYSTEM_BYTEORDER == 1
const String::Type String::WCharByteOrder = String::UTF16LE;