|
|
|
|||||
|
Questions about sanity-check of sequence sizes during sequence unmarshaling
I have noticed the comments in src/ice/BasicStream.cpp
Quote:
1)Basic Slice Types bool/byte/short/int/long/float/double/string 2)User-defined Types enumeration/structure/sequence/dictionary/ 3)class However, some new concepts appeared in the above quote: 1)a sequence of a variable-length type 2)sequences that contain constructed types 3)a sequence of a fixed-length type But I can not find the accurate definitions of "variable-length type" or "constructed type" or "fixed-length type" in Ice's manual. Just one example: If a struct has one member of class type, what's its type ? Another question: Quote:
I have noticed the following: Code:
-- test/ice/stream/Test.cpp (generated by Test.ice)
void
Test::__read(::IceInternal::BasicStream* __is, ::Test::MyClassS& v, ::Test::__U__MyClassS)
{
::Ice::Int sz;
__is->readSize(sz);
__is->startSeq(sz, 4); //4 bytes v.resize(sz);
for(int i = 0; i < sz; ++i)
{
__is->read(::Test::__patch__MyClassPtr, &v[i]);
__is->checkSeq();
__is->endElement();
}
__is->endSeq(sz);
}
-- test/ice/operations/Test.cpp (generated by Test.ice)
void
Test::__read(::IceInternal::BasicStream* __is, ::Test::MyClassS& v, ::Test::__U__MyClassS)
{
::Ice::Int sz;
__is->readSize(sz);
__is->startSeq(sz, 2); //2 bytes v.resize(sz);
for(int i = 0; i < sz; ++i)
{
::Test::__read(__is, v[i]);
__is->checkSeq();
__is->endElement();
}
__is->endSeq(sz);
}
Thanks. |
|
|||||
|
Quote:
How about enum type ? It's a construct type and it contains only fixed-length types, so it is a fixed-length type, right ? |
|
|||||
|
A bug ???
Code:
-- src/Ice/BasicStream.cpp
void
IceInternal::BasicStream::startSeq(int numElements, int minSize)
{
if(numElements == 0) // Optimization to avoid pushing a useless stack frame.
{
return;
}
//
// Push the current sequence details on the stack.
//
SeqData* sd = new SeqData(numElements, minSize);
sd->previous = _seqDataStack;
_seqDataStack = sd;
int bytesLeft = static_cast<int>(b.end() - i);
if(_seqDataStack == 0) // Outermost sequence
{ //This is always false
//
// The sequence must fit within the message.
//
if(numElements * minSize > bytesLeft)
{
throw UnmarshalOutOfBoundsException(__FILE__, __LINE__);
}
}
else // Nested sequence
{
checkSeq(bytesLeft);
}
}
Code:
if (sd->previous == 0) // Outermost sequence Last edited by rc_hz : 06-22-2005 at 08:56 AM. |
![]() |
| Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) | |
| Thread Tools | |
| Display Modes | Rate This Thread |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| null sequence in C# | chris92 | Help Center | 3 | 09-29-2006 09:58 AM |
| Sequence of classes in Slice? | bartley | Help Center | 2 | 05-19-2006 11:22 PM |
| C# and dictionary/sequence problem on ICE 3.0.1 | tkrieger | Help Center | 2 | 05-18-2006 01:59 PM |
| Sequence of 'unions'? | dwolfe5272 | Help Center | 6 | 10-18-2004 05:38 PM |
| Questions about sequence<byte> in C++? | rodrigc | Help Center | 3 | 02-24-2003 11:21 PM |