Skip to content

Commit

Permalink
Move the rest of the image file formats (except for XBM and XPM) to
Browse files Browse the repository at this point in the history
the fltk_images library; saves about 16k in the FLTK core library on my
Intel system.

Fix a memory leak bug in most of the fl_set_fonts*.cxx implementations;
as a result, the Fl_Fontdesc structure now has a fontname member to old
the human-readable font name.

Lots of fixes for shadowed variables, etc.

Use snprintf, strlcpy, and strlcat in more places.


git-svn-id: file:///fltk/svn/fltk/branches/branch-1.1@2566 ea41ed52-d2ee-0310-a9c1-e6b18d33e121
  • Loading branch information
michaelrsweet committed Aug 9, 2002
1 parent 27a54dc commit a6b9352
Show file tree
Hide file tree
Showing 55 changed files with 1,106 additions and 1,095 deletions.
10 changes: 10 additions & 0 deletions CHANGES
@@ -1,6 +1,16 @@
CHANGES IN FLTK 1.1.0

- Documentation updates.
- More snprintf/strlcpy/strlcat changes where needed.
- Fl::get_font_name() would leak 128 bytes.
- Eliminated most of the "shadowed" variables to avoid
potential problems with using the wrong copy of "foo"
in a class method.
- Moved Fl_BMP_Image, Fl_GIF_Image, and Fl_PNM_Image to
the fltk_images library, so the only image formats
that are supported by the core library are XBM and XPM
files. This reduces the size of the FLTK core library
by about 16k...
- The Fl_Text_Display::resize() method was incorrectly
flagged as protected.
- Fixed some memory/initialization bugs in
Expand Down
8 changes: 4 additions & 4 deletions FL/Fl.H
@@ -1,5 +1,5 @@
//
// "$Id: Fl.H,v 1.8.2.11.2.19 2002/07/30 14:57:02 easysw Exp $"
// "$Id: Fl.H,v 1.8.2.11.2.20 2002/08/09 01:09:48 easysw Exp $"
//
// Main header file for the Fast Light Tool Kit (FLTK).
//
Expand Down Expand Up @@ -69,7 +69,7 @@ public: // should be private!
static int compose_state;
static int visible_focus_;
static int dnd_text_ops_;
static void damage(int x) {damage_ = x;}
static void damage(int d) {damage_ = d;}

static void (*idle)();

Expand Down Expand Up @@ -237,7 +237,7 @@ public:
static int event_button2() {return e_state&FL_BUTTON2;}
static int event_button3() {return e_state&FL_BUTTON3;}
static void set_idle(void (*cb)()) {idle = cb;}
static void grab(Fl_Window&w) {grab(&w);}
static void grab(Fl_Window&win) {grab(&win);}
static void release() {grab(0);}

// Visible focus methods...
Expand All @@ -258,5 +258,5 @@ public:
#endif // !Fl_H

//
// End of "$Id: Fl.H,v 1.8.2.11.2.19 2002/07/30 14:57:02 easysw Exp $".
// End of "$Id: Fl.H,v 1.8.2.11.2.20 2002/08/09 01:09:48 easysw Exp $".
//
8 changes: 4 additions & 4 deletions FL/Fl_Adjuster.H
@@ -1,5 +1,5 @@
//
// "$Id: Fl_Adjuster.H,v 1.5.2.3.2.1 2002/01/01 15:11:27 easysw Exp $"
// "$Id: Fl_Adjuster.H,v 1.5.2.3.2.2 2002/08/09 01:09:48 easysw Exp $"
//
// Adjuster widget header file for the Fast Light Tool Kit (FLTK).
//
Expand Down Expand Up @@ -41,13 +41,13 @@ protected:
FL_EXPORT int handle(int);
FL_EXPORT void value_damage();
public:
FL_EXPORT Fl_Adjuster(int x,int y,int w,int h,const char *l=0);
FL_EXPORT void soft(int x) {soft_ = x;}
FL_EXPORT Fl_Adjuster(int X,int Y,int W,int H,const char *l=0);
FL_EXPORT void soft(int s) {soft_ = s;}
FL_EXPORT int soft() const {return soft_;}
};

