util: Fix style in ovs_hex_dump().
Reported-by: Russell Bryant
Acked-by: Russell Bryant
@@ -645,39 +645,43 @@ ovs_hex_dump(FILE *stream, const void *buf_, size_t size,
const uint8_t *buf = buf_;
const size_t per_line = 16; /* Maximum bytes per line. */
- while (size > 0)
- {
- size_t start, end, n;
+ while (size > 0) {
size_t i;
/* Number of bytes on this line. */
- start = ofs % per_line;
- end = per_line;
- if (end - start > size)
+ size_t start = ofs % per_line;
+ size_t end = per_line;
+ if (end - start > size) {
end = start + size;
- n = end - start;
+ }
+ size_t n = end - start;
/* Print line. */
- fprintf(stream, "%08"PRIxMAX" ", (uintmax_t) ROUND_DOWN(ofs, per_line));
- for (i = 0; i < start; i++)
+ fprintf(stream, "%08"PRIxMAX" ",
+ (uintmax_t) ROUND_DOWN(ofs, per_line));
+ for (i = 0; i < start; i++) {
fprintf(stream, " ");
- for (; i < end; i++)
+ }
+ for (; i < end; i++) {
fprintf(stream, "%c%02x",
i == per_line / 2 ? '-' : ' ', buf[i - start]);
- if (ascii)
- {
+ }
+ if (ascii) {
fprintf(stream, " ");
- for (; i < per_line; i++)
+ for (; i < per_line; i++) {
fprintf(stream, " ");
+ }
fprintf(stream, "|");
- for (i = 0; i < start; i++)
+ for (i = 0; i < start; i++) {
fprintf(stream, " ");
+ }
for (; i < end; i++) {
int c = buf[i - start];
putc(c >= 32 && c < 127 ? c : '.', stream);
}
- for (; i < per_line; i++)
+ for (; i < per_line; i++) {
fprintf(stream, " ");
+ }
fprintf(stream, "|");
}
fprintf(stream, "\n");
