Revision: 1143
          http://geeqie.svn.sourceforge.net/geeqie/?rev=1143&view=rev
Author:   nadvornik
Date:     2008-09-27 18:48:32 +0000 (Sat, 27 Sep 2008)

Log Message:
-----------
updated preview loader to work with current svn version of libexiv2

Modified Paths:
--------------
    trunk/src/exiv2.cc

Modified: trunk/src/exiv2.cc
===================================================================
--- trunk/src/exiv2.cc  2008-09-10 20:37:30 UTC (rev 1142)
+++ trunk/src/exiv2.cc  2008-09-27 18:48:32 UTC (rev 1143)
@@ -609,19 +609,28 @@
 guchar *exif_get_preview(ExifData *exif, guint *data_len)
 {
        if (!exif) return NULL;
+
+       const char* path = exif->image->io().path().c_str();
+       /* given image pathname, first do simple (and fast) file extension test 
*/
+       if (!filter_file_class(path, FORMAT_CLASS_RAWIMAGE)) return NULL;
+
        try {
 
-               Exiv2::PreviewImageList list(*exif->image);
-               list.read();
+               Exiv2::PreviewImageLoader loader(*exif->image);
 
-               Exiv2::PreviewImageList::iterator pos = list.begin();
-               if (pos != list.end())
+               Exiv2::PreviewPropertiesList list = 
loader.getPreviewPropertiesList();
+
+               if (!list.empty())
                        {
-                       Exiv2::DataBuf buf = pos->copy();
+                       Exiv2::PreviewPropertiesList::iterator pos = 
--list.end();
+
+                       Exiv2::PreviewImage image = 
loader.getPreviewImage(*pos);
+
+                       Exiv2::DataBuf &buf = image.data();
                        std::pair<Exiv2::byte*, long> p = buf.release();
 
                        *data_len = p.second;
-                       return p.first;
+                       return p.first;
                        }
                return NULL;
        }
@@ -680,7 +689,7 @@
        const char* path = exif->image->io().path().c_str();
 
        /* given image pathname, first do simple (and fast) file extension test 
*/
-       if (!filter_file_class(path, FORMAT_CLASS_RAWIMAGE)) return 0;
+       if (!filter_file_class(path, FORMAT_CLASS_RAWIMAGE)) return NULL;
 
        try {
                struct stat st;
@@ -696,20 +705,20 @@
                fd = open(path, O_RDONLY);
                if (fd == -1)
                        {
-                       return 0;
+                       return NULL;
                        }
 
                if (fstat(fd, &st) == -1)
                        {
                        close(fd);
-                       return 0;
+                       return NULL;
                        }
                map_len = st.st_size;
                map_data = (guchar *) mmap(0, map_len, PROT_READ, MAP_PRIVATE, 
fd, 0);
                close(fd);
                if (map_data == MAP_FAILED)
                        {
-                       return 0;
+                       return NULL;
                        }
                *data_len = map_len - offset;
                ud = g_new(UnmapData, 1);


This was sent by the SourceForge.net collaborative development platform, the 
world's largest Open Source development site.

-------------------------------------------------------------------------
This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
Build the coolest Linux based applications with Moblin SDK & win great prizes
Grand prize is a trip for two to an Open Source event anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100&url=/
_______________________________________________
Geeqie-svn mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/geeqie-svn

Reply via email to