Update of /cvsroot/libexif/libexif/libexif/olympus
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv4764
Modified Files:
exif-mnote-data-olympus.c exif-mnote-data-olympus.h
Log Message:
- fixed typo, which made the whole thing uncompileable ...
- replaced constant numbers in code with their already defined names
- tried to simplify code
Index: exif-mnote-data-olympus.h
===================================================================
RCS file: /cvsroot/libexif/libexif/libexif/olympus/exif-mnote-data-olympus.h,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -p -d -r1.5 -r1.6
--- exif-mnote-data-olympus.h 4 Jul 2005 10:05:00 -0000 1.5
+++ exif-mnote-data-olympus.h 5 Jul 2005 08:29:32 -0000 1.6
@@ -26,7 +26,7 @@
#include <libexif/exif-byte-order.h>
#include <libexif/exif-mem.h>
-enum OlympusVersion {olympus=0, nikonV1=1, nikonV2=2}:
+enum OlympusVersion {olympus = 0, nikonV1 = 1, nikonV2 = 2};
typedef struct _ExifMnoteDataOlympus ExifMnoteDataOlympus;
Index: exif-mnote-data-olympus.c
===================================================================
RCS file: /cvsroot/libexif/libexif/libexif/olympus/exif-mnote-data-olympus.c,v
retrieving revision 1.24
retrieving revision 1.25
diff -u -p -d -r1.24 -r1.25
--- exif-mnote-data-olympus.c 4 Jul 2005 10:05:00 -0000 1.24
+++ exif-mnote-data-olympus.c 5 Jul 2005 08:29:32 -0000 1.25
@@ -95,6 +95,7 @@ exif_mnote_data_olympus_save (ExifMnoteD
* Allocate enough memory for all entries and the number of entries.
*/
*buf_size = 6 + 2 + 2 + n->count * 12;
+ o2 += 2;
switch (n->version) {
case olympus:
*buf = exif_mem_alloc (ne->mem, *buf_size);
@@ -102,7 +103,6 @@ exif_mnote_data_olympus_save (ExifMnoteD
/* Write the header and the number of entries. */
strcpy ((char *)*buf, "OLYMP");
- o2 += 2;
datao = n->offset;
break;
case nikonV1:
@@ -119,7 +119,8 @@ exif_mnote_data_olympus_save (ExifMnoteD
/* Write the header and the number of entries. */
strcpy ((char *)*buf, "Nikon");
(*buf)[6] = n->version;
- o2 += 2; *buf_size += 2;
+
+ *buf_size += 2;
if (n->version == nikonV2) {
exif_set_short (*buf + 10, n->order, (ExifShort) (
(n->order == EXIF_BYTE_ORDER_INTEL) ?
@@ -131,6 +132,9 @@ exif_mnote_data_olympus_save (ExifMnoteD
}
datao = -10;
break;
+
+ default:
+ return;
}
exif_set_short (*buf + o2, n->order, (ExifShort) n->count);
@@ -202,7 +206,7 @@ exif_mnote_data_olympus_load (ExifMnoteD
"Parsing Olympus maker note...");
/* The number of entries is at position 8. */
- n->version = 0;
+ n->version = olympus;
o2 += 8;
} else if (!memcmp (buf + o2, "Nikon", 6)) {
@@ -211,8 +215,7 @@ exif_mnote_data_olympus_load (ExifMnoteD
"Parsing Nikon maker note (0x%02x, %02x, %02x, "
"%02x, %02x, %02x, %02x, %02x)...",
buf[o2 + 0], buf[o2 + 1], buf[o2 + 2], buf[o2 + 3],
- buf[o2 + 4], buf[o2 + 5], buf[o2 + 6], buf[o2 + 7]);
-
+ buf[o2 + 4], buf[o2 + 5], buf[o2 + 6], buf[o2 + 7]);
/* The first byte is the version. */
if (o2 >= buf_size) return;
n->version = buf[o2];
@@ -222,12 +225,12 @@ exif_mnote_data_olympus_load (ExifMnoteD
o2 += 1;
switch (n->version) {
- case 1:
+ case nikonV1:
base = MNOTE_NIKON1_TAG_BASE;
break;
- case 2:
+ case nikonV2:
/* Skip 2 unknown bytes (00 00). */
o2 += 2;
@@ -266,7 +269,7 @@ exif_mnote_data_olympus_load (ExifMnoteD
return;
}
} else if (!memcmp (buf + o2, "\0\x1b", 2)) {
- n->version = 2;
+ n->version = nikonV2;
} else {
return;
}
|