summaryrefslogtreecommitdiff
path: root/cpp/src/Slice/CsUtil.cpp
diff options
context:
space:
mode:
authorMichi Henning <michi@zeroc.com>2004-10-27 03:23:42 +0000
committerMichi Henning <michi@zeroc.com>2004-10-27 03:23:42 +0000
commit0770a34e5ae37938a6dce437a112784867d747b7 (patch)
treeb109a0851f148d6beaa5e8411e80e17f15045beb /cpp/src/Slice/CsUtil.cpp
parentfixes for glacier2 change (diff)
downloadice-0770a34e5ae37938a6dce437a112784867d747b7.tar.bz2
ice-0770a34e5ae37938a6dce437a112784867d747b7.tar.xz
ice-0770a34e5ae37938a6dce437a112784867d747b7.zip
- Fixed a bug in slice2cs: the generated code was incorrect for
dictionaries with sequence value types, if that sequence value type was mapped to an array.
Diffstat (limited to 'cpp/src/Slice/CsUtil.cpp')
-rwxr-xr-xcpp/src/Slice/CsUtil.cpp36
1 files changed, 18 insertions, 18 deletions
diff --git a/cpp/src/Slice/CsUtil.cpp b/cpp/src/Slice/CsUtil.cpp
index 2156728494d..ddd87d8a4c3 100755
--- a/cpp/src/Slice/CsUtil.cpp
+++ b/cpp/src/Slice/CsUtil.cpp
@@ -179,23 +179,6 @@ Slice::CsGenerator::typeToString(const TypePtr& type)
return "???";
}
-static string
-toArrayAlloc(const string& decl, const string& sz)
-{
- int count = 0;
- string::size_type pos = decl.size();
- while(pos > 1 && decl.substr(pos - 2, 2) == "[]")
- {
- ++count;
- pos -= 2;
- }
- assert(count > 0);
-
- ostringstream o;
- o << decl.substr(0, pos) << '[' << sz << ']' << decl.substr(pos + 2);
- return o.str();
-}
-
bool
Slice::CsGenerator::isValueType(const TypePtr& type)
{
@@ -618,7 +601,7 @@ Slice::CsGenerator::writeSequenceMarshalUnmarshalCode(Output& out,
out << nl << param << " = new ";
if(isArray)
{
- out << toArrayAlloc(typeS + "[]", "sz");
+ out << toArrayAlloc(typeS + "[]", "sz");
}
else
{
@@ -775,6 +758,23 @@ Slice::CsGenerator::writeSequenceMarshalUnmarshalCode(Output& out,
return;
}
+string
+Slice::CsGenerator::toArrayAlloc(const string& decl, const string& sz)
+{
+ int count = 0;
+ string::size_type pos = decl.size();
+ while(pos > 1 && decl.substr(pos - 2, 2) == "[]")
+ {
+ ++count;
+ pos -= 2;
+ }
+ assert(count > 0);
+
+ ostringstream o;
+ o << decl.substr(0, pos) << '[' << sz << ']' << decl.substr(pos + 2);
+ return o.str();
+}
+
void
Slice::CsGenerator::validateMetaData(const UnitPtr& unit)
{