diff options
author | Michi Henning <michi@zeroc.com> | 2007-10-11 14:41:47 +1000 |
---|---|---|
committer | Michi Henning <michi@zeroc.com> | 2007-10-11 14:41:47 +1000 |
commit | 74b2b8daa3c319fa8ebae4e9d8e8283025ab25df (patch) | |
tree | 0e93e82e148205355565e804535a1813db3a529f /cpp/src/Slice/CsUtil.cpp | |
parent | Windows port (diff) | |
download | ice-74b2b8daa3c319fa8ebae4e9d8e8283025ab25df.tar.bz2 ice-74b2b8daa3c319fa8ebae4e9d8e8283025ab25df.tar.xz ice-74b2b8daa3c319fa8ebae4e9d8e8283025ab25df.zip |
Bug 2502.
Diffstat (limited to 'cpp/src/Slice/CsUtil.cpp')
-rwxr-xr-x | cpp/src/Slice/CsUtil.cpp | 31 |
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) { |