extragear/graphics/digikam/libs/dimg/loaders

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

extragear/graphics/digikam/libs/dimg/loaders

Patrick Spendrin
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:[hidden email]

 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
_______________________________________________
Digikam-devel mailing list
[hidden email]
https://mail.kde.org/mailman/listinfo/digikam-devel
Reply | Threaded
Open this post in threaded view
|

Re: extragear/graphics/digikam/libs/dimg/loaders

Gilles Caulier-4


2008/11/21 Patrick Spendrin <[hidden email]>
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?

I'm totally agree. It will be more simple to maintains.

Gilles
 

[hidden email]

 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
_______________________________________________
Digikam-devel mailing list
[hidden email]
https://mail.kde.org/mailman/listinfo/digikam-devel


_______________________________________________
Digikam-devel mailing list
[hidden email]
https://mail.kde.org/mailman/listinfo/digikam-devel