diff options
author | Benoit Foucher <benoit@zeroc.com> | 2006-02-27 15:16:23 +0000 |
---|---|---|
committer | Benoit Foucher <benoit@zeroc.com> | 2006-02-27 15:16:23 +0000 |
commit | e16dd8f15eb8c52dff322f437af51fa49a9a0583 (patch) | |
tree | d13a794e58959c53bfa8fd5fe1c7670bfc9fc819 /cppe/include/IceE/BasicStream.h | |
parent | Fixed to work with Ice demo with instance name (diff) | |
download | ice-e16dd8f15eb8c52dff322f437af51fa49a9a0583.tar.bz2 ice-e16dd8f15eb8c52dff322f437af51fa49a9a0583.tar.xz ice-e16dd8f15eb8c52dff322f437af51fa49a9a0583.zip |
Inlined checkSeq.
Diffstat (limited to 'cppe/include/IceE/BasicStream.h')
-rw-r--r-- | cppe/include/IceE/BasicStream.h | 28 |
1 files changed, 26 insertions, 2 deletions
diff --git a/cppe/include/IceE/BasicStream.h b/cppe/include/IceE/BasicStream.h index f3a5791d1bd..e6e07a54185 100644 --- a/cppe/include/IceE/BasicStream.h +++ b/cppe/include/IceE/BasicStream.h @@ -81,8 +81,32 @@ public: } void startSeq(int, int); - void checkSeq(); - void checkSeq(int); + void checkSeq() + { + checkSeq(static_cast<int>(b.end() - i)); + } + void checkSeq(int bytesLeft) + { + // + // Check, given the number of elements requested for this sequence, + // that this sequence, plus the sum of the sizes of the remaining + // number of elements of all enclosing sequences, would still fit + // within the message. + // + int size = 0; + SeqData* sd = _seqDataStack; + do + { + size += (sd->numElements - 1) * sd->minSize; + sd = sd->previous; + } + while(sd); + + if(size > bytesLeft) + { + throwUnmarshalOutOfBoundsException(__FILE__, __LINE__); + } + } void checkFixedSeq(int, int); // For sequences of fixed-size types. void endElement() { |