[Digikam-devel] extragear/graphics/digikam/libs/dimg/loaders

Patrick Spendrin ps_ml at gmx.de
Thu Nov 20 23:13:53 GMT 2008


SVN commit 887048 by sengels:

fix digikam crashes when trying to open png files under MSVC
I will close the following bug - we need a more precise bug report now.
BUG:173918
@digikam-devels:
It should be possible to remove the ifdef's and use this solution under Linux too. That way maintenance would be easier for me and you. Ideas?
CCMAIL:digikam-devel at kde.org

 M  +12 -0     pngloader.cpp  


--- trunk/extragear/graphics/digikam/libs/dimg/loaders/pngloader.cpp #887047:887048
@@ -59,6 +59,14 @@
 #include "dimg.h"
 #include "dimgloaderobserver.h"
 
+#ifdef Q_CC_MSVC
+void _ReadProc(struct png_struct_def *png_ptr, unsigned char *data, unsigned int size)
+{
+    FILE* file_handle = (FILE*)png_get_io_ptr(png_ptr);
+    fread(data, size, 1, file_handle);
+}
+#endif
+
 namespace Digikam
 {
 
@@ -134,7 +142,11 @@
         return false;
     }
 
+#ifdef Q_CC_MSVC
+    png_set_read_fn(png_ptr, f, _ReadProc);
+#else
     png_init_io(png_ptr, f);
+#endif
 
     // -------------------------------------------------------------------
     // Read all PNG info up to image data



More information about the Digikam-devel mailing list