]> Dogcows Code - chaz/tar/blobdiff - src/xheader.c
Adjust to recent gnulib changes.
[chaz/tar] / src / xheader.c
index f5e119946fcf68d0cbcb313e7f75a593d0a36991..ec63d350b4e88b7b8fabf3b2d788cc5a48de85b1 100644 (file)
@@ -1,6 +1,6 @@
 /* POSIX extended headers for tar.
 
-   Copyright (C) 2003, 2004, 2005, 2006 Free Software Foundation, Inc.
+   Copyright (C) 2003, 2004, 2005, 2006, 2007 Free Software Foundation, Inc.
 
    This program is free software; you can redistribute it and/or modify it
    under the terms of the GNU General Public License as published by the
@@ -22,7 +22,6 @@
 #include <hash.h>
 #include <inttostr.h>
 #include <quotearg.h>
-#include <stpcpy.h>
 
 #include "common.h"
 
@@ -225,7 +224,7 @@ xheader_set_option (char *string)
                               to the result of the basename
                               utility on the translated file name.
      %p                       The process ID of the pax process.
-     %n                       The value of the 3rd argument.  
+     %n                       The value of the 3rd argument.
      %%                       A '%' character. */
 
 char *
@@ -264,7 +263,7 @@ xheader_format_name (struct tar_stat_info *st, const char *fmt, size_t n)
        case 'f':
          if (st)
            {
-             base = base_name (st->orig_file_name);
+             base = last_component (st->orig_file_name);
              len += strlen (base) - 2;
            }
          break;
@@ -331,7 +330,7 @@ xheader_format_name (struct tar_stat_info *st, const char *fmt, size_t n)
     }
 
   free (dirp);
-  
+
   /* Do not allow it to end in a slash */
   while (q > buf && ISSLASH (q[-1]))
     q--;
@@ -508,7 +507,7 @@ decode_record (char **ptr,
       ERROR ((0, 0, _("Extended header length is out of allowed range")));
       return false;
     }
-  
+
   if (len_max < len)
     {
       int len_len = len_lim - p;
@@ -647,12 +646,10 @@ void
 xheader_read (union block *p, size_t size)
 {
   size_t j = 0;
-  size_t nblocks;
 
   free (extended_header.buffer);
   size += BLOCKSIZE;
   extended_header.size = size;
-  nblocks = (size + BLOCKSIZE - 1) / BLOCKSIZE;
   extended_header.buffer = xmalloc (size + 1);
   extended_header.buffer[size] = '\0';
 
@@ -782,7 +779,7 @@ xheader_string_end (char const *keyword)
   if (size != p)
     {
       ERROR ((0, 0,
-        _("Generated keyword/value pair is too long (keyword=%s, length=%s"),
+        _("Generated keyword/value pair is too long (keyword=%s, length=%s)"),
              keyword, nbuf));
       obstack_free (extended_header.stk, obstack_finish (extended_header.stk));
       return false;
@@ -956,7 +953,7 @@ decode_time (struct timespec *ts, char const *arg, char const *keyword)
   return true;
 }
 
-  
+
 
 static void
 code_num (uintmax_t value, char const *keyword, struct xheader *xhdr)
@@ -1094,9 +1091,10 @@ ctime_decoder (struct tar_stat_info *st,
 
 static void
 mtime_coder (struct tar_stat_info const *st, char const *keyword,
-            struct xheader *xhdr, void const *data __attribute__ ((unused)))
+            struct xheader *xhdr, void const *data)
 {
-  code_time (st->mtime, keyword, xhdr);
+  struct timespec const *mtime = data;
+  code_time (mtime ? *mtime : st->mtime, keyword, xhdr);
 }
 
 static void
@@ -1380,8 +1378,8 @@ static void
 volume_size_coder (struct tar_stat_info const *st, char const *keyword,
                   struct xheader *xhdr, void const *data)
 {
-  off_t v = *(off_t*)data;
-  code_num (v, keyword, xhdr);
+  off_t const *v = data;
+  code_num (*v, keyword, xhdr);
 }
 
 static void
@@ -1399,8 +1397,8 @@ static void
 volume_offset_coder (struct tar_stat_info const *st, char const *keyword,
                     struct xheader *xhdr, void const *data)
 {
-  off_t v = *(off_t*)data;
-  code_num (v, keyword, xhdr);
+  off_t const *v = data;
+  code_num (*v, keyword, xhdr);
 }
 
 static void
@@ -1439,12 +1437,12 @@ sparse_major_decoder (struct tar_stat_info *st,
   if (decode_num (&u, arg, TYPE_MAXIMUM (unsigned), keyword))
     st->sparse_major = u;
 }
-  
+
 static void
 sparse_minor_coder (struct tar_stat_info const *st, char const *keyword,
                      struct xheader *xhdr, void const *data)
 {
-  code_num (st->sparse_minor, keyword, xhdr); 
+  code_num (st->sparse_minor, keyword, xhdr);
 }
 
 static void
@@ -1457,7 +1455,7 @@ sparse_minor_decoder (struct tar_stat_info *st,
   if (decode_num (&u, arg, TYPE_MAXIMUM (unsigned), keyword))
     st->sparse_minor = u;
 }
-  
+
 struct xhdr_tab const xhdr_tab[] = {
   { "atime",   atime_coder,    atime_decoder,    false },
   { "comment", dummy_coder,    dummy_decoder,    false },
This page took 0.029495 seconds and 4 git commands to generate.