From: mlichvar Date: Tue, 19 Sep 2006 12:06:40 +0000 (+0000) Subject: - fix some warnings X-Git-Tag: r0-52-3~9 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=c00a8d1b20976d6cbcdf18272363ef3c517284dd;p=thirdparty%2Fnewt.git - fix some warnings --- diff --git a/button.c b/button.c index 7c19de0..74f33f4 100644 --- a/button.c +++ b/button.c @@ -149,6 +149,8 @@ static struct eventResult buttonEvent(newtComponent co, struct eventResult er; struct button * bu = co->data; + er.result = ER_IGNORED; + if (ev.when == EV_NORMAL) { switch (ev.event) { case EV_FOCUS: @@ -195,8 +197,7 @@ static struct eventResult buttonEvent(newtComponent co, } break; } - } else - er.result = ER_IGNORED; + } return er; } diff --git a/checkbox.c b/checkbox.c index 763a05f..ad30717 100644 --- a/checkbox.c +++ b/checkbox.c @@ -210,6 +210,8 @@ struct eventResult cbEvent(newtComponent co, struct event ev) { struct eventResult er; const char * cur; + er.result = ER_IGNORED; + if (ev.when == EV_NORMAL) { switch (ev.event) { case EV_FOCUS: @@ -279,8 +281,7 @@ struct eventResult cbEvent(newtComponent co, struct event ev) { } } } - } else - er.result = ER_IGNORED; + } return er; } diff --git a/checkboxtree.c b/checkboxtree.c index 6190718..8734951 100644 --- a/checkboxtree.c +++ b/checkboxtree.c @@ -447,7 +447,7 @@ static void ctDraw(newtComponent co) { struct items ** item; int i, j; char * spaces; - int currRow; + int currRow = co->top; if (!co->isMapped) return ; @@ -513,11 +513,12 @@ static void ctDraw(newtComponent co) { spaces = alloca(co->width); memset(spaces, ' ', co->width); SLsmg_set_color(NEWT_COLORSET_LISTBOX); - } - while (i < co->height) { - newtGotorc(co->top + i, co->left); - SLsmg_write_nstring(spaces, co->width); - i++; + + while (i < co->height) { + newtGotorc(co->top + i, co->left); + SLsmg_write_nstring(spaces, co->width); + i++; + } } if(ct->sb) { diff --git a/dialogboxes.c b/dialogboxes.c index 70d367d..a86361a 100644 --- a/dialogboxes.c +++ b/dialogboxes.c @@ -120,7 +120,8 @@ int gauge(const char * text, int height, int width, poptContext optCon, int fd, buf[strlen(buf) - 1] = '\0'; if (!strcmp(buf, "XXX")) { - fgets(buf3, sizeof(buf3) - 1, f); + if (!fgets(buf3, sizeof(buf3) - 1, f)) + break; buf3[strlen(buf3) - 1] = '\0'; arg = buf3; diff --git a/entry.c b/entry.c index 9e67b3d..252865d 100644 --- a/entry.c +++ b/entry.c @@ -241,6 +241,8 @@ static struct eventResult entryEvent(newtComponent co, struct eventResult er; int ch; + er.result = ER_IGNORED; + if (ev.when == EV_NORMAL) { switch (ev.event) { case EV_FOCUS: @@ -283,8 +285,7 @@ static struct eventResult entryEvent(newtComponent co, } break; } - } else - er.result = ER_IGNORED; + } return er; } diff --git a/whiptail.c b/whiptail.c index 70bbe9f..a1673a5 100644 --- a/whiptail.c +++ b/whiptail.c @@ -196,8 +196,8 @@ static void spaceForButtons(int * height, int * width, int count, int full) { static int menuSize(int * height, int * width, enum mode mode, poptContext options) { - char ** argv = poptGetArgs(options); - char * * items = argv; + const char ** argv = poptGetArgs(options); + const char ** items = argv; int h = 0; int tagWidth = 0; int descriptionWidth = 0; @@ -466,7 +466,8 @@ int main(int argc, const char ** argv) { if (mode == MODE_NONE) usage(WAS_ERROR); - if (!(text = poptGetArg(optCon))) usage(WAS_ERROR); + if (!(nextArg = poptGetArg(optCon))) usage(WAS_ERROR); + text = strdup(nextArg); if (mode == MODE_TEXTBOX ) text = readTextFile(text);