fix for bit combinations during write to SymbolString

This commit is contained in:
john30
2018-10-03 10:53:38 +02:00
parent 799f6307be
commit 6bd433af46
2 changed files with 14 additions and 2 deletions
+13 -1
View File
@@ -249,7 +249,7 @@ class SymbolString {
} else if (m_data.size() >= lengthOffset+255) {
return false;
}
m_data[lengthOffset] = (symbol_t)(m_data.size() - 1 - lengthOffset);
m_data[lengthOffset] = (symbol_t)(m_data.size() - lengthOffset - 1);
return true;
}
@@ -272,6 +272,18 @@ class SymbolString {
return m_data.size() < lengthOffset + 1 + ret ? m_data.size() - lengthOffset - 1 : ret;
}
/**
* Return the calculated number of data bytes DD (nnot yet revealed in the length field).
* @return the calculated number of data bytes DD.
*/
size_t getCalculatedDataSize() const {
size_t lengthOffset = (m_isMaster ? 4 : 0);
if (m_data.size() <= lengthOffset) {
return 0;
}
return m_data.size() - lengthOffset - 1;
}
/**
* Return the data byte at the specified index (within DD).
* @param index the index of the data byte (within DD) to return.