summaryrefslogtreecommitdiff
path: root/cpp/src/Slice/CsUtil.cpp
diff options
context:
space:
mode:
authorMichi Henning <michi@zeroc.com>2007-10-11 14:41:47 +1000
committerMichi Henning <michi@zeroc.com>2007-10-11 14:41:47 +1000
commit74b2b8daa3c319fa8ebae4e9d8e8283025ab25df (patch)
tree0e93e82e148205355565e804535a1813db3a529f /cpp/src/Slice/CsUtil.cpp
parentWindows port (diff)
downloadice-74b2b8daa3c319fa8ebae4e9d8e8283025ab25df.tar.bz2
ice-74b2b8daa3c319fa8ebae4e9d8e8283025ab25df.tar.xz
ice-74b2b8daa3c319fa8ebae4e9d8e8283025ab25df.zip
Bug 2502.
Diffstat (limited to 'cpp/src/Slice/CsUtil.cpp')
-rwxr-xr-xcpp/src/Slice/CsUtil.cpp31
1 files changed, 25 insertions, 6 deletions
diff --git a/cpp/src/Slice/CsUtil.cpp b/cpp/src/Slice/CsUtil.cpp
index 9a515839e42..643670836e4 100755
--- a/cpp/src/Slice/CsUtil.cpp
+++ b/cpp/src/Slice/CsUtil.cpp
@@ -522,21 +522,40 @@ Slice::CsGenerator::writeMarshalUnmarshalCode(Output &out,
{
if(marshal)
{
- if(streamingAPI)
+ if(!isValueType(st))
{
- out << nl << param << ".ice_write(" << stream << ");";
+ out << nl << "if(" << param << " == null)";
+ out << sb;
+ string typeS = typeToString(st);
+ out << nl << typeS << " " << "tmp__ = new " << typeS << "();";
+ out << nl << "tmp__.";
+ out << (streamingAPI ? "ice_write" : "write__") << "(" << stream << ");";
+ out << eb;
+ out << nl << "else";
+ out << sb;
+ out << nl << param << "." << (streamingAPI ? "ice_write" : "write__") << "(" << stream << ");";
+ out << eb;
}
else
{
- out << nl << param << ".write__(" << stream << ");";
+ if(streamingAPI)
+ {
+ out << nl << param << ".ice_write(" << stream << ");";
+ }
+ else
+ {
+ out << nl << param << ".write__(" << stream << ");";
+ }
}
}
else
{
- string typeS = typeToString(type);
- if(param.size() < 6 || param.substr(param.size() - 5) != "_prop")
+ if(!isValueType(st))
{
- out << nl << param << " = new " << typeS << "();";
+ out << nl << "if(" << param << " == null)";
+ out << sb;
+ out << nl << param << " = new " << typeToString(type) << "();";
+ out << eb;
}
if(streamingAPI)
{