Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/usr.bin/vndcompress Write offsets in hexadecimal, not decimal.



details:   https://anonhg.NetBSD.org/src/rev/cf4d613dc906
branches:  trunk
changeset: 326196:cf4d613dc906
user:      riastradh <riastradh%NetBSD.org@localhost>
date:      Wed Jan 22 06:15:12 2014 +0000

description:
Write offsets in hexadecimal, not decimal.

diffstat:

 usr.bin/vndcompress/vndcompress.c   |  13 +++++++------
 usr.bin/vndcompress/vnduncompress.c |  14 ++++++++------
 2 files changed, 15 insertions(+), 12 deletions(-)

diffs (90 lines):

diff -r 3f9c2cbb3b58 -r cf4d613dc906 usr.bin/vndcompress/vndcompress.c
--- a/usr.bin/vndcompress/vndcompress.c Wed Jan 22 06:15:04 2014 +0000
+++ b/usr.bin/vndcompress/vndcompress.c Wed Jan 22 06:15:12 2014 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: vndcompress.c,v 1.16 2014/01/22 06:15:04 riastradh Exp $       */
+/*     $NetBSD: vndcompress.c,v 1.17 2014/01/22 06:15:12 riastradh Exp $       */
 
 /*-
  * Copyright (c) 2013 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
  */
 
 #include <sys/cdefs.h>
-__RCSID("$NetBSD: vndcompress.c,v 1.16 2014/01/22 06:15:04 riastradh Exp $");
+__RCSID("$NetBSD: vndcompress.c,v 1.17 2014/01/22 06:15:12 riastradh Exp $");
 
 #include <sys/endian.h>
 
@@ -596,7 +596,7 @@
        const uint64_t first_offset = offtab_get(&S->offtab, 0);
        if (first_offset != (sizeof(struct cloop2_header) +
                (S->n_offsets * sizeof(uint64_t)))) {
-               warnx("first offset is not %"PRIu64": %"PRIu64,
+               warnx("first offset is not 0x%"PRIx64": 0x%"PRIx64,
                    ((uint64_t)S->n_offsets * sizeof(uint64_t)),
                    first_offset);
                return false;
@@ -625,8 +625,9 @@
                        __CTASSERT(MAX_BLOCKSIZE <= (SIZE_MAX / 2));
                        if ((2 * (size_t)S->blocksize) <= (end - start)) {
                                warnx("block %"PRIu32" too large:"
-                                   " %"PRIu64" bytes",
-                                   blkno, (end - start));
+                                   " %"PRIu64" bytes"
+                                   " from 0x%"PRIx64" to 0x%"PRIx64,
+                                   blkno, (end - start), start, end);
                                return false;
                        }
                }
@@ -649,7 +650,7 @@
                        const uint64_t offset = offtab_get(&S->offtab, nblkno);
                        if (offset != ~(uint64_t)0) {
                                warnx("bad partial offset table entry"
-                                   " at %"PRIu32": %"PRIu64,
+                                   " at %"PRIu32": 0x%"PRIx64,
                                    nblkno, offset);
                                return false;
                        }
diff -r 3f9c2cbb3b58 -r cf4d613dc906 usr.bin/vndcompress/vnduncompress.c
--- a/usr.bin/vndcompress/vnduncompress.c       Wed Jan 22 06:15:04 2014 +0000
+++ b/usr.bin/vndcompress/vnduncompress.c       Wed Jan 22 06:15:12 2014 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: vnduncompress.c,v 1.5 2014/01/22 06:14:46 riastradh Exp $      */
+/*     $NetBSD: vnduncompress.c,v 1.6 2014/01/22 06:15:12 riastradh Exp $      */
 
 /*-
  * Copyright (c) 2013 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
  */
 
 #include <sys/cdefs.h>
-__RCSID("$NetBSD: vnduncompress.c,v 1.5 2014/01/22 06:14:46 riastradh Exp $");
+__RCSID("$NetBSD: vnduncompress.c,v 1.6 2014/01/22 06:15:12 riastradh Exp $");
 
 #include <sys/endian.h>
 
@@ -163,17 +163,19 @@
 
                /* Sanity-check the offsets.  */
                if (start != offset)
-                       errx(1, "strange offset for block %"PRIu32": %"PRIu64,
+                       errx(1, "strange offset for block %"PRIu32
+                           ": 0x%"PRIx64,
                            blkno, start);
                /* XXX compression ratio bound */
                __CTASSERT(MAX_BLOCKSIZE <= (SIZE_MAX / 2));
                if ((2 * (size_t)blocksize) <= (end - start))
-                       errx(1, "block %"PRIu32" too large: %"PRIu64" bytes",
-                           blkno, (end - start));
+                       errx(1, "block %"PRIu32" too large"
+                           ": %"PRIu64" bytes from 0x%"PRIx64" to 0x%"PRIx64,
+                           blkno, (end - start), start, end);
                assert(offset <= MIN(OFF_MAX, UINT64_MAX));
                if ((MIN(OFF_MAX, UINT64_MAX) - offset) < (end - start))
                        errx(1, "block %"PRIu32" overflows offset:"
-                           " %"PRIu64" + %"PRIu64,
+                           " 0x%"PRIx64" + %"PRIu64,
                            blkno, offset, (end - start));
 
                /* Read the compressed block.  */



Home | Main Index | Thread Index | Old Index