summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichael R Sweet <michael.r.sweet@gmail.com>2002-06-13 18:18:33 +0000
committerMichael R Sweet <michael.r.sweet@gmail.com>2002-06-13 18:18:33 +0000
commit91aa5847ba00e27c3f7b94068960daff0c930110 (patch)
tree64eb9bb525f154cb366a859238f525785fbfb3bb
parent1f30c63d322778388a167f82df5d27a76e115ab5 (diff)
Bug fixes from Sebastien.
git-svn-id: file:///fltk/svn/fltk/branches/branch-1.1@2309 ea41ed52-d2ee-0310-a9c1-e6b18d33e121
-rw-r--r--CHANGES9
-rw-r--r--src/Fl_BMP_Image.cxx20
-rw-r--r--src/Fl_File_Chooser2.cxx6
-rw-r--r--src/Fl_File_Icon.cxx27
-rw-r--r--src/fl_file_dir.cxx8
-rw-r--r--test/pixmap_browser.cxx8
6 files changed, 53 insertions, 25 deletions
diff --git a/CHANGES b/CHANGES
index 8cee5e99f..0d0105f99 100644
--- a/CHANGES
+++ b/CHANGES
@@ -1,5 +1,14 @@
CHANGES IN FLTK 1.1.0
+ - The pixmap_browser demo didn't check for a NULL image
+ pointer.
+ - Fl_File_Icon::find() now uses fl_filename_isdir()
+ under WIN32 to check for directories.
+ - Fl_File_Chooser's preview code called refcount()
+ on the deleted image's object.
+ - Fixed another problem with the Fl_BMP_Image loader.
+ - The fl_file_chooser() callback was being called with a
+ NULL filename.
- Documented that fl_push_clip() is preferred over
fl_clip(), with a corresponding source change.
- Minor changes to the MacOS X event handling code.
diff --git a/src/Fl_BMP_Image.cxx b/src/Fl_BMP_Image.cxx
index 16c392849..9df36f8c2 100644
--- a/src/Fl_BMP_Image.cxx
+++ b/src/Fl_BMP_Image.cxx
@@ -1,5 +1,5 @@
//
-// "$Id: Fl_BMP_Image.cxx,v 1.1.2.5 2002/06/10 17:21:49 easysw Exp $"
+// "$Id: Fl_BMP_Image.cxx,v 1.1.2.6 2002/06/13 18:18:33 easysw Exp $"
//
// Fl_BMP_Image routines.
//
@@ -94,19 +94,23 @@ Fl_BMP_Image::Fl_BMP_Image(const char *bmp) // I - File to read
// Then the bitmap information...
info_size = read_dword(fp);
- w(read_long(fp));
- h(read_long(fp));
- read_word(fp);
- depth = read_word(fp);
if (info_size < 40) {
// Old Windows/OS2 BMP header...
+ w(read_word(fp));
+ h(read_word(fp));
+ read_word(fp);
+ depth = read_word(fp);
compression = BI_RGB;
colors_used = 0;
- count = info_size - 12;
+ count = info_size - 8;
} else {
// New BMP header...
+ w(read_long(fp));
+ h(read_long(fp));
+ read_word(fp);
+ depth = read_word(fp);
compression = read_dword(fp);
read_dword(fp);
read_long(fp);
@@ -129,7 +133,7 @@ Fl_BMP_Image::Fl_BMP_Image(const char *bmp) // I - File to read
for (count = 0; count < colors_used; count ++) {
// Read BGR color...
- fread(colormap, colors_used, 3, fp);
+ fread(colormap[count], colors_used, 3, fp);
// Skip pad byte for new BMP files...
if (info_size > 12) getc(fp);
@@ -371,5 +375,5 @@ read_long(FILE *fp) { // I - File to read from
//
-// End of "$Id: Fl_BMP_Image.cxx,v 1.1.2.5 2002/06/10 17:21:49 easysw Exp $".
+// End of "$Id: Fl_BMP_Image.cxx,v 1.1.2.6 2002/06/13 18:18:33 easysw Exp $".
//
diff --git a/src/Fl_File_Chooser2.cxx b/src/Fl_File_Chooser2.cxx
index 10e56c960..a94314fe5 100644
--- a/src/Fl_File_Chooser2.cxx
+++ b/src/Fl_File_Chooser2.cxx
@@ -1,5 +1,5 @@
//
-// "$Id: Fl_File_Chooser2.cxx,v 1.1.2.15 2002/06/07 15:06:32 easysw Exp $"
+// "$Id: Fl_File_Chooser2.cxx,v 1.1.2.16 2002/06/13 18:18:33 easysw Exp $"
//
// More Fl_File_Chooser routines.
//
@@ -864,7 +864,7 @@ Fl_File_Chooser::update_preview()
oldimage = (Fl_Shared_Image *)previewBox->image();
- if (oldimage) while (oldimage->refcount()) oldimage->release();
+ if (oldimage) oldimage->release();
previewBox->image(0);
@@ -1103,5 +1103,5 @@ unquote_pathname(char *dst, // O - Destination string
//
-// End of "$Id: Fl_File_Chooser2.cxx,v 1.1.2.15 2002/06/07 15:06:32 easysw Exp $".
+// End of "$Id: Fl_File_Chooser2.cxx,v 1.1.2.16 2002/06/13 18:18:33 easysw Exp $".
//
diff --git a/src/Fl_File_Icon.cxx b/src/Fl_File_Icon.cxx
index 82e3d0626..274df2311 100644
--- a/src/Fl_File_Icon.cxx
+++ b/src/Fl_File_Icon.cxx
@@ -1,5 +1,5 @@
//
-// "$Id: Fl_File_Icon.cxx,v 1.1.2.12 2002/05/25 13:38:24 easysw Exp $"
+// "$Id: Fl_File_Icon.cxx,v 1.1.2.13 2002/06/13 18:18:33 easysw Exp $"
//
// Fl_File_Icon routines.
//
@@ -190,25 +190,36 @@ Fl_File_Icon::find(const char *filename,// I - Name of file */
// Get file information if needed...
if (filetype == ANY)
+ {
+#ifdef WIN32
+ if (fl_filename_isdir(filename))
+ filetype = DIRECTORY;
+ else
+ filetype = PLAIN;
+#else
if (!stat(filename, &fileinfo))
{
if (S_ISDIR(fileinfo.st_mode))
filetype = DIRECTORY;
-#ifdef S_IFIFO
+# ifdef S_IFIFO
else if (S_ISFIFO(fileinfo.st_mode))
filetype = FIFO;
-#endif // S_IFIFO
-#if defined(S_ICHR) && defined(S_IBLK)
+# endif // S_IFIFO
+# if defined(S_ICHR) && defined(S_IBLK)
else if (S_ISCHR(fileinfo.st_mode) || S_ISBLK(fileinfo.st_mode))
filetype = DEVICE;
-#endif // S_ICHR && S_IBLK
-#ifdef S_ILNK
+# endif // S_ICHR && S_IBLK
+# ifdef S_ILNK
else if (S_ISLNK(fileinfo.st_mode))
filetype = LINK;
-#endif // S_ILNK
+# endif // S_ILNK
else
filetype = PLAIN;
}
+ else
+ filetype = PLAIN;
+#endif // WIN32
+ }
// Look at the base name in the filename
name = fl_filename_name(filename);
@@ -464,5 +475,5 @@ Fl_File_Icon::labeltype(const Fl_Label *o, // I - Label data
//
-// End of "$Id: Fl_File_Icon.cxx,v 1.1.2.12 2002/05/25 13:38:24 easysw Exp $".
+// End of "$Id: Fl_File_Icon.cxx,v 1.1.2.13 2002/06/13 18:18:33 easysw Exp $".
//
diff --git a/src/fl_file_dir.cxx b/src/fl_file_dir.cxx
index 97c60a9a1..4474f9ef2 100644
--- a/src/fl_file_dir.cxx
+++ b/src/fl_file_dir.cxx
@@ -1,5 +1,5 @@
//
-// "$Id: fl_file_dir.cxx,v 1.1.2.12 2002/05/16 12:47:43 easysw Exp $"
+// "$Id: fl_file_dir.cxx,v 1.1.2.13 2002/06/13 18:18:33 easysw Exp $"
//
// File chooser widget for the Fast Light Tool Kit (FLTK).
//
@@ -33,8 +33,8 @@ static void (*current_callback)(const char*) = 0;
static void callback(Fl_File_Chooser *, void*) {
- if (current_callback)
- (*current_callback)(fc->value(0));
+ if (current_callback && fc->value())
+ (*current_callback)(fc->value());
}
@@ -142,5 +142,5 @@ fl_dir_chooser(const char *message, // I - Message for titlebar
//
-// End of "$Id: fl_file_dir.cxx,v 1.1.2.12 2002/05/16 12:47:43 easysw Exp $".
+// End of "$Id: fl_file_dir.cxx,v 1.1.2.13 2002/06/13 18:18:33 easysw Exp $".
//
diff --git a/test/pixmap_browser.cxx b/test/pixmap_browser.cxx
index e5bdfc4b8..8bb023fbd 100644
--- a/test/pixmap_browser.cxx
+++ b/test/pixmap_browser.cxx
@@ -1,5 +1,5 @@
//
-// "$Id: pixmap_browser.cxx,v 1.5.2.4.2.5 2002/01/06 17:51:12 easysw Exp $"
+// "$Id: pixmap_browser.cxx,v 1.5.2.4.2.6 2002/06/13 18:18:33 easysw Exp $"
//
// A shared image test program for the Fast Light Tool Kit (FLTK).
//
@@ -44,6 +44,10 @@ void load_file(const char *n) {
if (img) img->release();
img = Fl_Shared_Image::get(n);
+ if (!img) {
+ fl_alert("Image file format not recognized!");
+ return;
+ }
if (img->w() > b->w() || img->h() > b->h()) {
Fl_Image *temp;
if (img->w() > img->h()) temp = img->copy(b->w(), b->h() * img->h() / img->w());
@@ -94,5 +98,5 @@ int main(int argc, char **argv) {
}
//
-// End of "$Id: pixmap_browser.cxx,v 1.5.2.4.2.5 2002/01/06 17:51:12 easysw Exp $".
+// End of "$Id: pixmap_browser.cxx,v 1.5.2.4.2.6 2002/06/13 18:18:33 easysw Exp $".
//