From 54d5327958cbf6bd07ef34ebd3f3aea6415c51cc Mon Sep 17 00:00:00 2001 From: Manolo Gouy Date: Sat, 10 Nov 2012 08:31:35 +0000 Subject: [PATCH] Fix STR#2884: Fl_PNG_Image made from static memory will forget share name git-svn-id: file:///fltk/svn/fltk/branches/branch-1.3@9712 ea41ed52-d2ee-0310-a9c1-e6b18d33e121 --- src/Fl_PNG_Image.cxx | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/Fl_PNG_Image.cxx b/src/Fl_PNG_Image.cxx index d6261c9ce..24d3127d3 100644 --- a/src/Fl_PNG_Image.cxx +++ b/src/Fl_PNG_Image.cxx @@ -114,7 +114,7 @@ void Fl_PNG_Image::load_png_(const char *name_png, const unsigned char *buffer_p 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 @@ void Fl_PNG_Image::load_png_(const char *name_png, const unsigned char *buffer_p 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 @@ void Fl_PNG_Image::load_png_(const char *name_png, const unsigned char *buffer_p { 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; }