diff options
| author | Gordon Sim <gsim@apache.org> | 2008-04-30 14:16:38 +0000 |
|---|---|---|
| committer | Gordon Sim <gsim@apache.org> | 2008-04-30 14:16:38 +0000 |
| commit | a2b413c1c0bea044d0c82ac3e1a99de5036761d1 (patch) | |
| tree | 01166e7547caf8e5aee5a8569fa53db75f1d24f3 /cpp/src/qpid/framing/FieldTable.cpp | |
| parent | c86a77f2ce6150ce8fc0770604d92502acd996b8 (diff) | |
| download | qpid-python-a2b413c1c0bea044d0c82ac3e1a99de5036761d1.tar.gz | |
QPID-988 and QPID-989: fixes to framing for final 0-10 spec
git-svn-id: https://svn.apache.org/repos/asf/incubator/qpid/trunk/qpid@652386 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'cpp/src/qpid/framing/FieldTable.cpp')
| -rw-r--r-- | cpp/src/qpid/framing/FieldTable.cpp | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/cpp/src/qpid/framing/FieldTable.cpp b/cpp/src/qpid/framing/FieldTable.cpp index 903c7ed100..1f8ffa72bc 100644 --- a/cpp/src/qpid/framing/FieldTable.cpp +++ b/cpp/src/qpid/framing/FieldTable.cpp @@ -31,7 +31,7 @@ namespace framing { FieldTable::~FieldTable() {} uint32_t FieldTable::size() const { - uint32_t len(4); + uint32_t len(4/*size field*/ + 4/*count field*/); for(ValueMap::const_iterator i = values.begin(); i != values.end(); ++i) { // shortstr_len_byte + key size + value size len += 1 + (i->first).size() + (i->second)->size(); @@ -121,8 +121,9 @@ int FieldTable::getInt(const std::string& name) const { // value = getValue<FieldTable>(name); //} -void FieldTable::encode(Buffer& buffer) const{ +void FieldTable::encode(Buffer& buffer) const{ buffer.putLong(size() - 4); + buffer.putLong(values.size()); for (ValueMap::const_iterator i = values.begin(); i!=values.end(); ++i) { buffer.putShortString(i->first); i->second->encode(buffer); @@ -132,10 +133,11 @@ void FieldTable::encode(Buffer& buffer) const{ void FieldTable::decode(Buffer& buffer){ uint32_t len = buffer.getLong(); uint32_t available = buffer.available(); + uint32_t count = buffer.getLong(); if (available < len) throw IllegalArgumentException(QPID_MSG("Not enough data for field table.")); uint32_t leftover = available - len; - while(buffer.available() > leftover){ + while(buffer.available() > leftover && count--){ std::string name; ValuePtr value(new FieldValue); |