#endif

//
// End of "$Id: Fl_Adjuster.H,v 1.5.2.3.2.1 2002/01/01 15:11:27 easysw Exp $".
// End of "$Id: Fl_Adjuster.H,v 1.5.2.3.2.2 2002/08/09 01:09:48 easysw Exp $".
//
12 changes: 6 additions & 6 deletions FL/Fl_Box.H
@@ -1,5 +1,5 @@
//
// "$Id: Fl_Box.H,v 1.5.2.4.2.2 2002/04/12 20:16:07 easysw Exp $"
// "$Id: Fl_Box.H,v 1.5.2.4.2.3 2002/08/09 01:09:48 easysw Exp $"
//
// Box header file for the Fast Light Tool Kit (FLTK).
//
Expand Down Expand Up @@ -34,16 +34,16 @@ class Fl_Box : public Fl_Widget {
protected:
FL_EXPORT void draw();
public:
FL_EXPORT Fl_Box(int x, int y, int w, int h, const char *l=0)
: Fl_Widget(x,y,w,h,l) {}
FL_EXPORT Fl_Box(Fl_Boxtype b, int x, int y, int w, int h, const char *l)
: Fl_Widget(x,y,w,h,l) {box(b);}
FL_EXPORT Fl_Box(int X, int Y, int W, int H, const char *l=0)
: Fl_Widget(X,Y,W,H,l) {}
FL_EXPORT Fl_Box(Fl_Boxtype b, int X, int Y, int W, int H, const char *l)
: Fl_Widget(X,Y,W,H,l) {box(b);}

virtual FL_EXPORT int handle(int);
};

#endif

//
// End of "$Id: Fl_Box.H,v 1.5.2.4.2.2 2002/04/12 20:16:07 easysw Exp $".
// End of "$Id: Fl_Box.H,v 1.5.2.4.2.3 2002/08/09 01:09:48 easysw Exp $".
//
6 changes: 3 additions & 3 deletions FL/Fl_Menu_.H
@@ -1,5 +1,5 @@
//
// "$Id: Fl_Menu_.H,v 1.7.2.4.2.2 2002/01/01 15:11:27 easysw Exp $"
// "$Id: Fl_Menu_.H,v 1.7.2.4.2.3 2002/08/09 01:09:48 easysw Exp $"
//
// Menu base class header file for the Fast Light Tool Kit (FLTK).
//
Expand Down Expand Up @@ -65,7 +65,7 @@ public:
FL_EXPORT void replace(int,const char *);
FL_EXPORT void remove(int);
void shortcut(int i, int s) {menu_[i].shortcut(s);}
void mode(int i,int x) {menu_[i].flags = x;}
void mode(int i,int fl) {menu_[i].flags = fl;}
int mode(int i) const {return menu_[i].flags;}

const Fl_Menu_Item *mvalue() const {return value_;}
Expand Down Expand Up @@ -93,5 +93,5 @@ public:
#endif

//
// End of "$Id: Fl_Menu_.H,v 1.7.2.4.2.2 2002/01/01 15:11:27 easysw Exp $".
// End of "$Id: Fl_Menu_.H,v 1.7.2.4.2.3 2002/08/09 01:09:48 easysw Exp $".
//
8 changes: 4 additions & 4 deletions FL/Fl_Menu_Bar.H
@@ -1,5 +1,5 @@
//
// "$Id: Fl_Menu_Bar.H,v 1.5.2.4.2.1 2002/01/01 15:11:27 easysw Exp $"
// "$Id: Fl_Menu_Bar.H,v 1.5.2.4.2.2 2002/08/09 01:09:48 easysw Exp $"
//
// Menu bar header file for the Fast Light Tool Kit (FLTK).
//
Expand Down Expand Up @@ -33,12 +33,12 @@ protected:
FL_EXPORT void draw();
public:
FL_EXPORT int handle(int);
Fl_Menu_Bar(int x,int y,int w,int h,const char *l=0)
: Fl_Menu_(x,y,w,h,l) {}
Fl_Menu_Bar(int X, int Y, int W, int H,const char *l=0)
: Fl_Menu_(X,Y,W,H,l) {}
};

