diff --git a/FL/forms.H b/FL/forms.H index 440df8073..0e2cb2846 100644 --- a/FL/forms.H +++ b/FL/forms.H @@ -652,7 +652,7 @@ inline int fl_show_question(const char* c, int = 0) {return fl_choice("%s",fl_no 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 *); -inline const char *fl_show_input(const char *l,const char*d=0) {return fl_input(l,d);} +inline const char *fl_show_input(const char *l,const char*d=0) {return fl_input("%s",d,l);} FL_EXPORT /*const*/ char *fl_show_simple_input(const char *label, const char *deflt = 0); FL_EXPORT int fl_show_choice( const char *m1, diff --git a/fluid/Fl_Function_Type.cxx b/fluid/Fl_Function_Type.cxx index 0c33a50be..75effe86e 100644 --- a/fluid/Fl_Function_Type.cxx +++ b/fluid/Fl_Function_Type.cxx @@ -188,7 +188,7 @@ void Fl_Function_Type::open() { function_panel->show(); const char* message = 0; for (;;) { // repeat as long as there are errors - if (message) fl_alert(message); + if (message) fl_alert("%s", message); for (;;) { Fl_Widget* w = Fl::readqueue(); if (w == f_panel_cancel) goto BREAK2; @@ -332,7 +332,7 @@ void Fl_Function_Type::write_code1() { skipc = skipc ? 0 : 1; if(!skips && !skipc && plevel==1 && *nptr =='=' && !(nc && *(nptr-1)=='\'') ) // ignore '=' case - while(*++nptr && (skips || skipc || (*nptr!=',' && *nptr!=')' || plevel!=1) )) { + while(*++nptr && (skips || skipc || ( (*nptr!=',' && *nptr!=')') || plevel!=1) )) { if ( *nptr=='"' && *(nptr-1)!='\\' ) skips = skips ? 0 : 1; else if(!skips && *nptr=='\'' && *(nptr-1)!='\\') @@ -374,7 +374,7 @@ void Fl_Function_Type::write_code1() { skipc = skipc ? 0 : 1; if(!skips && !skipc && plevel==1 && *nptr =='=' && !(nc && *(nptr-1)=='\'') ) // ignore '=' case - while(*++nptr && (skips || skipc || (*nptr!=',' && *nptr!=')' || plevel!=1) )) { + while(*++nptr && (skips || skipc || ( (*nptr!=',' && *nptr!=')') || plevel!=1) )) { if ( *nptr=='"' && *(nptr-1)!='\\' ) skips = skips ? 0 : 1; else if(!skips && *nptr=='\'' && *(nptr-1)!='\\') @@ -449,7 +449,7 @@ void Fl_Code_Type::open() { code_panel->show(); const char* message = 0; for (;;) { // repeat as long as there are errors - if (message) fl_alert(message); + if (message) fl_alert("%s", message); for (;;) { Fl_Widget* w = Fl::readqueue(); if (w == code_panel_cancel) goto BREAK2; @@ -516,7 +516,7 @@ void Fl_CodeBlock_Type::open() { codeblock_panel->show(); const char* message = 0; for (;;) { // repeat as long as there are errors - if (message) fl_alert(message); + if (message) fl_alert("%s", message); for (;;) { Fl_Widget* w = Fl::readqueue(); if (w == codeblock_panel_cancel) goto BREAK2; @@ -620,7 +620,7 @@ void Fl_Decl_Type::open() { decl_panel->show(); const char* message = 0; for (;;) { // repeat as long as there are errors - if (message) fl_alert(message); + if (message) fl_alert("%s", message); for (;;) { Fl_Widget* w = Fl::readqueue(); if (w == decl_panel_cancel) goto BREAK2; @@ -668,11 +668,10 @@ void Fl_Decl_Type::write_code1() { const char* c = name(); if (!c) return; // handle a few keywords differently if inside a class - if (is_in_class() && ( - !strncmp(c,"class",5) && isspace(c[5]) - || !strncmp(c,"typedef",7) && isspace(c[7]) - || !strncmp(c,"FL_EXPORT",9) && isspace(c[9]) - || !strncmp(c,"struct",6) && isspace(c[6]) + if (is_in_class() && ( (!strncmp(c,"class",5) && isspace(c[5])) + || (!strncmp(c,"typedef",7) && isspace(c[7])) + || (!strncmp(c,"FL_EXPORT",9) && isspace(c[9])) + || (!strncmp(c,"struct",6) && isspace(c[6])) ) ) { write_public(public_); write_comment_h(" "); @@ -680,12 +679,12 @@ void Fl_Decl_Type::write_code1() { return; } // handle putting #include, extern, using or typedef into decl: - if (!isalpha(*c) && *c != '~' - || !strncmp(c,"extern",6) && isspace(c[6]) - || !strncmp(c,"class",5) && isspace(c[5]) - || !strncmp(c,"typedef",7) && isspace(c[7]) - || !strncmp(c,"using",5) && isspace(c[5]) - || !strncmp(c,"FL_EXPORT",9) && isspace(c[9]) + if ( (!isalpha(*c) && *c != '~') + || (!strncmp(c,"extern",6) && isspace(c[6])) + || (!strncmp(c,"class",5) && isspace(c[5])) + || (!strncmp(c,"typedef",7) && isspace(c[7])) + || (!strncmp(c,"using",5) && isspace(c[5])) + || (!strncmp(c,"FL_EXPORT",9) && isspace(c[9])) // || !strncmp(c,"struct",6) && isspace(c[6]) ) { if (public_) { @@ -779,7 +778,7 @@ void Fl_Data_Type::open() { data_panel->show(); const char* message = 0; for (;;) { // repeat as long as there are errors - if (message) fl_alert(message); + if (message) fl_alert("%s", message); for (;;) { Fl_Widget* w = Fl::readqueue(); if (w == data_panel_cancel) goto BREAK2; @@ -881,7 +880,7 @@ void Fl_Data_Type::write_code1() { fseek(f, 0, SEEK_SET); if (nData) { data = (char*)calloc(nData, 1); - fread(data, nData, 1, f); + if (fread(data, nData, 1, f)==0) { /* use default */ } } fclose(f); } @@ -980,7 +979,7 @@ void Fl_DeclBlock_Type::open() { declblock_panel->show(); const char* message = 0; for (;;) { // repeat as long as there are errors - if (message) fl_alert(message); + if (message) fl_alert("%s", message); for (;;) { Fl_Widget* w = Fl::readqueue(); if (w == declblock_panel_cancel) goto BREAK2; @@ -1103,7 +1102,7 @@ void Fl_Comment_Type::open() { char itempath[256]; itempath[0] = 0; int last_selected_item = 0; for (;;) { // repeat as long as there are errors - if (message) fl_alert(message); + if (message) fl_alert("%s", message); for (;;) { Fl_Widget* w = Fl::readqueue(); if (w == comment_panel_cancel) goto BREAK2; @@ -1359,7 +1358,7 @@ void Fl_Class_Type::open() { char *na=0,*pr=0,*p=0; // name and prefix substrings for (;;) { // repeat as long as there are errors - if (message) fl_alert(message); + if (message) fl_alert("%s", message); for (;;) { Fl_Widget* w = Fl::readqueue(); if (w == c_panel_cancel) goto BREAK2; diff --git a/fluid/Fl_Menu_Type.cxx b/fluid/Fl_Menu_Type.cxx index d08de57ac..de41a3a03 100644 --- a/fluid/Fl_Menu_Type.cxx +++ b/fluid/Fl_Menu_Type.cxx @@ -112,10 +112,10 @@ Fl_Type *Fl_Menu_Item_Type::make() { Fl_Type* q = Fl_Type::current; Fl_Type* p = q; if (p) { - if (force_parent && q->is_menu_item() || !q->is_parent()) p = p->parent; + if ( (force_parent && q->is_menu_item()) || !q->is_parent()) p = p->parent; } force_parent = 0; - if (!p || !(p->is_menu_button() || p->is_menu_item() && p->is_parent())) { + if (!p || !(p->is_menu_button() || (p->is_menu_item() && p->is_parent()))) { fl_message("Please select a menu to add to"); return 0; } @@ -565,17 +565,17 @@ int Shortcut_Button::handle(int e) { if (e == FL_KEYBOARD) { if (!value()) return 0; int v = Fl::event_text()[0]; - if (v > 32 && v < 0x7f || v > 0xa0 && v <= 0xff) { + if ( (v > 32 && v < 0x7f) || (v > 0xa0 && v <= 0xff) ) { if (isupper(v)) { v = tolower(v); v |= FL_SHIFT; } - v = v | Fl::event_state()&(FL_META|FL_ALT|FL_CTRL); + v = v | (Fl::event_state()&(FL_META|FL_ALT|FL_CTRL)); } else { - v = Fl::event_state()&(FL_META|FL_ALT|FL_CTRL|FL_SHIFT) | Fl::event_key(); + v = (Fl::event_state()&(FL_META|FL_ALT|FL_CTRL|FL_SHIFT)) | Fl::event_key(); if (v == FL_BackSpace && svalue) v = 0; } - if (v != svalue) {svalue = v; set_changed(); redraw(); do_callback(); } + if (v != svalue) {svalue = v; set_changed(); redraw(); do_callback(); } return 1; } else if (e == FL_UNFOCUS) { int c = changed(); value(0); if (c) set_changed(); diff --git a/fluid/Fl_Widget_Type.cxx b/fluid/Fl_Widget_Type.cxx index c58b5b10d..2f6f3328c 100644 --- a/fluid/Fl_Widget_Type.cxx +++ b/fluid/Fl_Widget_Type.cxx @@ -260,7 +260,7 @@ void Fl_Widget_Type::redraw() { Fl_Type *sort(Fl_Type *parent) { Fl_Type *f,*n=0; for (f = parent ? parent->next : Fl_Type::first; ; f = n) { - if (!f || parent && f->level <= parent->level) return f; + if (!f || (parent && f->level <= parent->level)) return f; n = sort(f); if (!f->selected || (!f->is_widget() || f->is_menu_item())) continue; Fl_Widget* fw = ((Fl_Widget_Type*)f)->o; @@ -1940,7 +1940,7 @@ const char *array_name(Fl_Widget_Type *o) { if (!e) continue; if (strncmp(c,e,d-c)) continue; int n1 = atoi(e+(d-c)+1); - if (n1 > num || n1==num && sawthis) return 0; + if (n1 > num || (n1==num && sawthis)) return 0; } static char buffer[128]; // MRS: we want strncpy() here... diff --git a/fluid/Fl_Window_Type.cxx b/fluid/Fl_Window_Type.cxx index 1be5ad9a5..3d8f44616 100644 --- a/fluid/Fl_Window_Type.cxx +++ b/fluid/Fl_Window_Type.cxx @@ -573,10 +573,34 @@ void Fl_Window_Type::newposition(Fl_Widget_Type *myo,int &X,int &Y,int &R,int &T R += dx; T += dy; } else { - if (drag&LEFT) if (X==bx) X += dx; else if (Xbr+dx) R = br+dx; - if (drag&BOTTOM) if (T==bt) T += dy; else if (T>bt+dx) T = bt+dx; + if (drag&LEFT) { + if (X==bx) { + X += dx; + } else { + if (Xbr+dx) R = br+dx; + } + } + if (drag&BOTTOM) { + if (T==bt) { + T += dy; + } else { + if (T>bt+dx) T = bt+dx; + } + } } if (R='a' && c<='z' || c>='A' && c<='Z' || c>='0' && c<='9' || c=='_'; + return (c>='a' && c<='z') || (c>='A' && c<='Z') || (c>='0' && c<='9') || c=='_'; } //////////////////////////////////////////////////////////////// @@ -215,7 +215,7 @@ void write_cstring(const char *w, int length) { // consume them as part of the quoted sequence. Use string constant // pasting to avoid this: c = *w; - if (w < e && (c>='0'&&c<='9' || c>='a'&&c<='f' || c>='A'&&c<='F')) { + if (w < e && ( (c>='0'&&c<='9') || (c>='a'&&c<='f') || (c>='A'&&c<='F') )) { putc('\"', code_file); linelength++; if (linelength >= 79) {fputs("\n",code_file); linelength = 0;} putc('\"', code_file); linelength++; diff --git a/fluid/file.cxx b/fluid/file.cxx index c98cb6f60..d5168a7ee 100644 --- a/fluid/file.cxx +++ b/fluid/file.cxx @@ -159,7 +159,7 @@ void read_error(const char *format, ...) { if (!fin) { char buffer[1024]; vsnprintf(buffer, sizeof(buffer), format, args); - fl_message(buffer); + fl_message("%s", buffer); } else { fprintf(stderr, "%s:%d: ", fname, lineno); vfprintf(stderr, format, args); diff --git a/fluid/print_panel.cxx b/fluid/print_panel.cxx index 54a07e236..38c138466 100644 --- a/fluid/print_panel.cxx +++ b/fluid/print_panel.cxx @@ -564,7 +564,7 @@ const char *printer = (const char *)print_choice->menu()[print_choice->value()]. if (print_choice->value()) { snprintf(command, sizeof(command), "lpstat -p '%s'", printer); if ((lpstat = popen(command, "r")) != NULL) { - fgets(status, sizeof(status), lpstat); + if (fgets(status, sizeof(status), lpstat)==0) { /* ignore */ } pclose(lpstat); } else strcpy(status, "printer status unavailable"); } else status[0] = '\0'; diff --git a/fluid/print_panel.fl b/fluid/print_panel.fl index 38c1ceb03..d8cf968b6 100644 --- a/fluid/print_panel.fl +++ b/fluid/print_panel.fl @@ -344,7 +344,7 @@ const char *printer = (const char *)print_choice->menu()[print_choice->value()]. if (print_choice->value()) { snprintf(command, sizeof(command), "lpstat -p '%s'", printer); if ((lpstat = popen(command, "r")) != NULL) { - fgets(status, sizeof(status), lpstat); + if (fgets(status, sizeof(status), lpstat)==0) { /* ignore */ } pclose(lpstat); } else strcpy(status, "printer status unavailable"); } else status[0] = '\\0'; diff --git a/src/Fl_BMP_Image.cxx b/src/Fl_BMP_Image.cxx index 8587790bc..2b8693264 100644 --- a/src/Fl_BMP_Image.cxx +++ b/src/Fl_BMP_Image.cxx @@ -177,7 +177,7 @@ Fl_BMP_Image::Fl_BMP_Image(const char *bmp) // I - File to read for (repcount = 0; repcount < colors_used; repcount ++) { // Read BGR color... - fread(colormap[repcount], 1, 3, fp); + if (fread(colormap[repcount], 1, 3, fp)==0) { /* ignore */ } // Skip pad byte for new BMP files... if (info_size > 12) getc(fp); diff --git a/src/Fl_PNM_Image.cxx b/src/Fl_PNM_Image.cxx index 5ffbdb73c..4ede73f07 100644 --- a/src/Fl_PNM_Image.cxx +++ b/src/Fl_PNM_Image.cxx @@ -166,7 +166,7 @@ Fl_PNM_Image::Fl_PNM_Image(const char *name) // I - File to read case 5 : case 6 : if (maxval < 256) { - fread(ptr, w(), d(), fp); + if (fread(ptr, w(), d(), fp)) { /* ignored */ } } else { for (x = d() * w(); x > 0; x --) { val = (uchar)getc(fp); diff --git a/src/forms_compatability.cxx b/src/forms_compatability.cxx index 32219b48a..59f4a2ebd 100644 --- a/src/forms_compatability.cxx +++ b/src/forms_compatability.cxx @@ -204,7 +204,7 @@ int fl_show_choice( } char *fl_show_simple_input(const char *str1, const char *defstr) { - const char *r = fl_input(str1, defstr); + const char *r = fl_input("%s", defstr, str1); return (char *)(r ? r : defstr); } diff --git a/src/gl_draw.cxx b/src/gl_draw.cxx index 1ef3c53ba..56ca2bf6e 100644 --- a/src/gl_draw.cxx +++ b/src/gl_draw.cxx @@ -84,8 +84,8 @@ void gl_font(int fontid, int size) { #else // Fltk-1.1.8 style GL font selection #if defined (USE_X11) // X-windows options follow, either XFT or "plain" X -# warning Ideally, for XFT, we really need a glXUseXftFont implementation here... -# warning GL font selection is basically wrong here +// FIXME: warning Ideally, for XFT, we really need a glXUseXftFont implementation here... +// FIXME: warning GL font selection is basically wrong here /* OksiD had a fairly sophisticated scheme for storing multiple X fonts in a XUtf8FontStruct, * then sorting through them at draw time (for normal X rendering) to find which one can * render the current glyph... But for now, just use the first font in the list for GL... diff --git a/test/demo.cxx b/test/demo.cxx index 01a320598..e4e2383a6 100644 --- a/test/demo.cxx +++ b/test/demo.cxx @@ -417,7 +417,7 @@ void dobut(Fl_Widget *, long arg) char* command = new char[icommand_length+5]; // 5 for extra './' and ' &\0' sprintf(command, "./%s &", menus[men].icommand[bn]); - system(command); + if (system(command)==-1) { /* ignore */ } delete[] command; #endif // WIN32 @@ -518,7 +518,10 @@ int main(int argc, char **argv) { if (buf!=fname) strcpy(buf,fname); const char *c = fl_filename_name(buf); - if (c > buf) {buf[c-buf] = 0; chdir(buf);} + if (c > buf) { + buf[c-buf] = 0; + if (chdir(buf)==-1) { /* ignore */ } + } push_menu("@main"); form->show(argc,argv); Fl::run(); diff --git a/test/navigation.cxx b/test/navigation.cxx index eb0959575..c1ac72091 100644 --- a/test/navigation.cxx +++ b/test/navigation.cxx @@ -57,8 +57,7 @@ int main(int argc, char **argv) { Fl_Widget *o = window.child(n); if (xx()+o->w() && x+w>o->x() && yy()+o->h() && y+h>o->y()) break; - if ( (!j && (y < o->y()) - || (y == o->y() && x < o->x())) ) j = o; + if ( !j && ( yy() || (y==o->y() && xx()) ) ) j = o; } // skip if intersection: if (n < window.children()) continue;