DO NOT REPLY TO THIS MESSAGE. INSTEAD, POST ANY RESPONSES TO THE LINK BELOW.
[STR New]
Link: http://www.fltk.org/str.php?L2529
Version: 1.3-current
With the new functionality to read png image frommemory there is a compiler
warning about "fp can be used without initialization" the patch attached
solve this warning.
Link: http://www.fltk.org/str.php?L2529
Version: 1.3-current
Index: src/Fl_PNG_Image.cxx
===================================================================
--- src/Fl_PNG_Image.cxx (revision 8289)
+++ src/Fl_PNG_Image.cxx (working copy)
@@ -111,9 +111,11 @@
png_infop info; // PNG info pointers
png_bytep *rows;// PNG row pointers
fl_png_memory png_mem_data;
- int from_memory = (buffer_png != NULL); // true iff reading image from memory
- if (!from_memory) {
+ if (buffer_png) { // true iff reading image from memory
+ fp = NULL;
+ }
+ else {
if ((fp = fl_fopen(name_png, "rb")) == NULL) return;
}
@@ -127,14 +129,14 @@
return;
}
- if (from_memory) {
+ if (fp) {
+ png_init_io(pp, fp); // Initialize the PNG file read "engine"...
+ } else {
png_mem_data.current = buffer_png;
png_mem_data.last = buffer_png + maxsize;
png_mem_data.pp = pp;
// Initialize the function pointer to the PNG read "engine"...
png_set_read_fn (pp, (png_voidp) &png_mem_data, png_read_data_from_mem);
- } else {
- png_init_io(pp, fp); // Initialize the PNG file read "engine"...
}
// Get the image dimensions and convert to grayscale or RGB...
@@ -200,7 +202,7 @@
png_read_end(pp, info);
png_destroy_read_struct(&pp, &info, NULL);
- if (!from_memory) fclose(fp);
+ if (fp) fclose(fp);
#endif // HAVE_LIBPNG && HAVE_LIBZ
}
_______________________________________________
fltk-bugs mailing list
[email protected]
http://lists.easysw.com/mailman/listinfo/fltk-bugs