From 3557f18a163da68d67e68c37b5fdee85f1481c97 Mon Sep 17 00:00:00 2001 From: obrien Date: Fri, 2 May 2003 00:03:10 +0000 Subject: Fix signed/unsigned mix comparisons involving sizeof. --- bin/pax/cpio.c | 12 ++++++------ bin/pax/options.c | 5 +++-- bin/pax/tar.c | 7 ++++--- 3 files changed, 13 insertions(+), 11 deletions(-) (limited to 'bin/pax') diff --git a/bin/pax/cpio.c b/bin/pax/cpio.c index 2cf93f2..a90ca40 100644 --- a/bin/pax/cpio.c +++ b/bin/pax/cpio.c @@ -188,7 +188,7 @@ rd_nm(ARCHD *arcn, int nsz) /* * do not even try bogus values */ - if ((nsz == 0) || (nsz > sizeof(arcn->name))) { + if ((nsz == 0) || (nsz > (int)sizeof(arcn->name))) { paxwarn(1, "Cpio file name length %d is out of range", nsz); return(-1); } @@ -266,7 +266,7 @@ rd_ln_nm(ARCHD *arcn) int cpio_id(char *blk, int size) { - if ((size < sizeof(HD_CPIO)) || + if ((size < (int)sizeof(HD_CPIO)) || (strncmp(blk, AMAGIC, sizeof(AMAGIC) - 1) != 0)) return(-1); return(0); @@ -522,7 +522,7 @@ cpio_wr(ARCHD *arcn) int vcpio_id(char *blk, int size) { - if ((size < sizeof(HD_VCPIO)) || + if ((size < (int)sizeof(HD_VCPIO)) || (strncmp(blk, AVMAGIC, sizeof(AVMAGIC) - 1) != 0)) return(-1); return(0); @@ -539,8 +539,8 @@ vcpio_id(char *blk, int size) int crc_id(char *blk, int size) { - if ((size < sizeof(HD_VCPIO)) || - (strncmp(blk, AVCMAGIC, sizeof(AVCMAGIC) - 1) != 0)) + if ((size < (int)sizeof(HD_VCPIO)) || + (strncmp(blk, AVCMAGIC, (int)sizeof(AVCMAGIC) - 1) != 0)) return(-1); return(0); } @@ -860,7 +860,7 @@ vcpio_wr(ARCHD *arcn) int bcpio_id(char *blk, int size) { - if (size < sizeof(HD_BCPIO)) + if (size < (int)sizeof(HD_BCPIO)) return(-1); /* diff --git a/bin/pax/options.c b/bin/pax/options.c index 3dc01de..fb5c546 100644 --- a/bin/pax/options.c +++ b/bin/pax/options.c @@ -188,7 +188,7 @@ static void pax_options(int argc, char **argv) { int c; - int i; + size_t i; unsigned int flg = 0; unsigned int bflg = 0; char *pt; @@ -1017,7 +1017,8 @@ mkpath(path) static void cpio_options(int argc, char **argv) { - int c, i; + int c; + size_t i; char *str; FSUB tmp; FILE *fp; diff --git a/bin/pax/tar.c b/bin/pax/tar.c index 0fd497a..5c3eb5a 100644 --- a/bin/pax/tar.c +++ b/bin/pax/tar.c @@ -537,7 +537,7 @@ tar_wr(ARCHD *arcn) case PAX_SLK: case PAX_HLK: case PAX_HRG: - if (arcn->ln_nlen > sizeof(hd->linkname)) { + if (arcn->ln_nlen > (int)sizeof(hd->linkname)) { paxwarn(1,"Link name too long for tar %s", arcn->ln_name); return(1); } @@ -554,7 +554,7 @@ tar_wr(ARCHD *arcn) len = arcn->nlen; if (arcn->type == PAX_DIR) ++len; - if (len >= sizeof(hd->name)) { + if (len >= (int)sizeof(hd->name)) { paxwarn(1, "File name too long for tar %s", arcn->name); return(1); } @@ -903,7 +903,8 @@ ustar_wr(ARCHD *arcn) * check the length of the linkname */ if (((arcn->type == PAX_SLK) || (arcn->type == PAX_HLK) || - (arcn->type == PAX_HRG)) && (arcn->ln_nlen >= sizeof(hd->linkname))){ + (arcn->type == PAX_HRG)) && + (arcn->ln_nlen >= (int)sizeof(hd->linkname))) { paxwarn(1, "Link name too long for ustar %s", arcn->ln_name); return(1); } -- cgit v1.1