From 934238cd25950ff5aa4a80b3e04e3d4e124003d4 Mon Sep 17 00:00:00 2001 From: Randy Dunlap Date: Mon, 15 Oct 2007 17:38:57 -0700 Subject: [PATCH] sfdisk: cleanup 83 gcc warnings Fix strict gcc warnings that come from using: ("-Wall -Wp,-D_FORTIFY_SOURCE=2") 83 warnings fixed: sfdisk.c:249: warning: pointer targets in initialization differ in signedness sfdisk.c:376: warning: pointer targets in passing argument 1 of 'chars_to_ulong' differ in signedness sfdisk.c:702: warning: pointer targets in passing argument 1 of 'copy_to_int' differ in signedness sfdisk.c:703: warning: pointer targets in passing argument 1 of 'copy_to_int' differ in signedness sfdisk.c:1709: warning: pointer targets in passing argument 1 of 'fgets' differ in signedness sfdisk.c:1709: warning: pointer targets in assignment differ in signedness sfdisk.c:1714: warning: pointer targets in passing argument 1 of 'index' differ in signedness sfdisk.c:1714: warning: pointer targets in assignment differ in signedness sfdisk.c:1719: warning: pointer targets in passing argument 1 of 'index' differ in signedness sfdisk.c:1719: warning: pointer targets in assignment differ in signedness sfdisk.c:1723: warning: pointer targets in passing argument 1 of 'strlen' differ in signedness sfdisk.c:1723: warning: pointer targets in passing argument 1 of '__builtin_strcmp' differ in signedness sfdisk.c:1723: warning: pointer targets in passing argument 1 of 'strlen' differ in signedness sfdisk.c:1723: warning: pointer targets in passing argument 1 of '__builtin_strcmp' differ in signedness sfdisk.c:1723: warning: pointer targets in passing argument 1 of '__builtin_strcmp' differ in signedness sfdisk.c:1723: warning: pointer targets in passing argument 1 of '__builtin_strcmp' differ in signedness sfdisk.c:1729: warning: pointer targets in passing argument 1 of 'index' differ in signedness sfdisk.c:1729: warning: pointer targets in assignment differ in signedness sfdisk.c:1739: warning: pointer targets in passing argument 1 of 'strlen' differ in signedness sfdisk.c:1739: warning: pointer targets in passing argument 1 of 'strlen' differ in signedness sfdisk.c:1739: warning: pointer targets in passing argument 1 of '__builtin_strcmp' differ in signedness sfdisk.c:1739: warning: pointer targets in passing argument 1 of 'strlen' differ in signedness sfdisk.c:1739: warning: pointer targets in passing argument 1 of '__builtin_strcmp' differ in signedness sfdisk.c:1739: warning: pointer targets in passing argument 1 of '__builtin_strcmp' differ in signedness sfdisk.c:1739: warning: pointer targets in passing argument 1 of '__builtin_strcmp' differ in signedness sfdisk.c:1739: warning: pointer targets in passing argument 1 of 'strncmp' differ in signedness sfdisk.c:2021: warning: pointer targets in passing argument 1 of 'strlen' differ in signedness sfdisk.c:2021: warning: pointer targets in passing argument 1 of '__builtin_strcmp' differ in signedness sfdisk.c:2021: warning: pointer targets in passing argument 1 of 'strlen' differ in signedness sfdisk.c:2021: warning: pointer targets in passing argument 1 of '__builtin_strcmp' differ in signedness sfdisk.c:2021: warning: pointer targets in passing argument 1 of '__builtin_strcmp' differ in signedness sfdisk.c:2021: warning: pointer targets in passing argument 1 of '__builtin_strcmp' differ in signedness sfdisk.c:2059: warning: pointer targets in passing argument 1 of 'strlen' differ in signedness sfdisk.c:2059: warning: pointer targets in passing argument 1 of '__builtin_strcmp' differ in signedness sfdisk.c:2059: warning: pointer targets in passing argument 1 of 'strlen' differ in signedness sfdisk.c:2059: warning: pointer targets in passing argument 1 of '__builtin_strcmp' differ in signedness sfdisk.c:2059: warning: pointer targets in passing argument 1 of '__builtin_strcmp' differ in signedness sfdisk.c:2059: warning: pointer targets in passing argument 1 of '__builtin_strcmp' differ in signedness sfdisk.c:2061: warning: pointer targets in passing argument 1 of 'strlen' differ in signedness sfdisk.c:2061: warning: pointer targets in passing argument 1 of '__builtin_strcmp' differ in signedness sfdisk.c:2061: warning: pointer targets in passing argument 1 of 'strlen' differ in signedness sfdisk.c:2061: warning: pointer targets in passing argument 1 of '__builtin_strcmp' differ in signedness sfdisk.c:2061: warning: pointer targets in passing argument 1 of '__builtin_strcmp' differ in signedness sfdisk.c:2061: warning: pointer targets in passing argument 1 of '__builtin_strcmp' differ in signedness sfdisk.c:2063: warning: pointer targets in passing argument 1 of 'strlen' differ in signedness sfdisk.c:2063: warning: pointer targets in passing argument 1 of '__builtin_strcmp' differ in signedness sfdisk.c:2063: warning: pointer targets in passing argument 1 of 'strlen' differ in signedness sfdisk.c:2063: warning: pointer targets in passing argument 1 of '__builtin_strcmp' differ in signedness sfdisk.c:2063: warning: pointer targets in passing argument 1 of '__builtin_strcmp' differ in signedness sfdisk.c:2063: warning: pointer targets in passing argument 1 of '__builtin_strcmp' differ in signedness sfdisk.c:2065: warning: pointer targets in passing argument 1 of 'strlen' differ in signedness sfdisk.c:2065: warning: pointer targets in passing argument 1 of '__builtin_strcmp' differ in signedness sfdisk.c:2065: warning: pointer targets in passing argument 1 of 'strlen' differ in signedness sfdisk.c:2065: warning: pointer targets in passing argument 1 of '__builtin_strcmp' differ in signedness sfdisk.c:2065: warning: pointer targets in passing argument 1 of '__builtin_strcmp' differ in signedness sfdisk.c:2065: warning: pointer targets in passing argument 1 of '__builtin_strcmp' differ in signedness sfdisk.c:2067: warning: pointer targets in passing argument 1 of 'get_ul' differ in signedness sfdisk.c:2083: warning: pointer targets in passing argument 1 of 'get_ul' differ in signedness sfdisk.c:2096: warning: pointer targets in passing argument 1 of 'get_ul' differ in signedness sfdisk.c:2130: warning: pointer targets in passing argument 1 of 'strlen' differ in signedness sfdisk.c:2130: warning: pointer targets in passing argument 1 of '__builtin_strcmp' differ in signedness sfdisk.c:2130: warning: pointer targets in passing argument 1 of 'strlen' differ in signedness sfdisk.c:2130: warning: pointer targets in passing argument 1 of '__builtin_strcmp' differ in signedness sfdisk.c:2130: warning: pointer targets in passing argument 1 of '__builtin_strcmp' differ in signedness sfdisk.c:2130: warning: pointer targets in passing argument 1 of '__builtin_strcmp' differ in signedness sfdisk.c:2132: warning: pointer targets in passing argument 1 of 'strlen' differ in signedness sfdisk.c:2132: warning: pointer targets in passing argument 1 of '__builtin_strcmp' differ in signedness sfdisk.c:2132: warning: pointer targets in passing argument 1 of 'strlen' differ in signedness sfdisk.c:2132: warning: pointer targets in passing argument 1 of '__builtin_strcmp' differ in signedness sfdisk.c:2132: warning: pointer targets in passing argument 1 of '__builtin_strcmp' differ in signedness sfdisk.c:2132: warning: pointer targets in passing argument 1 of '__builtin_strcmp' differ in signedness sfdisk.c:2132: warning: pointer targets in passing argument 1 of 'strlen' differ in signedness sfdisk.c:2132: warning: pointer targets in passing argument 1 of '__builtin_strcmp' differ in signedness sfdisk.c:2132: warning: pointer targets in passing argument 1 of 'strlen' differ in signedness sfdisk.c:2132: warning: pointer targets in passing argument 1 of '__builtin_strcmp' differ in signedness sfdisk.c:2132: warning: pointer targets in passing argument 1 of '__builtin_strcmp' differ in signedness sfdisk.c:2132: warning: pointer targets in passing argument 1 of '__builtin_strcmp' differ in signedness sfdisk.c:2154: warning: pointer targets in passing argument 1 of 'get_ul' differ in signedness sfdisk.c:2155: warning: pointer targets in passing argument 1 of 'get_ul' differ in signedness sfdisk.c:2156: warning: pointer targets in passing argument 1 of 'get_ul' differ in signedness sfdisk.c:2167: warning: pointer targets in passing argument 1 of 'get_ul' differ in signedness sfdisk.c:2168: warning: pointer targets in passing argument 1 of 'get_ul' differ in signedness sfdisk.c:2169: warning: pointer targets in passing argument 1 of 'get_ul' differ in signedness Signed-off-by: Randy Dunlap Signed-off-by: Karel Zak --- fdisk/sfdisk.c | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/fdisk/sfdisk.c b/fdisk/sfdisk.c index d82ba569..cb4229f0 100644 --- a/fdisk/sfdisk.c +++ b/fdisk/sfdisk.c @@ -246,7 +246,7 @@ get_sector(char *dev, int fd, unsigned long sno) { static int msdos_signature (struct sector *s) { - unsigned char *data = s->data; + unsigned char *data = (unsigned char *)s->data; if (data[510] == 0x55 && data[511] == 0xaa) return 1; error(_("ERROR: sector %lu does not have an msdos signature\n"), @@ -381,7 +381,7 @@ restore_sectors(char *dev) { ss0 = ss; ct = statbuf.st_size/516; while(ct--) { - sno = chars_to_ulong(ss); + sno = chars_to_ulong((unsigned char *) ss); if (!sseek(dev, fdout, sno)) goto err; if (write(fdout, ss+4, 512) != 512) { @@ -716,8 +716,8 @@ copy_to_part(char *cp, struct partition *p) { p->end_chs.h = *cp++; p->end_chs.s = *cp++; p->end_chs.c = *cp++; - p->start_sect = copy_to_int(cp); - p->nr_sects = copy_to_int(cp+4); + p->start_sect = copy_to_int((unsigned char *) cp); + p->nr_sects = copy_to_int((unsigned char *) cp+4); } static void @@ -1711,8 +1711,8 @@ struct dumpfld { #define RD_CMD (-2) static int -read_stdin(unsigned char **fields, unsigned char *line, int fieldssize, int linesize) { - unsigned char *lp, *ip; +read_stdin(char **fields, char *line, int fieldssize, int linesize) { + char *lp, *ip; int c, fno; /* boolean true and empty string at start */ @@ -2006,8 +2006,8 @@ build_surrounding_extended(struct part_desc *p, struct part_desc *ep, static int read_line(int pno, struct part_desc *ep, char *dev, int interactive, struct disk_desc *z) { - unsigned char line[1000]; - unsigned char *fields[11]; + char line[1000]; + char *fields[11]; int fno, pct = pno%4; struct part_desc p, *orig; unsigned long ff, ff1, ul, ml, ml1, def; -- 2.39.5