summaryrefslogtreecommitdiff
path: root/cpp/src/Ice/BasicStream.cpp
diff options
context:
space:
mode:
authorMichi Henning <michi@zeroc.com>2003-05-20 07:53:29 +0000
committerMichi Henning <michi@zeroc.com>2003-05-20 07:53:29 +0000
commitdcc2b4d839ee93c145fc321cc95b9f54e3b6c685 (patch)
tree3cec0953487f7ab3e3d8fed1f0e8d068bf189f50 /cpp/src/Ice/BasicStream.cpp
parentRemoved two slicing tests that can't be implemented in Java. (diff)
downloadice-dcc2b4d839ee93c145fc321cc95b9f54e3b6c685.tar.bz2
ice-dcc2b4d839ee93c145fc321cc95b9f54e3b6c685.tar.xz
ice-dcc2b4d839ee93c145fc321cc95b9f54e3b6c685.zip
Changed marshaling for sizes: sizes of up to 254 are now marshaled in a
single byte. Added appropriate tests for this to Ice/test/operations. Finished slicing for icej. All tests pass. Removed remaining trace.
Diffstat (limited to 'cpp/src/Ice/BasicStream.cpp')
-rw-r--r--cpp/src/Ice/BasicStream.cpp10
1 files changed, 6 insertions, 4 deletions
diff --git a/cpp/src/Ice/BasicStream.cpp b/cpp/src/Ice/BasicStream.cpp
index 0e848234636..c9662b1577e 100644
--- a/cpp/src/Ice/BasicStream.cpp
+++ b/cpp/src/Ice/BasicStream.cpp
@@ -400,9 +400,10 @@ IceInternal::BasicStream::skipSlice()
void
IceInternal::BasicStream::writeSize(Int v)
{
- if(v > 127)
+ assert(v >= 0);
+ if(v > 254)
{
- write(Byte(-1));
+ write(Byte(255));
write(v);
}
else
@@ -416,7 +417,8 @@ IceInternal::BasicStream::readSize(Ice::Int& v)
{
Byte byte;
read(byte);
- if(byte < 0)
+ unsigned val = static_cast<unsigned char>(byte);
+ if(val == 255)
{
read(v);
if(v < 0)
@@ -426,7 +428,7 @@ IceInternal::BasicStream::readSize(Ice::Int& v)
}
else
{
- v = static_cast<Int>(byte);
+ v = static_cast<Int>(static_cast<unsigned char>(byte));
}
}