Skip to content
Snippets Groups Projects

bugfix in rich unpacker

Merged Sergey Gorbunov requested to merge se.gorbunov/cbmroot:bugFixRich into master
1 file
+ 4
4
Compare changes
  • Side-by-side
  • Inline
@@ -20,7 +20,7 @@ std::string mRichSupport::GetBinaryRepresentation(size_t const size, uint8_t con
@@ -20,7 +20,7 @@ std::string mRichSupport::GetBinaryRepresentation(size_t const size, uint8_t con
for (int i = size - 1; i >= 0; i--) {
for (int i = size - 1; i >= 0; i--) {
for (int j = 7; j >= 0; j--) {
for (int j = 7; j >= 0; j--) {
byte = (b[i] >> j) & 1;
byte = (b[i] >> j) & 1;
snprintf(cStr, buf_size - 1, "%u", byte);
snprintf(cStr, buf_size, "%u", byte);
outString.append(cStr);
outString.append(cStr);
}
}
}
}
@@ -44,7 +44,7 @@ std::string mRichSupport::GetHexRepresentation(size_t const size, uint8_t const*
@@ -44,7 +44,7 @@ std::string mRichSupport::GetHexRepresentation(size_t const size, uint8_t const*
for (int i = size - 1; i >= 0; i--) {
for (int i = size - 1; i >= 0; i--) {
byte = b[i] & 0xff;
byte = b[i] & 0xff;
snprintf(cStr, buf_size - 1, "%02x", byte);
snprintf(cStr, buf_size, "%02x", byte);
outString.append(cStr);
outString.append(cStr);
}
}
@@ -66,7 +66,7 @@ std::string mRichSupport::GetWordHexRepr(uint8_t const* const ptr)
@@ -66,7 +66,7 @@ std::string mRichSupport::GetWordHexRepr(uint8_t const* const ptr)
char cStr[buf_size];
char cStr[buf_size];
cStr[9] = '\0';
cStr[9] = '\0';
snprintf(cStr, buf_size - 1, "%02x%02x %02x%02x", byte[0], byte[1], byte[2], byte[3]);
snprintf(cStr, buf_size, "%02x%02x %02x%02x", byte[0], byte[1], byte[2], byte[3]);
outString.append(cStr);
outString.append(cStr);
@@ -88,7 +88,7 @@ std::string mRichSupport::GetWordHexReprInv(uint8_t const* const ptr)
@@ -88,7 +88,7 @@ std::string mRichSupport::GetWordHexReprInv(uint8_t const* const ptr)
char cStr[buf_size];
char cStr[buf_size];
cStr[9] = '\0';
cStr[9] = '\0';
snprintf(cStr, buf_size - 1, "%02x%02x %02x%02x", byte[0], byte[1], byte[2], byte[3]);
snprintf(cStr, buf_size, "%02x%02x %02x%02x", byte[0], byte[1], byte[2], byte[3]);
outString.append(cStr);
outString.append(cStr);
Loading