Module Name:    src
Committed By:   riastradh
Date:           Wed Jan 22 06:15:13 UTC 2014

Modified Files:
        src/usr.bin/vndcompress: vndcompress.c vnduncompress.c

Log Message:
Write offsets in hexadecimal, not decimal.


To generate a diff of this commit:
cvs rdiff -u -r1.16 -r1.17 src/usr.bin/vndcompress/vndcompress.c
cvs rdiff -u -r1.5 -r1.6 src/usr.bin/vndcompress/vnduncompress.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/usr.bin/vndcompress/vndcompress.c
diff -u src/usr.bin/vndcompress/vndcompress.c:1.16 src/usr.bin/vndcompress/vndcompress.c:1.17
--- src/usr.bin/vndcompress/vndcompress.c:1.16	Wed Jan 22 06:15:04 2014
+++ src/usr.bin/vndcompress/vndcompress.c	Wed Jan 22 06:15:12 2014
@@ -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 @@ compress_restart(struct compress_state *
 	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 @@ compress_restart(struct compress_state *
 			__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 @@ compress_restart(struct compress_state *
 			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;
 			}

Index: src/usr.bin/vndcompress/vnduncompress.c
diff -u src/usr.bin/vndcompress/vnduncompress.c:1.5 src/usr.bin/vndcompress/vnduncompress.c:1.6
--- src/usr.bin/vndcompress/vnduncompress.c:1.5	Wed Jan 22 06:14:46 2014
+++ src/usr.bin/vndcompress/vnduncompress.c	Wed Jan 22 06:15:12 2014
@@ -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 @@ vnduncompress(int argc, char **argv, con
 
 		/* 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.  */

Reply via email to