/*
- * 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"
{
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;
}
{
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;
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;
{
mpo->images[i].offset += mpo->mpo_offset;
}
-
+
DEBUG_1(" image %x %x %x", image_attr, mpo->images[i].length, mpo->images[i].offset);
}
}
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)
break;
}
}
-
+
for (i = 0; i < mpo->num_images; i++)
{
if (i == 0)
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))
}
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;