summaryrefslogtreecommitdiff
path: root/cpp
diff options
context:
space:
mode:
Diffstat (limited to 'cpp')
-rw-r--r--cpp/src/Ice/BasicStream.cpp10
-rw-r--r--cpp/test/Ice/operations/Test.ice2
-rw-r--r--cpp/test/Ice/operations/TestAMD.ice2
-rw-r--r--cpp/test/Ice/operations/TestAMDI.cpp9
-rw-r--r--cpp/test/Ice/operations/TestAMDI.h2
-rw-r--r--cpp/test/Ice/operations/TestI.cpp9
-rw-r--r--cpp/test/Ice/operations/TestI.h2
-rw-r--r--cpp/test/Ice/operations/Twoways.cpp19
-rw-r--r--cpp/test/Ice/operations/TwowaysAMI.cpp44
9 files changed, 95 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));
}
}
diff --git a/cpp/test/Ice/operations/Test.ice b/cpp/test/Ice/operations/Test.ice
index a5f601c0043..201f10fc8c5 100644
--- a/cpp/test/Ice/operations/Test.ice
+++ b/cpp/test/Ice/operations/Test.ice
@@ -141,6 +141,8 @@ dictionary<string, MyEnum> StringMyEnumD;
StringMyEnumD opStringMyEnumD(StringMyEnumD p1, StringMyEnumD p2,
out StringMyEnumD p3);
+ IntS opIntS(IntS s);
+
};
["ami"] class MyDerivedClass extends MyClass
diff --git a/cpp/test/Ice/operations/TestAMD.ice b/cpp/test/Ice/operations/TestAMD.ice
index fcaa5fdc14d..b69fd08f7c1 100644
--- a/cpp/test/Ice/operations/TestAMD.ice
+++ b/cpp/test/Ice/operations/TestAMD.ice
@@ -141,6 +141,8 @@ dictionary<string, MyEnum> StringMyEnumD;
StringMyEnumD opStringMyEnumD(StringMyEnumD p1, StringMyEnumD p2,
out StringMyEnumD p3);
+ IntS opIntS(IntS s);
+
};
["ami", "amd"] class MyDerivedClass extends MyClass
diff --git a/cpp/test/Ice/operations/TestAMDI.cpp b/cpp/test/Ice/operations/TestAMDI.cpp
index b8bdf377092..e043405c985 100644
--- a/cpp/test/Ice/operations/TestAMDI.cpp
+++ b/cpp/test/Ice/operations/TestAMDI.cpp
@@ -14,6 +14,7 @@
#include <Ice/Ice.h>
#include <TestAMDI.h>
+#include <functional>
class Thread_opVoid : public IceUtil::Thread
{
@@ -349,6 +350,14 @@ MyDerivedClassI::opStringMyEnumD_async(const Test::AMD_MyClass_opStringMyEnumDPt
}
void
+MyDerivedClassI::opIntS_async(const ::Test::AMD_MyClass_opIntSPtr& cb, const Test::IntS& s, const Ice::Current&)
+{
+ Test::IntS r;
+ transform(s.begin(), s.end(), back_inserter(r), std::negate<int>());
+ cb->ice_response(r);
+}
+
+void
MyDerivedClassI::opDerived_async(const Test::AMD_MyDerivedClass_opDerivedPtr& cb,
const Ice::Current&)
{
diff --git a/cpp/test/Ice/operations/TestAMDI.h b/cpp/test/Ice/operations/TestAMDI.h
index 495d76321b6..fe82a7007ca 100644
--- a/cpp/test/Ice/operations/TestAMDI.h
+++ b/cpp/test/Ice/operations/TestAMDI.h
@@ -122,6 +122,8 @@ public:
const Test::StringMyEnumD&, const Test::StringMyEnumD&,
const Ice::Current&);
+ virtual void opIntS_async(const ::Test::AMD_MyClass_opIntSPtr&, const Test::IntS&, const Ice::Current&);
+
virtual void opDerived_async(const Test::AMD_MyDerivedClass_opDerivedPtr&,
const Ice::Current&);
diff --git a/cpp/test/Ice/operations/TestI.cpp b/cpp/test/Ice/operations/TestI.cpp
index 061a00a42be..3c80b6ee2b5 100644
--- a/cpp/test/Ice/operations/TestI.cpp
+++ b/cpp/test/Ice/operations/TestI.cpp
@@ -14,6 +14,7 @@
#include <Ice/Ice.h>
#include <TestI.h>
+#include <functional>
MyDerivedClassI::MyDerivedClassI(const Ice::ObjectAdapterPtr& adapter, const Ice::Identity& identity) :
_adapter(adapter),
@@ -326,6 +327,14 @@ MyDerivedClassI::opStringMyEnumD(const Test::StringMyEnumD& p1,
return r;
}
+Test::IntS
+MyDerivedClassI::opIntS(const Test::IntS& s, const Ice::Current&)
+{
+ Test::IntS r;
+ transform(s.begin(), s.end(), back_inserter(r), std::negate<int>());
+ return r;
+}
+
void
MyDerivedClassI::opDerived(const Ice::Current&)
{
diff --git a/cpp/test/Ice/operations/TestI.h b/cpp/test/Ice/operations/TestI.h
index e32ec545b8e..fe9f1c7aba3 100644
--- a/cpp/test/Ice/operations/TestI.h
+++ b/cpp/test/Ice/operations/TestI.h
@@ -146,6 +146,8 @@ public:
Test::StringMyEnumD&,
const Ice::Current&);
+ virtual Test::IntS opIntS(const Test::IntS&, const Ice::Current&);
+
virtual void opDerived(const Ice::Current&);
private:
diff --git a/cpp/test/Ice/operations/Twoways.cpp b/cpp/test/Ice/operations/Twoways.cpp
index bdcbbdb7b4d..3fc8b6cc167 100644
--- a/cpp/test/Ice/operations/Twoways.cpp
+++ b/cpp/test/Ice/operations/Twoways.cpp
@@ -572,4 +572,23 @@ twoways(const Test::MyClassPrx& p)
test(ro[""] == Test::enum2);
test(ro["Hello!!"] == Test::enum2);
}
+
+ {
+ const int lengths[] = { 0, 1, 2, 126, 127, 128, 129, 253, 254, 255, 256, 257, 1000 };
+
+ for(int l = 0; l != sizeof(lengths) / sizeof(*lengths); ++l)
+ {
+ Test::IntS s;
+ for(int i = 0; i < lengths[l]; ++i)
+ {
+ s.push_back(i);
+ }
+ Test::IntS r = p->opIntS(s);
+ test(r.size() == static_cast<size_t>(lengths[l]));
+ for(int j = 0; j < static_cast<int>(r.size()); ++j)
+ {
+ test(r[j] == -j);
+ }
+ }
+ }
}
diff --git a/cpp/test/Ice/operations/TwowaysAMI.cpp b/cpp/test/Ice/operations/TwowaysAMI.cpp
index ca25c66c146..cd3af19f958 100644
--- a/cpp/test/Ice/operations/TwowaysAMI.cpp
+++ b/cpp/test/Ice/operations/TwowaysAMI.cpp
@@ -696,6 +696,34 @@ public:
}
};
+class AMI_MyClass_opIntSI : public Test::AMI_MyClass_opIntS, public CallbackBase
+{
+public:
+
+ AMI_MyClass_opIntSI(int l) : _l(l) {}
+
+ virtual void ice_response(const Test::IntS& r)
+ {
+ test(r.size() == static_cast<size_t>(_l));
+ for(int j = 0; j < _l; ++j)
+ {
+ test(r[j] == -j);
+ }
+ called();
+ }
+
+ virtual void ice_exception(const ::Ice::Exception&)
+ {
+ test(false);
+ }
+
+private:
+
+ int _l;
+};
+
+typedef IceUtil::Handle<AMI_MyClass_opIntSI> AMI_MyClass_opIntSIPtr;
+
typedef IceUtil::Handle<AMI_MyClass_opStringMyEnumDI> AMI_MyClass_opStringMyEnumDIPtr;
class AMI_MyDerivedClass_opDerivedI : public Test::AMI_MyDerivedClass_opDerived, public CallbackBase
@@ -995,6 +1023,22 @@ twowaysAMI(const Test::MyClassPrx& p)
}
{
+ const int lengths[] = { 0, 1, 2, 126, 127, 128, 129, 253, 254, 255, 256, 257, 1000 };
+
+ for(int l = 0; l != sizeof(lengths) / sizeof(*lengths); ++l)
+ {
+ Test::IntS s;
+ for(int i = 0; i < lengths[l]; ++i)
+ {
+ s.push_back(i);
+ }
+ AMI_MyClass_opIntSIPtr cb = new AMI_MyClass_opIntSI(lengths[l]);
+ p->opIntS_async(cb, s);
+ test(cb->check());
+ }
+ }
+
+ {
Test::MyDerivedClassPrx derived = Test::MyDerivedClassPrx::checkedCast(p);
test(derived);
AMI_MyDerivedClass_opDerivedIPtr cb = new AMI_MyDerivedClass_opDerivedI;