summaryrefslogtreecommitdiff
path: root/cpp/src
diff options
context:
space:
mode:
Diffstat (limited to 'cpp/src')
-rw-r--r--cpp/src/Ice/Instance.cpp42
-rw-r--r--cpp/src/Ice/PropertiesI.cpp11
-rw-r--r--cpp/src/Ice/ReferenceFactory.cpp2
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(