mirror of
https://github.com/pocoproject/poco.git
synced 2025-01-18 00:15:27 +01:00
Linux fixes for UnicodeConverter
This commit is contained in:
parent
416cc7a630
commit
0bcf08b3f7
@ -18,14 +18,14 @@
|
||||
// execute, and transmit the Software, and to prepare derivative works of the
|
||||
// Software, and to permit third-parties to whom the Software is furnished to
|
||||
// do so, all subject to the following:
|
||||
//
|
||||
//
|
||||
// The copyright notices in the Software and this entire statement, including
|
||||
// the above license grant, this restriction and the following disclaimer,
|
||||
// must be included in all copies of the Software, in whole or in part, and
|
||||
// all derivative works of the Software, unless such copies or derivative
|
||||
// works are solely in the form of machine-executable object code generated by
|
||||
// a source language processor.
|
||||
//
|
||||
//
|
||||
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
// FITNESS FOR A PARTICULAR PURPOSE, TITLE AND NON-INFRINGEMENT. IN NO EVENT
|
||||
@ -67,9 +67,9 @@ namespace Poco {
|
||||
typedef UInt32 UTF32Char;
|
||||
typedef std::basic_string<UInt32> UTF32String;
|
||||
#elif (__SIZEOF_WCHAR_T__ == 4)
|
||||
typedef Poco::Uint16 UTF16Char;
|
||||
typedef Poco::UInt16 UTF16Char;
|
||||
typedef std::basic_string<UInt16> UTF16String;
|
||||
typedef UInt32 UTF32Char;
|
||||
typedef wchar_t UTF32Char;
|
||||
typedef std::wstring UTF32String;
|
||||
#endif
|
||||
#else // default to 32-bit wchar_t
|
||||
@ -79,7 +79,7 @@ namespace Poco {
|
||||
typedef std::wstring UTF32String;
|
||||
#endif //POCO_OS_FAMILY_WINDOWS
|
||||
//#endif // POCO_ENABLE_CPP11
|
||||
#endif POCO_NO_WSTRING
|
||||
#endif //POCO_NO_WSTRING
|
||||
|
||||
|
||||
} // namespace Poco
|
||||
|
@ -43,6 +43,7 @@
|
||||
#include "Poco/UTF8Encoding.h"
|
||||
#include "Poco/UTF16Encoding.h"
|
||||
#include "Poco/UTF32Encoding.h"
|
||||
#include <cstring>
|
||||
|
||||
|
||||
namespace Poco {
|
||||
|
@ -30,10 +30,10 @@
|
||||
//
|
||||
|
||||
|
||||
#include "Poco/UnicodeConverter.h"
|
||||
#include "UnicodeConverterTest.h"
|
||||
#include "CppUnit/TestCaller.h"
|
||||
#include "CppUnit/TestSuite.h"
|
||||
#include "Poco/UnicodeConverter.h"
|
||||
#include "Poco/UTFString.h"
|
||||
|
||||
|
||||
|
@ -38,6 +38,8 @@
|
||||
|
||||
#include "Poco/Foundation.h"
|
||||
#include "CppUnit/TestCase.h"
|
||||
#include "Poco/UnicodeConverter.h"
|
||||
#include <cstring>
|
||||
|
||||
|
||||
class UnicodeConverterTest: public CppUnit::TestCase
|
||||
@ -63,9 +65,9 @@ private:
|
||||
|
||||
// Convert from UTF-8 to wide
|
||||
T wtext, wtext2, wtext3;
|
||||
UnicodeConverter::convert(text, wtext);
|
||||
UnicodeConverter::convert((const char*) supp, strlen((const char*) supp), wtext2);
|
||||
UnicodeConverter::convert((const char*) supp, wtext3);
|
||||
Poco::UnicodeConverter::convert(text, wtext);
|
||||
Poco::UnicodeConverter::convert((const char*) supp, strlen((const char*) supp), wtext2);
|
||||
Poco::UnicodeConverter::convert((const char*) supp, wtext3);
|
||||
|
||||
std::string text2, text3, text4;
|
||||
|
||||
@ -74,9 +76,9 @@ private:
|
||||
assert (text != text4);
|
||||
|
||||
// Convert from wide to UTF-8
|
||||
UnicodeConverter::convert(wtext, text2);
|
||||
UnicodeConverter::convert(wtext2, text3);
|
||||
UnicodeConverter::convert(wtext3, text4);
|
||||
Poco::UnicodeConverter::convert(wtext, text2);
|
||||
Poco::UnicodeConverter::convert(wtext2, text3);
|
||||
Poco::UnicodeConverter::convert(wtext3, text4);
|
||||
|
||||
assert (text == text2);
|
||||
assert (text == text3);
|
||||
|
Loading…
x
Reference in New Issue
Block a user