Revert "Hide an internal variable from a public header."

This reverts commit fbd3b71690.
This commit is contained in:
Tsuda Kageyu 2015-08-31 16:20:41 +09:00
parent e2466a72f8
commit 12f59d774e
2 changed files with 16 additions and 14 deletions

View File

@ -49,14 +49,6 @@ 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)
{
@ -191,9 +183,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);
}
@ -209,9 +201,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);
}
@ -781,7 +773,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) {
@ -821,7 +813,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) {
@ -835,6 +827,9 @@ void String::copyFromUTF16(const char *s, size_t length, Type t)
}
}
const String::Type String::WCharByteOrder
= (Utils::systemByteOrder() == Utils::BigEndian) ? String::UTF16BE : String::UTF16LE;
}
////////////////////////////////////////////////////////////////////////////////

View File

@ -539,6 +539,13 @@ 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;
};