From a972c870a88c82a5b39eb5fd652729afe4f19679 Mon Sep 17 00:00:00 2001 From: "\"Vladimir N. Oleynik\"" Date: Fri, 2 Dec 2005 10:06:04 +0000 Subject: [PATCH] reduce signedness warning --- util-linux/fdisk.c | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/util-linux/fdisk.c b/util-linux/fdisk.c index eb26abb59..eec82a6be 100644 --- a/util-linux/fdisk.c +++ b/util-linux/fdisk.c @@ -106,7 +106,7 @@ struct hd_geometry { struct systypes { - const unsigned char *name; + const char *name; }; static uint sector_size = DEFAULT_SECTOR_SIZE, @@ -122,7 +122,7 @@ static char MBRbuffer[MAX_SECTOR_SIZE]; #else # define MBRbuffer bb_common_bufsiz1 #endif - + #ifdef CONFIG_FEATURE_SUN_LABEL static int sun_label; /* looking at sun disklabel */ #else @@ -309,7 +309,8 @@ str_units(int n) { /* n==1: use singular */ } static int -valid_part_table_flag(const unsigned char *b) { +valid_part_table_flag(const char *mbuffer) { + const unsigned char *b = (const unsigned char *)mbuffer; return (b[510] == 0x55 && b[511] == 0xaa); } @@ -2777,7 +2778,7 @@ static void create_sunlabel(void) puts(_("You may change all the disk params from the x menu")); } - snprintf(sunlabel->info, sizeof(sunlabel->info), + snprintf((char *)(sunlabel->info), sizeof(sunlabel->info), "%s%s%s cyl %d alt %d hd %d sec %d", p ? p->vendor : "", (p && *p->vendor) ? " " : "", p ? p->model @@ -3630,7 +3631,7 @@ static const char *partition_type(unsigned char type) const struct systypes *types = get_sys_types(); for (i=0; types[i].name; i++) - if (types[i].name[0] == type) + if ((unsigned char )types[i].name[0] == type) return types[i].name + 1; return _("Unknown"); @@ -3664,7 +3665,8 @@ void list_types(const struct systypes *sys) do { printf("%c%2x %-15.15s", i ? ' ' : '\n', - sys[next].name[0], partition_type(sys[next].name[0])); + (unsigned char)sys[next].name[0], + partition_type((unsigned char)sys[next].name[0])); next = last[i++] + done; if (i > 3 || next >= last[i]) { i = 0; @@ -3932,7 +3934,7 @@ get_kernel_geometry(void) { static void get_partition_table_geometry(void) { - const unsigned char *bufp = MBRbuffer; + const unsigned char *bufp = (const unsigned char *)MBRbuffer; struct partition *p; int i, h, s, hh, ss; int first = 1;