diff options
author | Mark Spruiell <mes@zeroc.com> | 2005-02-08 20:12:12 +0000 |
---|---|---|
committer | Mark Spruiell <mes@zeroc.com> | 2005-02-08 20:12:12 +0000 |
commit | 7f367e4ff47715aabd61d697f78d7206aab1f9d8 (patch) | |
tree | 4a74ad5c03148c72a41bdb69a3074cb7889eb098 /cpp/src/Slice/VbUtil.cpp | |
parent | Removed -a option from usage (diff) | |
download | ice-7f367e4ff47715aabd61d697f78d7206aab1f9d8.tar.bz2 ice-7f367e4ff47715aabd61d697f78d7206aab1f9d8.tar.xz ice-7f367e4ff47715aabd61d697f78d7206aab1f9d8.zip |
changing sequence unmarshaling for fixed-length types
Diffstat (limited to 'cpp/src/Slice/VbUtil.cpp')
-rwxr-xr-x | cpp/src/Slice/VbUtil.cpp | 67 |
1 files changed, 44 insertions, 23 deletions
diff --git a/cpp/src/Slice/VbUtil.cpp b/cpp/src/Slice/VbUtil.cpp index d872e67c22e..7bc5a3e3bb9 100755 --- a/cpp/src/Slice/VbUtil.cpp +++ b/cpp/src/Slice/VbUtil.cpp @@ -588,8 +588,16 @@ Slice::VbGenerator::writeSequenceMarshalUnmarshalCode(Output& out, out << nl << "Dim __lenx As Integer = " << stream << ".readSize()"; if(!streamingAPI) { - out << nl << stream << ".startSeq(__len, " << static_cast<unsigned>(builtin->minWireSize()) - << ")"; + if(builtin->isVariableLength()) + { + out << nl << stream << ".startSeq(__len, " << static_cast<unsigned>(builtin->minWireSize()) + << ")"; + } + else + { + out << nl << stream << ".checkFixedSeq(__len, " + << static_cast<unsigned>(builtin->minWireSize()) << ")"; + } } out << nl << param << " = New "; if(builtin->kind() == Builtin::KindObject) @@ -633,7 +641,7 @@ Slice::VbGenerator::writeSequenceMarshalUnmarshalCode(Output& out, out.dec(); out << nl << "Next"; } - if(!streamingAPI) + if(!streamingAPI && builtin->isVariableLength()) { out << nl << stream << ".checkSeq()"; out << nl << stream << ".endElement()"; @@ -702,7 +710,14 @@ Slice::VbGenerator::writeSequenceMarshalUnmarshalCode(Output& out, out << nl << "Dim szx As Integer = " << stream << ".readSize()"; if(!streamingAPI) { - out << nl << stream << ".startSeq(szx, " << static_cast<unsigned>(type->minWireSize()) << ')'; + if(type->isVariableLength()) + { + out << nl << stream << ".startSeq(szx, " << static_cast<unsigned>(type->minWireSize()) << ')'; + } + else + { + out << nl << stream << ".checkFixedSeq(szx, " << static_cast<unsigned>(type->minWireSize()) << ')'; + } } out << nl << param << " = New "; if(isArray) @@ -725,14 +740,14 @@ Slice::VbGenerator::writeSequenceMarshalUnmarshalCode(Output& out, { out << nl << stream << ".readObject(spx)"; } - if(!streamingAPI) + if(!streamingAPI && type->isVariableLength()) { out << nl << stream << ".checkSeq()"; out << nl << stream << ".endElement()"; } out.dec(); out << nl << "Next"; - if(!streamingAPI) + if(!streamingAPI && type->isVariableLength()) { out << nl << stream << ".endSeq(szx)"; } @@ -769,7 +784,14 @@ Slice::VbGenerator::writeSequenceMarshalUnmarshalCode(Output& out, out << nl << "Dim szx As Integer = " << stream << ".readSize()"; if(!streamingAPI) { - out << nl << stream << ".startSeq(szx, " << static_cast<unsigned>(type->minWireSize()) << ')'; + if(type->isVariableLength()) + { + out << nl << stream << ".startSeq(szx, " << static_cast<unsigned>(type->minWireSize()) << ')'; + } + else + { + out << nl << stream << ".checkFixedSeq(szx, " << static_cast<unsigned>(type->minWireSize()) << ')'; + } } out << nl << param << " = New "; if(isArray) @@ -783,14 +805,14 @@ Slice::VbGenerator::writeSequenceMarshalUnmarshalCode(Output& out, out << nl << "For __ix As Integer = 0 To " << param << '.' << limitID << " - 1"; out.inc(); out << nl << param << "(__ix).__read(" << stream << ")"; - if(st->isVariableLength() && !streamingAPI) + if(!streamingAPI && type->isVariableLength()) { out << nl << stream << ".checkSeq()"; out << nl << stream << ".endElement()"; } out.dec(); out << nl << "Next"; - if(!streamingAPI) + if(!streamingAPI && type->isVariableLength()) { out << nl << stream << ".endSeq(szx)"; } @@ -800,7 +822,6 @@ Slice::VbGenerator::writeSequenceMarshalUnmarshalCode(Output& out, return; } - EnumPtr en = EnumPtr::dynamicCast(type); if(en) { @@ -828,7 +849,7 @@ Slice::VbGenerator::writeSequenceMarshalUnmarshalCode(Output& out, out << nl << "Dim szx As Integer = " << stream << ".readSize()"; if(!streamingAPI) { - out << nl << stream << ".startSeq(szx, " << static_cast<unsigned>(type->minWireSize()) << ')'; + out << nl << stream << ".checkFixedSeq(szx, " << static_cast<unsigned>(type->minWireSize()) << ')'; } out << nl << param << " = New "; if(isArray) @@ -851,10 +872,6 @@ Slice::VbGenerator::writeSequenceMarshalUnmarshalCode(Output& out, } out.dec(); out << nl << "Next"; - if(!streamingAPI) - { - out << nl << stream << ".endSeq(szx)"; - } } out.dec(); out << nl << "Next"; @@ -903,7 +920,14 @@ Slice::VbGenerator::writeSequenceMarshalUnmarshalCode(Output& out, out << nl << "Dim szx As Integer = " << stream << ".readSize()"; if(!streamingAPI) { - out << nl << stream << ".startSeq(szx, " << static_cast<unsigned>(type->minWireSize()) << ")"; + if(type->isVariableLength()) + { + out << nl << stream << ".startSeq(szx, " << static_cast<unsigned>(type->minWireSize()) << ")"; + } + else + { + out << nl << stream << ".checkFixedSeq(szx, " << static_cast<unsigned>(type->minWireSize()) << ")"; + } } out << nl << param << " = New "; if(isArray) @@ -924,20 +948,17 @@ Slice::VbGenerator::writeSequenceMarshalUnmarshalCode(Output& out, { out << nl << param << ".Add(" << helperName << '.' << func << '(' << stream << "))"; } - if(type->isVariableLength()) + if(!streamingAPI && type->isVariableLength()) { - if(!SequencePtr::dynamicCast(type) && !streamingAPI) + if(!SequencePtr::dynamicCast(type)) { out << nl << stream << ".checkSeq()"; } - if(!streamingAPI) - { - out << nl << stream << ".endElement()"; - } + out << nl << stream << ".endElement()"; } out.dec(); out << nl << "Next"; - if(!streamingAPI) + if(!streamingAPI && type->isVariableLength()) { out << nl << stream << ".endSeq(szx)"; } |