]> Dogcows Code - chaz/tar/commitdiff
Port to Forte Developer 7 C 5.4 and C99.
authorPaul Eggert <eggert@cs.ucla.edu>
Tue, 12 Dec 2006 23:56:24 +0000 (23:56 +0000)
committerPaul Eggert <eggert@cs.ucla.edu>
Tue, 12 Dec 2006 23:56:24 +0000 (23:56 +0000)
* src/common.h (add_exclude_tag): Add decl; C99 requires this
and Forte warns about it.
* src/incremen.c: Include <mkdtemp.h> for mkdtemp prototype,
for same reason.
* src/misc.c (get_max_open_files): Rewrite to avoid code that
Forte C complains about as being unreachable.
* src/xheader.c (mtime_code): Rewrite to avoid Forte error
reported by Trond Hasle Amundsen.

* src/incremen.c (compare_dirnames): Rewrite to avoid casts.
* src/utf8.c (string_ascii_p): Likewise.
* src/xheader.c (mtime_coder, volume_size_coder, volume_offset_coder):
Likewise.

SCALAR(0x8283218)

ChangeLog
src/common.h
src/incremen.c
src/misc.c
src/utf8.c
src/xheader.c

index 4f852e5af8f53a2520614f808cc6cf8f73e5cdc0..531eaac84661d01b5cc5b32bfa2b2f211e34ed79 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,20 @@
+2006-12-12  Paul Eggert  <eggert@cs.ucla.edu>
+
+       Port to Forte Developer 7 C 5.4 and C99.
+       * src/common.h (add_exclude_tag): Add decl; C99 requires this
+       and Forte warns about it.
+       * src/incremen.c: Include <mkdtemp.h> for mkdtemp prototype,
+       for same reason.
+       * src/misc.c (get_max_open_files): Rewrite to avoid code that
+       Forte C complains about as being unreachable.
+       * src/xheader.c (mtime_code): Rewrite to avoid Forte error
+       reported by Trond Hasle Amundsen.
+
+       * src/incremen.c (compare_dirnames): Rewrite to avoid casts.
+       * src/utf8.c (string_ascii_p): Likewise.
+       * src/xheader.c (mtime_coder, volume_size_coder, volume_offset_coder):
+       Likewise.
+
 2006-12-08  Sergey Poznyakoff  <gray@gnu.org.ua>
 
        * bootstrap: Add paxutils files to dot_ignore.
@@ -19,7 +36,7 @@
        Patch proposed by Jan-Benedict Glaw <jbglaw@lug-owl.de>
        * tests/truncate.at: Use genfile instead of dd, because on some
        systems /dev/zero is not available.
-       
+
 2006-12-04  Paul Eggert  <eggert@cs.ucla.edu>
 
        * NEWS: Fix some race conditions with tar -x --same-owner.
index e7f4c684176f42932b652f09b88cf0ffecd343ad..b8c124e7cb01f198aa1394fa8679cd85a0073c57 100644 (file)
@@ -417,6 +417,7 @@ enum dump_status
     dump_status_not_implemented
   };
 
+void add_exclude_tag (const char *name);
 bool file_dumpable_p (struct tar_stat_info *st);
 void create_archive (void);
 void pad_archive (off_t size_left);
index 6cd8efb8b2ae662ce2fe058d0b3ae6af34b6293b..c68a88b48e83389359b57eb3cbbccefb19b0a3a9 100644 (file)
@@ -20,6 +20,7 @@
 #include <system.h>
 #include <getline.h>
 #include <hash.h>
+#include <mkdtemp.h>
 #include <quotearg.h>
 #include "common.h"
 
@@ -378,7 +379,9 @@ dumpdir_size (const char *p)
 static int
 compare_dirnames (const void *first, const void *second)
 {
-  return strcmp (*(const char**)first, *(const char**)second);
+  char const *const *name1 = first;
+  char const *const *name2 = second;
+  return strcmp (*name1, *name2);
 }
 
 /* Compare dumpdir array from DIRECTORY with directory listing DIR and
index 328591ca4b77beb26b216a86499f82687e353282..1d7e9e1eb7daff061e447029c7756fcbe28e4c27 100644 (file)
@@ -1,7 +1,7 @@
 /* Miscellaneous functions, not really specific to GNU tar.
 
    Copyright (C) 1988, 1992, 1994, 1995, 1996, 1997, 1999, 2000, 2001,
-   2003, 2004, 2005 Free Software Foundation, Inc.
+   2003, 2004, 2005, 2006 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
@@ -588,10 +588,12 @@ get_max_open_files ()
 
   if (getrlimit(RLIMIT_NOFILE, &rlim) == 0)
     return rlim.rlim_max;
+  return -1;
 #elif defined HAVE_GETDTABLESIZE
   return getdtablesize ();
-#endif
+#else
   return -1;
+#endif
 }
 
 /* Close all descriptors, except the first three */
@@ -603,7 +605,7 @@ closeopen ()
   for (i = get_max_open_files () - 1; i > 2; i--)
     close (i);
 }
-  
+
 /* Change to directory I.  If I is 0, change to the initial working
    directory; otherwise, I must be a value returned by chdir_arg.  */
 void
@@ -611,7 +613,7 @@ chdir_do (int i)
 {
   static int previous;
   static int saved_count;
-  
+
   if (previous != i)
     {
       struct wd *prev = &wd[previous];
index 3352cd1a55527a44e0aca51917035db62c5d32ca..75b7c1d17aa3c084e3ed08ab2de662a96eba0948 100644 (file)
@@ -1,6 +1,6 @@
 /* Charset handling for GNU tar.
 
-   Copyright (C) 2004 Free Software Foundation, Inc.
+   Copyright (C) 2004, 2006 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
@@ -28,7 +28,7 @@
 # define ICONV_CONST
 #endif
 
-#ifndef HAVE_ICONV 
+#ifndef HAVE_ICONV
 
 # undef iconv_open
 # define iconv_open(tocode, fromcode) ((iconv_t) -1)
@@ -39,7 +39,7 @@
 # undef iconv_close
 # define iconv_close(cd) 0
 
-#endif 
+#endif
 
 
 \f
@@ -88,11 +88,10 @@ utf8_convert (bool to_utf, char const *input, char **output)
 \f
 
 bool
-string_ascii_p (const char *str)
+string_ascii_p (char const *p)
 {
-  const unsigned char *p = (const unsigned char *)str;
   for (; *p; p++)
-    if (*p > 127)
+    if (! (0 <= *p && *p <= 127))
       return false;
   return true;
 }
index 70d287c05c58f264807f6f0216ff16a7e8ec553e..11b725e06622c082a0255a2fbf5c8cd3419c39cd 100644 (file)
@@ -225,7 +225,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 *
@@ -331,7 +331,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 +508,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;
@@ -954,7 +954,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,8 +1094,8 @@ static void
 mtime_coder (struct tar_stat_info const *st, char const *keyword,
             struct xheader *xhdr, void const *data)
 {
-  const struct timespec mtime = data ? *(struct timespec *) data : st->mtime;
-  code_time (mtime, keyword, xhdr);
+  struct timespec const *mtime = data;
+  code_time (mtime ? *mtime : st->mtime, keyword, xhdr);
 }
 
 static void
@@ -1379,8 +1379,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
@@ -1398,8 +1398,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
@@ -1438,12 +1438,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
@@ -1456,7 +1456,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.036121 seconds and 4 git commands to generate.