]> granicus.if.org Git - taglib/commitdiff
Hide an internal variable from a public header.
authorTsuda Kageyu <tsuda.kageyu@gmail.com>
Sat, 29 Aug 2015 15:56:32 +0000 (00:56 +0900)
committerTsuda Kageyu <tsuda.kageyu@gmail.com>
Sat, 29 Aug 2015 16:01:34 +0000 (01:01 +0900)
taglib/toolkit/tstring.cpp
taglib/toolkit/tstring.h

index 258e1fcf54f16af34e423262c005bb3f404405b4..be22c9c06c78452da200dec7b3fd293e24f7c713 100644 (file)
@@ -49,6 +49,14 @@ namespace
 {
   using namespace TagLib;
 
+  inline String::Type wcharByteOrder()
+  {
+    if(Utils::systemByteOrder() == Utils::LittleEndian)
+      return String::UTF16LE;
+    else
+      return String::UTF16BE;
+  }
+
   inline size_t UTF16toUTF8(
     const wchar_t *src, size_t srcLength, char *dst, size_t dstLength)
   {
@@ -183,9 +191,9 @@ String::String(const wstring &s, Type t)
     // This looks ugly but needed for the compatibility with TagLib1.8.
     // Should be removed in TabLib2.0.
     if (t == UTF16BE)
-      t = WCharByteOrder;
+      t = wcharByteOrder();
     else if (t == UTF16LE)
-      t = (WCharByteOrder == UTF16LE ? UTF16BE : UTF16LE);
+      t = (wcharByteOrder() == UTF16LE ? UTF16BE : UTF16LE);
 
     copyFromUTF16(s.c_str(), s.length(), t);
   }
@@ -201,9 +209,9 @@ String::String(const wchar_t *s, Type t)
     // This looks ugly but needed for the compatibility with TagLib1.8.
     // Should be removed in TabLib2.0.
     if (t == UTF16BE)
-      t = WCharByteOrder;
+      t = wcharByteOrder();
     else if (t == UTF16LE)
-      t = (WCharByteOrder == UTF16LE ? UTF16BE : UTF16LE);
+      t = (wcharByteOrder() == UTF16LE ? UTF16BE : UTF16LE);
 
     copyFromUTF16(s, ::wcslen(s), t);
   }
@@ -773,7 +781,7 @@ void String::copyFromUTF16(const wchar_t *s, size_t length, Type t)
     length--;
   }
   else
-    swap = (t != WCharByteOrder);
+    swap = (t != wcharByteOrder());
 
   d->data.resize(length);
   if(length > 0) {
@@ -813,7 +821,7 @@ void String::copyFromUTF16(const char *s, size_t length, Type t)
     length -= 2;
   }
   else
-    swap = (t != WCharByteOrder);
+    swap = (t != wcharByteOrder());
 
   d->data.resize(length / 2);
   for(size_t i = 0; i < length / 2; ++i) {
@@ -827,9 +835,6 @@ void String::copyFromUTF16(const char *s, size_t length, Type t)
   }
 }
 
-const String::Type String::WCharByteOrder
-  = (Utils::systemByteOrder() == Utils::BigEndian) ? String::UTF16BE : String::UTF16LE;
-
 }
 
 ////////////////////////////////////////////////////////////////////////////////
index 8b73988231e7081fff746c4f72d7a0f707629d4b..3fc2005374635eaee23915618062da675a9eb770 100644 (file)
@@ -539,13 +539,6 @@ namespace TagLib {
      */
     void copyFromUTF16(const char *s, size_t length, Type t);
 
-    /*!
-     * Indicates which byte order of UTF-16 is used to store strings internally.
-     *
-     * \note \e String::UTF16BE or \e String::UTF16LE
-     */
-    static const Type WCharByteOrder;
-
     class StringPrivate;
     StringPrivate *d;
   };