#endif

//
// End of "$Id: Fl_Menu_Bar.H,v 1.5.2.4.2.1 2002/01/01 15:11:27 easysw Exp $".
// End of "$Id: Fl_Menu_Bar.H,v 1.5.2.4.2.2 2002/08/09 01:09:48 easysw Exp $".
//
12 changes: 6 additions & 6 deletions FL/Fl_Pixmap.H
@@ -1,5 +1,5 @@
//
// "$Id: Fl_Pixmap.H,v 1.6.2.8.2.8 2002/08/05 17:50:23 easysw Exp $"
// "$Id: Fl_Pixmap.H,v 1.6.2.8.2.9 2002/08/09 01:09:48 easysw Exp $"
//
// Pixmap header file for the Fast Light Tool Kit (FLTK).
//
Expand Down Expand Up @@ -50,10 +50,10 @@ class FL_EXPORT Fl_Pixmap : public Fl_Image {
Fl_Offscreen id; // for internal use
Fl_Bitmask mask; // for internal use (mask bitmap)

explicit Fl_Pixmap(char * const * d) : Fl_Image(-1,0,1), alloc_data(0), id(0), mask(0) {set_data((const char*const*)d); measure();}
explicit Fl_Pixmap(uchar* const * d) : Fl_Image(-1,0,1), alloc_data(0), id(0), mask(0) {set_data((const char*const*)d); measure();}
explicit Fl_Pixmap(const char * const * d) : Fl_Image(-1,0,1), alloc_data(0), id(0), mask(0) {set_data((const char*const*)d); measure();}
explicit Fl_Pixmap(const uchar* const * d) : Fl_Image(-1,0,1), alloc_data(0), id(0), mask(0) {set_data((const char*const*)d); measure();}
explicit Fl_Pixmap(char * const * D) : Fl_Image(-1,0,1), alloc_data(0), id(0), mask(0) {set_data((const char*const*)D); measure();}
explicit Fl_Pixmap(uchar* const * D) : Fl_Image(-1,0,1), alloc_data(0), id(0), mask(0) {set_data((const char*const*)D); measure();}
explicit Fl_Pixmap(const char * const * D) : Fl_Image(-1,0,1), alloc_data(0), id(0), mask(0) {set_data((const char*const*)D); measure();}
explicit Fl_Pixmap(const uchar* const * D) : Fl_Image(-1,0,1), alloc_data(0), id(0), mask(0) {set_data((const char*const*)D); measure();}
virtual ~Fl_Pixmap();
virtual Fl_Image *copy(int W, int H);
Fl_Image *copy() { return copy(w(), h()); }
Expand All @@ -69,5 +69,5 @@ class FL_EXPORT Fl_Pixmap : public Fl_Image {
#endif

//
// End of "$Id: Fl_Pixmap.H,v 1.6.2.8.2.8 2002/08/05 17:50:23 easysw Exp $".
// End of "$Id: Fl_Pixmap.H,v 1.6.2.8.2.9 2002/08/09 01:09:48 easysw Exp $".
//
8 changes: 4 additions & 4 deletions FL/Fl_Return_Button.H
@@ -1,5 +1,5 @@
//
// "$Id: Fl_Return_Button.H,v 1.5.2.3.2.1 2002/01/01 15:11:28 easysw Exp $"
// "$Id: Fl_Return_Button.H,v 1.5.2.3.2.2 2002/08/09 01:09:48 easysw Exp $"
//
// Return button header file for the Fast Light Tool Kit (FLTK).
//
Expand Down Expand Up @@ -32,12 +32,12 @@ protected:
FL_EXPORT void draw();
public:
FL_EXPORT int handle(int);
Fl_Return_Button(int x,int y,int w,int h,const char *l=0)
: Fl_Button(x,y,w,h,l) {}
Fl_Return_Button(int X, int Y, int W, int H,const char *l=0)
: Fl_Button(X,Y,W,H,l) {}
};

#endif

//
// End of "$Id: Fl_Return_Button.H,v 1.5.2.3.2.1 2002/01/01 15:11:28 easysw Exp $".
// End of "$Id: Fl_Return_Button.H,v 1.5.2.3.2.2 2002/08/09 01:09:48 easysw Exp $".
//
8 changes: 4 additions & 4 deletions FL/Fl_Scrollbar.H
@@ -1,5 +1,5 @@
//
// "$Id: Fl_Scrollbar.H,v 1.5.2.4.2.1 2002/01/01 15:11:28 easysw Exp $"
// "$Id: Fl_Scrollbar.H,v 1.5.2.4.2.2 2002/08/09 01:09:48 easysw Exp $"
//
// Scroll bar header file for the Fast Light Tool Kit (FLTK).
//
Expand Down Expand Up @@ -43,8 +43,8 @@ public:
FL_EXPORT int handle(int);

int value() {return int(Fl_Slider::value());}
int value(int position, int size, int top, int total) {
return scrollvalue(position, size, top, total);
int value(int p, int s, int top, int total) {
return scrollvalue(p, s, top, total);
}
int linesize() const {return linesize_;}
void linesize(int i) {linesize_ = i;}
Expand All @@ -54,5 +54,5 @@ public:
#endif

//
// End of "$Id: Fl_Scrollbar.H,v 1.5.2.4.2.1 2002/01/01 15:11:28 easysw Exp $".
// End of "$Id: Fl_Scrollbar.H,v 1.5.2.4.2.2 2002/08/09 01:09:48 easysw Exp $".
//
6 changes: 3 additions & 3 deletions FL/Fl_Value_Input.H
@@ -1,5 +1,5 @@
//
// "$Id: Fl_Value_Input.H,v 1.5.2.3.2.2 2002/01/01 15:11:28 easysw Exp $"
// "$Id: Fl_Value_Input.H,v 1.5.2.3.2.3 2002/08/09 01:09:48 easysw Exp $"
//
// Value input header file for the Fast Light Tool Kit (FLTK).
//
Expand Down Expand Up @@ -42,7 +42,7 @@ public:
FL_EXPORT void resize(int,int,int,int);
FL_EXPORT Fl_Value_Input(int x,int y,int w,int h,const char *l=0);

void soft(char x) {soft_ = x;}
void soft(char s) {soft_ = s;}
char soft() const {return soft_;}

Fl_Font textfont() const {return input.textfont();}
Expand All @@ -59,5 +59,5 @@ public:
#endif

//
// End of "$Id: Fl_Value_Input.H,v 1.5.2.3.2.2 2002/01/01 15:11:28 easysw Exp $".
// End of "$Id: Fl_Value_Input.H,v 1.5.2.3.2.3 2002/08/09 01:09:48 easysw Exp $".
//
8 changes: 4 additions & 4 deletions FL/Fl_Widget.H
@@ -1,5 +1,5 @@
//
// "$Id: Fl_Widget.H,v 1.6.2.4.2.15 2002/07/23 15:07:32 easysw Exp $"
// "$Id: Fl_Widget.H,v 1.6.2.4.2.16 2002/08/09 01:09:48 easysw Exp $"
//
// Widget header file for the Fast Light Tool Kit (FLTK).
//
Expand Down Expand Up @@ -103,7 +103,7 @@ public:
FL_EXPORT virtual void draw() = 0;
FL_EXPORT virtual int handle(int);
Fl_Group* parent() const {return parent_;}
void parent(Fl_Group* w) {parent_ = w;} // for hacks only, Fl_Group::add()
void parent(Fl_Group* p) {parent_ = p;} // for hacks only, Fl_Group::add()

uchar type() const {return type_;}
void type(uchar t) {type_ = t;}
Expand Down Expand Up @@ -195,7 +195,7 @@ public:
FL_EXPORT void damage(uchar c);
FL_EXPORT void damage(uchar c,int,int,int,int);
FL_EXPORT void draw_label(int, int, int, int, Fl_Align) const;
void measure_label(int& x, int& y) {label_.measure(x,y);}
void measure_label(int& xx, int& yy) {label_.measure(xx,yy);}

FL_EXPORT Fl_Window* window() const ;

Expand All @@ -212,5 +212,5 @@ public:
#endif

//
// End of "$Id: Fl_Widget.H,v 1.6.2.4.2.15 2002/07/23 15:07:32 easysw Exp $".
// End of "$Id: Fl_Widget.H,v 1.6.2.4.2.16 2002/08/09 01:09:48 easysw Exp $".
//
10 changes: 5 additions & 5 deletions FL/x.H
@@ -1,5 +1,5 @@
//
// "$Id: x.H,v 1.10.2.8.2.9 2002/04/15 12:19:01 easysw Exp $"
// "$Id: x.H,v 1.10.2.8.2.10 2002/08/09 01:09:48 easysw Exp $"
//
// X11 header file for the Fast Light Tool Kit (FLTK).
//
Expand Down Expand Up @@ -114,15 +114,15 @@ public:
char wait_for_expose;
char backbuffer_bad; // used for XDBE
static FL_EXPORT Fl_X* first;
static FL_EXPORT Fl_X* i(const Fl_Window* w) {return w->i;}
static FL_EXPORT Fl_X* i(const Fl_Window* wi) {return wi->i;}
FL_EXPORT void setwindow(Fl_Window* wi) {w=wi; wi->i=this;}
FL_EXPORT void sendxjunk();
static FL_EXPORT void make_xid(Fl_Window*,XVisualInfo* =fl_visual, Colormap=fl_colormap);
static FL_EXPORT Fl_X* set_xid(Fl_Window*, Window);
// kludges to get around protection:
FL_EXPORT void flush() {w->flush();}
static FL_EXPORT void x(Fl_Window* w, int X) {w->x(X);}
static FL_EXPORT void y(Fl_Window* w, int Y) {w->y(Y);}
static FL_EXPORT void x(Fl_Window* wi, int X) {wi->x(X);}
static FL_EXPORT void y(Fl_Window* wi, int Y) {wi->y(Y);}
};

// convert xid <-> Fl_Window:
Expand All @@ -138,5 +138,5 @@ extern FL_EXPORT int fl_parse_color(const char* p, uchar& r, uchar& g, uchar& b)
#endif

//
// End of "$Id: x.H,v 1.10.2.8.2.9 2002/04/15 12:19:01 easysw Exp $".
// End of "$Id: x.H,v 1.10.2.8.2.10 2002/08/09 01:09:48 easysw Exp $".
//
6 changes: 3 additions & 3 deletions 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.82 2002/08/05 17:50:21 easysw Exp $"
dnl "$Id: configure.in,v 1.33.2.31.2.83 2002/08/09 01:09:47 easysw Exp $"
dnl
dnl Configuration script for the Fast Light Tool Kit (FLTK).
dnl
Expand Down Expand Up @@ -615,7 +615,7 @@ if test -n "$GCC"; then
CXX="$CC"

# Show all warnings when compiling...
OPTIM="-Wall $OPTIM"
OPTIM="-Wall -Wshadow -Wconversion -Winline $OPTIM"

# Set the default compiler optimizations...
if test -z "$DEBUGFLAG"; then
Expand Down Expand Up @@ -782,5 +782,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.82 2002/08/05 17:50:21 easysw Exp $".
dnl End of "$Id: configure.in,v 1.33.2.31.2.83 2002/08/09 01:09:47 easysw Exp $".
dnl

0 comments on commit a6b9352

Please sign in to comment.