Author: post
Date: 2013-02-11 17:54:14 +0100 (Mon, 11 Feb 2013)
New Revision: 4328

Modified:
   trunk/librawstudio/rs-dcp-file.c
   trunk/librawstudio/rs-tiff.c
Log:
Read magic values at correct places (fixes some weird profile issues), and 
don't add invalid IFD's.

Modified: trunk/librawstudio/rs-dcp-file.c
===================================================================
--- trunk/librawstudio/rs-dcp-file.c    2013-02-11 13:15:04 UTC (rev 4327)
+++ trunk/librawstudio/rs-dcp-file.c    2013-02-11 16:54:14 UTC (rev 4328)
@@ -77,10 +77,6 @@
        if (!RS_TIFF_CLASS(rs_dcp_file_parent_class)->read_file_header(tiff))
                return FALSE;
 
-       /* Read DCP Magic */
-       if (rs_tiff_get_ushort(tiff, 2) != 0x4352)
-               ret = TRUE;
-
        RSDcpFile *dcp_file = RS_DCP_FILE(tiff);
 
        /* Load and cache basic DCP information */

Modified: trunk/librawstudio/rs-tiff.c
===================================================================
--- trunk/librawstudio/rs-tiff.c        2013-02-11 13:15:04 UTC (rev 4327)
+++ trunk/librawstudio/rs-tiff.c        2013-02-11 16:54:14 UTC (rev 4328)
@@ -126,7 +126,8 @@
                ret = FALSE;
 
        /* Read TIFF identifier */
-       if (rs_tiff_get_ushort(tiff, 2) != 42)
+       gushort magic = rs_tiff_get_ushort(tiff, 2);
+       if (magic != 42 && magic != 0x4352)
                ret = FALSE;
 
        tiff->first_ifd_offset = rs_tiff_get_uint(tiff, 4);
@@ -134,10 +135,10 @@
        next_ifd = tiff->first_ifd_offset;
        while(next_ifd)
        {
-               tiff->num_ifd++;
                RSTiffIfd *ifd = rs_tiff_ifd_new(tiff, next_ifd);
                if (ifd)
                {
+                       tiff->num_ifd++;
                        tiff->ifds = g_list_append(tiff->ifds, ifd);
                        next_ifd = rs_tiff_ifd_get_next(ifd);
                }


_______________________________________________
Rawstudio-commit mailing list
[email protected]
http://rawstudio.org/cgi-bin/mailman/listinfo/rawstudio-commit

Reply via email to