diff options
author | Jose <jose@zeroc.com> | 2016-03-08 18:27:54 +0100 |
---|---|---|
committer | Jose <jose@zeroc.com> | 2016-03-08 18:27:54 +0100 |
commit | 0e7e446475ebb6cf3a9382d54f0a28c04fa6e776 (patch) | |
tree | 3370c718e1acab6fc5b7a9a3ffb2db01c56e46bf /cpp/src/slice2java | |
parent | renaming man pages for icegriddb/icestormdb (diff) | |
download | ice-0e7e446475ebb6cf3a9382d54f0a28c04fa6e776.tar.bz2 ice-0e7e446475ebb6cf3a9382d54f0a28c04fa6e776.tar.xz ice-0e7e446475ebb6cf3a9382d54f0a28c04fa6e776.zip |
String literals Windows fixes
Diffstat (limited to 'cpp/src/slice2java')
-rw-r--r-- | cpp/src/slice2java/Gen.cpp | 22 |
1 files changed, 11 insertions, 11 deletions
diff --git a/cpp/src/slice2java/Gen.cpp b/cpp/src/slice2java/Gen.cpp index eba540f57a6..e0e4df2aba7 100644 --- a/cpp/src/slice2java/Gen.cpp +++ b/cpp/src/slice2java/Gen.cpp @@ -55,7 +55,7 @@ writeU8Buffer(const vector<unsigned char>& u8buffer, ::IceUtilInternal::Output& throw IceUtil::IllegalConversionException(__FILE__, __LINE__); } } - + for(vector<unsigned short>::const_iterator c = u16buffer.begin(); c != u16buffer.end(); ++c) { out << u16CodePoint(*c); @@ -1902,9 +1902,9 @@ Slice::JavaVisitor::writeConstantValue(Output& out, const TypePtr& type, const S "_{}[]#()<>%:;.?*+-/^&|~!=,\\\"' "; static const set<char> charSet(basicSourceChars.begin(), basicSourceChars.end()); out << "\""; - + vector<unsigned char> u8buffer; // Buffer to convert multibyte characters - + for(size_t i = 0; i < value.size();) { if(charSet.find(value[i]) == charSet.end()) @@ -1967,7 +1967,7 @@ Slice::JavaVisitor::writeConstantValue(Output& out, const TypePtr& type, const S } s += "\\"; } - + // // An even number of slash \ will escape the backslash and // the codepoint will be interpreted as its charaters @@ -1985,8 +1985,8 @@ Slice::JavaVisitor::writeConstantValue(Output& out, const TypePtr& type, const S assert(codepoint.size() == sz); IceUtil::Int64 v = IceUtilInternal::strToInt64(codepoint.c_str(), 0, 16); - - + + // // Java doesn't like this special characters encoded as universal characters // @@ -2008,20 +2008,20 @@ Slice::JavaVisitor::writeConstantValue(Output& out, const TypePtr& type, const S } // // Unicode character in the range U+10000 to U+10FFFF is not permitted in a character literal - // and is represented using a Unicode surrogate pair. + // and is represented using a Unicode surrogate pair. // else if(v > 0xFFFF) { - unsigned int high = ((v - 0x10000) / 0x400) + 0xD800; - unsigned int low = ((v - 0x10000) % 0x400) + 0xDC00; + unsigned int high = ((static_cast<unsigned int>(v) - 0x10000) / 0x400) + 0xD800; + unsigned int low = ((static_cast<unsigned int>(v) - 0x10000) % 0x400) + 0xDC00; out << u16CodePoint(high); out << u16CodePoint(low); } else { - out << u16CodePoint(v); + out << u16CodePoint(static_cast<unsigned int>(v)); } - + i = j + 1 + sz; } else |