Remove all warnings for Mac buidl with gcc (except one)

- some warnings about using char for indexing
- some warnings about using signed int in strncmp
- some warnings about deprecated fl_ask (replaced with fl_choice)
The on warning not removed is the strftime("%c") in fluid since
I don't know anything about PS and I don't know if a different
data format would break PS. Mike?



git-svn-id: file:///fltk/svn/fltk/branches/branch-1.1@4270 ea41ed52-d2ee-0310-a9c1-e6b18d33e121
This commit is contained in:
Matthias Melcher 2005-04-11 07:35:33 +00:00
parent e9a3f0e927
commit e72630762d
8 changed files with 24 additions and 24 deletions

View File

@ -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_ask.H"
#include "fl_show_colormap.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_message(const char *,const char *,const char *);
FL_EXPORT void fl_show_alert(const char *,const char *,const char *,int=0); 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 *); FL_EXPORT int fl_show_question(const char *,const char *,const char *);

View File

@ -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) { 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( int fl_show_choice(

View File

@ -97,7 +97,7 @@ int fl_vsnprintf(char* buffer, size_t bufsize, const char* format, va_list ap) {
if ((format - bufformat + 1) > sizeof(tformat) || if ((format - bufformat + 1) > sizeof(tformat) ||
(width + 2) > sizeof(temp)) break; (width + 2) > sizeof(temp)) break;
strncpy(tformat, bufformat, format - bufformat); strncpy(tformat, bufformat, (size_t)(format - bufformat));
tformat[format - bufformat] = '\0'; tformat[format - bufformat] = '\0';
sprintf(temp, tformat, va_arg(ap, double)); 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) {
if ((bufptr + strlen(temp)) > bufend) { if ((bufptr + strlen(temp)) > bufend) {
strncpy(bufptr, temp, bufend - bufptr); strncpy(bufptr, temp, (size_t)(bufend - bufptr));
bufptr = bufend; bufptr = bufend;
break; break;
} else { } 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) || if ((format - bufformat + 1) > sizeof(tformat) ||
(width + 2) > sizeof(temp)) break; (width + 2) > sizeof(temp)) break;
strncpy(tformat, bufformat, format - bufformat); strncpy(tformat, bufformat, (size_t)(format - bufformat));
tformat[format - bufformat] = '\0'; tformat[format - bufformat] = '\0';
sprintf(temp, tformat, va_arg(ap, int)); 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) {
if ((bufptr + strlen(temp)) > bufend) { if ((bufptr + strlen(temp)) > bufend) {
strncpy(bufptr, temp, bufend - bufptr); strncpy(bufptr, temp, (size_t)(bufend - bufptr));
bufptr = bufend; bufptr = bufend;
break; break;
} else { } 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) || if ((format - bufformat + 1) > sizeof(tformat) ||
(width + 2) > sizeof(temp)) break; (width + 2) > sizeof(temp)) break;
strncpy(tformat, bufformat, format - bufformat); strncpy(tformat, bufformat, (size_t)(format - bufformat));
tformat[format - bufformat] = '\0'; tformat[format - bufformat] = '\0';
sprintf(temp, tformat, va_arg(ap, void *)); 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) {
if ((bufptr + strlen(temp)) > bufend) { if ((bufptr + strlen(temp)) > bufend) {
strncpy(bufptr, temp, bufend - bufptr); strncpy(bufptr, temp, (size_t)(bufend - bufptr));
bufptr = bufend; bufptr = bufend;
break; break;
} else { } else {
@ -177,7 +177,7 @@ int fl_vsnprintf(char* buffer, size_t bufsize, const char* format, va_list ap) {
else { else {
if ((bufptr + width) > bufend) width = bufend - bufptr; 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; 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 (slen > width) slen = width;
if (sign == '-') { if (sign == '-') {
strncpy(bufptr, s, slen); strncpy(bufptr, s, (size_t)slen);
memset(bufptr + slen, ' ', width - slen); memset(bufptr + slen, ' ', (size_t)(width - slen));
} else { } else {
memset(bufptr, ' ', width - slen); memset(bufptr, ' ', (size_t)(width - slen));
strncpy(bufptr + width - slen, s, slen); strncpy(bufptr + width - slen, s, (size_t)slen);
} }
bufptr += width; 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) || if ((format - bufformat + 1) > sizeof(tformat) ||
(width + 2) > sizeof(temp)) break; (width + 2) > sizeof(temp)) break;
strncpy(tformat, bufformat, format - bufformat); strncpy(tformat, bufformat, (size_t)(format - bufformat));
tformat[format - bufformat] = '\0'; tformat[format - bufformat] = '\0';
sprintf(temp, tformat, va_arg(ap, int)); 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) {
if ((bufptr + strlen(temp)) > bufend) { if ((bufptr + strlen(temp)) > bufend) {
strncpy(bufptr, temp, bufend - bufptr); strncpy(bufptr, temp, (size_t)(bufend - bufptr));
bufptr = bufend; bufptr = bufend;
break; break;
} else { } else {

View File

@ -51,7 +51,7 @@ void rename_me(Fl_Widget*o) {
} }
void window_callback(Fl_Widget*, void*) { 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); exit(0);
} }

View File

@ -221,7 +221,7 @@ void evaluateboard(node *n,int print) {
if (!n->who) tb = b; // move was black's if (!n->who) tb = b; // move was black's
else { 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; tb = flipboard;
} }
@ -413,7 +413,7 @@ void movepiece(node* f, int i, node* jnode) {
static char jumphappened; static char jumphappened;
for (int k=0; k<4; k++) { for (int k=0; k<4; k++) {
int direction = offset[b[i]][k]; int direction = offset[(int)b[i]][k];
if (!direction) break; if (!direction) break;
int j = i+direction; int j = i+direction;
if (b[j] == EMPTY) { if (b[j] == EMPTY) {

View File

@ -158,7 +158,7 @@ int numb2but(int inumb, int maxnumb)
/* Pushing and Popping menus */ /* Pushing and Popping menus */
char stack[64][32]; char stack[64][32];
char stsize = 0; int stsize = 0;
void push_menu(const char* nnn) void push_menu(const char* nnn)
/* Pushes a menu to be visible */ /* Pushes a menu to be visible */

View File

@ -154,7 +154,7 @@ hash(Config config)
value = 0; value = 0;
for (i = 0; i < HEIGHT; i++) { for (i = 0; i < HEIGHT; i++) {
for (j = 0; j < WIDTH; j++) { for (j = 0; j < WIDTH; j++) {
value = value + convert[config[i][j]]; value = value + convert[(int)config[i][j]];
value *= 6; value *= 6;
} }
} }
@ -521,8 +521,8 @@ addConfig(Config config, struct puzzle *back)
for (i = 0; i < WIDTH; i++) { for (i = 0; i < WIDTH; i++) {
for (j = 0; j < HEIGHT; j++) { for (j = 0; j < HEIGHT; j++) {
if (convert[config[j][i]] != if (convert[(int)config[j][i]] !=
convert[newpiece->pieces[j][i]]) convert[(int)newpiece->pieces[j][i]])
goto nomatch; goto nomatch;
} }
} }

View File

@ -37,8 +37,8 @@ int main(int, char **) {
fl_alert("Quantum fluctuations in the space-time continuum detected, " fl_alert("Quantum fluctuations in the space-time continuum detected, "
"you have %g seconds to comply.", 10.0); "you have %g seconds to comply.", 10.0);
printf("fl_ask returned %d\n", printf("fl_choice returned %d\n",
fl_ask("Do you really want to %s?", "continue")); fl_choice("Do you really want to %s?", "No", "Yes", 0L, "continue"));
printf("fl_choice returned %d\n", printf("fl_choice returned %d\n",
fl_choice("Choose one of the following:","choice0","choice1","choice2")); fl_choice("Choose one of the following:","choice0","choice1","choice2"));