fix for bit combinations during write to SymbolString
This commit is contained in:
@@ -781,7 +781,7 @@ result_t NumberDataType::writeRawValue(unsigned int value, size_t offset, size_t
|
||||
symbol = (value / exp) & 0xff;
|
||||
exp <<= 8;
|
||||
}
|
||||
if (index == start && (m_bitCount % 8) != 0 && offset + index < output->getDataSize()) {
|
||||
if (index == start && (m_bitCount % 8) != 0 && offset + index < output->getCalculatedDataSize()) {
|
||||
output->dataAt(offset + index) |= symbol;
|
||||
} else {
|
||||
output->dataAt(offset + index) = symbol;
|
||||
|
||||
+13
-1
@@ -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.
|
||||
|
||||
Reference in New Issue
Block a user