summaryrefslogtreecommitdiff
path: root/cpp/src/slice2java
diff options
context:
space:
mode:
authorBernard Normier <bernard@zeroc.com>2016-06-03 14:11:48 -0400
committerBernard Normier <bernard@zeroc.com>2016-06-03 14:11:48 -0400
commit48b141f8f6a8603f6b13a85bde002f6b480832f7 (patch)
tree41cf4ae281ad96e13216ea208a6579aa442844d3 /cpp/src/slice2java
parentFixed 3.7a2 version in msbuild props files (diff)
downloadice-48b141f8f6a8603f6b13a85bde002f6b480832f7.tar.bz2
ice-48b141f8f6a8603f6b13a85bde002f6b480832f7.tar.xz
ice-48b141f8f6a8603f6b13a85bde002f6b480832f7.zip
Refactored string converters and use codecvt_utf8[_utf16] when
available instead of ConvertUTF
Diffstat (limited to 'cpp/src/slice2java')
-rw-r--r--cpp/src/slice2java/Gen.cpp21
1 files changed, 3 insertions, 18 deletions
diff --git a/cpp/src/slice2java/Gen.cpp b/cpp/src/slice2java/Gen.cpp
index 97f46017c45..14d6acad2a0 100644
--- a/cpp/src/slice2java/Gen.cpp
+++ b/cpp/src/slice2java/Gen.cpp
@@ -14,7 +14,7 @@
#include <IceUtil/Iterator.h>
#include <IceUtil/StringUtil.h>
#include <IceUtil/InputUtil.h>
-#include <IceUtil/Unicode.h>
+#include <IceUtil/StringConverter.h>
#include <cstring>
#include <limits>
@@ -39,23 +39,8 @@ u16CodePoint(unsigned short value)
void
writeU8Buffer(const vector<unsigned char>& u8buffer, ::IceUtilInternal::Output& out)
{
- vector<unsigned short> u16buffer;
- IceUtilInternal::ConversionResult result = convertUTF8ToUTF16(u8buffer, u16buffer, IceUtil::lenientConversion);
- switch(result)
- {
- case conversionOK:
- break;
- case sourceExhausted:
- throw IceUtil::IllegalConversionException(__FILE__, __LINE__, "string source exhausted");
- case sourceIllegal:
- throw IceUtil::IllegalConversionException(__FILE__, __LINE__, "string source illegal");
- default:
- {
- assert(0);
- throw IceUtil::IllegalConversionException(__FILE__, __LINE__);
- }
- }
-
+ vector<unsigned short> u16buffer = toUTF16(u8buffer);
+
for(vector<unsigned short>::const_iterator c = u16buffer.begin(); c != u16buffer.end(); ++c)
{
out << u16CodePoint(*c);