summaryrefslogtreecommitdiff
path: root/cpp
diff options
context:
space:
mode:
authorMark Spruiell <mes@zeroc.com>2012-12-08 20:44:59 -0800
committerMark Spruiell <mes@zeroc.com>2012-12-08 20:44:59 -0800
commit7eea6e7c69ce71e69492330a4ff1cf09df9f39f2 (patch)
tree89404ec19d48b6ee7519486b831bc81d63c94208 /cpp
parentICE-5103 - SSL failure in C#/C++ cross test (diff)
downloadice-7eea6e7c69ce71e69492330a4ff1cf09df9f39f2.tar.bz2
ice-7eea6e7c69ce71e69492330a4ff1cf09df9f39f2.tar.xz
ice-7eea6e7c69ce71e69492330a4ff1cf09df9f39f2.zip
ICE-5120 - assertion error in C++ marshaling code
Diffstat (limited to 'cpp')
-rw-r--r--cpp/src/Slice/CPlusPlusUtil.cpp14
-rw-r--r--cpp/test/Ice/optional/AllTests.cpp4
2 files changed, 18 insertions, 0 deletions
diff --git a/cpp/src/Slice/CPlusPlusUtil.cpp b/cpp/src/Slice/CPlusPlusUtil.cpp
index 403fc9b15b5..6aa2416f3f3 100644
--- a/cpp/src/Slice/CPlusPlusUtil.cpp
+++ b/cpp/src/Slice/CPlusPlusUtil.cpp
@@ -222,16 +222,30 @@ writeParamEndCode(Output& out, const TypePtr& type, bool optional, const string&
out << nl << "if(___" << fixedName << ")";
out << sb;
out << nl << fixedName << ".__setIsSet();";
+ out << nl << "if(!___" << fixedName << "->empty())";
+ out << sb;
out << nl << fixedName << "->first" << " = &(*___" << fixedName << ")[0];";
out << nl << fixedName << "->second" << " = " << fixedName << "->first + " << "___"
<< fixedName << "->size();";
out << eb;
+ out << nl << "else";
+ out << sb;
+ out << nl << fixedName << "->first" << " = " << fixedName << "->second" << " = 0;";
+ out << eb;
+ out << eb;
}
else
{
+ out << nl << "if(!___" << fixedName << ".empty())";
+ out << sb;
out << nl << fixedName << ".first" << " = &___" << fixedName << "[0];";
out << nl << fixedName << ".second" << " = " << fixedName << ".first + " << "___"
<< fixedName << ".size();";
+ out << eb;
+ out << nl << "else";
+ out << sb;
+ out << nl << fixedName << ".first" << " = " << fixedName << ".second" << " = 0;";
+ out << eb;
}
}
}
diff --git a/cpp/test/Ice/optional/AllTests.cpp b/cpp/test/Ice/optional/AllTests.cpp
index f00294d28e5..ecaa1d44d26 100644
--- a/cpp/test/Ice/optional/AllTests.cpp
+++ b/cpp/test/Ice/optional/AllTests.cpp
@@ -1021,6 +1021,10 @@ allTests(const Ice::CommunicatorPtr& communicator, bool collocated)
IceUtil::Optional<FixedStructSeq> p2 = initial->opFixedStructSeq(p1, p3);
test(!p2 && !p3);
+ p1 = std::pair<const FixedStruct*, const FixedStruct*>(0, 0);
+ p2 = initial->opFixedStructSeq(p1, p3);
+ test(p2 && p3 && p2.get().empty() && p3.get().empty());
+
FixedStruct fss[10];
fss[0].m = 1;
fss[1].m = 2;