Addl fix #488: Hide menus when not in split mode
[geeqie.git] / src / jpeg_parser.c
index 9918aab..062b207 100644 (file)
@@ -1,13 +1,22 @@
 /*
- * Geeqie
- * (C) 2004 John Ellis
- * Copyright (C) 2008 - 2011 The Geeqie Team
+ * Copyright (C) 2004 John Ellis
+ * Copyright (C) 2008 - 2016 The Geeqie Team
  *
  * Author: Vladimir Nadvornik
  *
- * This software is released under the GNU General Public License (GNU GPL).
- * Please read the included file COPYING for more information.
- * This software comes with no warranty of any kind, use at your own risk!
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License along
+ * with this program; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
  */
 
 #include "main.h"
@@ -175,10 +184,10 @@ gint tiff_parse_IFD_table(const guchar *tiff, guint offset,
                {
                parse_entry(tiff, offset + i * TIFF_TIFD_SIZE, size, bo, data);
                }
-       
+
        next = tiff_byte_get_int32(tiff + offset + count * TIFF_TIFD_SIZE, bo);
        if (next_offset) *next_offset = next;
-       
+
        return 0;
 }
 
@@ -224,9 +233,9 @@ static gint mpo_parse_Index_IFD_entry(const guchar *tiff, guint offset,
                        {
                        return -1;
                        }
-               
+
                mpo->images = g_new0(MPOEntry, mpo->num_images);
-                       
+
                for (i = 0; i < mpo->num_images; i++) {
                        guint image_attr = tiff_byte_get_int32(tiff + data_offset + i * 16, bo);
                        mpo->images[i].type_code = image_attr & 0xffffff;
@@ -237,7 +246,7 @@ static gint mpo_parse_Index_IFD_entry(const guchar *tiff, guint offset,
                        mpo->images[i].offset = tiff_byte_get_int32(tiff + data_offset + i * 16 + 8, bo);
                        mpo->images[i].dep1 = tiff_byte_get_int16(tiff + data_offset + i * 16 + 12, bo);
                        mpo->images[i].dep2 = tiff_byte_get_int16(tiff + data_offset + i * 16 + 14, bo);
-                       
+
                        if (i == 0)
                                {
                                mpo->images[i].offset = 0;
@@ -246,7 +255,7 @@ static gint mpo_parse_Index_IFD_entry(const guchar *tiff, guint offset,
                                {
                                mpo->images[i].offset += mpo->mpo_offset;
                                }
-                               
+
                        DEBUG_1("   image %x %x %x", image_attr, mpo->images[i].length, mpo->images[i].offset);
                        }
                }
@@ -323,16 +332,16 @@ MPOData *jpeg_get_mpo_data(const guchar *data, guint size)
                DEBUG_1("mpo signature found at %x", seg_offset);
                seg_offset += 4;
                seg_size -= 4;
-               
+
                if (!tiff_directory_offset(data + seg_offset, seg_size, &offset, &bo)) return NULL;
 
                mpo = g_new0(MPOData, 1);
                mpo->mpo_offset = seg_offset;
-               
+
                tiff_parse_IFD_table(data + seg_offset,  offset , seg_size, bo, &next_offset, mpo_parse_Index_IFD_entry, (gpointer)mpo);
                if (!mpo->images) mpo->num_images = 0;
-               
-       
+
+
                for (i = 0; i < mpo->num_images; i++)
                        {
                        if (mpo->images[i].offset + mpo->images[i].length > size)
@@ -342,7 +351,7 @@ MPOData *jpeg_get_mpo_data(const guchar *data, guint size)
                                break;
                                }
                        }
-               
+
                for (i = 0; i < mpo->num_images; i++)
                        {
                        if (i == 0)
@@ -356,7 +365,7 @@ MPOData *jpeg_get_mpo_data(const guchar *data, guint size)
                                        DEBUG_1("MPO image %d: MPO signature not found", i);
                                        continue;
                                        }
-                               
+
                                seg_offset += 4;
                                seg_size -= 4;
                                if (!tiff_directory_offset(data + mpo->images[i].offset + seg_offset, seg_size, &offset, &bo))
@@ -368,7 +377,7 @@ MPOData *jpeg_get_mpo_data(const guchar *data, guint size)
                                }
                        tiff_parse_IFD_table(data + mpo->images[i].offset + seg_offset,  offset , seg_size, bo, NULL, mpo_parse_Attributes_IFD_entry, (gpointer)&mpo->images[i]);
                        }
-               
+
                return mpo;
                }
        return NULL;