From fdcdc8fd46547a7cd77010db6b57f9cc9f4f51d1 Mon Sep 17 00:00:00 2001 From: Michael R Sweet Date: Tue, 11 Dec 2001 16:03:13 +0000 Subject: Multiple fixes from Sebastien. git-svn-id: file:///fltk/svn/fltk/branches/branch-1.1@1833 ea41ed52-d2ee-0310-a9c1-e6b18d33e121 --- src/Fl_Button.cxx | 6 +++--- src/Fl_Chart.cxx | 10 +++++----- src/Fl_File_Chooser.cxx | 20 ++++++++++---------- src/Fl_File_Chooser.fl | 7 ++++--- src/Fl_GIF_Image.cxx | 23 ++++++++++++++++++----- src/Fl_Gl_Window.cxx | 15 +++++++++------ src/Fl_Help_View.cxx | 13 ++++++++----- src/Fl_PNG_Image.cxx | 7 ++++--- src/Fl_PNM_Image.cxx | 11 +++++++++-- src/Fl_Shared_Image.cxx | 6 +++--- src/Fl_Tiled_Image.cxx | 26 ++++++++++++++++---------- src/Fl_XBM_Image.cxx | 24 +++++++++++++++++++----- src/Fl_arg.cxx | 7 ++++--- src/filename_absolute.cxx | 26 ++++++++++---------------- src/filename_expand.cxx | 6 +++--- src/filename_match.cxx | 13 ++++--------- src/fl_font.cxx | 12 +++--------- 17 files changed, 132 insertions(+), 100 deletions(-) (limited to 'src') diff --git a/src/Fl_Button.cxx b/src/Fl_Button.cxx index 5a013bfa3..4b26865c9 100644 --- a/src/Fl_Button.cxx +++ b/src/Fl_Button.cxx @@ -1,5 +1,5 @@ // -// "$Id: Fl_Button.cxx,v 1.4.2.6.2.5 2001/11/03 19:24:22 easysw Exp $" +// "$Id: Fl_Button.cxx,v 1.4.2.6.2.6 2001/12/11 16:03:11 easysw Exp $" // // Button widget for the Fast Light Tool Kit (FLTK). // @@ -65,8 +65,8 @@ int Fl_Button::handle(int event) { // if ((value_?selection_color():color())==FL_GRAY) redraw(); return 1; case FL_PUSH: - case FL_DRAG: if (Fl::visible_focus()) take_focus(); + case FL_DRAG: if (Fl::event_inside(this)) { if (type() == FL_RADIO_BUTTON) newval = 1; else newval = !oldval; @@ -138,5 +138,5 @@ Fl_Button::Fl_Button(int x,int y,int w,int h, const char *l) } // -// End of "$Id: Fl_Button.cxx,v 1.4.2.6.2.5 2001/11/03 19:24:22 easysw Exp $". +// End of "$Id: Fl_Button.cxx,v 1.4.2.6.2.6 2001/12/11 16:03:11 easysw Exp $". // diff --git a/src/Fl_Chart.cxx b/src/Fl_Chart.cxx index ebeffef6b..7b50ecd12 100644 --- a/src/Fl_Chart.cxx +++ b/src/Fl_Chart.cxx @@ -1,5 +1,5 @@ // -// "$Id: Fl_Chart.cxx,v 1.5.2.6.2.2 2001/11/22 15:35:01 easysw Exp $" +// "$Id: Fl_Chart.cxx,v 1.5.2.6.2.3 2001/12/11 16:03:12 easysw Exp $" // // Forms-compatible chart widget for the Fast Light Tool Kit (FLTK). // @@ -312,7 +312,7 @@ void Fl_Chart::add(double val, const char *str, unsigned col) { entries[numb].val = float(val); entries[numb].col = col; if (str) { - strncpy(entries[numb].str,str,FL_CHART_LABEL_MAX+1); + strncpy(entries[numb].str,str,FL_CHART_LABEL_MAX); entries[numb].str[FL_CHART_LABEL_MAX] = 0; } else { entries[numb].str[0] = 0; @@ -336,7 +336,7 @@ void Fl_Chart::insert(int index, double val, const char *str, unsigned col) { entries[index-1].val = float(val); entries[index-1].col = col; if (str) { - strncpy(entries[index-1].str,str,FL_CHART_LABEL_MAX+1); + strncpy(entries[index-1].str,str,FL_CHART_LABEL_MAX); entries[index-1].str[FL_CHART_LABEL_MAX] = 0; } else { entries[index-1].str[0] = 0; @@ -349,7 +349,7 @@ void Fl_Chart::replace(int index,double val, const char *str, unsigned col) { entries[index-1].val = float(val); entries[index-1].col = col; if (str) { - strncpy(entries[index-1].str,str,FL_CHART_LABEL_MAX+1); + strncpy(entries[index-1].str,str,FL_CHART_LABEL_MAX); entries[index-1].str[FL_CHART_LABEL_MAX] = 0; } else { entries[index-1].str[0] = 0; @@ -378,5 +378,5 @@ void Fl_Chart::maxsize(int m) { } // -// End of "$Id: Fl_Chart.cxx,v 1.5.2.6.2.2 2001/11/22 15:35:01 easysw Exp $". +// End of "$Id: Fl_Chart.cxx,v 1.5.2.6.2.3 2001/12/11 16:03:12 easysw Exp $". // diff --git a/src/Fl_File_Chooser.cxx b/src/Fl_File_Chooser.cxx index 984b11a8c..9ab24d56b 100644 --- a/src/Fl_File_Chooser.cxx +++ b/src/Fl_File_Chooser.cxx @@ -53,10 +53,10 @@ void Fl_File_Chooser::cb_upButton(Fl_Button* o, void* v) { } #include -static unsigned char bits_up[] = +static unsigned char idata_up[] = "\0\0x\0\204\0\2\1""1\376y\200\375\200""1\200""1\200""1\200""1\200""1\200\1\ \200\1\200\377\377\0\0"; -static Fl_Bitmap bitmap_up(bits_up, 16, 16); +static Fl_Bitmap image_up(idata_up, 16, 16); inline void Fl_File_Chooser::cb_newButton_i(Fl_Button*, void*) { newdir(); @@ -65,10 +65,10 @@ void Fl_File_Chooser::cb_newButton(Fl_Button* o, void* v) { ((Fl_File_Chooser*)(o->parent()->user_data()))->cb_newButton_i(o,v); } -static unsigned char bits_new[] = +static unsigned char idata_new[] = "\0\0x\0\204\0\2\1\1\376\1\200""1\200""1\200\375\200\375\200""1\200""1\200\1\ \200\1\200\377\377\0\0"; -static Fl_Bitmap bitmap_new(bits_new, 16, 16); +static Fl_Bitmap image_new(idata_new, 16, 16); inline void Fl_File_Chooser::cb_dirMenu_i(Fl_Choice*, void*) { char pathname[1024]; @@ -96,9 +96,9 @@ void Fl_File_Chooser::cb_(Fl_Button* o, void* v) { ((Fl_File_Chooser*)(o->parent()->user_data()))->cb__i(o,v); } -static unsigned char bits_allfiles[] = +static unsigned char idata_allfiles[] = "\374?\4 \4 \4 \204!\244%\304#\364/\364/\304#\244%\204!\4 \4 \4 \374?"; -static Fl_Bitmap bitmap_allfiles(bits_allfiles, 16, 16); +static Fl_Bitmap image_allfiles(idata_allfiles, 16, 16); Fl_File_Chooser::Fl_File_Chooser(const char *d, const char *p, int t, const char *title) { Fl_Window* w; @@ -127,13 +127,13 @@ Fl_File_Chooser::Fl_File_Chooser(const char *d, const char *p, int t, const char } { Fl_Button* o = upButton = new Fl_Button(280, 10, 25, 25); o->tooltip("Show the parent directory."); - o->image(bitmap_up); + o->image(image_up); o->labelsize(8); o->callback((Fl_Callback*)cb_upButton); } { Fl_Button* o = newButton = new Fl_Button(310, 10, 25, 25); o->tooltip("Create a new directory."); - o->image(bitmap_new); + o->image(image_new); o->labelsize(8); o->callback((Fl_Callback*)cb_newButton); } @@ -144,7 +144,7 @@ Fl_File_Chooser::Fl_File_Chooser(const char *d, const char *p, int t, const char } { Fl_Button* o = new Fl_Button(340, 10, 25, 25); o->tooltip("Change the filename filter."); - o->image(bitmap_allfiles); + o->image(image_allfiles); o->labelsize(28); o->labelcolor(4); o->callback((Fl_Callback*)cb_); @@ -154,7 +154,7 @@ Fl_File_Chooser::Fl_File_Chooser(const char *d, const char *p, int t, const char o->set_modal(); o->end(); } - window->size_range(345, 270, 345); + window->size_range(375, 315, 375); fileList->filter(p); type(t); value(d); diff --git a/src/Fl_File_Chooser.fl b/src/Fl_File_Chooser.fl index 16a19fe2c..b92548d44 100644 --- a/src/Fl_File_Chooser.fl +++ b/src/Fl_File_Chooser.fl @@ -84,12 +84,13 @@ if ((f = fl_input("New Filter?", code0 {\#include } } } - code {window->size_range(345, 270, 345); + code {window->size_range(375, 315, 375); fileList->filter(p); type(t); value(d); callback_ = 0; -data_ = 0;} {} +data_ = 0;} {selected + } } decl {void (*callback_)(Fl_File_Chooser*, void *);} {} decl {void *data_;} {} @@ -215,5 +216,5 @@ decl {FL_EXPORT char *fl_dir_chooser(const char *message,const char *fname);} {p decl {FL_EXPORT char *fl_file_chooser(const char *message,const char *pat,const char *fname);} {public } -decl {FL_EXPORT void fl_file_chooser_callback(void (*cb)(const char*));} {selected public +decl {FL_EXPORT void fl_file_chooser_callback(void (*cb)(const char*));} {public } diff --git a/src/Fl_GIF_Image.cxx b/src/Fl_GIF_Image.cxx index 99ba3b6ed..5d6e469de 100644 --- a/src/Fl_GIF_Image.cxx +++ b/src/Fl_GIF_Image.cxx @@ -1,5 +1,5 @@ // -// "$Id: Fl_GIF_Image.cxx,v 1.1.2.5 2001/11/24 18:07:57 easysw Exp $" +// "$Id: Fl_GIF_Image.cxx,v 1.1.2.6 2001/12/11 16:03:12 easysw Exp $" // // Fl_GIF_Image routines. // @@ -87,9 +87,15 @@ Fl_GIF_Image::Fl_GIF_Image(const char *infname) : Fl_Pixmap((char *const*)0) { } {char b[6]; - if (fread(b,1,6,GifFile)<6) return; /* quit on eof */ + if (fread(b,1,6,GifFile)<6) { + fclose(GifFile); + return; /* quit on eof */ + } if (b[0]!='G' || b[1]!='I' || b[2] != 'F') { - Fl::error("%s is not a GIF file.\n", infname); return;} + Fl::error("%s is not a GIF file.\n", infname); + fclose(GifFile); + return; + } if (b[3]!='8' || b[4]>'9' || b[5]!= 'a') Fl::warning("%s is version %c%c%c.",infname,b[3],b[4],b[5]); } @@ -128,7 +134,11 @@ Fl_GIF_Image::Fl_GIF_Image(const char *infname) : Fl_Pixmap((char *const*)0) { for (;;) { int i = NEXTBYTE; - if (i<0) {Fl::error("%s: unexpected EOF",infname); return;} + if (i<0) { + Fl::error("%s: unexpected EOF",infname); + fclose(GifFile); + return; + } int blocklen; // if (i == 0x3B) return 0; eof code @@ -185,6 +195,7 @@ Fl_GIF_Image::Fl_GIF_Image(const char *infname) : Fl_Pixmap((char *const*)0) { uchar *Image = new uchar[Width*Height]; if (!Image) { Fl::fatal("Insufficient memory for %s.", infname); + fclose(GifFile); return; } @@ -361,9 +372,11 @@ Fl_GIF_Image::Fl_GIF_Image(const char *infname) : Fl_Pixmap((char *const*)0) { alloc_data = 1; delete[] Image; + + fclose(GifFile); } // -// End of "$Id: Fl_GIF_Image.cxx,v 1.1.2.5 2001/11/24 18:07:57 easysw Exp $". +// End of "$Id: Fl_GIF_Image.cxx,v 1.1.2.6 2001/12/11 16:03:12 easysw Exp $". // diff --git a/src/Fl_Gl_Window.cxx b/src/Fl_Gl_Window.cxx index e4a16c81e..9b491cf6d 100644 --- a/src/Fl_Gl_Window.cxx +++ b/src/Fl_Gl_Window.cxx @@ -1,5 +1,5 @@ // -// "$Id: Fl_Gl_Window.cxx,v 1.12.2.22.2.3 2001/12/06 00:17:47 matthiaswm Exp $" +// "$Id: Fl_Gl_Window.cxx,v 1.12.2.22.2.4 2001/12/11 16:03:12 easysw Exp $" // // OpenGL window code for the Fast Light Tool Kit (FLTK). // @@ -339,11 +339,14 @@ Fl_Gl_Window::~Fl_Gl_Window() { void Fl_Gl_Window::init() { end(); // we probably don't want any children box(FL_NO_BOX); - mode_ = FL_RGB | FL_DEPTH | FL_DOUBLE; - alist = 0; + + mode_ = FL_RGB | FL_DEPTH | FL_DOUBLE; + alist = 0; context_ = 0; - g = 0; - overlay = 0; + g = 0; + overlay = 0; + valid_ = 0; + damage1_ = 0; } void Fl_Gl_Window::draw_overlay() {} @@ -351,5 +354,5 @@ void Fl_Gl_Window::draw_overlay() {} #endif // -// End of "$Id: Fl_Gl_Window.cxx,v 1.12.2.22.2.3 2001/12/06 00:17:47 matthiaswm Exp $". +// End of "$Id: Fl_Gl_Window.cxx,v 1.12.2.22.2.4 2001/12/11 16:03:12 easysw Exp $". // diff --git a/src/Fl_Help_View.cxx b/src/Fl_Help_View.cxx index 19b1ba53a..5550768c9 100644 --- a/src/Fl_Help_View.cxx +++ b/src/Fl_Help_View.cxx @@ -1,5 +1,5 @@ // -// "$Id: Fl_Help_View.cxx,v 1.1.2.17 2001/11/30 16:10:08 easysw Exp $" +// "$Id: Fl_Help_View.cxx,v 1.1.2.18 2001/12/11 16:03:12 easysw Exp $" // // Fl_Help_View widget routines. // @@ -162,13 +162,13 @@ Fl_Help_View::add_link(const char *n, // I - Name of link temp->w = xx + ww; temp->h = yy + hh; - strncpy(temp->filename, n, sizeof(temp->filename)); + strncpy(temp->filename, n, sizeof(temp->filename) - 1); temp->filename[sizeof(temp->filename) - 1] = '\0'; if ((target = strrchr(temp->filename, '#')) != NULL) { *target++ = '\0'; - strncpy(temp->name, target, sizeof(temp->name)); + strncpy(temp->name, target, sizeof(temp->name) - 1); temp->name[sizeof(temp->name) - 1] = '\0'; } else @@ -202,7 +202,7 @@ Fl_Help_View::add_target(const char *n, // I - Name of target temp = targets_ + ntargets_; temp->y = yy; - strncpy(temp->name, n, sizeof(temp->name)); + strncpy(temp->name, n, sizeof(temp->name) - 1); temp->name[sizeof(temp->name) - 1] = '\0'; ntargets_ ++; @@ -2042,6 +2042,9 @@ Fl_Help_View::handle(int event) // I - Event to handle yy = Fl::event_y() - y() + topline_; break; + case FL_LEAVE : + fl_cursor(FL_CURSOR_DEFAULT); + default : return (Fl_Group::handle(event)); } @@ -2549,5 +2552,5 @@ hscrollbar_callback(Fl_Widget *s, void *) // -// End of "$Id: Fl_Help_View.cxx,v 1.1.2.17 2001/11/30 16:10:08 easysw Exp $". +// End of "$Id: Fl_Help_View.cxx,v 1.1.2.18 2001/12/11 16:03:12 easysw Exp $". // diff --git a/src/Fl_PNG_Image.cxx b/src/Fl_PNG_Image.cxx index e12cd5c77..4bd420848 100644 --- a/src/Fl_PNG_Image.cxx +++ b/src/Fl_PNG_Image.cxx @@ -1,5 +1,5 @@ // -// "$Id: Fl_PNG_Image.cxx,v 1.1.2.2 2001/11/23 12:06:36 easysw Exp $" +// "$Id: Fl_PNG_Image.cxx,v 1.1.2.3 2001/12/11 16:03:12 easysw Exp $" // // Fl_PNG_Image routines. // @@ -25,6 +25,7 @@ // // Contents: // +// Fl_PNG_Image::Fl_PNG_Image() - Load a PNG image file. // // @@ -115,7 +116,7 @@ Fl_PNG_Image::Fl_PNG_Image(const char *png) // I - File to read png_read_rows(pp, rows, NULL, h()); // Free memory and return... - delete rows; + delete[] rows; png_read_end(pp, info); # ifdef HAVE_PNG_READ_DESTROY @@ -130,5 +131,5 @@ Fl_PNG_Image::Fl_PNG_Image(const char *png) // I - File to read // -// End of "$Id: Fl_PNG_Image.cxx,v 1.1.2.2 2001/11/23 12:06:36 easysw Exp $". +// End of "$Id: Fl_PNG_Image.cxx,v 1.1.2.3 2001/12/11 16:03:12 easysw Exp $". // diff --git a/src/Fl_PNM_Image.cxx b/src/Fl_PNM_Image.cxx index 13bcb8e49..0f5801f0b 100644 --- a/src/Fl_PNM_Image.cxx +++ b/src/Fl_PNM_Image.cxx @@ -1,5 +1,5 @@ // -// "$Id: Fl_PNM_Image.cxx,v 1.1.2.2 2001/11/28 18:09:08 easysw Exp $" +// "$Id: Fl_PNM_Image.cxx,v 1.1.2.3 2001/12/11 16:03:12 easysw Exp $" // // Fl_PNM_Image routines. // @@ -24,6 +24,7 @@ // // Contents: // +// Fl_PNM_Image::Fl_PNM_Image() - Load a PNM image... // // @@ -73,6 +74,12 @@ Fl_PNM_Image::Fl_PNM_Image(const char *name) // I - File to read // lineptr = fgets(line, sizeof(line), fp); + if (!lineptr) { + Fl::error("Early end-of-file in PNM file \"%s\"!", name); + fclose(fp); + return; + } + lineptr ++; format = atoi(lineptr); @@ -159,5 +166,5 @@ Fl_PNM_Image::Fl_PNM_Image(const char *name) // I - File to read // -// End of "$Id: Fl_PNM_Image.cxx,v 1.1.2.2 2001/11/28 18:09:08 easysw Exp $". +// End of "$Id: Fl_PNM_Image.cxx,v 1.1.2.3 2001/12/11 16:03:12 easysw Exp $". // diff --git a/src/Fl_Shared_Image.cxx b/src/Fl_Shared_Image.cxx index 8e911fc5a..86d381515 100644 --- a/src/Fl_Shared_Image.cxx +++ b/src/Fl_Shared_Image.cxx @@ -1,5 +1,5 @@ // -// "$Id: Fl_Shared_Image.cxx,v 1.23.2.3 2001/11/29 00:24:43 easysw Exp $" +// "$Id: Fl_Shared_Image.cxx,v 1.23.2.4 2001/12/11 16:03:12 easysw Exp $" // // Shared image code for the Fast Light Tool Kit (FLTK). // @@ -118,7 +118,7 @@ Fl_Shared_Image::add() { temp = new Fl_Shared_Image *[alloc_images_ + 32]; if (alloc_images_) { - memcpy(images_, temp, sizeof(Fl_Shared_Image *)); + memcpy(temp, images_, alloc_images_ * sizeof(Fl_Shared_Image *)); delete[] images_; } @@ -376,5 +376,5 @@ Fl_Shared_Image::get(const char *n, int W, int H) { // -// End of "$Id: Fl_Shared_Image.cxx,v 1.23.2.3 2001/11/29 00:24:43 easysw Exp $". +// End of "$Id: Fl_Shared_Image.cxx,v 1.23.2.4 2001/12/11 16:03:12 easysw Exp $". // diff --git a/src/Fl_Tiled_Image.cxx b/src/Fl_Tiled_Image.cxx index 22cb2b86c..c331265bd 100644 --- a/src/Fl_Tiled_Image.cxx +++ b/src/Fl_Tiled_Image.cxx @@ -1,5 +1,5 @@ // -// "$Id: Fl_Tiled_Image.cxx,v 1.1.2.2 2001/12/06 18:12:35 easysw Exp $" +// "$Id: Fl_Tiled_Image.cxx,v 1.1.2.3 2001/12/11 16:03:12 easysw Exp $" // // Tiled image code for the Fast Light Tool Kit (FLTK). // @@ -74,12 +74,15 @@ Fl_Tiled_Image::copy(int W, // I - New width void Fl_Tiled_Image::color_average(Fl_Color c, // I - Color to blend with float i) { // I - Blend fraction - Fl_Image *temp = image_->copy(); + if (alloc_image_) image_->color_average(c, i); + else { + Fl_Image *temp = image_->copy(); - temp->color_average(c, i); + temp->color_average(c, i); - image_ = temp; - alloc_image_ = 1; + image_ = temp; + alloc_image_ = 1; + } } @@ -89,12 +92,15 @@ Fl_Tiled_Image::color_average(Fl_Color c, // I - Color to blend with void Fl_Tiled_Image::desaturate() { - Fl_Image *temp = image_->copy(); + if (alloc_image_) image_->desaturate(); + else { + Fl_Image *temp = image_->copy(); - temp->desaturate(); + temp->desaturate(); - image_ = temp; - alloc_image_ = 1; + image_ = temp; + alloc_image_ = 1; + } } @@ -133,5 +139,5 @@ Fl_Tiled_Image::draw(int X, // I - Starting X position // -// End of "$Id: Fl_Tiled_Image.cxx,v 1.1.2.2 2001/12/06 18:12:35 easysw Exp $". +// End of "$Id: Fl_Tiled_Image.cxx,v 1.1.2.3 2001/12/11 16:03:12 easysw Exp $". // diff --git a/src/Fl_XBM_Image.cxx b/src/Fl_XBM_Image.cxx index 9eedcad2f..56393e053 100644 --- a/src/Fl_XBM_Image.cxx +++ b/src/Fl_XBM_Image.cxx @@ -1,5 +1,5 @@ // -// "$Id: Fl_XBM_Image.cxx,v 1.1.2.1 2001/11/24 18:07:57 easysw Exp $" +// "$Id: Fl_XBM_Image.cxx,v 1.1.2.2 2001/12/11 16:03:12 easysw Exp $" // // Fl_XBM_Image routines. // @@ -24,6 +24,7 @@ // // Contents: // +// Fl_XBM_Image::Fl_XBM_Image() - Load an XBM file. // // @@ -37,6 +38,10 @@ #include #include +// +// 'Fl_XBM_Image::Fl_XBM_Image()' - Load an XBM file. +// + Fl_XBM_Image::Fl_XBM_Image(const char *name) : Fl_Bitmap((const char *)0,0,0) { FILE *f; uchar *data; @@ -49,7 +54,10 @@ Fl_XBM_Image::Fl_XBM_Image(const char *name) : Fl_Bitmap((const char *)0,0,0) { int i; for (i = 0; i<2; i++) { for (;;) { - if (!fgets(buffer,1024,f)) return; + if (!fgets(buffer,1024,f)) { + fclose(f); + return; + } int r = sscanf(buffer,"#define %s %d",junk,&wh[i]); if (r >= 2) break; } @@ -57,7 +65,10 @@ Fl_XBM_Image::Fl_XBM_Image(const char *name) : Fl_Bitmap((const char *)0,0,0) { // skip to data array: for (;;) { - if (!fgets(buffer,1024,f)) return; + if (!fgets(buffer,1024,f)) { + fclose(f); + return; + } if (!strncmp(buffer,"static ",7)) break; } @@ -70,7 +81,10 @@ Fl_XBM_Image::Fl_XBM_Image(const char *name) : Fl_Bitmap((const char *)0,0,0) { // read the data: for (i = 0, data = (uchar *)array; i < n;) { - if (!fgets(buffer,1024,f)) return; + if (!fgets(buffer,1024,f)) { + fclose(f); + return; + } const char *a = buffer; while (*a && i temp) slash --; + while (!isdirsep(*slash) && slash > from) slash --; if (isdirsep(*slash)) slash ++; @@ -158,10 +154,8 @@ filename_relative(char *to, // O - Relative filename to[0] = '\0'; to[tolen - 1] = '\0'; - while (*newslash != '\0') - { - if (*newslash == '/' || *newslash == '\\') - strncat(to, "../", tolen - 1); + while (*newslash != '\0') { + if (isdirsep(*newslash)) strncat(to, "../", tolen - 1); newslash ++; } @@ -173,5 +167,5 @@ filename_relative(char *to, // O - Relative filename // -// End of "$Id: filename_absolute.cxx,v 1.5.2.4.2.2 2001/11/26 19:41:57 easysw Exp $". +// End of "$Id: filename_absolute.cxx,v 1.5.2.4.2.3 2001/12/11 16:03:12 easysw Exp $". // diff --git a/src/filename_expand.cxx b/src/filename_expand.cxx index 06d76721f..8a08557f3 100644 --- a/src/filename_expand.cxx +++ b/src/filename_expand.cxx @@ -1,5 +1,5 @@ // -// "$Id: filename_expand.cxx,v 1.4.2.4.2.1 2001/11/26 00:15:06 easysw Exp $" +// "$Id: filename_expand.cxx,v 1.4.2.4.2.2 2001/12/11 16:03:13 easysw Exp $" // // Filename expansion routines for the Fast Light Tool Kit (FLTK). // @@ -46,7 +46,7 @@ static inline int isdirsep(char c) {return c=='/' || c=='\\';} int filename_expand(char *to,int tolen, const char *from) { char *temp = new char[tolen]; - strncpy(temp,from, tolen); + strncpy(temp,from, tolen - 1); temp[tolen - 1] = '\0'; char *start = temp; char *end = temp+strlen(temp); @@ -106,5 +106,5 @@ int filename_expand(char *to,int tolen, const char *from) { // -// End of "$Id: filename_expand.cxx,v 1.4.2.4.2.1 2001/11/26 00:15:06 easysw Exp $". +// End of "$Id: filename_expand.cxx,v 1.4.2.4.2.2 2001/12/11 16:03:13 easysw Exp $". // diff --git a/src/filename_match.cxx b/src/filename_match.cxx index a9e6d57a2..69ac82245 100644 --- a/src/filename_match.cxx +++ b/src/filename_match.cxx @@ -1,5 +1,5 @@ // -// "$Id: filename_match.cxx,v 1.5.2.4 2001/01/22 15:13:40 easysw Exp $" +// "$Id: filename_match.cxx,v 1.5.2.4.2.1 2001/12/11 16:03:13 easysw Exp $" // // Pattern matching routines for the Fast Light Tool Kit (FLTK). // @@ -89,25 +89,20 @@ int filename_match(const char *s, const char *p) { case 0: // end of pattern return !*s; -#if defined(WIN32) && !defined(__CYGWIN__) case '\\': // quote next character if (*p) p++; - if (*s++ != *(p-1)) return 0; - break; default: +#if defined(WIN32) || defined(__CYGWIN__) || defined(__APPLE__) if (tolower(*s) != tolower(*(p-1))) return 0; s++; #else - case '\\': // quote next character - if (*p) p++; - default : if (*s++ != *(p-1)) return 0; - break; #endif + break; } } } // -// End of "$Id: filename_match.cxx,v 1.5.2.4 2001/01/22 15:13:40 easysw Exp $". +// End of "$Id: filename_match.cxx,v 1.5.2.4.2.1 2001/12/11 16:03:13 easysw Exp $". // diff --git a/src/fl_font.cxx b/src/fl_font.cxx index e88eaa8ce..c00c674ed 100644 --- a/src/fl_font.cxx +++ b/src/fl_font.cxx @@ -1,5 +1,5 @@ // -// "$Id: fl_font.cxx,v 1.9.2.5.2.1 2001/11/27 17:44:08 easysw Exp $" +// "$Id: fl_font.cxx,v 1.9.2.5.2.2 2001/12/11 16:03:13 easysw Exp $" // // Font selection code for the Fast Light Tool Kit (FLTK). // @@ -38,6 +38,7 @@ # include "Fl_Font.H" # include +# include # include # include @@ -172,14 +173,7 @@ static Fl_FontSize* find(int fnum, int size) { // whoa! A scalable font! Use unless exact match found: int l = c-thisname; memcpy(namebuffer,thisname,l); -#if 1 // this works if you don't want stdio - if (size>=100) namebuffer[l++] = size/100+'0'; - if (size>=10) namebuffer[l++] = (size/10)%10+'0'; - namebuffer[l++] = (size%10)+'0'; -#else - //for some reason, sprintf fails to return the right value under Solaris. l += sprintf(namebuffer+l,"%d",size); -#endif while (*c == '0') c++; strcpy(namebuffer+l,c); name = namebuffer; @@ -295,5 +289,5 @@ void fl_draw(const char* str, int x, int y) { #endif // -// End of "$Id: fl_font.cxx,v 1.9.2.5.2.1 2001/11/27 17:44:08 easysw Exp $". +// End of "$Id: fl_font.cxx,v 1.9.2.5.2.2 2001/12/11 16:03:13 easysw Exp $". // -- cgit v1.2.3