Skip to content
Browse files

IOBuffer.printHex() fix

  • Loading branch information...
1 parent 22c070d commit 090268bf91ff74d42133d40eed5cc1118f294306 @roxlu committed
Showing with 4 additions and 4 deletions.
  1. +4 −4 src/IOBuffer.cpp
View
8 src/IOBuffer.cpp
@@ -363,8 +363,7 @@ string IOBuffer::consumeString(uint32_t upToNumBytes) {
// helpers
//------------------------------------------------------------------------------
void IOBuffer::printHex(uint32_t start, uint32_t end) {
- if(start == 0 && end == 0) {
- start = consumed;
+ if(end == 0) {
end = published;
}
if(end > published) {
@@ -375,10 +374,11 @@ void IOBuffer::printHex(uint32_t start, uint32_t end) {
}
int c = 0;
for(int i = start,c=0; i < end; ++i,++c) {
- printf("%02X ", buffer[i]);
- if(c > 0 && c % 20 == 0) {
+ if(c > 20) {
printf("\n");
+ c = 0;
}
+ printf("%02X ", buffer[i]);
}
printf("\n");
}

0 comments on commit 090268b

Please sign in to comment.
Something went wrong with that request. Please try again.