diff src/format_canon.c @ 48:6948407f52a5

Fri Jun 3 18:43:46 2005 John Ellis <johne@verizon.net> * bar_exif.c: Set a default size for the EXIF data column in the advanced view, and allow resizing of that column to allow more data to be visible when needed. * format_canon.c: Fix data type for Canon MakerNote Serial Number. ##### Note: GQview CVS on sourceforge is not always up to date, please use ##### ##### an offical release when making enhancements and translation updates. #####
author gqview
date Fri, 03 Jun 2005 22:48:37 +0000
parents aa4c0e1b54b0
children ae627d150a6b
line wrap: on
line diff
--- a/src/format_canon.c	Fri Jun 03 06:07:02 2005 +0000
+++ b/src/format_canon.c	Fri Jun 03 22:48:37 2005 +0000
@@ -754,7 +754,7 @@
 	{ 7,	EXIF_FORMAT_STRING, -1,		"MkN.Canon.FirmwareVersion",	"Firmware version", NULL },
 	{ 8,	EXIF_FORMAT_LONG_UNSIGNED, 1,	"MkN.Canon.ImageNumber",	"Image number", NULL },
 	{ 9,	EXIF_FORMAT_STRING, -1,		"MkN.Canon.OwnerName",		"Owner name", NULL },
-	{ 12,	EXIF_FORMAT_BYTE_UNSIGNED, -1,	"MkN.Canon.SerialNumber",	"Camera serial number", NULL },
+	{ 12,	EXIF_FORMAT_LONG_UNSIGNED, -1,	"MkN.Canon.SerialNumber",	"Camera serial number", NULL },
 	{ 15,	EXIF_FORMAT_SHORT_UNSIGNED, -1,	"MkN.Canon.CustomFunctions",	NULL, NULL },
 	EXIF_MARKER_LIST_END
 };
@@ -785,6 +785,7 @@
 static void canon_mknote_parse_convert(ExifData *exif)
 {
 	gint value;
+	ExifItem *result;
 
 	/* seems we need more than only this value for distance */
 	if (exif_get_integer(exif, "MkN.Canon.SubjectDistance", &value))
@@ -802,16 +803,18 @@
 		exif->items = g_list_prepend(exif->items, item);
 		}
 
-	/* Serial Number untested */
-	if (exif_get_integer(exif, "MkN.Canon.SerialNumber", &value))
+	result = exif_get_item(exif, "MkN.Canon.SerialNumber");
+	if (result && result->format == EXIF_FORMAT_LONG_UNSIGNED && result->data_len == 4)
 		{
 		static ExifMarker marker= { 12, EXIF_FORMAT_STRING, -1,
 					    "SerialNumber", "Camera serial number", NULL };
 		ExifItem *item;
 		gchar *text;
 		gint l;
+		guint32 n;
 
-		text = g_strdup_printf("%04X%05d", value & 0xff00 >> 8, value & 0x00ff);
+		n = (guint32)result->data;
+		text = g_strdup_printf("%04X%05d", n & 0xffff0000 >> 8, n & 0x0000ffff);
 		l = strlen(text);
 		item = exif_item_new(marker.format, marker.tag, l, &marker);
 		memcpy(item->data, text, l);