From 96094e5617f0762538b12d5ba3cfead3d809b73c Mon Sep 17 00:00:00 2001 From: Michael R Sweet Date: Fri, 28 Jun 2002 15:23:03 +0000 Subject: [PATCH] Increase size of header buffer to 64 bytes. Fix XBM file loader. git-svn-id: file:///fltk/svn/fltk/branches/branch-1.1@2327 ea41ed52-d2ee-0310-a9c1-e6b18d33e121 --- CHANGES | 5 +++-- src/Fl_Shared_Image.cxx | 6 +++--- src/Fl_XBM_Image.cxx | 11 +++++++---- 3 files changed, 13 insertions(+), 9 deletions(-) diff --git a/CHANGES b/CHANGES index ce5cb8ac3..460f4f9e4 100644 --- a/CHANGES +++ b/CHANGES @@ -1,7 +1,8 @@ CHANGES IN FLTK 1.1.0 - - Added Greg Ercolano's MacOS filedescriptor support. - - Fixed text width bug. + - Fl_XBM_Image didn't correctly load XBM files. + - MacOS: Added Greg Ercolano's file descriptor support. + - MacOS: Fixed text width bug. - A change in fl_fix_focus() broken click-focus in FLWM. - Cygwin with -mnocygwin didn't like the FL/math.h header file. diff --git a/src/Fl_Shared_Image.cxx b/src/Fl_Shared_Image.cxx index 916ad8009..46d5359a5 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.12 2002/05/25 13:38:24 easysw Exp $" +// "$Id: Fl_Shared_Image.cxx,v 1.23.2.13 2002/06/28 15:23:03 easysw Exp $" // // Shared image code for the Fast Light Tool Kit (FLTK). // @@ -210,7 +210,7 @@ Fl_Shared_Image::reload() { // Load image from disk... int i; // Looping var FILE *fp; // File pointer - uchar header[16]; // Buffer for auto-detecting files + uchar header[64]; // Buffer for auto-detecting files Fl_Image *img; // New image if (!name_) return; @@ -461,5 +461,5 @@ Fl_Shared_Image::remove_handler(Fl_Shared_Handler f) { // -// End of "$Id: Fl_Shared_Image.cxx,v 1.23.2.12 2002/05/25 13:38:24 easysw Exp $". +// End of "$Id: Fl_Shared_Image.cxx,v 1.23.2.13 2002/06/28 15:23:03 easysw Exp $". // diff --git a/src/Fl_XBM_Image.cxx b/src/Fl_XBM_Image.cxx index 608584501..1de0bb6b0 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.5 2002/05/25 13:38:24 easysw Exp $" +// "$Id: Fl_XBM_Image.cxx,v 1.1.2.6 2002/06/28 15:23:03 easysw Exp $" // // Fl_XBM_Image routines. // @@ -76,7 +76,7 @@ Fl_XBM_Image::Fl_XBM_Image(const char *name) : Fl_Bitmap((const char *)0,0,0) { h(wh[1]); int n = ((wh[0]+7)/8)*wh[1]; - array = new uchar[((w() + 7) / 8) * h()]; + array = new uchar[n]; // read the data: for (i = 0, data = (uchar *)array; i < n;) { @@ -87,7 +87,10 @@ Fl_XBM_Image::Fl_XBM_Image(const char *name) : Fl_Bitmap((const char *)0,0,0) { const char *a = buffer; while (*a && i0) *data++ = t; + if (sscanf(a," 0x%x",&t)>0) { + *data++ = t; + i ++; + } while (*a && *a++ != ','); } } @@ -97,5 +100,5 @@ Fl_XBM_Image::Fl_XBM_Image(const char *name) : Fl_Bitmap((const char *)0,0,0) { // -// End of "$Id: Fl_XBM_Image.cxx,v 1.1.2.5 2002/05/25 13:38:24 easysw Exp $". +// End of "$Id: Fl_XBM_Image.cxx,v 1.1.2.6 2002/06/28 15:23:03 easysw Exp $". //