diff --git a/FL/forms.H b/FL/forms.H index d6a45f181..46409772a 100644 --- a/FL/forms.H +++ b/FL/forms.H @@ -645,7 +645,7 @@ fl_add_free(int t,double x,double y,double w,double h,const char* l, #include "fl_ask.H" #include "fl_show_colormap.H" -inline int fl_show_question(const char* c, int = 0) {return fl_ask(c);} +inline int fl_show_question(const char* c, int = 0) {return fl_choice(c,"No","Yes",0L);} FL_EXPORT void fl_show_message(const char *,const char *,const char *); FL_EXPORT void fl_show_alert(const char *,const char *,const char *,int=0); FL_EXPORT int fl_show_question(const char *,const char *,const char *); diff --git a/src/forms_compatability.cxx b/src/forms_compatability.cxx index 01bcb2eb7..7642860da 100755 --- a/src/forms_compatability.cxx +++ b/src/forms_compatability.cxx @@ -185,7 +185,7 @@ void fl_show_alert(const char *q1,const char *q2,const char *q3,int) { } int fl_show_question(const char *q1,const char *q2,const char *q3) { - return fl_ask("%s\n%s\n%s", q1?q1:"", q2?q2:"", q3?q3:""); + return fl_choice("%s\n%s\n%s", "No", "Yes", 0L, q1?q1:"", q2?q2:"", q3?q3:""); } int fl_show_choice( diff --git a/src/vsnprintf.c b/src/vsnprintf.c index 96a8b85a6..f9986b6a7 100644 --- a/src/vsnprintf.c +++ b/src/vsnprintf.c @@ -97,7 +97,7 @@ int fl_vsnprintf(char* buffer, size_t bufsize, const char* format, va_list ap) { if ((format - bufformat + 1) > sizeof(tformat) || (width + 2) > sizeof(temp)) break; - strncpy(tformat, bufformat, format - bufformat); + strncpy(tformat, bufformat, (size_t)(format - bufformat)); tformat[format - bufformat] = '\0'; sprintf(temp, tformat, va_arg(ap, double)); @@ -106,7 +106,7 @@ int fl_vsnprintf(char* buffer, size_t bufsize, const char* format, va_list ap) { if (bufptr) { if ((bufptr + strlen(temp)) > bufend) { - strncpy(bufptr, temp, bufend - bufptr); + strncpy(bufptr, temp, (size_t)(bufend - bufptr)); bufptr = bufend; break; } else { @@ -127,7 +127,7 @@ int fl_vsnprintf(char* buffer, size_t bufsize, const char* format, va_list ap) { if ((format - bufformat + 1) > sizeof(tformat) || (width + 2) > sizeof(temp)) break; - strncpy(tformat, bufformat, format - bufformat); + strncpy(tformat, bufformat, (size_t)(format - bufformat)); tformat[format - bufformat] = '\0'; sprintf(temp, tformat, va_arg(ap, int)); @@ -136,7 +136,7 @@ int fl_vsnprintf(char* buffer, size_t bufsize, const char* format, va_list ap) { if (bufptr) { if ((bufptr + strlen(temp)) > bufend) { - strncpy(bufptr, temp, bufend - bufptr); + strncpy(bufptr, temp, (size_t)(bufend - bufptr)); bufptr = bufend; break; } else { @@ -150,7 +150,7 @@ int fl_vsnprintf(char* buffer, size_t bufsize, const char* format, va_list ap) { if ((format - bufformat + 1) > sizeof(tformat) || (width + 2) > sizeof(temp)) break; - strncpy(tformat, bufformat, format - bufformat); + strncpy(tformat, bufformat, (size_t)(format - bufformat)); tformat[format - bufformat] = '\0'; sprintf(temp, tformat, va_arg(ap, void *)); @@ -159,7 +159,7 @@ int fl_vsnprintf(char* buffer, size_t bufsize, const char* format, va_list ap) { if (bufptr) { if ((bufptr + strlen(temp)) > bufend) { - strncpy(bufptr, temp, bufend - bufptr); + strncpy(bufptr, temp, (size_t)(bufend - bufptr)); bufptr = bufend; break; } else { @@ -177,7 +177,7 @@ int fl_vsnprintf(char* buffer, size_t bufsize, const char* format, va_list ap) { else { if ((bufptr + width) > bufend) width = bufend - bufptr; - memcpy(bufptr, va_arg(ap, char *), width); + memcpy(bufptr, va_arg(ap, char *), (size_t)width); bufptr += width; } } @@ -197,11 +197,11 @@ int fl_vsnprintf(char* buffer, size_t bufsize, const char* format, va_list ap) { if (slen > width) slen = width; if (sign == '-') { - strncpy(bufptr, s, slen); - memset(bufptr + slen, ' ', width - slen); + strncpy(bufptr, s, (size_t)slen); + memset(bufptr + slen, ' ', (size_t)(width - slen)); } else { - memset(bufptr, ' ', width - slen); - strncpy(bufptr + width - slen, s, slen); + memset(bufptr, ' ', (size_t)(width - slen)); + strncpy(bufptr + width - slen, s, (size_t)slen); } bufptr += width; @@ -212,7 +212,7 @@ int fl_vsnprintf(char* buffer, size_t bufsize, const char* format, va_list ap) { if ((format - bufformat + 1) > sizeof(tformat) || (width + 2) > sizeof(temp)) break; - strncpy(tformat, bufformat, format - bufformat); + strncpy(tformat, bufformat, (size_t)(format - bufformat)); tformat[format - bufformat] = '\0'; sprintf(temp, tformat, va_arg(ap, int)); @@ -221,7 +221,7 @@ int fl_vsnprintf(char* buffer, size_t bufsize, const char* format, va_list ap) { if (bufptr) { if ((bufptr + strlen(temp)) > bufend) { - strncpy(bufptr, temp, bufend - bufptr); + strncpy(bufptr, temp, (size_t)(bufend - bufptr)); bufptr = bufend; break; } else { diff --git a/test/ask.cxx b/test/ask.cxx index ac1358e93..86ce59435 100644 --- a/test/ask.cxx +++ b/test/ask.cxx @@ -51,7 +51,7 @@ void rename_me(Fl_Widget*o) { } void window_callback(Fl_Widget*, void*) { - if (!fl_ask("Are you sure you want to quit?")) return; + if (!fl_choice("Are you sure you want to quit?", "Cancel", "Quit", 0L)) return; exit(0); } diff --git a/test/checkers.cxx b/test/checkers.cxx index 720a109d5..83eb1b7f2 100644 --- a/test/checkers.cxx +++ b/test/checkers.cxx @@ -221,7 +221,7 @@ void evaluateboard(node *n,int print) { if (!n->who) tb = b; // move was black's else { - for (int i=0; i<45; i++) flipboard[44-i] = flip[b[i]]; + for (int i=0; i<45; i++) flipboard[44-i] = flip[(int)b[i]]; tb = flipboard; } @@ -413,7 +413,7 @@ void movepiece(node* f, int i, node* jnode) { static char jumphappened; for (int k=0; k<4; k++) { - int direction = offset[b[i]][k]; + int direction = offset[(int)b[i]][k]; if (!direction) break; int j = i+direction; if (b[j] == EMPTY) { diff --git a/test/demo.cxx b/test/demo.cxx index a907c2414..87e0ac88c 100644 --- a/test/demo.cxx +++ b/test/demo.cxx @@ -158,7 +158,7 @@ int numb2but(int inumb, int maxnumb) /* Pushing and Popping menus */ char stack[64][32]; -char stsize = 0; +int stsize = 0; void push_menu(const char* nnn) /* Pushes a menu to be visible */ diff --git a/test/glpuzzle.cxx b/test/glpuzzle.cxx index ea73dd67d..94bba7997 100644 --- a/test/glpuzzle.cxx +++ b/test/glpuzzle.cxx @@ -154,7 +154,7 @@ hash(Config config) value = 0; for (i = 0; i < HEIGHT; i++) { for (j = 0; j < WIDTH; j++) { - value = value + convert[config[i][j]]; + value = value + convert[(int)config[i][j]]; value *= 6; } } @@ -521,8 +521,8 @@ addConfig(Config config, struct puzzle *back) for (i = 0; i < WIDTH; i++) { for (j = 0; j < HEIGHT; j++) { - if (convert[config[j][i]] != - convert[newpiece->pieces[j][i]]) + if (convert[(int)config[j][i]] != + convert[(int)newpiece->pieces[j][i]]) goto nomatch; } } diff --git a/test/message.cxx b/test/message.cxx index 4f0c51a2f..4d2329b32 100644 --- a/test/message.cxx +++ b/test/message.cxx @@ -37,8 +37,8 @@ int main(int, char **) { fl_alert("Quantum fluctuations in the space-time continuum detected, " "you have %g seconds to comply.", 10.0); - printf("fl_ask returned %d\n", - fl_ask("Do you really want to %s?", "continue")); + printf("fl_choice returned %d\n", + fl_choice("Do you really want to %s?", "No", "Yes", 0L, "continue")); printf("fl_choice returned %d\n", fl_choice("Choose one of the following:","choice0","choice1","choice2"));