mirror of
https://github.com/debauchee/barrier.git
synced 2025-08-06 10:09:28 +02:00
Changes from mercurial repository.
This commit is contained in:
parent
44bb32f476
commit
98c68897d8
135 changed files with 2686 additions and 26965 deletions
|
@ -97,7 +97,7 @@ CUnicode::isUTF8(const CString& src)
|
|||
{
|
||||
// convert and test each character
|
||||
const UInt8* data = reinterpret_cast<const UInt8*>(src.c_str());
|
||||
for (UInt32 n = src.size(); n > 0; ) {
|
||||
for (UInt32 n = (UInt32)src.size(); n > 0; ) {
|
||||
if (fromUTF8(data, n) == s_invalid) {
|
||||
return false;
|
||||
}
|
||||
|
@ -112,7 +112,7 @@ CUnicode::UTF8ToUCS2(const CString& src, bool* errors)
|
|||
resetError(errors);
|
||||
|
||||
// get size of input string and reserve some space in output
|
||||
UInt32 n = src.size();
|
||||
UInt32 n = (UInt32)src.size();
|
||||
CString dst;
|
||||
dst.reserve(2 * n);
|
||||
|
||||
|
@ -141,7 +141,7 @@ CUnicode::UTF8ToUCS4(const CString& src, bool* errors)
|
|||
resetError(errors);
|
||||
|
||||
// get size of input string and reserve some space in output
|
||||
UInt32 n = src.size();
|
||||
UInt32 n = (UInt32)src.size();
|
||||
CString dst;
|
||||
dst.reserve(4 * n);
|
||||
|
||||
|
@ -165,7 +165,7 @@ CUnicode::UTF8ToUTF16(const CString& src, bool* errors)
|
|||
resetError(errors);
|
||||
|
||||
// get size of input string and reserve some space in output
|
||||
UInt32 n = src.size();
|
||||
UInt32 n = (UInt32)src.size();
|
||||
CString dst;
|
||||
dst.reserve(2 * n);
|
||||
|
||||
|
@ -203,7 +203,7 @@ CUnicode::UTF8ToUTF32(const CString& src, bool* errors)
|
|||
resetError(errors);
|
||||
|
||||
// get size of input string and reserve some space in output
|
||||
UInt32 n = src.size();
|
||||
UInt32 n = (UInt32)src.size();
|
||||
CString dst;
|
||||
dst.reserve(4 * n);
|
||||
|
||||
|
@ -254,7 +254,7 @@ CUnicode::UCS2ToUTF8(const CString& src, bool* errors)
|
|||
resetError(errors);
|
||||
|
||||
// convert
|
||||
UInt32 n = src.size() >> 1;
|
||||
UInt32 n = (UInt32)src.size() >> 1;
|
||||
return doUCS2ToUTF8(reinterpret_cast<const UInt8*>(src.data()), n, errors);
|
||||
}
|
||||
|
||||
|
@ -265,7 +265,7 @@ CUnicode::UCS4ToUTF8(const CString& src, bool* errors)
|
|||
resetError(errors);
|
||||
|
||||
// convert
|
||||
UInt32 n = src.size() >> 2;
|
||||
UInt32 n = (UInt32)src.size() >> 2;
|
||||
return doUCS4ToUTF8(reinterpret_cast<const UInt8*>(src.data()), n, errors);
|
||||
}
|
||||
|
||||
|
@ -276,7 +276,7 @@ CUnicode::UTF16ToUTF8(const CString& src, bool* errors)
|
|||
resetError(errors);
|
||||
|
||||
// convert
|
||||
UInt32 n = src.size() >> 1;
|
||||
UInt32 n = (UInt32)src.size() >> 1;
|
||||
return doUTF16ToUTF8(reinterpret_cast<const UInt8*>(src.data()), n, errors);
|
||||
}
|
||||
|
||||
|
@ -287,7 +287,7 @@ CUnicode::UTF32ToUTF8(const CString& src, bool* errors)
|
|||
resetError(errors);
|
||||
|
||||
// convert
|
||||
UInt32 n = src.size() >> 2;
|
||||
UInt32 n = (UInt32)src.size() >> 2;
|
||||
return doUTF32ToUTF8(reinterpret_cast<const UInt8*>(src.data()), n, errors);
|
||||
}
|
||||
|
||||
|
@ -298,7 +298,7 @@ CUnicode::textToUTF8(const CString& src, bool* errors)
|
|||
resetError(errors);
|
||||
|
||||
// convert string to wide characters
|
||||
UInt32 n = src.size();
|
||||
UInt32 n = (UInt32)src.size();
|
||||
int len = ARCH->convStringMBToWC(NULL, src.c_str(), n, errors);
|
||||
wchar_t* wcs = new wchar_t[len + 1];
|
||||
ARCH->convStringMBToWC(wcs, src.c_str(), n, errors);
|
||||
|
@ -320,22 +320,22 @@ CUnicode::UTF8ToWideChar(const CString& src, UInt32& size, bool* errors)
|
|||
switch (ARCH->getWideCharEncoding()) {
|
||||
case IArchString::kUCS2:
|
||||
tmp = UTF8ToUCS2(src, errors);
|
||||
size = tmp.size() >> 1;
|
||||
size = (UInt32)tmp.size() >> 1;
|
||||
break;
|
||||
|
||||
case IArchString::kUCS4:
|
||||
tmp = UTF8ToUCS4(src, errors);
|
||||
size = tmp.size() >> 2;
|
||||
size = (UInt32)tmp.size() >> 2;
|
||||
break;
|
||||
|
||||
case IArchString::kUTF16:
|
||||
tmp = UTF8ToUTF16(src, errors);
|
||||
size = tmp.size() >> 1;
|
||||
size = (UInt32)tmp.size() >> 1;
|
||||
break;
|
||||
|
||||
case IArchString::kUTF32:
|
||||
tmp = UTF8ToUTF32(src, errors);
|
||||
size = tmp.size() >> 2;
|
||||
size = (UInt32)tmp.size() >> 2;
|
||||
break;
|
||||
|
||||
default:
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue