diff options
author | Mark Spruiell <mes@zeroc.com> | 2012-10-17 12:38:03 -0700 |
---|---|---|
committer | Mark Spruiell <mes@zeroc.com> | 2012-10-17 12:38:03 -0700 |
commit | f087326373250c76fa3b7b8e68cede0cb9af01ff (patch) | |
tree | e801ec18aba93a74b373388fc947617643da0008 /cpp/src/Slice/CsUtil.cpp | |
parent | Fix related to ICE-4847 (diff) | |
download | ice-f087326373250c76fa3b7b8e68cede0cb9af01ff.tar.bz2 ice-f087326373250c76fa3b7b8e68cede0cb9af01ff.tar.xz ice-f087326373250c76fa3b7b8e68cede0cb9af01ff.zip |
ICE-4619 - custom enumerator values
Diffstat (limited to 'cpp/src/Slice/CsUtil.cpp')
-rw-r--r-- | cpp/src/Slice/CsUtil.cpp | 12 |
1 files changed, 7 insertions, 5 deletions
diff --git a/cpp/src/Slice/CsUtil.cpp b/cpp/src/Slice/CsUtil.cpp index 1ec3bff4a56..e3841b72e9e 100644 --- a/cpp/src/Slice/CsUtil.cpp +++ b/cpp/src/Slice/CsUtil.cpp @@ -651,24 +651,26 @@ Slice::CsGenerator::writeMarshalUnmarshalCode(Output &out, EnumPtr en = EnumPtr::dynamicCast(type); if(en) { - size_t sz = en->getEnumerators().size(); if(marshal) { if(streamingAPI) { - out << nl << "if((int)" << param << " < 0 || (int)" << param << " >= " << sz << ")"; + out << nl << "if((int)" << param << " < " << en->minValue() + << " || (int)" << param << " > " << en->maxValue() << ")"; out << sb; out << nl << "throw new Ice.MarshalException(\"enumerator out of range\");"; out << eb; } - out << nl << stream << ".writeEnum((int)" << param << ", " << sz << ");"; + out << nl << stream << ".writeEnum((int)" << param << ", " << en->maxValue() << ");"; } else { - out << nl << param << " = (" << fixId(en->scoped()) << ')' << stream << ".readEnum(" << sz << ");"; + out << nl << param << " = (" << fixId(en->scoped()) << ')' << stream << ".readEnum(" << en->maxValue() + << ");"; if(streamingAPI) { - out << nl << "if((int)" << param << " < 0 || (int)" << param << " >= " << sz << ")"; + out << nl << "if((int)" << param << " < " << en->minValue() << " || (int)" << param << " > " + << en->maxValue() << ")"; out << sb; out << nl << "throw new Ice.MarshalException(\"enumerator out of range\");"; out << eb; |