Author: manolo
Date: 2012-11-10 00:31:35 -0800 (Sat, 10 Nov 2012)
New Revision: 9712
Log:
Fix STR#2884: Fl_PNG_Image made from static memory will forget share name

Modified:
   branches/branch-1.3/src/Fl_PNG_Image.cxx

Modified: branches/branch-1.3/src/Fl_PNG_Image.cxx
===================================================================
--- branches/branch-1.3/src/Fl_PNG_Image.cxx    2012-11-09 17:17:34 UTC (rev 
9711)
+++ branches/branch-1.3/src/Fl_PNG_Image.cxx    2012-11-10 08:31:35 UTC (rev 
9712)
@@ -114,7 +114,7 @@
   if (!from_memory) {
     if ((fp = fl_fopen(name_png, "rb")) == NULL) return;
   }
-  else name_png = "In-memory PNG data";
+  const char *display_name = (name_png ? name_png : "");
 
   // Setup the PNG data structures...
   pp = png_create_read_struct(PNG_LIBPNG_VER_STRING, NULL, NULL, NULL);
@@ -122,7 +122,7 @@
   if (!pp || !info) {
     if (pp) png_destroy_read_struct(&pp, NULL, NULL);
     if (!from_memory) fclose(fp);
-    Fl::warning("Cannot allocate memory to read PNG file or data \"%s\".\n", 
name_png);
+    Fl::warning("Cannot allocate memory to read PNG file or data \"%s\".\n", 
display_name);
     return;
   }
   
@@ -130,7 +130,7 @@
   {
     png_destroy_read_struct(&pp, &info, NULL);
     if (!from_memory) fclose(fp);
-    Fl::warning("PNG file or data \"%s\" is too large or contains errors!\n", 
name_png);
+    Fl::warning("PNG file or data \"%s\" is too large or contains errors!\n", 
display_name);
     return;
   }
 

_______________________________________________
fltk-commit mailing list
[email protected]
http://lists.easysw.com/mailman/listinfo/fltk-commit

Reply via email to