diff options
author | Bernard Normier <bernard@zeroc.com> | 2016-06-03 14:11:48 -0400 |
---|---|---|
committer | Bernard Normier <bernard@zeroc.com> | 2016-06-03 14:11:48 -0400 |
commit | 48b141f8f6a8603f6b13a85bde002f6b480832f7 (patch) | |
tree | 41cf4ae281ad96e13216ea208a6579aa442844d3 /cpp/src/slice2php | |
parent | Fixed 3.7a2 version in msbuild props files (diff) | |
download | ice-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/slice2php')
-rw-r--r-- | cpp/src/slice2php/Main.cpp | 28 |
1 files changed, 6 insertions, 22 deletions
diff --git a/cpp/src/slice2php/Main.cpp b/cpp/src/slice2php/Main.cpp index 35117e68f36..a1689dc5c25 100644 --- a/cpp/src/slice2php/Main.cpp +++ b/cpp/src/slice2php/Main.cpp @@ -16,7 +16,7 @@ #include <IceUtil/StringUtil.h> #include <IceUtil/Mutex.h> #include <IceUtil/MutexPtrLock.h> -#include <IceUtil/Unicode.h> +#include <IceUtil/StringConverter.h> #include <Slice/Checksum.h> #include <Slice/Preprocessor.h> #include <Slice/FileTracker.h> @@ -393,10 +393,10 @@ CodeVisitor::visitClassDefStart(const ClassDefPtr& p) _out << nl << "return $proxy->ice_uncheckedCast('" << scoped << "', $facet);"; _out << eb; - _out << sp << nl << "public static function ice_staticId()"; - _out << sb; - _out << nl << "return '" << scoped << "';"; - _out << eb; + _out << sp << nl << "public static function ice_staticId()"; + _out << sb; + _out << nl << "return '" << scoped << "';"; + _out << eb; _out << eb; } @@ -1327,23 +1327,7 @@ CodeVisitor::writeConstantValue(const TypePtr& type, const SyntaxTreeBasePtr& va vector<unsigned int> u32buffer; u32buffer.push_back(static_cast<unsigned int>(v)); - vector<unsigned char> u8buffer; - - IceUtilInternal::ConversionResult result = convertUTF32ToUTF8(u32buffer, u8buffer, 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 char> u8buffer = fromUTF32(u32buffer); ostringstream s; for(vector<unsigned char>::const_iterator q = u8buffer.begin(); q != u8buffer.end(); ++q) |