mirror of
https://github.com/taglib/taglib.git
synced 2025-11-17 07:02:53 -05:00
Prefixed public variables
This commit is contained in:
@ -25,7 +25,7 @@
|
||||
|
||||
#include "taglib_config.h"
|
||||
|
||||
#if HAVE_ZLIB
|
||||
#if TAGLIB_HAVE_ZLIB
|
||||
#include <zlib.h>
|
||||
#endif
|
||||
|
||||
@ -248,7 +248,7 @@ ByteVector Frame::fieldData(const ByteVector &frameData) const
|
||||
frameDataOffset += 4;
|
||||
}
|
||||
|
||||
#if HAVE_ZLIB
|
||||
#if TAGLIB_HAVE_ZLIB
|
||||
if(d->header->compression() &&
|
||||
!d->header->encryption())
|
||||
{
|
||||
|
||||
@ -133,7 +133,7 @@ Frame *FrameFactory::createFrame(const ByteVector &origData, Header *tagHeader)
|
||||
// TagLib doesn't mess with encrypted frames, so just treat them
|
||||
// as unknown frames.
|
||||
|
||||
#if HAVE_ZLIB == 0
|
||||
#if !defined(TAGLIB_HAVE_ZLIB) || TAGLIB_HAVE_ZLIB == 0
|
||||
if(header->compression()) {
|
||||
debug("Compressed frames are currently not supported.");
|
||||
return new UnknownFrame(data, header);
|
||||
|
||||
@ -4,39 +4,33 @@
|
||||
#cmakedefine TAGLIB_LITTLE_ENDIAN 1
|
||||
#cmakedefine TAGLIB_BIG_ENDIAN 1
|
||||
|
||||
/* Size of integral types */
|
||||
#cmakedefine SIZEOF_SHORT ${SIZEOF_SHORT}
|
||||
#cmakedefine SIZEOF_INT ${SIZEOF_INT}
|
||||
#cmakedefine SIZEOF_LONGLONG ${SIZEOF_LONGLONG}
|
||||
#cmakedefine SIZEOF_WCHAR_T ${SIZEOF_WCHAR_T}
|
||||
|
||||
/* Defined if your compiler supports std::wstring */
|
||||
#cmakedefine HAVE_STD_WSTRING 1
|
||||
#cmakedefine TAGLIB_HAVE_STD_WSTRING 1
|
||||
|
||||
/* Defined if your compiler supports some atomic operations */
|
||||
#cmakedefine HAVE_STD_ATOMIC 1
|
||||
#cmakedefine HAVE_BOOST_ATOMIC 1
|
||||
#cmakedefine HAVE_GCC_ATOMIC 1
|
||||
#cmakedefine HAVE_MAC_ATOMIC 1
|
||||
#cmakedefine HAVE_WIN_ATOMIC 1
|
||||
#cmakedefine HAVE_IA64_ATOMIC 1
|
||||
#cmakedefine TAGLIB_HAVE_STD_ATOMIC 1
|
||||
#cmakedefine TAGLIB_HAVE_BOOST_ATOMIC 1
|
||||
#cmakedefine TAGLIB_HAVE_GCC_ATOMIC 1
|
||||
#cmakedefine TAGLIB_HAVE_MAC_ATOMIC 1
|
||||
#cmakedefine TAGLIB_HAVE_WIN_ATOMIC 1
|
||||
#cmakedefine TAGLIB_HAVE_IA64_ATOMIC 1
|
||||
|
||||
/* Defined if your compiler supports some byte swap functions */
|
||||
#cmakedefine HAVE_GCC_BYTESWAP_16 1
|
||||
#cmakedefine HAVE_GCC_BYTESWAP_32 1
|
||||
#cmakedefine HAVE_GCC_BYTESWAP_64 1
|
||||
#cmakedefine HAVE_GLIBC_BYTESWAP 1
|
||||
#cmakedefine HAVE_MSC_BYTESWAP 1
|
||||
#cmakedefine HAVE_MAC_BYTESWAP 1
|
||||
#cmakedefine HAVE_OPENBSD_BYTESWAP 1
|
||||
#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 HAVE_STD_CODECVT 1
|
||||
#cmakedefine TAGLIB_HAVE_STD_CODECVT 1
|
||||
|
||||
/* Defined if you have libz */
|
||||
#cmakedefine HAVE_ZLIB 1
|
||||
#cmakedefine TAGLIB_HAVE_ZLIB 1
|
||||
|
||||
#define TAGLIB_WITH_ASF 1
|
||||
#define TAGLIB_WITH_MP4 1
|
||||
|
||||
#cmakedefine TESTS_DIR "@TESTS_DIR@"
|
||||
#cmakedefine TAGLIB_TESTS_DIR "@TESTS_DIR@"
|
||||
|
||||
@ -32,26 +32,6 @@
|
||||
#define TAGLIB_MINOR_VERSION 8
|
||||
#define TAGLIB_PATCH_VERSION 0
|
||||
|
||||
// Check the widths of integral types.
|
||||
|
||||
#if SIZEOF_SHORT != 2
|
||||
# error TagLib requires that short is 16-bit wide.
|
||||
#endif
|
||||
|
||||
#if SIZEOF_INT != 4
|
||||
# error TagLib requires that int is 32-bit wide.
|
||||
#endif
|
||||
|
||||
#if SIZEOF_LONGLONG != 8
|
||||
# error TagLib requires that long long is 64-bit wide.
|
||||
#endif
|
||||
|
||||
#if SIZEOF_WCHAR_T < 2
|
||||
# error TagLib requires that wchar_t is sufficient to store a UTF-16 char.
|
||||
#endif
|
||||
|
||||
#include <string>
|
||||
|
||||
#if defined(__GNUC__) && (__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ > 1))
|
||||
#define TAGLIB_IGNORE_MISSING_DESTRUCTOR _Pragma("GCC diagnostic ignored \"-Wnon-virtual-dtor\"")
|
||||
#else
|
||||
@ -64,23 +44,25 @@
|
||||
#define TAGLIB_CONSTRUCT_BITSET(x) static_cast<unsigned long>(x)
|
||||
#endif
|
||||
|
||||
#include <string>
|
||||
|
||||
// Atomic increment/decrement operations
|
||||
|
||||
#if defined(HAVE_STD_ATOMIC)
|
||||
#if defined(TAGLIB_HAVE_STD_ATOMIC)
|
||||
# include <atomic>
|
||||
# define TAGLIB_ATOMIC_INT std::atomic<unsigned int>
|
||||
# define TAGLIB_ATOMIC_INC(x) x.fetch_add(1)
|
||||
# define TAGLIB_ATOMIC_DEC(x) (x.fetch_sub(1) - 1)
|
||||
#elif defined(HAVE_BOOST_ATOMIC)
|
||||
#elif defined(TAGLIB_HAVE_BOOST_ATOMIC)
|
||||
# include <boost/atomic.hpp>
|
||||
# define TAGLIB_ATOMIC_INT boost::atomic<unsigned int>
|
||||
# define TAGLIB_ATOMIC_INC(x) x.fetch_add(1)
|
||||
# define TAGLIB_ATOMIC_DEC(x) (x.fetch_sub(1) - 1)
|
||||
#elif defined(HAVE_GCC_ATOMIC)
|
||||
#elif defined(TAGLIB_HAVE_GCC_ATOMIC)
|
||||
# define TAGLIB_ATOMIC_INT int
|
||||
# define TAGLIB_ATOMIC_INC(x) __sync_add_and_fetch(&x, 1)
|
||||
# define TAGLIB_ATOMIC_DEC(x) __sync_sub_and_fetch(&x, 1)
|
||||
#elif defined(HAVE_WIN_ATOMIC)
|
||||
#elif defined(TAGLIB_HAVE_WIN_ATOMIC)
|
||||
# if !defined(NOMINMAX)
|
||||
# define NOMINMAX
|
||||
# endif
|
||||
@ -88,12 +70,12 @@
|
||||
# define TAGLIB_ATOMIC_INT long
|
||||
# define TAGLIB_ATOMIC_INC(x) InterlockedIncrement(&x)
|
||||
# define TAGLIB_ATOMIC_DEC(x) InterlockedDecrement(&x)
|
||||
#elif defined(HAVE_MAC_ATOMIC)
|
||||
#elif defined(TAGLIB_HAVE_MAC_ATOMIC)
|
||||
# include <libkern/OSAtomic.h>
|
||||
# define TAGLIB_ATOMIC_INT int32_t
|
||||
# define TAGLIB_ATOMIC_INC(x) OSAtomicIncrement32Barrier(&x)
|
||||
# define TAGLIB_ATOMIC_DEC(x) OSAtomicDecrement32Barrier(&x)
|
||||
#elif defined(HAVE_IA64_ATOMIC)
|
||||
#elif defined(TAGLIB_HAVE_IA64_ATOMIC)
|
||||
# include <ia64intrin.h>
|
||||
# define TAGLIB_ATOMIC_INT int
|
||||
# define TAGLIB_ATOMIC_INC(x) __sync_add_and_fetch(&x, 1)
|
||||
@ -106,49 +88,49 @@
|
||||
|
||||
// Optimized byte swap functions.
|
||||
|
||||
#if defined(HAVE_MSC_BYTESWAP)
|
||||
#if defined(TAGLIB_HAVE_MSC_BYTESWAP)
|
||||
# include <stdlib.h>
|
||||
#elif defined(HAVE_GLIBC_BYTESWAP)
|
||||
#elif defined(TAGLIB_HAVE_GLIBC_BYTESWAP)
|
||||
# include <byteswap.h>
|
||||
#elif defined(HAVE_MAC_BYTESWAP)
|
||||
#elif defined(TAGLIB_HAVE_MAC_BYTESWAP)
|
||||
# include <libkern/OSByteOrder.h>
|
||||
#elif defined(HAVE_OPENBSD_BYTESWAP)
|
||||
#elif defined(TAGLIB_HAVE_OPENBSD_BYTESWAP)
|
||||
# include <sys/endian.h>
|
||||
#endif
|
||||
|
||||
#if defined(HAVE_GCC_BYTESWAP_16)
|
||||
#if defined(TAGLIB_HAVE_GCC_BYTESWAP_16)
|
||||
# define TAGLIB_BYTESWAP_16(x) __builtin_bswap16(x)
|
||||
#elif defined(HAVE_MSC_BYTESWAP)
|
||||
#elif defined(TAGLIB_HAVE_MSC_BYTESWAP)
|
||||
# define TAGLIB_BYTESWAP_16(x) _byteswap_ushort(x)
|
||||
#elif defined(HAVE_GLIBC_BYTESWAP)
|
||||
#elif defined(TAGLIB_HAVE_GLIBC_BYTESWAP)
|
||||
# define TAGLIB_BYTESWAP_16(x) __bswap_16(x)
|
||||
#elif defined(HAVE_MAC_BYTESWAP)
|
||||
#elif defined(TAGLIB_HAVE_MAC_BYTESWAP)
|
||||
# define TAGLIB_BYTESWAP_16(x) OSSwapInt16(x)
|
||||
#elif defined(HAVE_OPENBSD_BYTESWAP)
|
||||
#elif defined(TAGLIB_HAVE_OPENBSD_BYTESWAP)
|
||||
# define TAGLIB_BYTESWAP_16(x) swap16(x)
|
||||
#endif
|
||||
|
||||
#if defined(HAVE_GCC_BYTESWAP_32)
|
||||
#if defined(TAGLIB_HAVE_GCC_BYTESWAP_32)
|
||||
# define TAGLIB_BYTESWAP_32(x) __builtin_bswap32(x)
|
||||
#elif defined(HAVE_MSC_BYTESWAP)
|
||||
#elif defined(TAGLIB_HAVE_MSC_BYTESWAP)
|
||||
# define TAGLIB_BYTESWAP_32(x) _byteswap_ulong(x)
|
||||
#elif defined(HAVE_GLIBC_BYTESWAP)
|
||||
#elif defined(TAGLIB_HAVE_GLIBC_BYTESWAP)
|
||||
# define TAGLIB_BYTESWAP_32(x) __bswap_32(x)
|
||||
#elif defined(HAVE_MAC_BYTESWAP)
|
||||
#elif defined(TAGLIB_HAVE_MAC_BYTESWAP)
|
||||
# define TAGLIB_BYTESWAP_32(x) OSSwapInt32(x)
|
||||
#elif defined(HAVE_OPENBSD_BYTESWAP)
|
||||
#elif defined(TAGLIB_HAVE_OPENBSD_BYTESWAP)
|
||||
# define TAGLIB_BYTESWAP_32(x) swap32(x)
|
||||
#endif
|
||||
|
||||
#if defined(HAVE_GCC_BYTESWAP_64)
|
||||
#if defined(TAGLIB_HAVE_GCC_BYTESWAP_64)
|
||||
# define TAGLIB_BYTESWAP_64(x) __builtin_bswap64(x)
|
||||
#elif defined(HAVE_MSC_BYTESWAP)
|
||||
#elif defined(TAGLIB_HAVE_MSC_BYTESWAP)
|
||||
# define TAGLIB_BYTESWAP_64(x) _byteswap_uint64(x)
|
||||
#elif defined(HAVE_GLIBC_BYTESWAP)
|
||||
#elif defined(TAGLIB_HAVE_GLIBC_BYTESWAP)
|
||||
# define TAGLIB_BYTESWAP_64(x) __bswap_64(x)
|
||||
#elif defined(HAVE_MAC_BYTESWAP)
|
||||
#elif defined(TAGLIB_HAVE_MAC_BYTESWAP)
|
||||
# define TAGLIB_BYTESWAP_64(x) OSSwapInt64(x)
|
||||
#elif defined(HAVE_OPENBSD_BYTESWAP)
|
||||
#elif defined(TAGLIB_HAVE_OPENBSD_BYTESWAP)
|
||||
# define TAGLIB_BYTESWAP_64(x) swap64(x)
|
||||
#endif
|
||||
|
||||
@ -179,7 +161,7 @@ namespace TagLib {
|
||||
* Unfortunately std::wstring isn't defined on some systems, (i.e. GCC < 3)
|
||||
* so I'm providing something here that should be constant.
|
||||
*/
|
||||
#ifdef HAVE_STD_WSTRING
|
||||
#ifdef TAGLIB_HAVE_STD_WSTRING
|
||||
typedef std::wstring wstring;
|
||||
#else
|
||||
typedef std::basic_string<wchar> wstring;
|
||||
|
||||
@ -32,13 +32,7 @@
|
||||
#include <iostream>
|
||||
#include <string.h>
|
||||
|
||||
// x86 CPUs are alignment-tolerant or allow pointer casts from smaller types to larger types.
|
||||
#if defined(__i386__) || defined(_M_IX86) || defined(__amd64) || defined(__amd64__) \
|
||||
|| defined(_M_AMD64) || defined(__x86_64) || defined(__x86_64__) || defined(_M_X64)
|
||||
# define TAGLIB_ALIGNMENT_TOLERANT 1
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_STD_CODECVT
|
||||
#ifdef TAGLIB_HAVE_STD_CODECVT
|
||||
# include <codecvt>
|
||||
#else
|
||||
# include "unicode.h"
|
||||
@ -66,7 +60,7 @@ namespace
|
||||
|
||||
void UTF16toUTF8(const wchar_t *src, size_t srcLength, char *dst, size_t dstLength)
|
||||
{
|
||||
#ifdef HAVE_STD_CODECVT
|
||||
#ifdef TAGLIB_HAVE_STD_CODECVT
|
||||
|
||||
typedef std::codecvt_utf8_utf16<wchar_t> utf8_utf16_t;
|
||||
|
||||
@ -112,7 +106,7 @@ namespace
|
||||
|
||||
void UTF8toUTF16(const char *src, size_t srcLength, wchar_t *dst, size_t dstLength)
|
||||
{
|
||||
#ifdef HAVE_STD_CODECVT
|
||||
#ifdef TAGLIB_HAVE_STD_CODECVT
|
||||
|
||||
typedef std::codecvt_utf8_utf16<wchar_t> utf8_utf16_t;
|
||||
|
||||
@ -813,12 +807,6 @@ void String::copyFromUTF16(const wchar_t *s, size_t length, Type t)
|
||||
|
||||
void String::copyFromUTF16(const char *s, size_t length, Type t)
|
||||
{
|
||||
#if SIZEOF_WCHAR_T == 2 && defined(TAGLIB_ALIGNMENT_TOLERANT)
|
||||
|
||||
copyFromUTF16(reinterpret_cast<const wchar_t*>(s), length / 2, t);
|
||||
|
||||
#else
|
||||
|
||||
bool swap;
|
||||
if(t == UTF16) {
|
||||
if(length < 2) {
|
||||
@ -850,8 +838,6 @@ void String::copyFromUTF16(const char *s, size_t length, Type t)
|
||||
d->data[i] = swap ? combine(*s, *(s + 1)) : combine(*(s + 1), *s);
|
||||
s += 2;
|
||||
}
|
||||
|
||||
#endif
|
||||
}
|
||||
|
||||
#ifdef TAGLIB_LITTLE_ENDIAN
|
||||
|
||||
Reference in New Issue
Block a user