]> git.ipfire.org Git - thirdparty/tar.git/commitdiff
ptrdiff_t, not int
authorPaul Eggert <eggert@cs.ucla.edu>
Thu, 1 Aug 2024 14:16:49 +0000 (07:16 -0700)
committerPaul Eggert <eggert@cs.ucla.edu>
Sun, 4 Aug 2024 08:41:43 +0000 (01:41 -0700)
* src/delete.c (delete_archive_members): Use ptrdiff_t, not int,
to count memory blocks.
(write_recent_bytes): Simplify remainder calculation.

src/delete.c

index cd32ec97a078ec264d52f31f314f90580e00f9ca..4223f95c033ee3a89dfa589b7bb7e51c8f3546cf 100644 (file)
@@ -116,7 +116,7 @@ static void
 write_recent_bytes (char *data, size_t bytes)
 {
   size_t blocks = bytes / BLOCKSIZE;
-  size_t rest = bytes - blocks * BLOCKSIZE;
+  size_t rest = bytes % BLOCKSIZE;
 
   write_recent_blocks ((union block *)data, blocks);
   memcpy (new_record[new_blocks].buffer, data + blocks * BLOCKSIZE, rest);
@@ -154,7 +154,7 @@ delete_archive_members (void)
   /* FIXME: Should clean the routine before cleaning these variables :-( */
   struct name *name;
   off_t blocks_to_keep = 0;
-  int kept_blocks_in_record;
+  ptrdiff_t kept_blocks_in_record;
 
   name_gather ();
   open_archive (ACCESS_UPDATE);
@@ -307,7 +307,7 @@ delete_archive_members (void)
 
              while (blocks_to_keep)
                {
-                 int count;
+                 ptrdiff_t count;
 
                  if (current_block == record_end)
                    {