diff options
author | Robin H. Johnson <robbat2@gentoo.org> | 2012-08-13 22:23:35 +0000 |
---|---|---|
committer | Robin H. Johnson <robbat2@gentoo.org> | 2012-08-13 22:23:35 +0000 |
commit | 2f4144495ecc7607e8f9e4ad664fcf30c52f5ef1 (patch) | |
tree | 9208e0bb15f2cae9d4bfbd13b2a8f6e749da07e0 | |
parent | Fix qlist test cases for showdebug support. (diff) | |
download | portage-utils-2f4144495ecc7607e8f9e4ad664fcf30c52f5ef1.tar.gz portage-utils-2f4144495ecc7607e8f9e4ad664fcf30c52f5ef1.tar.bz2 portage-utils-2f4144495ecc7607e8f9e4ad664fcf30c52f5ef1.zip |
Fix compiler warnings for signedness.v0.11
-rw-r--r-- | libq/colors.c | 4 | ||||
-rw-r--r-- | libq/prelink.c | 4 | ||||
-rw-r--r-- | main.c | 23 | ||||
-rw-r--r-- | qcache.c | 35 | ||||
-rw-r--r-- | qfile.c | 8 | ||||
-rw-r--r-- | qgrep.c | 6 | ||||
-rw-r--r-- | qlist.c | 6 | ||||
-rw-r--r-- | qmerge.c | 6 | ||||
-rw-r--r-- | quse.c | 10 | ||||
-rw-r--r-- | qxpak.c | 8 |
10 files changed, 55 insertions, 55 deletions
diff --git a/libq/colors.c b/libq/colors.c index bb315b0f..bd2c1e0a 100644 --- a/libq/colors.c +++ b/libq/colors.c @@ -49,11 +49,11 @@ void color_remap(void); void color_remap(void) { FILE *fp; - int i; + unsigned int i; size_t buflen; char *buf; char *p; - int lineno = 0; + unsigned int lineno = 0; if ((fp = fopen(COLOR_MAP, "r")) == NULL) return; diff --git a/libq/prelink.c b/libq/prelink.c index 6608fb56..eebabefe 100644 --- a/libq/prelink.c +++ b/libq/prelink.c @@ -1,7 +1,7 @@ /* * Copyright 2011 Gentoo Foundation * Distributed under the terms of the GNU General Public License v2 - * $Header: /var/cvsroot/gentoo-projects/portage-utils/libq/prelink.c,v 1.3 2011/12/09 16:52:15 vapier Exp $ + * $Header: /var/cvsroot/gentoo-projects/portage-utils/libq/prelink.c,v 1.4 2012/08/13 22:23:35 robbat2 Exp $ */ #include <signal.h> @@ -75,7 +75,7 @@ static bool is_prelink_elf(int fd, const char *filename) } if (lseek(fd, 0, SEEK_SET) != 0) errp("unable to reset after ELF check %s\n", filename); - if (len < sizeof(header)) + if (len < (ssize_t)sizeof(header)) return false; if (memcmp(header, ELFMAG, SELFMAG)) @@ -1,7 +1,7 @@ /* * Copyright 2005-2008 Gentoo Foundation * Distributed under the terms of the GNU General Public License v2 - * $Header: /var/cvsroot/gentoo-projects/portage-utils/main.c,v 1.219 2012/08/13 21:16:57 robbat2 Exp $ + * $Header: /var/cvsroot/gentoo-projects/portage-utils/main.c,v 1.220 2012/08/13 22:23:35 robbat2 Exp $ * * Copyright 2005-2008 Ned Ludd - <solar@gentoo.org> * Copyright 2005-2008 Mike Frysinger - <vapier@gentoo.org> @@ -902,10 +902,10 @@ const char *initialize_flat(int cache_type) } if (cache_type == CACHE_METADATA) { - if(chdir(portcachedir_md5) == 0) { + if (chdir(portcachedir_md5) == 0) { portcachedir_type = CACHE_METADATA_MD5; portcachedir_actual = portcachedir_md5; - } else if(chdir(portcachedir_pms) == 0) { + } else if (chdir(portcachedir_pms) == 0) { portcachedir_type = CACHE_METADATA_PMS; portcachedir_actual = portcachedir_pms; } else { @@ -1064,10 +1064,12 @@ portage_cache *cache_read_file(const char *file); portage_cache *cache_read_file(const char *file) { - if(portcachedir_type == CACHE_METADATA_MD5) + if (portcachedir_type == CACHE_METADATA_MD5) return(cache_read_file_md5(file)); - else if(portcachedir_type == CACHE_METADATA_PMS) + else if (portcachedir_type == CACHE_METADATA_PMS) return(cache_read_file_pms(file)); + warn("Unknown metadata cache type!"); + return NULL; } portage_cache *cache_read_file_pms(const char *file) @@ -1131,7 +1133,6 @@ portage_cache *cache_read_file_md5(const char *file) { struct stat s; char *ptr, *endptr; - //const char *cmpkey; FILE *f; portage_cache *ret = NULL; size_t len; @@ -1149,7 +1150,7 @@ portage_cache *cache_read_file_md5(const char *file) goto err; ret->atom = atom_explode(file); - + /* We have a block of key=value\n data. * KEY=VALUE\n * Where KEY does NOT contain: @@ -1167,24 +1168,24 @@ portage_cache *cache_read_file_md5(const char *file) ptr = ret->_data; endptr = strchr(ptr, '\0'); - if(endptr == NULL) { + if (endptr == NULL) { warn("Invalid cache file '%s' - could not find end of cache data", file); goto err; } - while(ptr != NULL && ptr != endptr) { + while (ptr != NULL && ptr != endptr) { char *keyptr; char *valptr; keyptr = ptr; valptr = strchr(ptr, '='); - if(valptr == NULL) { + if (valptr == NULL) { warn("Invalid cache file '%s' val", file); goto err; } *valptr = '\0'; valptr++; ptr = strchr(valptr, '\n'); - if(ptr == NULL) { + if (ptr == NULL) { warn("Invalid cache file '%s' key", file); goto err; } @@ -1,7 +1,7 @@ /* * Copyright 2005-2010 Gentoo Foundation * Distributed under the terms of the GNU General Public License v2 - * $Header: /var/cvsroot/gentoo-projects/portage-utils/qcache.c,v 1.39 2011/02/21 07:33:21 vapier Exp $ + * $Header: /var/cvsroot/gentoo-projects/portage-utils/qcache.c,v 1.40 2012/08/13 22:23:35 robbat2 Exp $ * * Copyright 2006 Thomas A. Cort - <tcort@gentoo.org> */ @@ -47,7 +47,7 @@ static const char * const qcache_opts_help[] = { COMMON_OPTS_HELP }; -static const char qcache_rcsid[] = "$Id: qcache.c,v 1.39 2011/02/21 07:33:21 vapier Exp $"; +static const char qcache_rcsid[] = "$Id: qcache.c,v 1.40 2012/08/13 22:23:35 robbat2 Exp $"; #define qcache_usage(ret) usage(ret, QCACHE_FLAGS, qcache_long_opts, qcache_opts_help, lookup_applet_idx("qcache")) /********************************************************************/ @@ -75,7 +75,7 @@ typedef struct { /********************************************************************/ static char **archlist; /* Read from PORTDIR/profiles/arch.list in qcache_init() */ -static unsigned int archlist_count; +static int archlist_count; const char status[3] = {'-', '~', '+'}; int qcache_skip, qcache_test_arch, qcache_last = 0; char *qcache_matchpkg = NULL, *qcache_matchcat = NULL; @@ -120,10 +120,10 @@ int decode_status(char c) * OUT: * int pos - location of arch in archlist[] */ -unsigned int decode_arch(const char *arch); -unsigned int decode_arch(const char *arch) +int decode_arch(const char *arch); +int decode_arch(const char *arch) { - unsigned int a; + int a; const char *p; p = arch; @@ -149,7 +149,7 @@ unsigned int decode_arch(const char *arch) void print_keywords(char *category, char *ebuild, int *keywords); void print_keywords(char *category, char *ebuild, int *keywords) { - unsigned int a; + int a; char *package; package = xstrdup(ebuild); @@ -189,7 +189,7 @@ int read_keywords(char *s, int *keywords) { char *arch, delim[2] = { ' ', '\0' }; size_t slen; - unsigned int a; + int a; if (!s) return -1; @@ -233,7 +233,7 @@ int read_keywords(char *s, int *keywords) */ static unsigned int qcache_count_lines(char *filename) { - unsigned int count, fd; + int count, fd; char c; if ((fd = open(filename, O_RDONLY)) != -1) { @@ -265,7 +265,7 @@ static unsigned int qcache_count_lines(char *filename) char **qcache_read_lines(char *filename); char **qcache_read_lines(char *filename) { - unsigned int len, fd, count, i, num_lines; + int len, fd, count, i, num_lines; char **lines, c; if (-1 == (num_lines = qcache_count_lines(filename))) @@ -626,7 +626,7 @@ void qcache_imlate(qcache_data *data); void qcache_imlate(qcache_data *data) { int *keywords; - unsigned int a; + int a; keywords = xmalloc(sizeof(*keywords) * archlist_count); @@ -742,15 +742,14 @@ void qcache_stats(qcache_data *data); void qcache_stats(qcache_data *data) { static time_t runtime; - static unsigned int numpkg = 0; - static unsigned int numebld = 0; - static unsigned int numcat; - static unsigned int *packages_stable; - static unsigned int *packages_testing; + static int numpkg = 0; + static int numebld = 0; + static int numcat; + static int *packages_stable; + static int *packages_testing; static int *current_package_keywords; static int *keywords; - int i; - unsigned int a; + int a, i; if (!numpkg) { struct dirent **categories; @@ -1,7 +1,7 @@ /* * Copyright 2005-2010 Gentoo Foundation * Distributed under the terms of the GNU General Public License v2 - * $Header: /var/cvsroot/gentoo-projects/portage-utils/qfile.c,v 1.60 2012/01/16 01:12:31 vapier Exp $ + * $Header: /var/cvsroot/gentoo-projects/portage-utils/qfile.c,v 1.61 2012/08/13 22:23:35 robbat2 Exp $ * * Copyright 2005-2010 Ned Ludd - <solar@gentoo.org> * Copyright 2005-2010 Mike Frysinger - <vapier@gentoo.org> @@ -34,12 +34,12 @@ static const char * const qfile_opts_help[] = { "Display installed packages with slots", COMMON_OPTS_HELP }; -static const char qfile_rcsid[] = "$Id: qfile.c,v 1.60 2012/01/16 01:12:31 vapier Exp $"; +static const char qfile_rcsid[] = "$Id: qfile.c,v 1.61 2012/08/13 22:23:35 robbat2 Exp $"; #define qfile_usage(ret) usage(ret, QFILE_FLAGS, qfile_long_opts, qfile_opts_help, lookup_applet_idx("qfile")) #define qfile_is_prefix(path, prefix, prefix_length) \ (!prefix_length \ - || (strlen(path) >= prefix_length \ + || (strlen(path) >= (size_t)prefix_length \ && (path[prefix_length] == '/' || path[prefix_length] == '\0') \ && !strncmp(path, prefix, prefix_length))) @@ -97,7 +97,7 @@ void qfile(char *path, const char *root, qfile_args_t *args) /* We reuse pkg for reading files in the subdir */ base = basename(path); i = snprintf(pkg, sizeof(pkg), "%s/%s", base, dentry->d_name); - if (i + 20 >= sizeof(pkg)) { + if (i + 20 >= (ssize_t)sizeof(pkg)) { warn("skipping long pkg name: %s/%s", base, dentry->d_name); continue; } @@ -1,7 +1,7 @@ /* * Copyright 2005-2010 Gentoo Foundation * Distributed under the terms of the GNU General Public License v2 - * $Header: /var/cvsroot/gentoo-projects/portage-utils/qgrep.c,v 1.30 2011/10/03 01:25:54 vapier Exp $ + * $Header: /var/cvsroot/gentoo-projects/portage-utils/qgrep.c,v 1.31 2012/08/13 22:23:35 robbat2 Exp $ * * Copyright 2005-2010 Ned Ludd - <solar@gentoo.org> * Copyright 2005-2010 Mike Frysinger - <vapier@gentoo.org> @@ -47,7 +47,7 @@ static const char * const qgrep_opts_help[] = { "Print <arg> lines of trailing context", COMMON_OPTS_HELP }; -static const char qgrep_rcsid[] = "$Id: qgrep.c,v 1.30 2011/10/03 01:25:54 vapier Exp $"; +static const char qgrep_rcsid[] = "$Id: qgrep.c,v 1.31 2012/08/13 22:23:35 robbat2 Exp $"; #define qgrep_usage(ret) usage(ret, QGREP_FLAGS, qgrep_long_opts, qgrep_opts_help, lookup_applet_idx("qgrep")) char qgrep_name_match(const char*, const int, depend_atom**); @@ -444,7 +444,7 @@ int qgrep_main(int argc, char **argv) continue; if ((newfp = fopen(ebuild, "r")) != NULL) { - unsigned int lineno = 0; + int lineno = 0; char remaining_after_context = 0; count = 0; /* if there have been some matches already, then a separator will be needed */ @@ -1,7 +1,7 @@ /* * Copyright 2005-2010 Gentoo Foundation * Distributed under the terms of the GNU General Public License v2 - * $Header: /var/cvsroot/gentoo-projects/portage-utils/qlist.c,v 1.69 2012/08/04 20:07:26 vapier Exp $ + * $Header: /var/cvsroot/gentoo-projects/portage-utils/qlist.c,v 1.70 2012/08/13 22:23:35 robbat2 Exp $ * * Copyright 2005-2010 Ned Ludd - <solar@gentoo.org> * Copyright 2005-2010 Mike Frysinger - <vapier@gentoo.org> @@ -43,7 +43,7 @@ static const char * const qlist_opts_help[] = { /* "query filename for pkgname", */ COMMON_OPTS_HELP }; -static const char qlist_rcsid[] = "$Id: qlist.c,v 1.69 2012/08/04 20:07:26 vapier Exp $"; +static const char qlist_rcsid[] = "$Id: qlist.c,v 1.70 2012/08/13 22:23:35 robbat2 Exp $"; #define qlist_usage(ret) usage(ret, QLIST_FLAGS, qlist_long_opts, qlist_opts_help, lookup_applet_idx("qlist")) queue *filter_dups(queue *sets); @@ -95,7 +95,7 @@ static char *grab_pkg_umap(const char *CAT, const char *PV) /* grab_vdb is a static function so save it to memory right away */ makeargv(use, &use_argc, &use_argv); if ((iuse = grab_vdb_item("IUSE", CAT, PV)) != NULL) { - for (i = 0; i < strlen(iuse); i++) + for (i = 0; i < (int)strlen(iuse); i++) if (iuse[i] == '+') iuse[i] = ' '; makeargv(iuse, &iuse_argc, &iuse_argv); for (u = 1; u < use_argc; u++) { @@ -1,7 +1,7 @@ /* * Copyright 2005-2010 Gentoo Foundation * Distributed under the terms of the GNU General Public License v2 - * $Header: /var/cvsroot/gentoo-projects/portage-utils/qmerge.c,v 1.115 2011/12/19 04:58:09 vapier Exp $ + * $Header: /var/cvsroot/gentoo-projects/portage-utils/qmerge.c,v 1.116 2012/08/13 22:23:35 robbat2 Exp $ * * Copyright 2005-2010 Ned Ludd - <solar@gentoo.org> * Copyright 2005-2010 Mike Frysinger - <vapier@gentoo.org> @@ -65,7 +65,7 @@ static const char * const qmerge_opts_help[] = { COMMON_OPTS_HELP }; -static const char qmerge_rcsid[] = "$Id: qmerge.c,v 1.115 2011/12/19 04:58:09 vapier Exp $"; +static const char qmerge_rcsid[] = "$Id: qmerge.c,v 1.116 2012/08/13 22:23:35 robbat2 Exp $"; #define qmerge_usage(ret) usage(ret, QMERGE_FLAGS, qmerge_long_opts, qmerge_opts_help, lookup_applet_idx("qmerge")) char search_pkgs = 0; @@ -298,7 +298,7 @@ void install_mask_pwd(int iargc, char **iargv, const struct stat st) globbuf.gl_offs = 0; if (glob(buf, GLOB_DOOFFS|GLOB_BRACE, NULL, &globbuf) == 0) { - for (g = 0; g < globbuf.gl_pathc; g++) { + for (g = 0; g < (int)globbuf.gl_pathc; g++) { strncpy(buf, globbuf.gl_pathv[g], sizeof(buf)); /* qprintf("globbed: %s\n", globbuf.gl_pathv[g]); */ crossmount_rm(globbuf.gl_pathv[g], st); @@ -1,7 +1,7 @@ /* * Copyright 2005-2010 Gentoo Foundation * Distributed under the terms of the GNU General Public License v2 - * $Header: /var/cvsroot/gentoo-projects/portage-utils/quse.c,v 1.64 2011/02/21 07:33:21 vapier Exp $ + * $Header: /var/cvsroot/gentoo-projects/portage-utils/quse.c,v 1.65 2012/08/13 22:23:35 robbat2 Exp $ * * Copyright 2005-2010 Ned Ludd - <solar@gentoo.org> * Copyright 2005-2010 Mike Frysinger - <vapier@gentoo.org> @@ -35,10 +35,10 @@ static const char * const quse_opts_help[] = { "Only show package name", COMMON_OPTS_HELP }; -static const char quse_rcsid[] = "$Id: quse.c,v 1.64 2011/02/21 07:33:21 vapier Exp $"; +static const char quse_rcsid[] = "$Id: quse.c,v 1.65 2012/08/13 22:23:35 robbat2 Exp $"; #define quse_usage(ret) usage(ret, QUSE_FLAGS, quse_long_opts, quse_opts_help, lookup_applet_idx("quse")) -int quse_describe_flag(int ind, int argc, char **argv); +int quse_describe_flag(unsigned int ind, unsigned int argc, char **argv); char quse_name_only = 0; @@ -81,12 +81,12 @@ static void print_highlighted_use_flags(char *string, int ind, int argc, char ** } } -int quse_describe_flag(int ind, int argc, char **argv) +int quse_describe_flag(unsigned int ind, unsigned int argc, char **argv) { #define NUM_SEARCH_FILES ARRAY_SIZE(search_files) size_t buflen; char *buf, *p; - int i, f; + unsigned int i, f; size_t s; const char *search_files[] = { "use.desc", "use.local.desc", "arch.list", "lang.desc" }; FILE *fp[NUM_SEARCH_FILES]; @@ -1,7 +1,7 @@ /* * Copyright 2005-2010 Gentoo Foundation * Distributed under the terms of the GNU General Public License v2 - * $Header: /var/cvsroot/gentoo-projects/portage-utils/qxpak.c,v 1.24 2011/12/19 04:28:35 vapier Exp $ + * $Header: /var/cvsroot/gentoo-projects/portage-utils/qxpak.c,v 1.25 2012/08/13 22:23:35 robbat2 Exp $ * * Copyright 2005-2010 Ned Ludd - <solar@gentoo.org> * Copyright 2005-2010 Mike Frysinger - <vapier@gentoo.org> @@ -46,7 +46,7 @@ static const char * const qxpak_opts_help[] = { "Write files to stdout", COMMON_OPTS_HELP }; -static const char qxpak_rcsid[] = "$Id: qxpak.c,v 1.24 2011/12/19 04:28:35 vapier Exp $"; +static const char qxpak_rcsid[] = "$Id: qxpak.c,v 1.25 2012/08/13 22:23:35 robbat2 Exp $"; #define qxpak_usage(ret) usage(ret, QXPAK_FLAGS, qxpak_long_opts, qxpak_opts_help, lookup_applet_idx("qxpak")) typedef struct { @@ -214,13 +214,13 @@ xpak_extract(int dir_fd, const char *file, int argc, char **argv) assert((size_t)x->index_len < sizeof(buf)); in = fread(x->index, 1, x->index_len, x->fp); - if (in != x->index_len) + if ((int)in != x->index_len) err("index chunk: read %i bytes, wanted %i bytes", (int)in, x->index_len); /* the xpak may be large (like when it has CONTENTS) #300744 */ x->data = (size_t)x->data_len < sizeof(ext) ? ext : xmalloc(x->data_len); in = fread(x->data, 1, x->data_len, x->fp); - if (in != x->data_len) + if ((int)in != x->data_len) err("data chunk: read %i bytes, wanted %i bytes", (int)in, x->data_len); _xpak_walk_index(x, argc, argv, &_xpak_extract_callback); |