]> git.ipfire.org Git - thirdparty/coreutils.git/commitdiff
build: shred.c: avoid i686-specific gcc -Wstrict-overflow warning
authorJim Meyering <meyering@redhat.com>
Sun, 15 Jul 2012 09:31:18 +0000 (11:31 +0200)
committerJim Meyering <meyering@redhat.com>
Sun, 15 Jul 2012 09:39:01 +0000 (11:39 +0200)
* src/shred.c: Avoid gcc -Wstrict-overflow warning.
Addresses http://bugs.gnu.org/11927

src/shred.c

index 7a282601b1658827be2407462d45aa437cf5cabf..322bcf1f5a9cef9116c21b6453168aca74125d35 100644 (file)
@@ -485,10 +485,11 @@ dopass (int fd, char const *qname, off_t *sizep, int type,
 
       offset += soff;
 
+      bool done = offset == size;
+
       /* Time to print progress? */
-      if (n
-          && ((offset == size && *previous_human_offset)
-              || thresh <= (now = time (NULL))))
+      if (n && ((done && *previous_human_offset)
+                || thresh <= (now = time (NULL))))
         {
           char offset_buf[LONGEST_HUMAN_READABLE + 1];
           char size_buf[LONGEST_HUMAN_READABLE + 1];
@@ -498,8 +499,7 @@ dopass (int fd, char const *qname, off_t *sizep, int type,
             = human_readable (offset, offset_buf,
                               human_floor | human_progress_opts, 1, 1);
 
-          if (offset == size
-              || !STREQ (previous_human_offset, human_offset))
+          if (done || !STREQ (previous_human_offset, human_offset))
             {
               if (size < 0)
                 error (0, 0, _("%s: pass %lu/%lu (%s)...%s"),
@@ -516,7 +516,7 @@ dopass (int fd, char const *qname, off_t *sizep, int type,
                     = human_readable (size, size_buf,
                                       human_ceiling | human_progress_opts,
                                       1, 1);
-                  if (offset == size)
+                  if (done)
                     human_offset = human_size;
                   error (0, 0, _("%s: pass %lu/%lu (%s)...%s/%s %d%%"),
                          qname, k, n, pass_string, human_offset, human_size,