diff options
-rw-r--r-- | coreutils/od_bloaty.c | 11 |
1 files changed, 6 insertions, 5 deletions
diff --git a/coreutils/od_bloaty.c b/coreutils/od_bloaty.c index c4d11601f..34ceefb1c 100644 --- a/coreutils/od_bloaty.c +++ b/coreutils/od_bloaty.c | |||
@@ -394,8 +394,8 @@ print_named_ascii(size_t n_bytes, const char *block, | |||
394 | " sp" | 394 | " sp" |
395 | }; | 395 | }; |
396 | // buf[N] pos: 01234 56789 | 396 | // buf[N] pos: 01234 56789 |
397 | char buf[12] = " x\0 0xx\0"; | 397 | char buf[12] = " x\0 xxx\0"; |
398 | // actually " x\0 xxx\0", but want to share string with print_ascii. | 398 | // share string with print_ascii. |
399 | // [12] because we take three 32bit stack slots anyway, and | 399 | // [12] because we take three 32bit stack slots anyway, and |
400 | // gcc is too dumb to initialize with constant stores, | 400 | // gcc is too dumb to initialize with constant stores, |
401 | // it copies initializer from rodata. Oh well. | 401 | // it copies initializer from rodata. Oh well. |
@@ -426,7 +426,7 @@ print_ascii(size_t n_bytes, const char *block, | |||
426 | const char *unused_fmt_string UNUSED_PARAM) | 426 | const char *unused_fmt_string UNUSED_PARAM) |
427 | { | 427 | { |
428 | // buf[N] pos: 01234 56789 | 428 | // buf[N] pos: 01234 56789 |
429 | char buf[12] = " x\0 0xx\0"; | 429 | char buf[12] = " x\0 xxx\0"; |
430 | 430 | ||
431 | while (n_bytes--) { | 431 | while (n_bytes--) { |
432 | const char *s; | 432 | const char *s; |
@@ -465,8 +465,9 @@ print_ascii(size_t n_bytes, const char *block, | |||
465 | case '\x7f': | 465 | case '\x7f': |
466 | s = " 177"; | 466 | s = " 177"; |
467 | break; | 467 | break; |
468 | default: /* c is never larger than 040 */ | 468 | default: |
469 | buf[7] = (c >> 3) + '0'; | 469 | buf[6] = (c >> 6 & 3) + '0'; |
470 | buf[7] = (c >> 3 & 7) + '0'; | ||
470 | buf[8] = (c & 7) + '0'; | 471 | buf[8] = (c & 7) + '0'; |
471 | s = buf + 5; | 472 | s = buf + 5; |
472 | } | 473 | } |