Update utility.cpp

- address review comment
This commit is contained in:
Nikolaj Schlej 2021-10-13 17:40:48 -07:00 committed by Vitaly Cheptsov
parent 1f488862c6
commit fae9d6681d

View File

@ -33,7 +33,7 @@ UString visibleAsciiOrHex(UINT8* bytes, UINT32 length)
for (UINT32 i = 0; i < length; i++) { for (UINT32 i = 0; i < length; i++) {
hexString += usprintf("%02X", bytes[i]); hexString += usprintf("%02X", bytes[i]);
if (bytes[i] == '\x00') { // Check for the rest of the buffer being zeroes, and make the whole previous string visible, if so if (ascii && i > 0 && bytes[i] == '\x00') { // Check for the rest of the buffer being zeroes, and make the whole previous string visible, if so
for (UINT32 j = i + 1; j < length; j++) { for (UINT32 j = i + 1; j < length; j++) {
if (bytes[j] != '\x00') { if (bytes[j] != '\x00') {
ascii = false; ascii = false;