mirror of
https://github.com/taglib/taglib.git
synced 2025-06-04 01:28:21 -04:00
Prefixed public variables
This commit is contained in:
parent
b0938a3cf1
commit
8f8ef3788f
@ -21,7 +21,7 @@ option(BUILD_EXAMPLES "Build the examples" OFF)
|
||||
|
||||
option(NO_ITUNES_HACKS "Disable workarounds for iTunes bugs" OFF)
|
||||
|
||||
set(TESTS_DIR "${CMAKE_CURRENT_SOURCE_DIR}/tests/")
|
||||
set(TAGLIB_TESTS_DIR "${CMAKE_CURRENT_SOURCE_DIR}/tests/")
|
||||
|
||||
## the following are directories where stuff will be installed to
|
||||
set(LIB_SUFFIX "" CACHE STRING "Define suffix of directory name (32/64)")
|
||||
|
@ -7,6 +7,28 @@ include(CheckTypeSize)
|
||||
include(CheckCXXSourceCompiles)
|
||||
include(TestBigEndian)
|
||||
|
||||
# Check if the size of integral types are suitable.
|
||||
|
||||
check_type_size("short" SIZEOF_SHORT)
|
||||
if(NOT ${SIZEOF_SHORT} EQUAL 2)
|
||||
MESSAGE(FATAL_ERROR "TagLib requires that short is 16-bit wide.")
|
||||
endif()
|
||||
|
||||
check_type_size("int" SIZEOF_INT)
|
||||
if(NOT ${SIZEOF_INT} EQUAL 4)
|
||||
MESSAGE(FATAL_ERROR "TagLib requires that int is 32-bit wide.")
|
||||
endif()
|
||||
|
||||
check_type_size("long long" SIZEOF_LONGLONG)
|
||||
if(NOT ${SIZEOF_LONGLONG} EQUAL 8)
|
||||
MESSAGE(FATAL_ERROR "TagLib requires that long long is 64-bit wide.")
|
||||
endif()
|
||||
|
||||
check_type_size("wchar_t" SIZEOF_WCHAR_T)
|
||||
if(${SIZEOF_WCHAR_T} LESS 2)
|
||||
MESSAGE(FATAL_ERROR "TagLib requires that wchar_t is sufficient to store a UTF-16 char.")
|
||||
endif()
|
||||
|
||||
# Determine the CPU byte order.
|
||||
|
||||
test_big_endian(TAGLIB_BIG_ENDIAN)
|
||||
@ -15,13 +37,6 @@ if(NOT TAGLIB_BIG_ENDIAN)
|
||||
set(TAGLIB_LITTLE_ENDIAN 1)
|
||||
endif()
|
||||
|
||||
# Determine the size of integral types.
|
||||
|
||||
check_type_size("short" SIZEOF_SHORT)
|
||||
check_type_size("int" SIZEOF_INT)
|
||||
check_type_size("long long" SIZEOF_LONGLONG)
|
||||
check_type_size("wchar_t" SIZEOF_WCHAR_T)
|
||||
|
||||
# Determine if your compiler supports std::wstring.
|
||||
|
||||
check_cxx_source_compiles("
|
||||
@ -30,7 +45,7 @@ check_cxx_source_compiles("
|
||||
std::wstring x(L\"ABC\");
|
||||
return 0;
|
||||
}
|
||||
" HAVE_STD_WSTRING)
|
||||
" TAGLIB_HAVE_STD_WSTRING)
|
||||
|
||||
# Determine which kind of atomic operations your compiler supports.
|
||||
|
||||
@ -42,9 +57,9 @@ check_cxx_source_compiles("
|
||||
x.fetch_sub(1);
|
||||
return 0;
|
||||
}
|
||||
" HAVE_STD_ATOMIC)
|
||||
" TAGLIB_HAVE_STD_ATOMIC)
|
||||
|
||||
if(NOT HAVE_STD_ATOMIC)
|
||||
if(NOT TAGLIB_HAVE_STD_ATOMIC)
|
||||
check_cxx_source_compiles("
|
||||
#include <boost/atomic.hpp>
|
||||
int main() {
|
||||
@ -53,9 +68,9 @@ if(NOT HAVE_STD_ATOMIC)
|
||||
x.fetch_sub(1);
|
||||
return 0;
|
||||
}
|
||||
" HAVE_BOOST_ATOMIC)
|
||||
" TAGLIB_HAVE_BOOST_ATOMIC)
|
||||
|
||||
if(NOT HAVE_BOOST_ATOMIC)
|
||||
if(NOT TAGLIB_HAVE_BOOST_ATOMIC)
|
||||
check_cxx_source_compiles("
|
||||
int main() {
|
||||
volatile int x;
|
||||
@ -63,9 +78,9 @@ if(NOT HAVE_STD_ATOMIC)
|
||||
int y = __sync_sub_and_fetch(&x, 1);
|
||||
return 0;
|
||||
}
|
||||
" HAVE_GCC_ATOMIC)
|
||||
" TAGLIB_HAVE_GCC_ATOMIC)
|
||||
|
||||
if(NOT HAVE_GCC_ATOMIC)
|
||||
if(NOT TAGLIB_HAVE_GCC_ATOMIC)
|
||||
check_cxx_source_compiles("
|
||||
#include <libkern/OSAtomic.h>
|
||||
int main() {
|
||||
@ -74,9 +89,9 @@ if(NOT HAVE_STD_ATOMIC)
|
||||
int32_t y = OSAtomicDecrement32Barrier(&x);
|
||||
return 0;
|
||||
}
|
||||
" HAVE_MAC_ATOMIC)
|
||||
" TAGLIB_HAVE_MAC_ATOMIC)
|
||||
|
||||
if(NOT HAVE_MAC_ATOMIC)
|
||||
if(NOT TAGLIB_HAVE_MAC_ATOMIC)
|
||||
check_cxx_source_compiles("
|
||||
#include <windows.h>
|
||||
int main() {
|
||||
@ -85,9 +100,9 @@ if(NOT HAVE_STD_ATOMIC)
|
||||
LONG y = InterlockedDecrement(&x);
|
||||
return 0;
|
||||
}
|
||||
" HAVE_WIN_ATOMIC)
|
||||
" TAGLIB_HAVE_WIN_ATOMIC)
|
||||
|
||||
if(NOT HAVE_WIN_ATOMIC)
|
||||
if(NOT TAGLIB_HAVE_WIN_ATOMIC)
|
||||
check_cxx_source_compiles("
|
||||
#include <ia64intrin.h>
|
||||
int main() {
|
||||
@ -96,7 +111,7 @@ if(NOT HAVE_STD_ATOMIC)
|
||||
int y = __sync_sub_and_fetch(&x, 1);
|
||||
return 0;
|
||||
}
|
||||
" HAVE_IA64_ATOMIC)
|
||||
" TAGLIB_HAVE_IA64_ATOMIC)
|
||||
endif()
|
||||
endif()
|
||||
endif()
|
||||
@ -112,23 +127,23 @@ check_cxx_source_compiles("
|
||||
__builtin_bswap16(0);
|
||||
return 0;
|
||||
}
|
||||
" HAVE_GCC_BYTESWAP_16)
|
||||
" TAGLIB_HAVE_GCC_BYTESWAP_16)
|
||||
|
||||
check_cxx_source_compiles("
|
||||
int main() {
|
||||
__builtin_bswap32(0);
|
||||
return 0;
|
||||
}
|
||||
" HAVE_GCC_BYTESWAP_32)
|
||||
" TAGLIB_HAVE_GCC_BYTESWAP_32)
|
||||
|
||||
check_cxx_source_compiles("
|
||||
int main() {
|
||||
__builtin_bswap64(0);
|
||||
return 0;
|
||||
}
|
||||
" HAVE_GCC_BYTESWAP_64)
|
||||
" TAGLIB_HAVE_GCC_BYTESWAP_64)
|
||||
|
||||
if(NOT HAVE_GCC_BYTESWAP_16 OR NOT HAVE_GCC_BYTESWAP_32 OR NOT HAVE_GCC_BYTESWAP_64)
|
||||
if(NOT TAGLIB_HAVE_GCC_BYTESWAP_16 OR NOT TAGLIB_HAVE_GCC_BYTESWAP_32 OR NOT TAGLIB_HAVE_GCC_BYTESWAP_64)
|
||||
check_cxx_source_compiles("
|
||||
#include <byteswap.h>
|
||||
int main() {
|
||||
@ -137,9 +152,9 @@ if(NOT HAVE_GCC_BYTESWAP_16 OR NOT HAVE_GCC_BYTESWAP_32 OR NOT HAVE_GCC_BYTESWAP
|
||||
__bswap_64(0);
|
||||
return 0;
|
||||
}
|
||||
" HAVE_GLIBC_BYTESWAP)
|
||||
" TAGLIB_HAVE_GLIBC_BYTESWAP)
|
||||
|
||||
if(NOT HAVE_GLIBC_BYTESWAP)
|
||||
if(NOT TAGLIB_HAVE_GLIBC_BYTESWAP)
|
||||
check_cxx_source_compiles("
|
||||
#include <stdlib.h>
|
||||
int main() {
|
||||
@ -148,9 +163,9 @@ if(NOT HAVE_GCC_BYTESWAP_16 OR NOT HAVE_GCC_BYTESWAP_32 OR NOT HAVE_GCC_BYTESWAP
|
||||
_byteswap_uint64(0);
|
||||
return 0;
|
||||
}
|
||||
" HAVE_MSC_BYTESWAP)
|
||||
" TAGLIB_HAVE_MSC_BYTESWAP)
|
||||
|
||||
if(NOT HAVE_MSC_BYTESWAP)
|
||||
if(NOT TAGLIB_HAVE_MSC_BYTESWAP)
|
||||
check_cxx_source_compiles("
|
||||
#include <libkern/OSByteOrder.h>
|
||||
int main() {
|
||||
@ -159,9 +174,9 @@ if(NOT HAVE_GCC_BYTESWAP_16 OR NOT HAVE_GCC_BYTESWAP_32 OR NOT HAVE_GCC_BYTESWAP
|
||||
OSSwapInt64(0);
|
||||
return 0;
|
||||
}
|
||||
" HAVE_MAC_BYTESWAP)
|
||||
" TAGLIB_HAVE_MAC_BYTESWAP)
|
||||
|
||||
if(NOT HAVE_MAC_BYTESWAP)
|
||||
if(NOT TAGLIB_HAVE_MAC_BYTESWAP)
|
||||
check_cxx_source_compiles("
|
||||
#include <sys/endian.h>
|
||||
int main() {
|
||||
@ -170,7 +185,7 @@ if(NOT HAVE_GCC_BYTESWAP_16 OR NOT HAVE_GCC_BYTESWAP_32 OR NOT HAVE_GCC_BYTESWAP
|
||||
swap64(0);
|
||||
return 0;
|
||||
}
|
||||
" HAVE_OPENBSD_BYTESWAP)
|
||||
" TAGLIB_HAVE_OPENBSD_BYTESWAP)
|
||||
endif()
|
||||
endif()
|
||||
endif()
|
||||
@ -184,15 +199,15 @@ check_cxx_source_compiles("
|
||||
std::codecvt_utf8_utf16<wchar_t> x;
|
||||
return 0;
|
||||
}
|
||||
" HAVE_STD_CODECVT)
|
||||
" TAGLIB_HAVE_STD_CODECVT)
|
||||
|
||||
# Check for libz using the cmake supplied FindZLIB.cmake
|
||||
|
||||
find_package(ZLIB)
|
||||
if(ZLIB_FOUND)
|
||||
set(HAVE_ZLIB 1)
|
||||
set(TAGLIB_HAVE_ZLIB 1)
|
||||
else()
|
||||
set(HAVE_ZLIB 0)
|
||||
set(TAGLIB_HAVE_ZLIB 0)
|
||||
endif()
|
||||
|
||||
|
||||
|
@ -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
|
||||
|
@ -17,7 +17,7 @@ using namespace std;
|
||||
|
||||
inline string testFilePath(const string &filename)
|
||||
{
|
||||
return string(TESTS_DIR "data/") + filename;
|
||||
return string(TAGLIB_TESTS_DIR "data/") + filename;
|
||||
}
|
||||
|
||||
#define TEST_FILE_PATH_C(f) testFilePath(f).c_str()
|
||||
|
Loading…
x
Reference in New Issue
Block a user