X-Git-Url: http://geeqie.org/cgi-bin/gitweb.cgi?a=blobdiff_plain;f=src%2Fformat_nikon.c;h=2b60ee54d75b773280b6ca049137d260db7fda1a;hb=78373c788d9a9fc130ef0f039d8e15e1742da77e;hp=a3e9f410b9f6621301744fc84ca1ae283c9d6bc5;hpb=7953e558b89d1423c2843c6e5cb7e5a9718419cc;p=geeqie.git diff --git a/src/format_nikon.c b/src/format_nikon.c index a3e9f410..2b60ee54 100644 --- a/src/format_nikon.c +++ b/src/format_nikon.c @@ -1,6 +1,7 @@ /* - * GQView - * (C) 2005 John Ellis + * Geeqie + * (C) 2005 John Ellis + * Copyright (C) 2008 - 2012 The Geeqie Team * * Authors: * Raw NEF jpeg extraction based on nefextract.c by Joseph Heled, @@ -15,6 +16,7 @@ # include "config.h" #endif +#ifndef HAVE_EXIV2 #include #include @@ -24,6 +26,7 @@ #include "intl.h" +#include "main.h" #include "format_nikon.h" #include "exif.h" @@ -35,12 +38,12 @@ *----------------------------------------------------------------------------- */ -static guint nikon_tiff_table(unsigned char *data, const guint len, guint offset, ExifByteOrder bo, +static guint nikon_tiff_table(guchar *data, const guint len, guint offset, ExifByteOrder bo, gint level, guint *image_offset, guint *jpeg_len); -static void nikon_tiff_entry(unsigned char *data, const guint len, guint offset, ExifByteOrder bo, +static void nikon_tiff_entry(guchar *data, const guint len, guint offset, ExifByteOrder bo, gint level, guint *image_offset, guint *image_length, guint *jpeg_start, guint *jpeg_len) { @@ -71,7 +74,7 @@ static void nikon_tiff_entry(unsigned char *data, const guint len, guint offset, if (tag == 0x14a) { /* sub IFD table */ - gint i; + guint i; for (i = 0; i < count; i++) { @@ -94,7 +97,7 @@ static void nikon_tiff_entry(unsigned char *data, const guint len, guint offset, } } -static guint nikon_tiff_table(unsigned char *data, const guint len, guint offset, ExifByteOrder bo, +static guint nikon_tiff_table(guchar *data, const guint len, guint offset, ExifByteOrder bo, gint level, guint *image_offset, guint *image_length) { @@ -128,8 +131,8 @@ static guint nikon_tiff_table(unsigned char *data, const guint len, guint offset return exif_byte_get_int32(data + offset + count * EXIF_TIFD_SIZE, bo); } -gint format_nikon_raw(unsigned char *data, const guint len, - guint *image_offset, guint *exif_offset) +gboolean format_nikon_raw(guchar *data, const guint len, + guint *image_offset, guint *exif_offset) { guint i_off = 0; guint i_len = 0; @@ -218,14 +221,6 @@ static ExifTextList NikonTagConverter[]= { EXIF_TEXT_LIST_END }; -#if 0 -static ExifTextList NikonTag[]= { - { , "" }, - { , "" }, - EXIF_TEXT_LIST_END -}; -#endif - static ExifMarker NikonExifMarkersList1[] = { { 0x0002, EXIF_FORMAT_STRING, 6, "Nikon.unknown", NULL, NULL }, { 0x0003, EXIF_FORMAT_SHORT_UNSIGNED, 1, "Nikon.Quality", "Quality", NikonTagQuality }, @@ -279,17 +274,6 @@ static ExifTextList NikonTag2FlashUsed[]= { EXIF_TEXT_LIST_END }; -#if 0 -static ExifTextList NikonTagi2Saturation[]= { - { -3, "black and white" }, - { -2, "-2" }, - { -1, "-1" }, - { 0, "normal" }, - { 1, "+1" }, - { 2, "+2" }, - EXIF_TEXT_LIST_END -}; -#endif static ExifMarker NikonExifMarkersList2[] = { { 0x0002, EXIF_FORMAT_SHORT_UNSIGNED, 2, "Nikon.ISOSpeed", "ISO speed", NULL }, @@ -352,10 +336,10 @@ static ExifTextList NikonAFPoint[]= { }; -gint format_nikon_makernote(ExifData *exif, unsigned char *tiff, guint offset, - guint size, ExifByteOrder bo) +gboolean format_nikon_makernote(ExifData *exif, guchar *tiff, guint offset, + guint size, ExifByteOrder bo) { - unsigned char *data; + guchar *data; ExifItem *item; if (offset + 8 + 4 >= size) return FALSE; @@ -399,19 +383,18 @@ gint format_nikon_makernote(ExifData *exif, unsigned char *tiff, guint offset, static ExifMarker marker = { 0x0088, EXIF_FORMAT_STRING, -1, "Nikon.AutoFocusPoint", "Auto focus point", NULL }; guchar *array = item->data; - const gchar *text; + gchar *text; + gint l; text = exif_text_list_find_value(NikonAFPoint, (gint)array[1]); - if (text) - { - gint l; + l = strlen(text) + 1; - l = strlen(text) + 1; - item = exif_item_new(marker.format, marker.tag, l, &marker); - memcpy(item->data, text, l); + item = exif_item_new(marker.format, marker.tag, l, &marker); + memcpy(item->data, text, l); - exif->items = g_list_prepend(exif->items, item); - } + g_free(text); + + exif->items = g_list_prepend(exif->items, item); } item = exif_get_item(exif, "Nikon.ISOSpeed"); @@ -443,3 +426,6 @@ gint format_nikon_makernote(ExifData *exif, unsigned char *tiff, guint offset, return TRUE; } +#endif +/* not HAVE_EXIV2 */ +/* vim: set shiftwidth=8 softtabstop=0 cindent cinoptions={1s: */