From dc83dd642209319bfd093e37a0e470e3b56eee5a Mon Sep 17 00:00:00 2001 From: Robert Millan Date: Sun, 8 Nov 2009 22:54:27 +0000 Subject: [PATCH] Fix build warnings (without -Wall). --- util/mkisofs/eltorito.c | 2 +- util/mkisofs/getopt.c | 8 +++++--- util/mkisofs/joliet.c | 2 +- util/mkisofs/match.c | 4 ++-- util/mkisofs/mkisofs.c | 9 +++++---- util/mkisofs/mkisofs.h | 2 +- util/mkisofs/rock.c | 8 +++++--- util/mkisofs/tree.c | 8 ++++---- util/mkisofs/write.c | 8 +++++--- 9 files changed, 29 insertions(+), 22 deletions(-) diff --git a/util/mkisofs/eltorito.c b/util/mkisofs/eltorito.c index b577c731d..e003f2b67 100644 --- a/util/mkisofs/eltorito.c +++ b/util/mkisofs/eltorito.c @@ -123,7 +123,7 @@ void FDECL1(get_torito_desc, struct eltorito_boot_descriptor *, boot_desc) unsigned char * checksum_ptr; struct directory_entry * de; struct directory_entry * de2; - int i; + unsigned int i; int nsectors; memset(boot_desc, 0, sizeof(*boot_desc)); diff --git a/util/mkisofs/getopt.c b/util/mkisofs/getopt.c index 79080aa54..14d52b341 100644 --- a/util/mkisofs/getopt.c +++ b/util/mkisofs/getopt.c @@ -3,13 +3,13 @@ "Keep this file name-space clean" means, talk to roland@gnu.ai.mit.edu before changing it! - Copyright (C) 1987, 88, 89, 90, 91, 92, 93, 94, 95 + Copyright (C) 1987, 88, 89, 90, 91, 92, 93, 94, 95, 2009 Free Software Foundation, Inc. This file is part of the libiberty library. This library is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the -Free Software Foundation; either version 2, or (at your option) +Free Software Foundation; either version 3, or (at your option) any later version. This library is distributed in the hope that it will be useful, @@ -53,6 +53,7 @@ the executable file might be covered by the GNU General Public License. */ #endif #include +#include /* Comment out all this code if we are using the GNU C Library, and are not actually compiling the library itself. This code is part of the GNU C @@ -498,7 +499,8 @@ _getopt_internal (argc, argv, optstring, longopts, longind, long_only) for (p = longopts, option_index = 0; p->name; p++, option_index++) if (!strncmp (p->name, nextchar, nameend - nextchar)) { - if (nameend - nextchar == strlen (p->name)) + assert (nameend > nextchar); + if (nameend == strlen (p->name) + nextchar) { /* Exact match found. */ pfound = p; diff --git a/util/mkisofs/joliet.c b/util/mkisofs/joliet.c index 0aa866854..d1cd25bf4 100644 --- a/util/mkisofs/joliet.c +++ b/util/mkisofs/joliet.c @@ -77,7 +77,7 @@ static char rcsid[] ="$Id: joliet.c,v 1.14 1999/03/07 17:41:19 eric Exp $"; #include #include -static int jpath_table_index; +static unsigned int jpath_table_index; static struct directory ** jpathlist; static int next_jpath_index = 1; static int sort_goof; diff --git a/util/mkisofs/match.c b/util/mkisofs/match.c index e01314b0b..8590be470 100644 --- a/util/mkisofs/match.c +++ b/util/mkisofs/match.c @@ -98,7 +98,7 @@ char * fn; int i_ishidden() { - return((int)i_mat[0]); + return (i_mat[0] != NULL); } /* Joliet hide */ @@ -142,6 +142,6 @@ char * fn; int j_ishidden() { - return((int)j_mat[0]); + return (j_mat[0] != NULL); } diff --git a/util/mkisofs/mkisofs.c b/util/mkisofs/mkisofs.c index 0eb9d95fb..2b11dc6ec 100644 --- a/util/mkisofs/mkisofs.c +++ b/util/mkisofs/mkisofs.c @@ -115,7 +115,7 @@ int volume_sequence_number = 1; int omit_period = 0; /* Violates iso9660, but these are a pain */ int transparent_compression = 0; /* So far only works with linux */ int omit_version_number = 0; /* May violate iso9660, but noone uses vers*/ -int RR_relocation_depth = 6; /* Violates iso9660, but most systems work */ +unsigned int RR_relocation_depth = 6; /* Violates iso9660, but most systems work */ int full_iso9660_filenames = 0; /* Used with Amiga. Disc will not work with DOS */ int allow_leading_dots = 0; /* DOS cannot read names with leading dots */ @@ -461,7 +461,7 @@ void usage(){ [-x path -x path ...] path\n"); #endif - int i; + unsigned int i; /* const char **targets, **pp;*/ fprintf (stderr, "Usage: %s [options] file...\n", program_name); @@ -473,7 +473,7 @@ void usage(){ { int comma; int len; - int j; + unsigned int j; fprintf (stderr, " "); @@ -641,7 +641,8 @@ int FDECL2(main, int, argc, char **, argv){ the ordering of the two. We describe each non-option ARGV-element as if it were the argument of an option with character code 1. */ { - int i, is, il; + unsigned int i; + int is, il; shortopts[0] = '-'; is = 1; il = 0; diff --git a/util/mkisofs/mkisofs.h b/util/mkisofs/mkisofs.h index db297eec6..ffabb96f9 100644 --- a/util/mkisofs/mkisofs.h +++ b/util/mkisofs/mkisofs.h @@ -277,7 +277,7 @@ extern int split_output; extern int omit_period; extern int omit_version_number; extern int transparent_compression; -extern int RR_relocation_depth; +extern unsigned int RR_relocation_depth; extern int full_iso9660_filenames; extern int split_SL_component; extern int split_SL_field; diff --git a/util/mkisofs/rock.c b/util/mkisofs/rock.c index 45fbd51f3..fa1557658 100644 --- a/util/mkisofs/rock.c +++ b/util/mkisofs/rock.c @@ -5,9 +5,11 @@ Copyright 1993 Yggdrasil Computing, Incorporated + Copyright (C) 2009 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 Free Software Foundation; either version 2, or (at your option) + the Free Software Foundation; either version 3, or (at your option) any later version. This program is distributed in the hope that it will be useful, @@ -16,7 +18,7 @@ GNU General Public License for more details. You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software + along with this program; if not, see . Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ static char rcsid[] ="$Id: rock.c,v 1.8 1999/03/02 03:41:26 eric Exp $"; @@ -86,7 +88,7 @@ static char rcsid[] ="$Id: rock.c,v 1.8 1999/03/02 03:41:26 eric Exp $"; a CE entry for the continuation record */ #define MAYBE_ADD_CE_ENTRY(BYTES) \ - (BYTES + CE_SIZE + currlen + (ipnt - recstart) > reclimit ? 1 : 0) + ((unsigned) ((BYTES) + CE_SIZE + currlen + ipnt) > (unsigned) (recstart + reclimit) ? 1 : 0) /* * Buffer to build RR attributes diff --git a/util/mkisofs/tree.c b/util/mkisofs/tree.c index 59d76d9a6..9d5418965 100644 --- a/util/mkisofs/tree.c +++ b/util/mkisofs/tree.c @@ -107,9 +107,9 @@ static void DECL(delete_directory, (struct directory * parent, struct directory extern int verbose; -struct stat fstatbuf = {0,}; /* We use this for the artificial entries we create */ +struct stat fstatbuf; /* We use this for the artificial entries we create */ -struct stat root_statbuf = {0, }; /* Stat buffer for root directory */ +struct stat root_statbuf; /* Stat buffer for root directory */ struct directory * reloc_dir = NULL; @@ -1269,7 +1269,7 @@ FDECL3(insert_file_entry,struct directory *, this_dir, } if (strcmp(short_name,".") && strcmp(short_name,"..") && - S_ISDIR(statbuf.st_mode) && this_dir->depth > RR_relocation_depth) + S_ISDIR(statbuf.st_mode) && this_dir->depth > RR_relocation_depth) { struct directory * child; @@ -1612,7 +1612,7 @@ struct directory * FDECL4(find_or_create_directory, struct directory *, parent, #ifdef DEBUG fprintf(stderr,"%s(%d) ", path, dpnt->depth); #endif - if(parent->depth > RR_relocation_depth) + if(parent->depth > RR_relocation_depth) { fprintf(stderr,"Directories too deep %s\n", path); exit(1); diff --git a/util/mkisofs/write.c b/util/mkisofs/write.c index bb70cc752..8d46d89c6 100644 --- a/util/mkisofs/write.c +++ b/util/mkisofs/write.c @@ -34,6 +34,7 @@ static char rcsid[] ="$Id: write.c,v 1.21 1999/03/07 17:41:19 eric Exp $"; #include #include #include +#include #ifdef HAVE_UNISTD_H #include @@ -178,7 +179,7 @@ struct deferred_write static struct deferred_write * dw_head = NULL, * dw_tail = NULL; unsigned int last_extent_written =0; -static int path_table_index; +static unsigned int path_table_index; static time_t begun; /* We recursively walk through all of the directories and assign extent @@ -239,7 +240,7 @@ static void FDECL3(write_one_file, char *, filename, char buffer[SECTOR_SIZE * NSECT]; FILE * infile; int remain; - int use; + unsigned int use; if ((infile = fopen(filename, "rb")) == NULL) @@ -1163,7 +1164,8 @@ static int FDECL1(file_write, FILE *, outfile) /* * Hard links throw us off here */ - if(should_write != last_extent - session_start) + assert (last_extent > session_start); + if(should_write + session_start != last_extent) { fprintf(stderr,"Number of extents written not what was predicted. Please fix.\n"); fprintf(stderr,"Predicted = %d, written = %d\n", should_write, last_extent);