Skip to content

Commit

Permalink
Fixed the remaining warnings
Browse files Browse the repository at this point in the history
git-svn-id: file:///fltk/svn/fltk/branches/branch-1.3@7767 ea41ed52-d2ee-0310-a9c1-e6b18d33e121
  • Loading branch information
Matthias Melcher committed Oct 28, 2010
1 parent 1b6dae1 commit 8f79d20
Show file tree
Hide file tree
Showing 16 changed files with 75 additions and 50 deletions.
2 changes: 1 addition & 1 deletion FL/forms.H
Expand Up @@ -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,
Expand Down
43 changes: 21 additions & 22 deletions fluid/Fl_Function_Type.cxx
Expand Up @@ -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;
Expand Down Expand Up @@ -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)!='\\')
Expand Down Expand Up @@ -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)!='\\')
Expand Down Expand Up @@ -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;
Expand Down Expand Up @@ -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;
Expand Down Expand Up @@ -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;
Expand Down Expand Up @@ -668,24 +668,23 @@ 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(" ");
write_h(" %s\n", c);
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_) {
Expand Down Expand Up @@ -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;
Expand Down Expand Up @@ -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);
}
Expand Down Expand Up @@ -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;
Expand Down Expand Up @@ -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;
Expand Down Expand Up @@ -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;
Expand Down
12 changes: 6 additions & 6 deletions fluid/Fl_Menu_Type.cxx
Expand Up @@ -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;
}
Expand Down Expand Up @@ -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();
Expand Down
4 changes: 2 additions & 2 deletions fluid/Fl_Widget_Type.cxx
Expand Up @@ -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;
Expand Down Expand Up @@ -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...
Expand Down
32 changes: 28 additions & 4 deletions fluid/Fl_Window_Type.cxx
Expand Up @@ -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 (X<bx+dx) X = bx+dx;
if (drag&TOP) if (Y==by) Y += dy; else if (Y<by+dy) Y = by+dy;
if (drag&RIGHT) if (R==br) R += dx; else if (R>br+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 (X<bx+dx) X = bx+dx;
}
}
if (drag&TOP) {
if (Y==by) {
Y += dy;
} else {
if (Y<by+dy) Y = by+dy;
}
}
if (drag&RIGHT) {
if (R==br) {
R += dx;
} else {
if (R>br+dx) R = br+dx;
}
}
if (drag&BOTTOM) {
if (T==bt) {
T += dy;
} else {
if (T>bt+dx) T = bt+dx;
}
}
}
if (R<X) {int n = X; X = R; R = n;}
if (T<Y) {int n = Y; Y = T; T = n;}
Expand Down
2 changes: 1 addition & 1 deletion fluid/Fluid_Image.cxx
Expand Up @@ -120,7 +120,7 @@ void Fluid_Image::write_static() {
fseek(f, 0, SEEK_SET);
if (nData) {
char *data = (char*)calloc(nData, 1);
fread(data, nData, 1, f);
if (fread(data, nData, 1, f)==0) { /* ignore */ }
write_cdata(data, nData);
free(data);
}
Expand Down
4 changes: 2 additions & 2 deletions fluid/code.cxx
Expand Up @@ -47,7 +47,7 @@ extern const char* i18n_set;
// return true if c can be in a C identifier. I needed this so
// it is not messed up by locale settings:
int is_id(char c) {
return c>='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=='_';
}

////////////////////////////////////////////////////////////////
Expand Down Expand Up @@ -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++;
Expand Down
2 changes: 1 addition & 1 deletion fluid/file.cxx
Expand Up @@ -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);
Expand Down
2 changes: 1 addition & 1 deletion fluid/print_panel.cxx
Expand Up @@ -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';
Expand Down
2 changes: 1 addition & 1 deletion fluid/print_panel.fl
Expand Up @@ -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';
Expand Down
2 changes: 1 addition & 1 deletion src/Fl_BMP_Image.cxx
Expand Up @@ -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);
Expand Down
2 changes: 1 addition & 1 deletion src/Fl_PNM_Image.cxx
Expand Up @@ -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);
Expand Down
2 changes: 1 addition & 1 deletion src/forms_compatability.cxx
Expand Up @@ -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);
}

Expand Down
4 changes: 2 additions & 2 deletions src/gl_draw.cxx
Expand Up @@ -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...
Expand Down
7 changes: 5 additions & 2 deletions test/demo.cxx
Expand Up @@ -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
Expand Down Expand Up @@ -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();
Expand Down
3 changes: 1 addition & 2 deletions test/navigation.cxx
Expand Up @@ -57,8 +57,7 @@ int main(int argc, char **argv) {
Fl_Widget *o = window.child(n);
if (x<o->x()+o->w() && x+w>o->x() &&
y<o->y()+o->h() && y+h>o->y()) break;
if ( (!j && (y < o->y())
|| (y == o->y() && x < o->x())) ) j = o;
if ( !j && ( y<o->y() || (y==o->y() && x<o->x()) ) ) j = o;
}
// skip if intersection:
if (n < window.children()) continue;
Expand Down

0 comments on commit 8f79d20

Please sign in to comment.