aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--coreutils/od_bloaty.c14
1 files changed, 6 insertions, 8 deletions
diff --git a/coreutils/od_bloaty.c b/coreutils/od_bloaty.c
index 2c26dda16..ab7ea997d 100644
--- a/coreutils/od_bloaty.c
+++ b/coreutils/od_bloaty.c
@@ -387,11 +387,11 @@ print_named_ascii(size_t n_bytes, const char *block,
387 " sp" 387 " sp"
388 }; 388 };
389 // buf[N] pos: 01234 56789 389 // buf[N] pos: 01234 56789
390 char buf[12] = " x\0 0xx\0"; 390 char buf[12] = " x\0 xxx\0";
391 // actually " x\0 xxx\0", but want to share string with print_ascii.
392 // [12] because we take three 32bit stack slots anyway, and 391 // [12] because we take three 32bit stack slots anyway, and
393 // gcc is too dumb to initialize with constant stores, 392 // gcc is too dumb to initialize with constant stores,
394 // it copies initializer from rodata. Oh well. 393 // it copies initializer from rodata. Oh well.
394 // https://gcc.gnu.org/bugzilla/show_bug.cgi?id=65410
395 395
396 while (n_bytes--) { 396 while (n_bytes--) {
397 unsigned masked_c = *(unsigned char *) block++; 397 unsigned masked_c = *(unsigned char *) block++;
@@ -419,7 +419,7 @@ print_ascii(size_t n_bytes, const char *block,
419 const char *unused_fmt_string UNUSED_PARAM) 419 const char *unused_fmt_string UNUSED_PARAM)
420{ 420{
421 // buf[N] pos: 01234 56789 421 // buf[N] pos: 01234 56789
422 char buf[12] = " x\0 0xx\0"; 422 char buf[12] = " x\0 xxx\0";
423 423
424 while (n_bytes--) { 424 while (n_bytes--) {
425 const char *s; 425 const char *s;
@@ -455,11 +455,9 @@ print_ascii(size_t n_bytes, const char *block,
455 case '\v': 455 case '\v':
456 s = " \\v"; 456 s = " \\v";
457 break; 457 break;
458 case '\x7f': 458 default:
459 s = " 177"; 459 buf[6] = (c >> 6 & 3) + '0';
460 break; 460 buf[7] = (c >> 3 & 7) + '0';
461 default: /* c is never larger than 040 */
462 buf[7] = (c >> 3) + '0';
463 buf[8] = (c & 7) + '0'; 461 buf[8] = (c & 7) + '0';
464 s = buf + 5; 462 s = buf + 5;
465 } 463 }