diff options
| author | Michael R Sweet <michael.r.sweet@gmail.com> | 2002-08-09 22:57:00 +0000 |
|---|---|---|
| committer | Michael R Sweet <michael.r.sweet@gmail.com> | 2002-08-09 22:57:00 +0000 |
| commit | b2e9308751ec0bc90dfbae69bc7309df62672e9f (patch) | |
| tree | 19a56f1e83990f98f36a9b970ecac46d22570bc0 | |
| parent | 050919103f76dbe4aebaa8ac8a1e2633713ee571 (diff) | |
More shadowed variables in FLUID, plus use snprintf, strlcpy, and strlcat.
Don't use extra warning flags for normal compiles.
git-svn-id: file:///fltk/svn/fltk/branches/branch-1.1@2568 ea41ed52-d2ee-0310-a9c1-e6b18d33e121
| -rw-r--r-- | FL/Fl_Hold_Browser.H | 8 | ||||
| -rw-r--r-- | configure.in | 11 | ||||
| -rw-r--r-- | fluid/Fl_Function_Type.cxx | 31 | ||||
| -rw-r--r-- | fluid/Fl_Menu_Type.cxx | 16 | ||||
| -rw-r--r-- | fluid/Fl_Type.cxx | 50 | ||||
| -rw-r--r-- | fluid/Fl_Type.h | 36 | ||||
| -rw-r--r-- | fluid/Fl_Widget_Type.cxx | 40 | ||||
| -rw-r--r-- | fluid/Fl_Window_Type.cxx | 34 | ||||
| -rw-r--r-- | fluid/Fluid_Image.cxx | 24 | ||||
| -rw-r--r-- | fluid/Shortcut_Button.h | 8 | ||||
| -rw-r--r-- | fluid/file.cxx | 10 | ||||
| -rw-r--r-- | fluid/fluid.cxx | 44 | ||||
| -rw-r--r-- | src/Fl_Scroll.cxx | 7 | ||||
| -rw-r--r-- | src/gl_draw.cxx | 14 | ||||
| -rw-r--r-- | test/bitmap.cxx | 16 | ||||
| -rw-r--r-- | test/checkers.cxx | 8 |
16 files changed, 181 insertions, 176 deletions
diff --git a/FL/Fl_Hold_Browser.H b/FL/Fl_Hold_Browser.H index e3a5c511f..e2d969169 100644 --- a/FL/Fl_Hold_Browser.H +++ b/FL/Fl_Hold_Browser.H @@ -1,5 +1,5 @@ // -// "$Id: Fl_Hold_Browser.H,v 1.4.2.3.2.1 2002/01/01 15:11:27 easysw Exp $" +// "$Id: Fl_Hold_Browser.H,v 1.4.2.3.2.2 2002/08/09 22:56:59 easysw Exp $" // // Hold browser header file for the Fast Light Tool Kit (FLTK). // @@ -30,12 +30,12 @@ class Fl_Hold_Browser : public Fl_Browser { public: - Fl_Hold_Browser(int x,int y,int w,int h,const char *l=0) - : Fl_Browser(x,y,w,h,l) {type(FL_HOLD_BROWSER);} + Fl_Hold_Browser(int X,int Y,int W,int H,const char *l=0) + : Fl_Browser(X,Y,W,H,l) {type(FL_HOLD_BROWSER);} }; #endif // -// End of "$Id: Fl_Hold_Browser.H,v 1.4.2.3.2.1 2002/01/01 15:11:27 easysw Exp $". +// End of "$Id: Fl_Hold_Browser.H,v 1.4.2.3.2.2 2002/08/09 22:56:59 easysw Exp $". // diff --git a/configure.in b/configure.in index f435237af..1f61bbb83 100644 --- a/configure.in +++ b/configure.in @@ -1,7 +1,7 @@ dnl -*- sh -*- dnl the "configure" script is made from this by running GNU "autoconf" dnl -dnl "$Id: configure.in,v 1.33.2.31.2.83 2002/08/09 01:09:47 easysw Exp $" +dnl "$Id: configure.in,v 1.33.2.31.2.84 2002/08/09 22:56:59 easysw Exp $" dnl dnl Configuration script for the Fast Light Tool Kit (FLTK). dnl @@ -614,8 +614,11 @@ if test -n "$GCC"; then CXX="$CC" - # Show all warnings when compiling... - OPTIM="-Wall -Wshadow -Wconversion -Winline $OPTIM" + # Show all standard warnings + unused variables when compiling... + OPTIM="-Wall -Wunused $OPTIM" + + # The following additional warnings are useful for tracking down problems... + #OPTIM="-Wshadow -Wconversion -Winline $OPTIM" # Set the default compiler optimizations... if test -z "$DEBUGFLAG"; then @@ -782,5 +785,5 @@ dnl Make sure the fltk-config script is executable... chmod +x fltk-config dnl -dnl End of "$Id: configure.in,v 1.33.2.31.2.83 2002/08/09 01:09:47 easysw Exp $". +dnl End of "$Id: configure.in,v 1.33.2.31.2.84 2002/08/09 22:56:59 easysw Exp $". dnl diff --git a/fluid/Fl_Function_Type.cxx b/fluid/Fl_Function_Type.cxx index f33622e26..a049f7437 100644 --- a/fluid/Fl_Function_Type.cxx +++ b/fluid/Fl_Function_Type.cxx @@ -1,5 +1,5 @@ // -// "$Id: Fl_Function_Type.cxx,v 1.15.2.16.2.7 2002/05/16 12:47:42 easysw Exp $" +// "$Id: Fl_Function_Type.cxx,v 1.15.2.16.2.8 2002/08/09 22:56:59 easysw Exp $" // // C function type code for the Fast Light Tool Kit (FLTK). // @@ -258,25 +258,26 @@ void Fl_Function_Type::write_code1() { write_h("%s;\n", s); // skip all function default param. init in body: int skips=0,skipc=0; - int nc=0,level=0; + int nc=0,plevel=0; for (sptr=s,nptr=(char*)name(); *nptr; nc++,nptr++) { - if (!skips && *nptr=='(') level++; - else if (!skips && *nptr==')') level--; + if (!skips && *nptr=='(') plevel++; + else if (!skips && *nptr==')') plevel--; if ( *nptr=='"' && !(nc && *(nptr-1)=='\\') ) skips = skips ? 0 : 1; else if(!skips && *nptr=='\'' && !(nc && *(nptr-1)=='\\')) skipc = skipc ? 0 : 1; - if(!skips && !skipc && level==1 && *nptr =='=' && + if(!skips && !skipc && plevel==1 && *nptr =='=' && !(nc && *(nptr-1)=='\'') ) // ignore '=' case - while(*++nptr && (skips || skipc || (*nptr!=',' && *nptr!=')' || level!=1) )) { + while(*++nptr && (skips || skipc || (*nptr!=',' && *nptr!=')' || plevel!=1) )) { if ( *nptr=='"' && *(nptr-1)!='\\' ) skips = skips ? 0 : 1; else if(!skips && *nptr=='\'' && *(nptr-1)!='\\') skipc = skipc ? 0 : 1; - if (!skips && !skipc && *nptr=='(') level++; - else if (!skips && *nptr==')') level--; + if (!skips && !skipc && *nptr=='(') plevel++; + else if (!skips && *nptr==')') plevel--; } - *sptr++ = *nptr; + + if (sptr < (s + sizeof(s) - 1)) *sptr++ = *nptr; } *sptr = '\0'; @@ -599,11 +600,11 @@ const char* Fl_Type::class_name(const int need_nest) const { const char* q = 0; if(need_nest) q=p->class_name(need_nest); if (q) { - static char buffer[256]; - if (q != buffer) strcpy(buffer, q); - strcat(buffer, "::"); - strcat(buffer, p->name()); - return buffer; + static char s[256]; + if (q != s) strlcpy(s, q, sizeof(s)); + strlcat(s, "::", sizeof(s)); + strlcat(s, p->name(), sizeof(s)); + return s; } return p->name(); } @@ -703,5 +704,5 @@ void Fl_Class_Type::write_code2() { } // -// End of "$Id: Fl_Function_Type.cxx,v 1.15.2.16.2.7 2002/05/16 12:47:42 easysw Exp $". +// End of "$Id: Fl_Function_Type.cxx,v 1.15.2.16.2.8 2002/08/09 22:56:59 easysw Exp $". // diff --git a/fluid/Fl_Menu_Type.cxx b/fluid/Fl_Menu_Type.cxx index 9bfa773d4..077fac8ea 100644 --- a/fluid/Fl_Menu_Type.cxx +++ b/fluid/Fl_Menu_Type.cxx @@ -1,5 +1,5 @@ // -// "$Id: Fl_Menu_Type.cxx,v 1.16.2.12.2.5 2002/05/16 12:47:42 easysw Exp $" +// "$Id: Fl_Menu_Type.cxx,v 1.16.2.12.2.6 2002/08/09 22:56:59 easysw Exp $" // // Menu item code for the Fast Light Tool Kit (FLTK). // @@ -260,13 +260,13 @@ void Fl_Menu_Item_Type::write_item() { } void Fl_Menu_Item_Type::write_code1() { - int i; const char* name = menu_name(i); + int i; const char* mname = menu_name(i); if (!prev->is_menu_item()) { // for first menu item, declare the array if (class_name(1)) - write_h(" static Fl_Menu_Item %s[];\n", name); + write_h(" static Fl_Menu_Item %s[];\n", mname); else - write_h("extern Fl_Menu_Item %s[];\n", name); + write_h("extern Fl_Menu_Item %s[];\n", mname); } const char *c = array_name(this); @@ -275,7 +275,7 @@ void Fl_Menu_Item_Type::write_code1() { write_public(public_); write_h(" static Fl_Menu_Item *%s;\n", c); } else - write_h("#define %s (%s+%d)\n", c, name, i); + write_h("#define %s (%s+%d)\n", c, mname, i); } if (callback()) { @@ -290,7 +290,7 @@ void Fl_Menu_Item_Type::write_code1() { int init = 0; if (image) { - write_c(" {Fl_Menu_Item* o = &%s[%d];\n", name, i); + write_c(" {Fl_Menu_Item* o = &%s[%d];\n", mname, i); init = 1; image->write_code(); } @@ -298,7 +298,7 @@ void Fl_Menu_Item_Type::write_code1() { if (extra_code(n) && !isdeclare(extra_code(n))) { if (!init) { init = 1; - write_c("%s{ Fl_Menu_Item* o = &%s[%d];\n", indent(), name, i); + write_c("%s{ Fl_Menu_Item* o = &%s[%d];\n", indent(), mname, i); } write_c("%s %s\n", indent(), extra_code(n)); } @@ -465,5 +465,5 @@ void shortcut_in_cb(Shortcut_Button* i, void* v) { } // -// End of "$Id: Fl_Menu_Type.cxx,v 1.16.2.12.2.5 2002/05/16 12:47:42 easysw Exp $". +// End of "$Id: Fl_Menu_Type.cxx,v 1.16.2.12.2.6 2002/08/09 22:56:59 easysw Exp $". // diff --git a/fluid/Fl_Type.cxx b/fluid/Fl_Type.cxx index ee1680a33..5e777b76a 100644 --- a/fluid/Fl_Type.cxx +++ b/fluid/Fl_Type.cxx @@ -1,5 +1,5 @@ // -// "$Id: Fl_Type.cxx,v 1.6.2.6.2.8 2002/05/16 12:47:42 easysw Exp $" +// "$Id: Fl_Type.cxx,v 1.6.2.6.2.9 2002/08/09 22:57:00 easysw Exp $" // // Widget type code for the Fast Light Tool Kit (FLTK). // @@ -100,8 +100,8 @@ static void Widget_Browser_callback(Fl_Widget *o,void *) { ((Widget_Browser *)o)->callback(); } -Widget_Browser::Widget_Browser(int x,int y,int w,int h,const char*l) -: Fl_Browser_(x,y,w,h,l) { +Widget_Browser::Widget_Browser(int X,int Y,int W,int H,const char*l) +: Fl_Browser_(X,Y,W,H,l) { type(FL_MULTI_BROWSER); Fl_Widget::callback(Widget_Browser_callback); when(FL_WHEN_RELEASE); @@ -133,39 +133,39 @@ const char* Fl_Type::title() { extern const char* subclassname(Fl_Type*); -void Widget_Browser::item_draw(void *v, int x, int y, int, int) const { +void Widget_Browser::item_draw(void *v, int X, int Y, int, int) const { Fl_Type *l = (Fl_Type *)v; - x += 3 + 16 + l->level * 10; + X += 3 + 16 + l->level * 10; if (l->new_selected) fl_color(fl_contrast(FL_BLACK,FL_SELECTION_COLOR)); else fl_color(FL_BLACK); - if (l->is_public() == 0) lock_pixmap.draw(x - 16, y); - else if (l->is_public() > 0) unlock_pixmap.draw(x - 16, y); + if (l->is_public() == 0) lock_pixmap.draw(X - 16, Y); + else if (l->is_public() > 0) unlock_pixmap.draw(X - 16, Y); if (l->is_parent()) { if (!l->next || l->next->level <= l->level) { if (l->open_!=(l==pushedtitle)) { - fl_loop(x,y+7,x+5,y+12,x+10,y+7); + fl_loop(X,Y+7,X+5,Y+12,X+10,Y+7); } else { - fl_loop(x+2,y+2,x+7,y+7,x+2,y+12); + fl_loop(X+2,Y+2,X+7,Y+7,X+2,Y+12); } } else { if (l->open_!=(l==pushedtitle)) { - fl_polygon(x,y+7,x+5,y+12,x+10,y+7); + fl_polygon(X,Y+7,X+5,Y+12,X+10,Y+7); } else { - fl_polygon(x+2,y+2,x+7,y+7,x+2,y+12); + fl_polygon(X+2,Y+2,X+7,Y+7,X+2,Y+12); } } - x += 10; + X += 10; } if (l->is_widget() || l->is_class()) { const char* c = subclassname(l); if (!strncmp(c,"Fl_",3)) c += 3; fl_font(textfont(), textsize()); - fl_draw(c, x, y+13); - x += int(fl_width(c)+fl_width('n')); + fl_draw(c, X, Y+13); + X += int(fl_width(c)+fl_width('n')); c = l->name(); if (c) { fl_font(textfont()|FL_BOLD, textsize()); - fl_draw(c, x, y+13); + fl_draw(c, X, Y+13); } else if ((c=l->label())) { char buf[50]; char* p = buf; *p++ = '"'; @@ -176,7 +176,7 @@ void Widget_Browser::item_draw(void *v, int x, int y, int, int) const { if (*c) {strcpy(p,"..."); p+=3;} *p++ = '"'; *p = 0; - fl_draw(buf, x, y+13); + fl_draw(buf, X, Y+13); } } else { const char* c = l->title(); @@ -188,7 +188,7 @@ void Widget_Browser::item_draw(void *v, int x, int y, int, int) const { if (*c) {strcpy(p,"..."); p+=3;} *p = 0; fl_font(textfont() | (l->is_code_block() && (l->level==0 || l->parent->is_class())?0:FL_BOLD), textsize()); - fl_draw(buf, x, y+13); + fl_draw(buf, X, Y+13); } } @@ -197,18 +197,18 @@ int Widget_Browser::item_width(void *v) const { if (!l->visible) return 0; - int w = 3 + 16 + l->level*10; - if (l->is_parent()) w += 10; + int W = 3 + 16 + l->level*10; + if (l->is_parent()) W += 10; if (l->is_widget() || l->is_class()) { const char* c = l->type_name(); if (!strncmp(c,"Fl_",3)) c += 3; fl_font(textfont(), textsize()); - w += int(fl_width(c) + fl_width('n')); + W += int(fl_width(c) + fl_width('n')); c = l->name(); if (c) { fl_font(textfont()|FL_BOLD, textsize()); - w += int(fl_width(c)); + W += int(fl_width(c)); } else if ((c=l->label())) { char buf[50]; char* p = buf; *p++ = '"'; @@ -219,7 +219,7 @@ int Widget_Browser::item_width(void *v) const { if (*c) {strcpy(p,"..."); p+=3;} *p++ = '"'; *p = 0; - w += int(fl_width(buf)); + W += int(fl_width(buf)); } } else { const char* c = l->title(); @@ -231,10 +231,10 @@ int Widget_Browser::item_width(void *v) const { if (*c) {strcpy(p,"..."); p+=3;} *p = 0; fl_font(textfont() | (l->is_code_block() && (l->level==0 || l->parent->is_class())?0:FL_BOLD), textsize()); - w += int(fl_width(buf)); + W += int(fl_width(buf)); } - return w; + return W; } void redraw_browser() { @@ -680,5 +680,5 @@ void Fl_Type::read_property(const char *c) { int Fl_Type::read_fdesign(const char*, const char*) {return 0;} // -// End of "$Id: Fl_Type.cxx,v 1.6.2.6.2.8 2002/05/16 12:47:42 easysw Exp $". +// End of "$Id: Fl_Type.cxx,v 1.6.2.6.2.9 2002/08/09 22:57:00 easysw Exp $". // diff --git a/fluid/Fl_Type.h b/fluid/Fl_Type.h index 141b8fcad..d1fed8451 100644 --- a/fluid/Fl_Type.h +++ b/fluid/Fl_Type.h @@ -1,5 +1,5 @@ // -// "$Id: Fl_Type.h,v 1.5.2.11.2.5 2002/04/27 18:34:11 easysw Exp $" +// "$Id: Fl_Type.h,v 1.5.2.11.2.6 2002/08/09 22:57:00 easysw Exp $" // // Widget type header file for the Fast Light Tool Kit (FLTK). // @@ -298,26 +298,26 @@ public: class igroup : public Fl_Group { public: void resize(int,int,int,int); - igroup(int x,int y,int w,int h) : Fl_Group(x,y,w,h) {Fl_Group::current(0);} + igroup(int X,int Y,int W,int H) : Fl_Group(X,Y,W,H) {Fl_Group::current(0);} }; class itabs : public Fl_Tabs { public: void resize(int,int,int,int); - itabs(int x,int y,int w,int h) : Fl_Tabs(x,y,w,h) {} + itabs(int X,int Y,int W,int H) : Fl_Tabs(X,Y,W,H) {} }; class iwizard : public Fl_Wizard { public: void resize(int,int,int,int); - iwizard(int x,int y,int w,int h) : Fl_Wizard(x,y,w,h) {} + iwizard(int X,int Y,int W,int H) : Fl_Wizard(X,Y,W,H) {} }; class Fl_Group_Type : public Fl_Widget_Type { public: virtual const char *type_name() {return "Fl_Group";} - Fl_Widget *widget(int x,int y,int w,int h) { - igroup *g = new igroup(x,y,w,h); Fl_Group::current(0); return g;} + Fl_Widget *widget(int X,int Y,int W,int H) { + igroup *g = new igroup(X,Y,W,H); Fl_Group::current(0); return g;} Fl_Widget_Type *_make() {return new Fl_Group_Type();} Fl_Type *make(); void write_code1(); @@ -344,8 +344,8 @@ extern const char tabs_type_name[]; class Fl_Tabs_Type : public Fl_Group_Type { public: virtual const char *type_name() {return tabs_type_name;} - Fl_Widget *widget(int x,int y,int w,int h) { - itabs *g = new itabs(x,y,w,h); Fl_Group::current(0); return g;} + Fl_Widget *widget(int X,int Y,int W,int H) { + itabs *g = new itabs(X,Y,W,H); Fl_Group::current(0); return g;} Fl_Widget_Type *_make() {return new Fl_Tabs_Type();} Fl_Type* click_test(int,int); void add_child(Fl_Type*, Fl_Type*); @@ -375,8 +375,8 @@ extern const char wizard_type_name[]; class Fl_Wizard_Type : public Fl_Group_Type { public: virtual const char *type_name() {return wizard_type_name;} - Fl_Widget *widget(int x,int y,int w,int h) { - iwizard *g = new iwizard(x,y,w,h); Fl_Group::current(0); return g;} + Fl_Widget *widget(int X,int Y,int W,int H) { + iwizard *g = new iwizard(X,Y,W,H); Fl_Group::current(0); return g;} Fl_Widget_Type *_make() {return new Fl_Wizard_Type();} }; @@ -499,8 +499,8 @@ class Fl_Menu_Button_Type : public Fl_Menu_Type { Fl_Menu_Item *subtypes() {return button_type_menu;} public: virtual const char *type_name() {return "Fl_Menu_Button";} - Fl_Widget *widget(int x,int y,int w,int h) { - return new Fl_Menu_Button(x,y,w,h,"menu");} + Fl_Widget *widget(int X,int Y,int W,int H) { + return new Fl_Menu_Button(X,Y,W,H,"menu");} Fl_Widget_Type *_make() {return new Fl_Menu_Button_Type();} }; @@ -510,8 +510,8 @@ extern Fl_Menu_Item dummymenu[]; class Fl_Choice_Type : public Fl_Menu_Type { public: virtual const char *type_name() {return "Fl_Choice";} - Fl_Widget *widget(int x,int y,int w,int h) { - Fl_Choice *myo = new Fl_Choice(x,y,w,h,"choice:"); + Fl_Widget *widget(int X,int Y,int W,int H) { + Fl_Choice *myo = new Fl_Choice(X,Y,W,H,"choice:"); myo->menu(dummymenu); return myo; } @@ -522,12 +522,12 @@ public: class Fl_Menu_Bar_Type : public Fl_Menu_Type { public: virtual const char *type_name() {return "Fl_Menu_Bar";} - Fl_Widget *widget(int x,int y,int w,int h) { - return new Fl_Menu_Bar(x,y,w,h);} + Fl_Widget *widget(int X,int Y,int W,int H) { + return new Fl_Menu_Bar(X,Y,W,H);} Fl_Widget_Type *_make() {return new Fl_Menu_Bar_Type();} }; // object list operations: -Fl_Widget *make_widget_browser(int x,int y,int w,int h); +Fl_Widget *make_widget_browser(int X,int Y,int W,int H); extern int modflag; void delete_all(int selected_only=0); void selection_changed(Fl_Type* new_current); @@ -567,5 +567,5 @@ int storestring(const char *n, const char * & p, int nostrip=0); extern int include_H_from_C; // -// End of "$Id: Fl_Type.h,v 1.5.2.11.2.5 2002/04/27 18:34:11 easysw Exp $". +// End of "$Id: Fl_Type.h,v 1.5.2.11.2.6 2002/08/09 22:57:00 easysw Exp $". // diff --git a/fluid/Fl_Widget_Type.cxx b/fluid/Fl_Widget_Type.cxx index c649fcde1..ccbb4696e 100644 --- a/fluid/Fl_Widget_Type.cxx +++ b/fluid/Fl_Widget_Type.cxx @@ -1,5 +1,5 @@ // -// "$Id: Fl_Widget_Type.cxx,v 1.15.2.16.2.16 2002/05/24 14:19:19 easysw Exp $" +// "$Id: Fl_Widget_Type.cxx,v 1.15.2.16.2.17 2002/08/09 22:57:00 easysw Exp $" // // Widget type code for the Fast Light Tool Kit (FLTK). // @@ -1878,9 +1878,9 @@ Fl_Menu_Item boxmenu1[] = { extern int fdesign_flip; int lookup_symbol(const char *, int &, int numberok = 0); -int Fl_Widget_Type::read_fdesign(const char* name, const char* value) { +int Fl_Widget_Type::read_fdesign(const char* propname, const char* value) { int v; - if (!strcmp(name,"box")) { + if (!strcmp(propname,"box")) { float x,y,w,h; if (sscanf(value,"%f %f %f %f",&x,&y,&w,&h) == 4) { if (fdesign_flip) { @@ -1892,39 +1892,39 @@ int Fl_Widget_Type::read_fdesign(const char* name, const char* value) { y += pasteoffset; o->resize(int(x),int(y),int(w),int(h)); } - } else if (!strcmp(name,"label")) { + } else if (!strcmp(propname,"label")) { label(value); - } else if (!strcmp(name,"name")) { + } else if (!strcmp(propname,"name")) { this->name(value); - } else if (!strcmp(name,"callback")) { + } else if (!strcmp(propname,"callback")) { callback(value); user_data_type("long"); - } else if (!strcmp(name,"argument")) { + } else if (!strcmp(propname,"argument")) { user_data(value); - } else if (!strcmp(name,"shortcut")) { + } else if (!strcmp(propname,"shortcut")) { if (value[0]) { char buf[128]; sprintf(buf,"o->shortcut(\"%s\");",value); extra_code(0,buf); } - } else if (!strcmp(name,"style")) { + } else if (!strcmp(propname,"style")) { if (!strncmp(value,"FL_NORMAL",9)) return 1; if (!lookup_symbol(value,v,1)) return 0; o->labelfont(v); o->labeltype((Fl_Labeltype)(v>>8)); - } else if (!strcmp(name,"size")) { + } else if (!strcmp(propname,"size")) { if (!lookup_symbol(value,v,1)) return 0; o->labelsize(v); - } else if (!strcmp(name,"type")) { + } else if (!strcmp(propname,"type")) { if (!strncmp(value,"NORMAL",6)) return 1; if (lookup_symbol(value,v,1)) {o->type(v); return 1;} if (!strcmp(value+strlen(value)-5,"FRAME")) goto TRY_BOXTYPE; if (!strcmp(value+strlen(value)-3,"BOX")) goto TRY_BOXTYPE; return 0; - } else if (!strcmp(name,"lcol")) { + } else if (!strcmp(propname,"lcol")) { if (!lookup_symbol(value,v,1)) return 0; o->labelcolor(v); - } else if (!strcmp(name,"return")) { + } else if (!strcmp(propname,"return")) { if (!lookup_symbol(value,v,0)) return 0; o->when(v|FL_WHEN_RELEASE); - } else if (!strcmp(name,"alignment")) { + } else if (!strcmp(propname,"alignment")) { if (!lookup_symbol(value,v)) { // convert old numeric values: int v1 = atoi(value); if (v1 <= 0 && strcmp(value,"0")) return 0; @@ -1940,9 +1940,9 @@ int Fl_Widget_Type::read_fdesign(const char* name, const char* value) { } } o->align(v); - } else if (!strcmp(name,"resizebox")) { + } else if (!strcmp(propname,"resizebox")) { resizable(1); - } else if (!strcmp(name,"colors")) { + } else if (!strcmp(propname,"colors")) { char* p = (char*)value; while (*p != ' ') {if (!*p) return 0; p++;} *p = 0; @@ -1950,11 +1950,11 @@ int Fl_Widget_Type::read_fdesign(const char* name, const char* value) { if (!lookup_symbol(value,v,1) || !lookup_symbol(p+1,v1,1)) { *p=' '; return 0;} o->color(v,v1); - } else if (!strcmp(name,"resize")) { + } else if (!strcmp(propname,"resize")) { return !strcmp(value,"FL_RESIZE_ALL"); - } else if (!strcmp(name,"gravity")) { + } else if (!strcmp(propname,"gravity")) { return !strcmp(value,"FL_NoGravity FL_NoGravity"); - } else if (!strcmp(name,"boxtype")) { + } else if (!strcmp(propname,"boxtype")) { TRY_BOXTYPE: int x = boxnumber(value); if (!x) {x = item_number(boxmenu1, value); if (x < 0) return 0;} @@ -1970,5 +1970,5 @@ int Fl_Widget_Type::read_fdesign(const char* name, const char* value) { } // -// End of "$Id: Fl_Widget_Type.cxx,v 1.15.2.16.2.16 2002/05/24 14:19:19 easysw Exp $". +// End of "$Id: Fl_Widget_Type.cxx,v 1.15.2.16.2.17 2002/08/09 22:57:00 easysw Exp $". // diff --git a/fluid/Fl_Window_Type.cxx b/fluid/Fl_Window_Type.cxx index 0eca85c58..5cab936b7 100644 --- a/fluid/Fl_Window_Type.cxx +++ b/fluid/Fl_Window_Type.cxx @@ -1,5 +1,5 @@ // -// "$Id: Fl_Window_Type.cxx,v 1.13.2.10.2.5 2002/05/16 12:47:43 easysw Exp $" +// "$Id: Fl_Window_Type.cxx,v 1.13.2.10.2.6 2002/08/09 22:57:00 easysw Exp $" // // Window type code for the Fast Light Tool Kit (FLTK). // @@ -213,7 +213,7 @@ class Overlay_Window : public Fl_Overlay_Window { public: Fl_Window_Type *window; int handle(int); - Overlay_Window(int w,int h) : Fl_Overlay_Window(w,h) {Fl_Group::current(0);} + Overlay_Window(int W,int H) : Fl_Overlay_Window(W,H) {Fl_Group::current(0);} void resize(int,int,int,int); }; void Overlay_Window::draw() { @@ -222,11 +222,11 @@ void Overlay_Window::draw() { if ((damage()&FL_DAMAGE_ALL) && (!box() || (box()>=4&&!(box()&2)) || box()>=_FL_ROUNDED_BOX)) { // if so, draw checkerboard so user can see what areas are clear: - for (int y = 0; y < h(); y += CHECKSIZE) - for (int x = 0; x < w(); x += CHECKSIZE) { - fl_color(((y/(2*CHECKSIZE))&1) != ((x/(2*CHECKSIZE))&1) ? + for (int Y = 0; Y < h(); Y += CHECKSIZE) + for (int X = 0; X < w(); X += CHECKSIZE) { + fl_color(((Y/(2*CHECKSIZE))&1) != ((X/(2*CHECKSIZE))&1) ? FL_WHITE : FL_BLACK); - fl_rectf(x,y,CHECKSIZE,CHECKSIZE); + fl_rectf(X,Y,CHECKSIZE,CHECKSIZE); } } Fl_Overlay_Window::draw(); @@ -539,9 +539,9 @@ void Fl_Window_Type::moveallchildren() for (p = myo->next; p && p->level>myo->level; p = p->next) if (p->is_widget() && !p->is_menu_item()) { Fl_Widget_Type* myo2 = (Fl_Widget_Type*)p; - int x,y,r,t; - newposition(myo2,x,y,r,t); - myo2->o->resize(x,y,r-x,t-y); + int X,Y,R,T; + newposition(myo2,X,Y,R,T); + myo2->o->resize(X,Y,R-X,T-Y); } i = p; } else { @@ -772,25 +772,25 @@ void Fl_Window_Type::read_property(const char *c) { } } -int Fl_Window_Type::read_fdesign(const char* name, const char* value) { +int Fl_Window_Type::read_fdesign(const char* propname, const char* value) { int x; o->box(FL_NO_BOX); // because fdesign always puts an Fl_Box next - if (!strcmp(name,"Width")) { + if (!strcmp(propname,"Width")) { if (sscanf(value,"%d",&x) == 1) o->size(x,o->h()); - } else if (!strcmp(name,"Height")) { + } else if (!strcmp(propname,"Height")) { if (sscanf(value,"%d",&x) == 1) o->size(o->w(),x); - } else if (!strcmp(name,"NumberofWidgets")) { + } else if (!strcmp(propname,"NumberofWidgets")) { return 1; // we can figure out count from file - } else if (!strcmp(name,"border")) { + } else if (!strcmp(propname,"border")) { if (sscanf(value,"%d",&x) == 1) ((Fl_Window*)o)->border(x); - } else if (!strcmp(name,"title")) { + } else if (!strcmp(propname,"title")) { label(value); } else { - return Fl_Widget_Type::read_fdesign(name,value); + return Fl_Widget_Type::read_fdesign(propname,value); } return 1; } // -// End of "$Id: Fl_Window_Type.cxx,v 1.13.2.10.2.5 2002/05/16 12:47:43 easysw Exp $". +// End of "$Id: Fl_Window_Type.cxx,v 1.13.2.10.2.6 2002/08/09 22:57:00 easysw Exp $". // diff --git a/fluid/Fluid_Image.cxx b/fluid/Fluid_Image.cxx index 0addb39d4..2e94f4c4a 100644 --- a/fluid/Fluid_Image.cxx +++ b/fluid/Fluid_Image.cxx @@ -1,5 +1,5 @@ // -// "$Id: Fluid_Image.cxx,v 1.7.2.9.2.10 2002/06/07 15:06:32 easysw Exp $" +// "$Id: Fluid_Image.cxx,v 1.7.2.9.2.11 2002/08/09 22:57:00 easysw Exp $" // // Pixmap label support for the Fast Light Tool Kit (FLTK). // @@ -129,15 +129,15 @@ static Fluid_Image** images = 0; // sorted list static int numimages = 0; static int tablesize = 0; -Fluid_Image* Fluid_Image::find(const char *name) { - if (!name || !*name) return 0; +Fluid_Image* Fluid_Image::find(const char *iname) { + if (!iname || !*iname) return 0; // first search to see if it exists already: int a = 0; int b = numimages; while (a < b) { int c = (a+b)/2; - int i = strcmp(name,images[c]->name_); + int i = strcmp(iname,images[c]->name_); if (i < 0) b = c; else if (i > 0) a = c+1; else return images[c]; @@ -146,20 +146,20 @@ Fluid_Image* Fluid_Image::find(const char *name) { // no, so now see if the file exists: goto_source_dir(); - FILE *f = fopen(name,"rb"); + FILE *f = fopen(iname,"rb"); if (!f) { - read_error("%s : %s",name,strerror(errno)); + read_error("%s : %s",iname,strerror(errno)); leave_source_dir(); return 0; } fclose(f); - Fluid_Image *ret = new Fluid_Image(name); + Fluid_Image *ret = new Fluid_Image(iname); if (!ret->img->w() || !ret->img->h()) { delete ret; ret = 0; - read_error("%s : unrecognized image format", name); + read_error("%s : unrecognized image format", iname); } leave_source_dir(); if (!ret) return 0; @@ -177,11 +177,11 @@ Fluid_Image* Fluid_Image::find(const char *name) { return ret; } -Fluid_Image::Fluid_Image(const char *name) { - name_ = strdup(name); +Fluid_Image::Fluid_Image(const char *iname) { + name_ = strdup(iname); written = 0; refcount = 0; - img = Fl_Shared_Image::get(name); + img = Fl_Shared_Image::get(iname); } void Fluid_Image::increment() { @@ -219,5 +219,5 @@ Fluid_Image *ui_find_image(const char *oldname) { // -// End of "$Id: Fluid_Image.cxx,v 1.7.2.9.2.10 2002/06/07 15:06:32 easysw Exp $". +// End of "$Id: Fluid_Image.cxx,v 1.7.2.9.2.11 2002/08/09 22:57:00 easysw Exp $". // diff --git a/fluid/Shortcut_Button.h b/fluid/Shortcut_Button.h index eb592c077..b239cc14b 100644 --- a/fluid/Shortcut_Button.h +++ b/fluid/Shortcut_Button.h @@ -1,5 +1,5 @@ // -// "$Id: Shortcut_Button.h,v 1.3.2.3.2.1 2002/01/01 15:11:29 easysw Exp $" +// "$Id: Shortcut_Button.h,v 1.3.2.3.2.2 2002/08/09 22:57:00 easysw Exp $" // // Shortcut header file for the Fast Light Tool Kit (FLTK). // @@ -30,10 +30,10 @@ public: int svalue; int handle(int); void draw(); - Shortcut_Button(int x, int y, int w, int h, const char* l = 0) : - Fl_Button(x,y,w,h,l) {svalue = 0;} + Shortcut_Button(int X,int Y,int W,int H, const char* l = 0) : + Fl_Button(X,Y,W,H,l) {svalue = 0;} }; // -// End of "$Id: Shortcut_Button.h,v 1.3.2.3.2.1 2002/01/01 15:11:29 easysw Exp $". +// End of "$Id: Shortcut_Button.h,v 1.3.2.3.2.2 2002/08/09 22:57:00 easysw Exp $". // diff --git a/fluid/file.cxx b/fluid/file.cxx index cd3610169..7cc2daac8 100644 --- a/fluid/file.cxx +++ b/fluid/file.cxx @@ -1,5 +1,5 @@ // -// "$Id: file.cxx,v 1.7.2.6.2.6 2002/05/16 12:47:43 easysw Exp $" +// "$Id: file.cxx,v 1.7.2.6.2.7 2002/08/09 22:57:00 easysw Exp $" // // Fluid file routines for the Fast Light Tool Kit (FLTK). // @@ -465,9 +465,9 @@ static void read_children(Fl_Type *p, int paste) { t->open_ = 0; for (;;) { - const char *c = read_word(); - if (!c || !strcmp(c,"}")) break; - t->read_property(c); + const char *cc = read_word(); + if (!cc || !strcmp(cc,"}")) break; + t->read_property(cc); } if (!t->is_parent()) continue; @@ -631,5 +631,5 @@ void read_fdesign() { } // -// End of "$Id: file.cxx,v 1.7.2.6.2.6 2002/05/16 12:47:43 easysw Exp $". +// End of "$Id: file.cxx,v 1.7.2.6.2.7 2002/08/09 22:57:00 easysw Exp $". // diff --git a/fluid/fluid.cxx b/fluid/fluid.cxx index 4a4d20f50..d1be42831 100644 --- a/fluid/fluid.cxx +++ b/fluid/fluid.cxx @@ -1,5 +1,5 @@ // -// "$Id: fluid.cxx,v 1.15.2.13.2.29 2002/06/28 21:10:19 easysw Exp $" +// "$Id: fluid.cxx,v 1.15.2.13.2.30 2002/08/09 22:57:00 easysw Exp $" // // FLUID main entry for the Fast Light Tool Kit (FLTK). // @@ -93,7 +93,7 @@ void goto_source_dir() { const char *p = fl_filename_name(filename); if (p <= filename) return; // it is in the current directory char buffer[1024]; - strcpy(buffer,filename); + strlcpy(buffer, filename, sizeof(buffer)); int n = p-filename; if (n>1) n--; buffer[n] = 0; if (!pwd) { pwd = getcwd(0,1024); @@ -218,24 +218,25 @@ void write_cb(Fl_Widget *, void *) { } char cname[1024]; char hname[1024]; - strcpy(i18n_program, fl_filename_name(filename)); - fl_filename_setext(i18n_program, ""); + strlcpy(i18n_program, fl_filename_name(filename), sizeof(i18n_program)); + fl_filename_setext(i18n_program, sizeof(i18n_program), ""); if (*code_file_name == '.' && strchr(code_file_name, '/') == NULL) { - strcpy(cname,fl_filename_name(filename)); - fl_filename_setext(cname, code_file_name); + strlcpy(cname, fl_filename_name(filename), sizeof(cname)); + fl_filename_setext(cname, sizeof(cname), code_file_name); } else { - strcpy(cname, code_file_name); + strlcpy(cname, code_file_name, sizeof(hname)); } if (*header_file_name == '.' && strchr(header_file_name, '/') == NULL) { - strcpy(hname,fl_filename_name(filename)); - fl_filename_setext(hname, header_file_name); + strlcpy(hname, fl_filename_name(filename), sizeof(hname)); + fl_filename_setext(hname, sizeof(hname), header_file_name); } else { - strcpy(hname, header_file_name); + strlcpy(hname, header_file_name, sizeof(hname)); } if (!compile_only) goto_source_dir(); int x = write_code(cname,hname); if (!compile_only) leave_source_dir(); - strcat(cname, " and "); strcat(cname,hname); + strlcat(cname, " and ", sizeof(cname)); + strlcat(cname, hname, sizeof(cname)); if (compile_only) { if (!x) {fprintf(stderr,"%s : %s\n",cname,strerror(errno)); exit(1);} } else { @@ -254,8 +255,8 @@ void write_strings_cb(Fl_Widget *, void *) { if (!filename) return; } char sname[1024]; - strcpy(sname,fl_filename_name(filename)); - fl_filename_setext(sname, exts[i18n_type]); + strlcpy(sname, fl_filename_name(filename), sizeof(sname)); + fl_filename_setext(sname, sizeof(sname), exts[i18n_type]); if (!compile_only) goto_source_dir(); int x = write_strings(sname); if (!compile_only) leave_source_dir(); @@ -365,7 +366,7 @@ void about_cb(Fl_Widget *, void *) { void show_help(const char *name) { const char *docdir; - char filename[1024]; + char helpname[1024]; if (!help_dialog) help_dialog = new Fl_Help_Dialog(); @@ -374,16 +375,17 @@ void show_help(const char *name) { // Doesn't make sense to have a hardcoded fallback static char fltk_docdir[1024]; - strcpy(fltk_docdir, __XOS2RedirRoot("/XFree86/lib/X11/fltk/doc")); + strlcpy(fltk_docdir, __XOS2RedirRoot("/XFree86/lib/X11/fltk/doc"), + sizeof(fltk_docdir)); docdir = fltk_docdir; #else docdir = FLTK_DOCDIR; #endif // __EMX__ } - snprintf(filename, sizeof(filename), "%s/%s", docdir, name); + snprintf(helpname, sizeof(helpname), "%s/%s", docdir, name); - help_dialog->load(filename); + help_dialog->load(helpname); help_dialog->show(); } @@ -539,11 +541,11 @@ void load_history() { } // Update file history from preferences... -void update_history(const char *filename) { +void update_history(const char *flname) { int i; // Looping var char absolute[1024]; - fl_filename_absolute(absolute, sizeof(absolute), filename); + fl_filename_absolute(absolute, sizeof(absolute), flname); for (i = 0; i < 10; i ++) #if defined(WIN32) || defined(__APPLE__) @@ -556,7 +558,7 @@ void update_history(const char *filename) { if (i >= 10) i = 9; - // Move the other filenames down in the list... + // Move the other flnames down in the list... memmove(absolute_history + 1, absolute_history, i * sizeof(absolute_history[0])); memmove(relative_history + 1, relative_history, @@ -795,5 +797,5 @@ int main(int argc,char **argv) { } // -// End of "$Id: fluid.cxx,v 1.15.2.13.2.29 2002/06/28 21:10:19 easysw Exp $". +// End of "$Id: fluid.cxx,v 1.15.2.13.2.30 2002/08/09 22:57:00 easysw Exp $". // diff --git a/src/Fl_Scroll.cxx b/src/Fl_Scroll.cxx index 3eeda1046..22593c146 100644 --- a/src/Fl_Scroll.cxx +++ b/src/Fl_Scroll.cxx @@ -1,5 +1,5 @@ // -// "$Id: Fl_Scroll.cxx,v 1.7.2.6.2.1 2002/01/01 15:11:31 easysw Exp $" +// "$Id: Fl_Scroll.cxx,v 1.7.2.6.2.2 2002/08/09 22:57:00 easysw Exp $" // // Scroll widget for the Fast Light Tool Kit (FLTK). // @@ -29,9 +29,8 @@ // Insure the scrollbars are the last children: void Fl_Scroll::fix_scrollbar_order() { - Fl_Widget*const* a = array(); + Fl_Widget** a = (Fl_Widget**)array(); if (a[children()-1] != &scrollbar) { - Fl_Widget** a = (Fl_Widget**)array(); int i,j; for (i = j = 0; j < children(); j++) if (a[j] != &hscrollbar && a[j] != &scrollbar) a[i++] = a[j]; a[i++] = &hscrollbar; @@ -249,5 +248,5 @@ int Fl_Scroll::handle(int event) { } // -// End of "$Id: Fl_Scroll.cxx,v 1.7.2.6.2.1 2002/01/01 15:11:31 easysw Exp $". +// End of "$Id: Fl_Scroll.cxx,v 1.7.2.6.2.2 2002/08/09 22:57:00 easysw Exp $". // diff --git a/src/gl_draw.cxx b/src/gl_draw.cxx index 5d8fa6d5c..9175126e3 100644 --- a/src/gl_draw.cxx +++ b/src/gl_draw.cxx @@ -1,5 +1,5 @@ // -// "$Id: gl_draw.cxx,v 1.7.2.5.2.8 2002/06/27 04:29:39 matthiaswm Exp $" +// "$Id: gl_draw.cxx,v 1.7.2.5.2.9 2002/08/09 22:57:00 easysw Exp $" // // OpenGL drawing support routines for the Fast Light Tool Kit (FLTK). // @@ -47,21 +47,21 @@ void gl_font(int fontid, int size) { if (!fl_fontsize->listbase) { #ifdef WIN32 int base = fl_fontsize->metr.tmFirstChar; - int size = fl_fontsize->metr.tmLastChar-base+1; + int count = fl_fontsize->metr.tmLastChar-base+1; HFONT oldFid = (HFONT)SelectObject(fl_gc, fl_fontsize->fid); fl_fontsize->listbase = glGenLists(256); - wglUseFontBitmaps(fl_gc, base, size, fl_fontsize->listbase+base); + wglUseFontBitmaps(fl_gc, base, count, fl_fontsize->listbase+base); SelectObject(fl_gc, oldFid); #elif defined(__APPLE__) - // undefined characters automatically receive an empty GL LIst in aglUseFont + // undefined characters automatically receive an empty GL list in aglUseFont fl_fontsize->listbase = glGenLists(256); aglUseFont(aglGetCurrentContext(), fl_fontsize->font, fl_fontsize->face, fl_fontsize->size, 0, 256, fl_fontsize->listbase); #else int base = fl_xfont->min_char_or_byte2; - int size = fl_xfont->max_char_or_byte2-base+1; + int count = fl_xfont->max_char_or_byte2-base+1; fl_fontsize->listbase = glGenLists(256); - glXUseXFont(fl_xfont->fid, base, size, fl_fontsize->listbase+base); + glXUseXFont(fl_xfont->fid, base, count, fl_fontsize->listbase+base); #endif } glListBase(fl_fontsize->listbase); @@ -159,5 +159,5 @@ void gl_draw_image(const uchar* b, int x, int y, int w, int h, int d, int ld) { #endif // -// End of "$Id: gl_draw.cxx,v 1.7.2.5.2.8 2002/06/27 04:29:39 matthiaswm Exp $". +// End of "$Id: gl_draw.cxx,v 1.7.2.5.2.9 2002/08/09 22:57:00 easysw Exp $". // diff --git a/test/bitmap.cxx b/test/bitmap.cxx index 72dc8cfd0..755dd16c9 100644 --- a/test/bitmap.cxx +++ b/test/bitmap.cxx @@ -1,5 +1,5 @@ // -// "$Id: bitmap.cxx,v 1.4.2.3.2.3 2002/01/01 15:11:32 easysw Exp $" +// "$Id: bitmap.cxx,v 1.4.2.3.2.4 2002/08/09 22:57:00 easysw Exp $" // // Bitmap label test program for the Fast Light Tool Kit (FLTK). // @@ -117,9 +117,9 @@ void button_cb(Fl_Widget *,void *) { } int main(int argc, char **argv) { - Fl_Window window(400,400); ::w = &window; - Fl_Button b(140,160,120,120,"Bitmap"); ::b = &b; - (new Fl_Bitmap(sorceress_bits,sorceress_width,sorceress_height))->label(&b); + w = new Fl_Window(400,400); + b = new Fl_Button(140,160,120,120,"Bitmap"); + b->image(new Fl_Bitmap(sorceress_bits,sorceress_width,sorceress_height)); leftb = new Fl_Toggle_Button(25,50,50,25,"left"); leftb->callback(button_cb); rightb = new Fl_Toggle_Button(75,50,50,25,"right"); @@ -134,12 +134,12 @@ int main(int argc, char **argv) { overb->callback(button_cb); inactb = new Fl_Toggle_Button(125,75,100,25,"inactive"); inactb->callback(button_cb); - window.resizable(window); - window.end(); - window.show(argc, argv); + w->resizable(w); + w->end(); + w->show(argc, argv); return Fl::run(); } // -// End of "$Id: bitmap.cxx,v 1.4.2.3.2.3 2002/01/01 15:11:32 easysw Exp $". +// End of "$Id: bitmap.cxx,v 1.4.2.3.2.4 2002/08/09 22:57:00 easysw Exp $". // diff --git a/test/checkers.cxx b/test/checkers.cxx index 65b33a4ca..555ff6ba1 100644 --- a/test/checkers.cxx +++ b/test/checkers.cxx @@ -1,5 +1,5 @@ // -// "$Id: checkers.cxx,v 1.9.2.7.2.2 2002/05/16 12:47:43 easysw Exp $" +// "$Id: checkers.cxx,v 1.9.2.7.2.3 2002/08/09 22:57:00 easysw Exp $" // // Checkers game for the Fast Light Tool Kit (FLTK). // @@ -184,7 +184,7 @@ char check(int target,int direction) { int src = target+direction; if (tb[src] == FRIENDKING); else if (direction < 0 || tb[src] != FRIEND) return(0); - piece a = tb[target]; piece b = tb[src]; + piece aa = tb[target]; piece bb = tb[src]; tb[target] = EMPTY; tb[src] = EMPTY; int safe = (tb[src-4]&FRIEND && tb[src-8]&ENEMY @@ -195,7 +195,7 @@ char check(int target,int direction) { ||tb[src+5]&FRIEND && tb[src+10]==ENEMYKING ||tb[dst+4]==ENEMYKING && !tb[dst-4] ||tb[dst+5]==ENEMYKING && !tb[dst-5]); - tb[target] = a; tb[src] = b; + tb[target] = aa; tb[src] = bb; return(safe); } @@ -1355,5 +1355,5 @@ int main(int argc, char **argv) { } // -// End of "$Id: checkers.cxx,v 1.9.2.7.2.2 2002/05/16 12:47:43 easysw Exp $". +// End of "$Id: checkers.cxx,v 1.9.2.7.2.3 2002/08/09 22:57:00 easysw Exp $". // |
