diff options
author | Dwayne Boone <dwayne@zeroc.com> | 2007-07-20 12:35:54 -0230 |
---|---|---|
committer | Dwayne Boone <dwayne@zeroc.com> | 2007-07-20 12:35:54 -0230 |
commit | d5449422a0da8293c1116a8585d942fc626bcfac (patch) | |
tree | c07128d9d38f6e9f4036e560adc4efa2d6aef640 /cpp/src | |
parent | Adding missing Windows projects for evictor demos. (diff) | |
download | ice-d5449422a0da8293c1116a8585d942fc626bcfac.tar.bz2 ice-d5449422a0da8293c1116a8585d942fc626bcfac.tar.xz ice-d5449422a0da8293c1116a8585d942fc626bcfac.zip |
http://bugzilla.zeroc.com/bugzilla/show_bug.cgi?id=2303 - do not call toUTF8/fromUTF8 with empty string
Diffstat (limited to 'cpp/src')
-rw-r--r-- | cpp/src/Ice/Instance.cpp | 42 | ||||
-rw-r--r-- | cpp/src/Ice/PropertiesI.cpp | 11 | ||||
-rw-r--r-- | cpp/src/Ice/ReferenceFactory.cpp | 2 |
3 files changed, 36 insertions, 19 deletions
diff --git a/cpp/src/Ice/Instance.cpp b/cpp/src/Ice/Instance.cpp index d4ae7b27c76..dbb7524c0f0 100644 --- a/cpp/src/Ice/Instance.cpp +++ b/cpp/src/Ice/Instance.cpp @@ -409,15 +409,22 @@ IceInternal::Instance::stringToIdentity(const string& s) const if(_initData.stringConverter) { string tmpString; - _initData.stringConverter->fromUTF8(reinterpret_cast<const Byte*>(ident.name.data()), - reinterpret_cast<const Byte*>(ident.name.data() + ident.name.size()), - tmpString); - ident.name = tmpString; + if(!ident.name.empty()) + { + _initData.stringConverter->fromUTF8(reinterpret_cast<const Byte*>(ident.name.data()), + reinterpret_cast<const Byte*>(ident.name.data() + ident.name.size()), + tmpString); + ident.name = tmpString; + } - _initData.stringConverter->fromUTF8(reinterpret_cast<const Byte*>(ident.category.data()), - reinterpret_cast<const Byte*>(ident.category.data() + ident.category.size()), - tmpString); - ident.category = tmpString; + if(!ident.category.empty()) + { + _initData.stringConverter->fromUTF8(reinterpret_cast<const Byte*>(ident.category.data()), + reinterpret_cast<const Byte*>(ident.category.data() + + ident.category.size()), + tmpString); + ident.category = tmpString; + } } return ident; @@ -431,14 +438,21 @@ IceInternal::Instance::identityToString(const Identity& ident) const if(_initData.stringConverter) { UTF8BufferI buffer; - Byte* last = _initData.stringConverter->toUTF8(ident.name.data(), ident.name.data() + ident.name.size(), - buffer); - name = string(reinterpret_cast<const char*>(buffer.getBuffer()), last - buffer.getBuffer()); + Byte* last; + if(!ident.name.empty()) + { + last = _initData.stringConverter->toUTF8(ident.name.data(), ident.name.data() + ident.name.size(), + buffer); + name = string(reinterpret_cast<const char*>(buffer.getBuffer()), last - buffer.getBuffer()); + } buffer.reset(); - last = _initData.stringConverter->toUTF8(ident.category.data(), ident.category.data() + ident.category.size(), - buffer); - category = string(reinterpret_cast<const char*>(buffer.getBuffer()), last - buffer.getBuffer()); + if(!ident.category.empty()) + { + last = _initData.stringConverter->toUTF8(ident.category.data(), + ident.category.data() + ident.category.size(), buffer); + category = string(reinterpret_cast<const char*>(buffer.getBuffer()), last - buffer.getBuffer()); + } } if(category.empty()) diff --git a/cpp/src/Ice/PropertiesI.cpp b/cpp/src/Ice/PropertiesI.cpp index 09d38acc992..4bd8711b351 100644 --- a/cpp/src/Ice/PropertiesI.cpp +++ b/cpp/src/Ice/PropertiesI.cpp @@ -413,13 +413,16 @@ Ice::PropertiesI::parseLine(const string& line, const StringConverterPtr& conver if(converter) { string tmp; - converter->fromUTF8(reinterpret_cast<const Byte*>(key.data()), + converter->fromUTF8(reinterpret_cast<const Byte*>(key.data()), reinterpret_cast<const Byte*>(key.data() + key.size()), tmp); key.swap(tmp); - converter->fromUTF8(reinterpret_cast<const Byte*>(value.data()), - reinterpret_cast<const Byte*>(value.data() + value.size()), tmp); - value.swap(tmp); + if(!value.empty()) + { + converter->fromUTF8(reinterpret_cast<const Byte*>(value.data()), + reinterpret_cast<const Byte*>(value.data() + value.size()), tmp); + value.swap(tmp); + } } setProperty(key, value); diff --git a/cpp/src/Ice/ReferenceFactory.cpp b/cpp/src/Ice/ReferenceFactory.cpp index 5ba3c621c12..4c055017f68 100644 --- a/cpp/src/Ice/ReferenceFactory.cpp +++ b/cpp/src/Ice/ReferenceFactory.cpp @@ -541,7 +541,7 @@ IceInternal::ReferenceFactory::create(const string& str) throw ex; } - if(_instance->initializationData().stringConverter) + if(_instance->initializationData().stringConverter && !adapter.empty()) { string tmpAdapter; _instance->initializationData().stringConverter->fromUTF8( |