summaryrefslogtreecommitdiff
path: root/fdisk/cfdisk.c
diff options
context:
space:
mode:
authorSami Kerola <kerolasa@iki.fi>2011-01-23 15:40:18 +0100
committerKarel Zak <kzak@redhat.com>2011-01-25 10:40:34 +0100
commit2897f29a10ba95a96af2139b982ddaddfd49a60d (patch)
tree2faad79af0ca5a6708e17b18075e20acbd940ad9 /fdisk/cfdisk.c
parent5a669b12f84f85f7ace13712b20ce9592a08f157 (diff)
downloadutil-linux-old-2897f29a10ba95a96af2139b982ddaddfd49a60d.tar.gz
cfdisk: data type mismatch, and other, compiler warning fixes
Following warnings will longer appear when one will compile with gcc flags -Wall -Wextra -pedantic cfdisk.c:475:3: warning: comparison of unsigned expression < 0 is always false cfdisk.c:487:16: warning: comparison between signed and unsigned integer expressions cfdisk.c:492:14: warning: comparison between signed and unsigned integer expressions cfdisk.c:565:19: warning: comparison between signed and unsigned integer expressions cfdisk.c:569:19: warning: comparison between signed and unsigned integer expressions cfdisk.c:1070:14: warning: comparison between signed and unsigned integer expressions cfdisk.c:1568:5: warning: missing initializer cfdisk.c:1568:5: warning: (near initialization for 'tmp_ext.volume_label') mbsalign.c:131:2: warning: comparison of unsigned expression >= 0 is always true Signed-off-by: Sami Kerola <kerolasa@iki.fi>
Diffstat (limited to 'fdisk/cfdisk.c')
-rw-r--r--fdisk/cfdisk.c15
1 files changed, 10 insertions, 5 deletions
diff --git a/fdisk/cfdisk.c b/fdisk/cfdisk.c
index 95f1864d..7faa44a3 100644
--- a/fdisk/cfdisk.c
+++ b/fdisk/cfdisk.c
@@ -427,7 +427,8 @@ fdexit(int ret) {
*/
static int
get_string(char *str, int len, char *def) {
- size_t cells = 0, i = 0;
+ size_t cells = 0;
+ ssize_t i = 0;
int x, y;
int use_def = FALSE;
wint_t c;
@@ -562,11 +563,11 @@ fatal(char *s, int ret) {
char *str = xmalloc(strlen(s) + strlen(err1) + strlen(err2) + 10);
sprintf(str, "%s: %s", err1, s);
- if (strlen(str) > COLS)
+ if (strlen(str) > (size_t) COLS)
str[COLS] = 0;
mvaddstr(WARNING_START, (COLS-strlen(str))/2, str);
sprintf(str, "%s", err2);
- if (strlen(str) > COLS)
+ if (strlen(str) > (size_t) COLS)
str[COLS] = 0;
mvaddstr(WARNING_START+1, (COLS-strlen(str))/2, str);
putchar(BELL); /* CTRL-G */
@@ -1067,7 +1068,7 @@ menuUpdate( int y, int x, struct MenuItem *menuItems, int itemLength,
if(lenName > itemLength || lenName >= sizeof(buff))
print_warning(_("Menu item too long. Menu may look odd."));
#endif
- if (lenName >= sizeof(buff)) { /* truncate ridiculously long string */
+ if ((size_t) lenName >= sizeof(buff)) { /* truncate ridiculously long string */
xstrncpy(buff, mi, sizeof(buff));
} else if (lenName >= itemLength) {
snprintf(buff, sizeof(buff),
@@ -1565,7 +1566,11 @@ fill_p_info(void) {
unsigned long long llsectors;
struct partition *p;
partition_table buffer;
- partition_info tmp_ext = { 0, 0, 0, 0, FREE_SPACE, PRIMARY };
+ partition_info tmp_ext;
+
+ memset(&tmp_ext, 0, sizeof tmp_ext);
+ tmp_ext.id = FREE_SPACE;
+ tmp_ext.num = PRIMARY;
if ((fd = open(disk_device, O_RDWR)) < 0) {
if ((fd = open(disk_device, O_RDONLY)) < 0)