Use consistent format specifiers (%lld) and casts (long long) when
authorkrw <krw@openbsd.org>
Sat, 24 May 2014 14:54:49 +0000 (14:54 +0000)
committerkrw <krw@openbsd.org>
Sat, 24 May 2014 14:54:49 +0000 (14:54 +0000)
printing out block numbers and sector numbers. Make output verbiage
consistent. -Wall happier.

Original diff and ok chl@

sbin/fsck_ext2fs/utilities.c
sbin/fsck_ffs/utilities.c

index 81ec619..a23ae0c 100644 (file)
@@ -1,4 +1,4 @@
-/*     $OpenBSD: utilities.c,v 1.21 2014/05/22 14:04:41 krw Exp $      */
+/*     $OpenBSD: utilities.c,v 1.22 2014/05/24 14:54:49 krw Exp $      */
 /*     $NetBSD: utilities.c,v 1.6 2001/02/04 21:19:34 christos Exp $   */
 
 /*
@@ -295,11 +295,12 @@ bread(int fd, char *buf, daddr32_t blk, long size)
        for (cp = buf, i = 0; i < size; i += secsize, cp += secsize) {
                if (pread(fd, cp, secsize, offset + i) != secsize) {
                        if (secsize != DEV_BSIZE)
-                               printf(" %ld (%ld),",
-                                   (blk * DEV_BSIZE + i) / secsize,
-                                   blk + i / DEV_BSIZE);
+                               printf(" %lld (%lld),",
+                                   (long long)(offset + i) / secsize,
+                                   (long long)blk + i / DEV_BSIZE);
                        else
-                               printf(" %ld,", blk + i / DEV_BSIZE);
+                               printf(" %lld,", (long long)blk +
+                                   i / DEV_BSIZE);
                        errs++;
                }
        }
@@ -326,7 +327,13 @@ bwrite(int fd, char *buf, daddr32_t blk, long size)
        printf("THE FOLLOWING SECTORS COULD NOT BE WRITTEN:");
        for (cp = buf, i = 0; i < size; i += secsize, cp += secsize)
                if (pwrite(fd, cp, secsize, offset + i) != secsize) {
-                       printf(" %ld,", blk + i / DEV_BSIZE);
+                       if (secsize != DEV_BSIZE)
+                               printf(" %lld (%lld),",
+                                   (long long)(offset + i) / secsize,
+                                   (long long)blk + i / DEV_BSIZE);
+                       else
+                               printf(" %lld,", (long long)blk +
+                                   i / DEV_BSIZE);
                }
        printf("\n");
        return;
index 55f51e3..a1d2926 100644 (file)
@@ -1,4 +1,4 @@
-/*     $OpenBSD: utilities.c,v 1.45 2014/05/21 18:53:05 krw Exp $      */
+/*     $OpenBSD: utilities.c,v 1.46 2014/05/24 14:54:49 krw Exp $      */
 /*     $NetBSD: utilities.c,v 1.18 1996/09/27 22:45:20 christos Exp $  */
 
 /*
@@ -349,12 +349,11 @@ bread(int fd, char *buf, daddr_t blk, long size)
                if (pread(fd, cp, secsize, offset + i) != secsize) {
                        if (secsize != DEV_BSIZE)
                                printf(" %lld (%lld),",
-                                   (long long)((blk * DEV_BSIZE + i) /
-                                   secsize),
-                                   (long long)(blk + i / DEV_BSIZE));
+                                   (long long)(offset + i) / secsize,
+                                   (long long)blk + i / DEV_BSIZE);
                        else
-                               printf(" %lld,",
-                                   (long long)(blk + i / DEV_BSIZE));
+                               printf(" %lld,", (long long)blk +
+                                   i / DEV_BSIZE);
                        errs++;
                }
        }
@@ -383,12 +382,11 @@ bwrite(int fd, char *buf, daddr_t blk, long size)
                if (pwrite(fd, cp, secsize, offset + i) != secsize) {
                        if (secsize != DEV_BSIZE)
                                printf(" %lld (%lld),",
-                                   (long long)((blk * DEV_BSIZE + i) /
-                                   secsize),
-                                   (long long)(blk + i / DEV_BSIZE));
+                                   (long long)(offset + i) / secsize,
+                                   (long long)blk + i / DEV_BSIZE);
                        else
-                               printf(" %lld,",
-                                   (long long)(blk + i / DEV_BSIZE));
+                               printf(" %lld,", (long long)blk +
+                                   i / DEV_BSIZE);
                }
        printf("\n");
        return;