summaryrefslogtreecommitdiff
path: root/cpp
diff options
context:
space:
mode:
authorMichi Henning <michi@zeroc.com>2005-08-18 23:48:52 +0000
committerMichi Henning <michi@zeroc.com>2005-08-18 23:48:52 +0000
commita49c0bed90203f241b0195d7c3f59dc111f7d053 (patch)
tree6585a4af32edb4f58d7fbff55cdbbb41b35cff0d /cpp
parentFix for (diff)
downloadice-a49c0bed90203f241b0195d7c3f59dc111f7d053.tar.bz2
ice-a49c0bed90203f241b0195d7c3f59dc111f7d053.tar.xz
ice-a49c0bed90203f241b0195d7c3f59dc111f7d053.zip
Fix for http://www.zeroc.com/vbulletin/showthread.php?t=1653
Diffstat (limited to 'cpp')
-rw-r--r--cpp/CHANGES8
-rwxr-xr-xcpp/src/Slice/CsUtil.cpp54
-rwxr-xr-xcpp/src/Slice/VbUtil.cpp60
3 files changed, 65 insertions, 57 deletions
diff --git a/cpp/CHANGES b/cpp/CHANGES
index 9b35d2f889d..b22531a1850 100644
--- a/cpp/CHANGES
+++ b/cpp/CHANGES
@@ -1,6 +1,14 @@
Changes since version 2.1.2
---------------------------
+- Fixed a bug in the slice2cs code generator: if an operation
+ had a parameter named i or szx, incorrect code was generated
+ in some cases.
+
+- Fixed a bug in the slice2vb code generator: if an operation
+ had a parameter named ix or spx, incorrect code was generated
+ in some cases.
+
- Added unsupported and untested "support" for Tru64 (with gcc)
- Renamed CompressionNotSupportException to a more general
diff --git a/cpp/src/Slice/CsUtil.cpp b/cpp/src/Slice/CsUtil.cpp
index 8f9880d1349..7e7c8962731 100755
--- a/cpp/src/Slice/CsUtil.cpp
+++ b/cpp/src/Slice/CsUtil.cpp
@@ -683,32 +683,32 @@ Slice::CsGenerator::writeSequenceMarshalUnmarshalCode(Output& out,
else
{
out << sb;
- out << nl << "int szx = " << stream << ".readSize();";
+ out << nl << "int __szx = " << stream << ".readSize();";
if(!streamingAPI)
{
if(type->isVariableLength())
{
- out << nl << stream << ".startSeq(szx, " << static_cast<unsigned>(type->minWireSize()) << ");";
+ out << nl << stream << ".startSeq(__szx, " << static_cast<unsigned>(type->minWireSize()) << ");";
}
else
{
- out << nl << stream << ".checkFixedSeq(szx, " << static_cast<unsigned>(type->minWireSize()) << ");";
+ out << nl << stream << ".checkFixedSeq(__szx, " << static_cast<unsigned>(type->minWireSize()) << ");";
}
}
out << nl << param << " = new ";
if(isArray)
{
- out << toArrayAlloc(typeS + "[]", "szx");
+ out << toArrayAlloc(typeS + "[]", "__szx");
}
else
{
- out << fixId(seq->scoped()) << "(szx)";
+ out << fixId(seq->scoped()) << "(__szx)";
}
out << ';';
- out << nl << "for(int i = 0; i < szx; ++i)";
+ out << nl << "for(int __i = 0; __i < __szx; ++__i)";
out << sb;
out << nl << "IceInternal.SequencePatcher spx = new IceInternal.SequencePatcher("
- << param << ", " << "typeof(" << typeS << "), i);";
+ << param << ", " << "typeof(" << typeS << "), __i);";
out << nl << stream << ".readObject(";
if(streamingAPI)
{
@@ -723,7 +723,7 @@ Slice::CsGenerator::writeSequenceMarshalUnmarshalCode(Output& out,
out << eb;
if(!streamingAPI && type->isVariableLength())
{
- out << nl << stream << ".endSeq(szx);";
+ out << nl << stream << ".endSeq(__szx);";
}
out << eb;
}
@@ -751,29 +751,29 @@ Slice::CsGenerator::writeSequenceMarshalUnmarshalCode(Output& out,
else
{
out << sb;
- out << nl << "int szx = " << stream << ".readSize();";
+ out << nl << "int __szx = " << stream << ".readSize();";
if(!streamingAPI)
{
if(type->isVariableLength())
{
- out << nl << stream << ".startSeq(szx, " << static_cast<unsigned>(type->minWireSize()) << ");";
+ out << nl << stream << ".startSeq(__szx, " << static_cast<unsigned>(type->minWireSize()) << ");";
}
else
{
- out << nl << stream << ".checkFixedSeq(szx, " << static_cast<unsigned>(type->minWireSize()) << ");";
+ out << nl << stream << ".checkFixedSeq(__szx, " << static_cast<unsigned>(type->minWireSize()) << ");";
}
}
out << nl << param << " = new ";
if(isArray)
{
- out << toArrayAlloc(typeS + "[]", "szx");
+ out << toArrayAlloc(typeS + "[]", "__szx");
}
else
{
- out << fixId(seq->scoped()) << "(szx)";
+ out << fixId(seq->scoped()) << "(__szx)";
}
out << ';';
- out << nl << "for(int __ix = 0; __ix < szx; ++__ix)";
+ out << nl << "for(int __ix = 0; __ix < __szx; ++__ix)";
out << sb;
if(isArray)
{
@@ -793,7 +793,7 @@ Slice::CsGenerator::writeSequenceMarshalUnmarshalCode(Output& out,
out << eb;
if(!streamingAPI && type->isVariableLength())
{
- out << nl << stream << ".endSeq(szx);";
+ out << nl << stream << ".endSeq(__szx);";
}
out << eb;
}
@@ -821,22 +821,22 @@ Slice::CsGenerator::writeSequenceMarshalUnmarshalCode(Output& out,
else
{
out << sb;
- out << nl << "int szx = " << stream << ".readSize();";
+ out << nl << "int __szx = " << stream << ".readSize();";
if(!streamingAPI)
{
- out << nl << stream << ".checkFixedSeq(szx, " << static_cast<unsigned>(type->minWireSize()) << ");";
+ out << nl << stream << ".checkFixedSeq(__szx, " << static_cast<unsigned>(type->minWireSize()) << ");";
}
out << nl << param << " = new ";
if(isArray)
{
- out << toArrayAlloc(typeS + "[]", "szx");
+ out << toArrayAlloc(typeS + "[]", "__szx");
}
else
{
- out << fixId(seq->scoped()) << "(szx)";
+ out << fixId(seq->scoped()) << "(__szx)";
}
out << ';';
- out << nl << "for(int __ix = 0; __ix < szx; ++__ix)";
+ out << nl << "for(int __ix = 0; __ix < __szx; ++__ix)";
out << sb;
if(isArray)
{
@@ -887,29 +887,29 @@ Slice::CsGenerator::writeSequenceMarshalUnmarshalCode(Output& out,
{
func += "read";
out << sb;
- out << nl << "int szx = " << stream << ".readSize();";
+ out << nl << "int __szx = " << stream << ".readSize();";
if(!streamingAPI)
{
if(type->isVariableLength())
{
- out << nl << stream << ".startSeq(szx, " << static_cast<unsigned>(type->minWireSize()) << ");";
+ out << nl << stream << ".startSeq(__szx, " << static_cast<unsigned>(type->minWireSize()) << ");";
}
else
{
- out << nl << stream << ".checkFixedSeq(szx, " << static_cast<unsigned>(type->minWireSize()) << ");";
+ out << nl << stream << ".checkFixedSeq(__szx, " << static_cast<unsigned>(type->minWireSize()) << ");";
}
}
out << nl << param << " = new ";
if(isArray)
{
- out << toArrayAlloc(typeS + "[]", "szx");
+ out << toArrayAlloc(typeS + "[]", "__szx");
}
else
{
- out << fixId(seq->scoped()) << "(szx)";
+ out << fixId(seq->scoped()) << "(__szx)";
}
out << ';';
- out << nl << "for(int __ix = 0; __ix < szx; ++__ix)";
+ out << nl << "for(int __ix = 0; __ix < __szx; ++__ix)";
out << sb;
if(isArray)
{
@@ -930,7 +930,7 @@ Slice::CsGenerator::writeSequenceMarshalUnmarshalCode(Output& out,
out << eb;
if(!streamingAPI && type->isVariableLength())
{
- out << nl << stream << ".endSeq(szx);";
+ out << nl << stream << ".endSeq(__szx);";
}
out << eb;
}
diff --git a/cpp/src/Slice/VbUtil.cpp b/cpp/src/Slice/VbUtil.cpp
index 9d7e1505fbf..0ee820a4ca4 100755
--- a/cpp/src/Slice/VbUtil.cpp
+++ b/cpp/src/Slice/VbUtil.cpp
@@ -716,38 +716,38 @@ Slice::VbGenerator::writeSequenceMarshalUnmarshalCode(Output& out,
}
else
{
- out << nl << "Dim szx As Integer = " << stream << ".readSize()";
+ out << nl << "Dim __szx As Integer = " << stream << ".readSize()";
if(!streamingAPI)
{
if(type->isVariableLength())
{
- out << nl << stream << ".startSeq(szx, " << static_cast<unsigned>(type->minWireSize()) << ')';
+ out << nl << stream << ".startSeq(__szx, " << static_cast<unsigned>(type->minWireSize()) << ')';
}
else
{
- out << nl << stream << ".checkFixedSeq(szx, " << static_cast<unsigned>(type->minWireSize()) << ')';
+ out << nl << stream << ".checkFixedSeq(__szx, " << static_cast<unsigned>(type->minWireSize()) << ')';
}
}
out << nl << param << " = New ";
if(isArray)
{
- out << toArrayAlloc(typeS + "()", "szx - 1") << " {}";
+ out << toArrayAlloc(typeS + "()", "__szx - 1") << " {}";
}
else
{
- out << fixId(seq->scoped()) << "(szx)";
+ out << fixId(seq->scoped()) << "(__szx)";
}
- out << nl << "For ix As Integer = 0 To sz - 1";
+ out << nl << "For __ix As Integer = 0 To __szx - 1";
out.inc();
- out << nl << "Dim spx As IceInternal.SequencePatcher = New IceInternal.SequencePatcher("
- << param << ", " << "GetType(" << typeS << "), ix)";
+ out << nl << "Dim __spx As IceInternal.SequencePatcher = New IceInternal.SequencePatcher("
+ << param << ", " << "GetType(" << typeS << "), __ix)";
if(streamingAPI)
{
- out << nl << stream << ".readObject(CType(spx, Ice.ReadObjectCallback))";
+ out << nl << stream << ".readObject(CType(__spx, Ice.ReadObjectCallback))";
}
else
{
- out << nl << stream << ".readObject(spx)";
+ out << nl << stream << ".readObject(__spx)";
}
if(!streamingAPI && type->isVariableLength())
{
@@ -758,7 +758,7 @@ Slice::VbGenerator::writeSequenceMarshalUnmarshalCode(Output& out,
out << nl << "Next";
if(!streamingAPI && type->isVariableLength())
{
- out << nl << stream << ".endSeq(szx)";
+ out << nl << stream << ".endSeq(__szx)";
}
}
out.dec();
@@ -790,28 +790,28 @@ Slice::VbGenerator::writeSequenceMarshalUnmarshalCode(Output& out,
}
else
{
- out << nl << "Dim szx As Integer = " << stream << ".readSize()";
+ out << nl << "Dim __szx As Integer = " << stream << ".readSize()";
if(!streamingAPI)
{
if(type->isVariableLength())
{
- out << nl << stream << ".startSeq(szx, " << static_cast<unsigned>(type->minWireSize()) << ')';
+ out << nl << stream << ".startSeq(__szx, " << static_cast<unsigned>(type->minWireSize()) << ')';
}
else
{
- out << nl << stream << ".checkFixedSeq(szx, " << static_cast<unsigned>(type->minWireSize()) << ')';
+ out << nl << stream << ".checkFixedSeq(__szx, " << static_cast<unsigned>(type->minWireSize()) << ')';
}
}
out << nl << param << " = New ";
if(isArray)
{
- out << toArrayAlloc(typeS + "()", "szx - 1") << " {}";
+ out << toArrayAlloc(typeS + "()", "__szx - 1") << " {}";
}
else
{
- out << fixId(seq->scoped()) << "(szx)";
+ out << fixId(seq->scoped()) << "(__szx)";
}
- out << nl << "For __ix As Integer = 0 To szx - 1";
+ out << nl << "For __ix As Integer = 0 To __szx - 1";
out.inc();
if(isArray)
{
@@ -832,7 +832,7 @@ Slice::VbGenerator::writeSequenceMarshalUnmarshalCode(Output& out,
out << nl << "Next";
if(!streamingAPI && type->isVariableLength())
{
- out << nl << stream << ".endSeq(szx)";
+ out << nl << stream << ".endSeq(__szx)";
}
}
out.dec();
@@ -864,21 +864,21 @@ Slice::VbGenerator::writeSequenceMarshalUnmarshalCode(Output& out,
}
else
{
- out << nl << "Dim szx As Integer = " << stream << ".readSize()";
+ out << nl << "Dim __szx As Integer = " << stream << ".readSize()";
if(!streamingAPI)
{
- out << nl << stream << ".checkFixedSeq(szx, " << static_cast<unsigned>(type->minWireSize()) << ')';
+ out << nl << stream << ".checkFixedSeq(__szx, " << static_cast<unsigned>(type->minWireSize()) << ')';
}
out << nl << param << " = New ";
if(isArray)
{
- out << toArrayAlloc(typeS + "()", "szx - 1") << " {}";
+ out << toArrayAlloc(typeS + "()", "__szx - 1") << " {}";
}
else
{
- out << fixId(seq->scoped()) << "(szx)";
+ out << fixId(seq->scoped()) << "(__szx)";
}
- out << nl << "For __ix As Integer = 0 To szx - 1";
+ out << nl << "For __ix As Integer = 0 To __szx - 1";
out.inc();
if(isArray)
{
@@ -935,28 +935,28 @@ Slice::VbGenerator::writeSequenceMarshalUnmarshalCode(Output& out,
out << nl << "For __block As Integer = 0 To 0";
out.inc();
string func = ProxyPtr::dynamicCast(type) ? "__read" : "read";
- out << nl << "Dim szx As Integer = " << stream << ".readSize()";
+ out << nl << "Dim __szx As Integer = " << stream << ".readSize()";
if(!streamingAPI)
{
if(type->isVariableLength())
{
- out << nl << stream << ".startSeq(szx, " << static_cast<unsigned>(type->minWireSize()) << ")";
+ out << nl << stream << ".startSeq(__szx, " << static_cast<unsigned>(type->minWireSize()) << ")";
}
else
{
- out << nl << stream << ".checkFixedSeq(szx, " << static_cast<unsigned>(type->minWireSize()) << ")";
+ out << nl << stream << ".checkFixedSeq(__szx, " << static_cast<unsigned>(type->minWireSize()) << ")";
}
}
out << nl << param << " = New ";
if(isArray)
{
- out << toArrayAlloc(typeS + "()", "szx - 1") << " {}";
+ out << toArrayAlloc(typeS + "()", "__szx - 1") << " {}";
}
else
{
- out << fixId(seq->scoped()) << "(szx)";
+ out << fixId(seq->scoped()) << "(__szx)";
}
- out << nl << "For __ix As Integer = 0 To szx - 1";
+ out << nl << "For __ix As Integer = 0 To __szx - 1";
out.inc();
if(isArray)
{
@@ -978,7 +978,7 @@ Slice::VbGenerator::writeSequenceMarshalUnmarshalCode(Output& out,
out << nl << "Next";
if(!streamingAPI && type->isVariableLength())
{
- out << nl << stream << ".endSeq(szx)";
+ out << nl << stream << ".endSeq(__szx)";
}
out.dec();
out << nl << "Next";