summaryrefslogtreecommitdiff
path: root/fluid
diff options
context:
space:
mode:
authorMatthias Melcher <fltk@matthiasm.com>2010-10-28 21:47:01 +0000
committerMatthias Melcher <fltk@matthiasm.com>2010-10-28 21:47:01 +0000
commit8f79d200a0c20c1840f8f8fa9862c4f84ce72135 (patch)
tree7695dc20692a91694f00424da1c5a8caad792e2d /fluid
parent1b6dae10bff9e86977f7293e14d48fb8b619a1c9 (diff)
Fixed the remaining warnings
git-svn-id: file:///fltk/svn/fltk/branches/branch-1.3@7767 ea41ed52-d2ee-0310-a9c1-e6b18d33e121
Diffstat (limited to 'fluid')
-rw-r--r--fluid/Fl_Function_Type.cxx43
-rw-r--r--fluid/Fl_Menu_Type.cxx12
-rw-r--r--fluid/Fl_Widget_Type.cxx4
-rw-r--r--fluid/Fl_Window_Type.cxx32
-rw-r--r--fluid/Fluid_Image.cxx2
-rw-r--r--fluid/code.cxx4
-rw-r--r--fluid/file.cxx2
-rw-r--r--fluid/print_panel.cxx2
-rw-r--r--fluid/print_panel.fl2
9 files changed, 63 insertions, 40 deletions
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 (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;}
diff --git a/fluid/Fluid_Image.cxx b/fluid/Fluid_Image.cxx
index afd959c4d..244dc812e 100644
--- a/fluid/Fluid_Image.cxx
+++ b/fluid/Fluid_Image.cxx
@@ -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);
}
diff --git a/fluid/code.cxx b/fluid/code.cxx
index 24cea697b..fab97d428 100644
--- a/fluid/code.cxx
+++ b/fluid/code.cxx
@@ -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++;
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';