Fixed the remaining warnings

git-svn-id: file:///fltk/svn/fltk/branches/branch-1.3@7767 ea41ed52-d2ee-0310-a9c1-e6b18d33e121
This commit is contained in:
Matthias Melcher 2010-10-28 21:47:01 +00:00
parent 1b6dae10bf
commit 8f79d200a0
16 changed files with 75 additions and 50 deletions

View File

@ -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,

View File

@ -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;

View File

@ -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();

View File

@ -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...

View File

@ -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;}

View File

@ -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);
}

View File

@ -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=='_';
}
////////////////////////////////////////////////////////////////
@ -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++;

View File

@ -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);

View File

@ -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';

View File

@ -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';

View File

@ -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);

View File

@ -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);

View File

@ -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);
}

View File

@ -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...

View File

@ -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();

View File

@ -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;