You can subscribe to this list here.
2002 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
(22) |
Sep
(57) |
Oct
(39) |
Nov
(93) |
Dec
(72) |
---|---|---|---|---|---|---|---|---|---|---|---|---|
2003 |
Jan
(15) |
Feb
(8) |
Mar
(12) |
Apr
(25) |
May
(2) |
Jun
|
Jul
(11) |
Aug
(32) |
Sep
(18) |
Oct
(53) |
Nov
|
Dec
(11) |
2004 |
Jan
(19) |
Feb
(1) |
Mar
(15) |
Apr
(17) |
May
(56) |
Jun
(19) |
Jul
(6) |
Aug
(16) |
Sep
(44) |
Oct
(31) |
Nov
(36) |
Dec
(13) |
2005 |
Jan
(2) |
Feb
(41) |
Mar
(304) |
Apr
(176) |
May
(19) |
Jun
(33) |
Jul
(14) |
Aug
(21) |
Sep
(4) |
Oct
(3) |
Nov
|
Dec
(8) |
2006 |
Jan
(18) |
Feb
(9) |
Mar
(5) |
Apr
(2) |
May
(2) |
Jun
(4) |
Jul
(2) |
Aug
|
Sep
(7) |
Oct
(10) |
Nov
|
Dec
|
2007 |
Jan
|
Feb
(3) |
Mar
(1) |
Apr
(4) |
May
(124) |
Jun
(59) |
Jul
(1) |
Aug
(13) |
Sep
(3) |
Oct
(11) |
Nov
(30) |
Dec
(35) |
2008 |
Jan
(31) |
Feb
(42) |
Mar
(4) |
Apr
(5) |
May
(2) |
Jun
(12) |
Jul
(8) |
Aug
(2) |
Sep
(4) |
Oct
(5) |
Nov
(89) |
Dec
(23) |
2009 |
Jan
(71) |
Feb
(5) |
Mar
(8) |
Apr
(7) |
May
(8) |
Jun
(7) |
Jul
|
Aug
(4) |
Sep
(58) |
Oct
(74) |
Nov
(53) |
Dec
(32) |
2010 |
Jan
(8) |
Feb
(13) |
Mar
(4) |
Apr
|
May
|
Jun
(10) |
Jul
(1) |
Aug
(2) |
Sep
(12) |
Oct
(17) |
Nov
(2) |
Dec
(24) |
2011 |
Jan
(2) |
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
2012 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
(24) |
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
2013 |
Jan
|
Feb
(20) |
Mar
(18) |
Apr
|
May
|
Jun
|
Jul
(5) |
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
2014 |
Jan
(2) |
Feb
|
Mar
|
Apr
|
May
(1) |
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
2016 |
Jan
|
Feb
|
Mar
|
Apr
(4) |
May
|
Jun
|
Jul
|
Aug
|
Sep
(12) |
Oct
|
Nov
|
Dec
|
2017 |
Jan
|
Feb
|
Mar
|
Apr
|
May
(8) |
Jun
|
Jul
(7) |
Aug
|
Sep
|
Oct
|
Nov
(1) |
Dec
(5) |
From: Jan P. <pa...@us...> - 2004-05-24 12:13:30
|
Update of /cvsroot/libexif/libexif/libexif In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv30798 Modified Files: exif-entry.c Log Message: Some rational values are printed as %2.2f and not %i/%i because some cameras and SW tend to write both the numerator and denominator prescaled with some (huge) value (I have several such Photoshop-edited images taken by kodak DX4900). Index: exif-entry.c =================================================================== RCS file: /cvsroot/libexif/libexif/libexif/exif-entry.c,v retrieving revision 1.51 retrieving revision 1.52 diff -u -d -r1.51 -r1.52 --- exif-entry.c 7 May 2004 14:37:53 -0000 1.51 +++ exif-entry.c 24 May 2004 12:13:20 -0000 1.52 @@ -718,16 +718,17 @@ break; case EXIF_FORMAT_RATIONAL: v_rat = exif_get_rational (e->data, o); - snprintf (val, maxlen, "%i/%i", - (int) v_rat.numerator, - (int) v_rat.denominator); + if (v_rat.denominator) { + snprintf (val, maxlen, "%2.2f", (double)v_rat.numerator / v_rat.denominator); + } else { + snprintf (val, maxlen, "%i/%i", v_rat.numerator, v_rat.denominator); + } maxlen -= strlen (val); for (i = 1; i < e->components; i++) { v_rat = exif_get_rational ( e->data + 8 * i, o); - snprintf (b, sizeof (b), ", %i/%i", - (int) v_rat.numerator, - (int) v_rat.denominator); + snprintf (b, sizeof (b), ", %2.2f", + (double)v_rat.numerator / v_rat.denominator); strncat (val, b, maxlen); maxlen -= strlen (b); if ((signed)maxlen <= 0) break; @@ -735,16 +736,17 @@ break; case EXIF_FORMAT_SRATIONAL: v_srat = exif_get_srational (e->data, o); - snprintf (val, maxlen, "%i/%i", - (int) v_srat.numerator, - (int) v_srat.denominator); + if (v_srat.denominator) { + snprintf (val, maxlen, "%2.2f", (double)v_srat.numerator / v_srat.denominator); + } else { + snprintf (val, maxlen, "%i/%i", v_srat.numerator, v_srat.denominator); + } maxlen -= strlen (val); for (i = 1; i < e->components; i++) { v_srat = exif_get_srational ( e->data + 8 * i, o); - snprintf (b, sizeof (b), ", %i/%i", - (int) v_srat.numerator, - (int) v_srat.denominator); + snprintf (b, sizeof (b), ", %2.2f", + (double)v_srat.numerator / v_srat.denominator); strncat (val, b, maxlen); maxlen -= strlen (b); if ((signed) maxlen <= 0) break; |
From: Jan P. <pa...@us...> - 2004-05-24 12:08:27
|
Update of /cvsroot/libexif/libexif/libexif/olympus In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv29792 Modified Files: mnote-olympus-entry.c Log Message: 1) New 3 values of MNOTE_NIKON1_TAG_QUALITY 2) ASCII numeric value of MNOTE_NIKON_TAG_FIRMWARE displays as ASCII and not hex 3) support for MNOTE_NIKON_TAG_DIGITALZOOM, MNOTE_NIKON1_TAG_DIGITALZOOM, MNOTE_NIKON1_TAG_FOCUS & MNOTE_NIKON1_TAG_CONVERTER 4) support of rational value of MNOTE_OLYMPUS_TAG_DIGIZOOM (not only SHORT) 5) double instead of float to avoid precision problems (like 0xFFFFFFFF / 0xFFFFFFFF) Index: mnote-olympus-entry.c =================================================================== RCS file: /cvsroot/libexif/libexif/libexif/olympus/mnote-olympus-entry.c,v retrieving revision 1.9 retrieving revision 1.10 diff -u -d -r1.9 -r1.10 --- mnote-olympus-entry.c 10 May 2004 12:57:17 -0000 1.9 +++ mnote-olympus-entry.c 24 May 2004 12:08:17 -0000 1.10 @@ -61,7 +61,7 @@ struct { int index; const char *string; - } elem[8]; + } elem[10]; } items[] = { { MNOTE_NIKON_TAG_LENSTYPE, EXIF_FORMAT_BYTE, { {0, N_("AF non D Lens")}, @@ -83,6 +83,9 @@ {4, N_("SXGA Basic")}, {5, N_("SXGA Normal")}, {6, N_("SXGA Fine")}, + {10, N_("2 MPixel Basic")}, + {11, N_("2 MPixel Normal")}, + {12, N_("2 MPixel Fine")}, {0, NULL}}}, { MNOTE_NIKON1_TAG_COLORMODE, EXIF_FORMAT_SHORT, { {1, N_("Color")}, @@ -110,6 +113,10 @@ {5, N_("Cloudy")}, {6, N_("SpeedLight")}, {0, NULL}}}, + { MNOTE_NIKON1_TAG_CONVERTER, EXIF_FORMAT_SHORT, + { {0, N_("No Fisheye")}, + {1, N_("Fisheye On")}, + {0, NULL}}}, { MNOTE_OLYMPUS_TAG_QUALITY, EXIF_FORMAT_SHORT, { {1, N_("SQ")}, {2, N_("HQ")}, @@ -154,6 +161,7 @@ ExifShort vs; ExifRational vr; int i, j; + double r, b; if (!entry) return (NULL); @@ -166,27 +174,31 @@ switch (entry->tag) { /* Nikon */ - case MNOTE_NIKON_TAG_FIRMWARE: - CF (entry->format, EXIF_FORMAT_UNDEFINED, v, maxlen); - CC (entry->components, 4, v, maxlen); - vl = exif_get_long (entry->data, entry->order); - snprintf (v, maxlen, "0x%04lx", vl); - break; - case MNOTE_NIKON_TAG_ISO: + case MNOTE_NIKON_TAG_FIRMWARE: + CF (entry->format, EXIF_FORMAT_UNDEFINED, v, maxlen); + CC (entry->components, 4, v, maxlen); + vl = exif_get_long (entry->data, entry->order); + if ((vl & 0xF0F0F0F0) == 0x30303030) { + memcpy (v, entry->data, MIN(maxlen, 4)); + } else { + snprintf (v, maxlen, "%04lx", vl); + } + break; + case MNOTE_NIKON_TAG_ISO: CF (entry->format, EXIF_FORMAT_SHORT, v, maxlen); CC (entry->components, 2, v, maxlen); //vs = exif_get_short (entry->data, entry->order); vs = exif_get_short (entry->data + 2, entry->order); snprintf (v, maxlen, "ISO %hd", vs); break; - case MNOTE_NIKON_TAG_ISO2: + case MNOTE_NIKON_TAG_ISO2: CF (entry->format, EXIF_FORMAT_SHORT, v, maxlen); CC (entry->components, 2, v, maxlen); //vs = exif_get_short (entry->data, entry->order); vs = exif_get_short (entry->data + 2, entry->order); snprintf (v, maxlen, "ISO2 %hd", vs); break; - case MNOTE_NIKON_TAG_QUALITY: + case MNOTE_NIKON_TAG_QUALITY: CF (entry->format, EXIF_FORMAT_ASCII, v, maxlen); //CC (entry->components, 8, v, maxlen); //vl = exif_get_long (entry->data , entry->order); @@ -195,49 +207,60 @@ memcpy(v, entry->data ,entry->components); //snprintf (v, maxlen, "%s<", ( entry->data - 9 ); break; - case MNOTE_NIKON_TAG_COLORMODE: - case MNOTE_NIKON_TAG_COLORMODE1: - case MNOTE_NIKON_TAG_WHITEBALANCE: - case MNOTE_NIKON_TAG_SHARPENING: - case MNOTE_NIKON_TAG_FOCUSMODE: - case MNOTE_NIKON_TAG_FLASHSETTING: - case MNOTE_NIKON_TAG_ISOSELECTION: - case MNOTE_NIKON_TAG_FLASHMODE: - case MNOTE_NIKON_TAG_IMAGEADJUSTMENT: - case MNOTE_NIKON_TAG_ADAPTER: + case MNOTE_NIKON_TAG_COLORMODE: + case MNOTE_NIKON_TAG_COLORMODE1: + case MNOTE_NIKON_TAG_WHITEBALANCE: + case MNOTE_NIKON_TAG_SHARPENING: + case MNOTE_NIKON_TAG_FOCUSMODE: + case MNOTE_NIKON_TAG_FLASHSETTING: + case MNOTE_NIKON_TAG_ISOSELECTION: + case MNOTE_NIKON_TAG_FLASHMODE: + case MNOTE_NIKON_TAG_IMAGEADJUSTMENT: + case MNOTE_NIKON_TAG_ADAPTER: CF (entry->format, EXIF_FORMAT_ASCII, v, maxlen); memcpy(v, entry->data, MIN (maxlen, entry->components)); break; - case MNOTE_NIKON_TAG_TOTALPICTURES: + case MNOTE_NIKON_TAG_TOTALPICTURES: CF (entry->format, EXIF_FORMAT_LONG, v, maxlen); CC (entry->components, 1, v, maxlen); vl = exif_get_long (entry->data, entry->order); snprintf (v, maxlen, "%lu", vl ); break; - case MNOTE_NIKON_TAG_WHITEBALANCEFINE: + case MNOTE_NIKON_TAG_WHITEBALANCEFINE: CF (entry->format, EXIF_FORMAT_SSHORT, v, maxlen); CC (entry->components, 1, v, maxlen); vs = exif_get_short (entry->data, entry->order); snprintf (v, maxlen, "%hd", vs); break; - case MNOTE_NIKON_TAG_WHITEBALANCERB: - CF (entry->format, EXIF_FORMAT_RATIONAL, v, maxlen); - CC (entry->components, 4, v, maxlen); - //vr = exif_get_rational (entry->data, entry->order); - //if (vr.numerator == 0) { - // strncpy (v, _("Unknown"), maxlen); - //} - //else { - { - float r,b; - vr = exif_get_rational (entry->data, entry->order); - r = (1.0*vr.numerator) / vr.denominator; - vr = exif_get_rational (entry->data+8, entry->order); - b = (1.0*vr.numerator) / vr.denominator; - //printf("numerator %li, denominator %li\n", vr.numerator, vr.denominator); - snprintf (v, maxlen, "Red Correction %f, Blue Correction %f", r,b); - } - break; + case MNOTE_NIKON_TAG_WHITEBALANCERB: + CF (entry->format, EXIF_FORMAT_RATIONAL, v, maxlen); + CC (entry->components, 4, v, maxlen); + vr = exif_get_rational (entry->data, entry->order); + r = (double)vr.numerator / vr.denominator; + vr = exif_get_rational (entry->data+8, entry->order); + b = (double)vr.numerator / vr.denominator; + //printf("numerator %li, denominator %li\n", vr.numerator, vr.denominator); + snprintf (v, maxlen, "Red Correction %f, Blue Correction %f", r,b); + break; + case MNOTE_NIKON_TAG_MANUALFOCUSDISTANCE: + CF (entry->format, EXIF_FORMAT_RATIONAL, v, maxlen); + CC (entry->components, 1, v, maxlen); + vr = exif_get_rational (entry->data, entry->order); + if (vr.numerator) { + r = (double)vr.numerator / vr.denominator; + snprintf (v, maxlen, "%2.2f meters", r); + } else { + strncpy (v, _("No manual focus selection"), maxlen); + } + break; + case MNOTE_NIKON_TAG_DIGITALZOOM: + case MNOTE_NIKON1_TAG_DIGITALZOOM: + CF (entry->format, EXIF_FORMAT_RATIONAL, v, maxlen); + CC (entry->components, 1, v, maxlen); + vr = exif_get_rational (entry->data, entry->order); + r = (double)vr.numerator / vr.denominator; + snprintf (v, maxlen, "%2.2f", r); + break; case MNOTE_NIKON_TAG_AFFOCUSPOSITION: CF (entry->format, EXIF_FORMAT_UNDEFINED, v, maxlen); CC (entry->components, 4, v, maxlen); @@ -250,6 +273,19 @@ default: strncpy (v, "Unknown AF Position", maxlen); } break; + case MNOTE_OLYMPUS_TAG_DIGIZOOM: + if (entry->format == EXIF_FORMAT_RATIONAL) { + CC (entry->components, 1, v, maxlen); + vr = exif_get_rational (entry->data, entry->order); + r = (double)vr.numerator / vr.denominator; + if (!vr.numerator) { + strncpy (v, _("None"), maxlen); + } else { + snprintf (v, maxlen, "%2.2f", r); + } + break; + } + /* fall through to handle SHORT version of this tag */ case MNOTE_NIKON_TAG_LENSTYPE: case MNOTE_NIKON_TAG_FLASHUSED: case MNOTE_NIKON1_TAG_QUALITY: @@ -257,9 +293,9 @@ case MNOTE_NIKON1_TAG_IMAGEADJUSTMENT: case MNOTE_NIKON1_TAG_CCDSENSITIVITY: case MNOTE_NIKON1_TAG_WHITEBALANCE: + case MNOTE_NIKON1_TAG_CONVERTER: case MNOTE_OLYMPUS_TAG_QUALITY: case MNOTE_OLYMPUS_TAG_MACRO: - case MNOTE_OLYMPUS_TAG_DIGIZOOM: case MNOTE_OLYMPUS_TAG_FLASHMODE: case MNOTE_OLYMPUS_TAG_SHARPNESS: case MNOTE_OLYMPUS_TAG_CONTRAST: @@ -295,20 +331,31 @@ CF (entry->format, EXIF_FORMAT_RATIONAL, v, maxlen); CC (entry->components, 4, v, maxlen); { - float c,d; + double c,d; unsigned long a,b; vr = exif_get_rational (entry->data, entry->order); a = vr.numerator / vr.denominator; vr = exif_get_rational (entry->data+8, entry->order); b = vr.numerator / vr.denominator; vr = exif_get_rational (entry->data+16, entry->order); - c = (1.0*vr.numerator) / vr.denominator; + c = (double)vr.numerator / vr.denominator; vr = exif_get_rational (entry->data+24, entry->order); - d = (1.0*vr.numerator) / vr.denominator; + d = (double)vr.numerator / vr.denominator; //printf("numerator %li, denominator %li\n", vr.numerator, vr.denominator); snprintf (v, maxlen, "%ld-%ldmm 1:%3.1f - %3.1f",a,b,c,d); } break; + case MNOTE_NIKON1_TAG_FOCUS: + CF (entry->format, EXIF_FORMAT_RATIONAL, v, maxlen); + CC (entry->components, 1, v, maxlen); + vr = exif_get_rational (entry->data, entry->order); + if (!vr.denominator) { + strncpy (v, _("Infinite"), maxlen); + } else { + r = (double)vr.numerator / vr.denominator; + snprintf (v, maxlen, "%2.2f", r); + } + break; /* Olympus */ case MNOTE_OLYMPUS_TAG_MODE: |
From: Jan P. <pa...@us...> - 2004-05-24 12:06:28
|
Update of /cvsroot/libexif/libexif/libjpeg In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv29422 Modified Files: jpeg-data.c jpeg-data.h Log Message: jpeg_data_append_section changed from static to public Index: jpeg-data.c =================================================================== RCS file: /cvsroot/libexif/libexif/libjpeg/jpeg-data.c,v retrieving revision 1.16 retrieving revision 1.17 diff -u -d -r1.16 -r1.17 --- jpeg-data.c 11 May 2004 14:25:15 -0000 1.16 +++ jpeg-data.c 24 May 2004 12:06:09 -0000 1.17 @@ -52,7 +52,7 @@ return (data); } -static void +void jpeg_data_append_section (JPEGData *data) { JPEGSection *s; Index: jpeg-data.h =================================================================== RCS file: /cvsroot/libexif/libexif/libjpeg/jpeg-data.h,v retrieving revision 1.5 retrieving revision 1.6 diff -u -d -r1.5 -r1.6 --- jpeg-data.h 11 May 2004 14:25:15 -0000 1.5 +++ jpeg-data.h 24 May 2004 12:06:09 -0000 1.6 @@ -83,4 +83,6 @@ void jpeg_data_dump (JPEGData *data); +void jpeg_data_append_section (JPEGData *data); + #endif /* __JPEG_DATA_H__ */ |
From: Jan P. <pa...@us...> - 2004-05-24 12:05:50
|
Update of /cvsroot/libexif/exif In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv29299 Modified Files: ChangeLog Log Message: 2004-05-24 Jan Patera <pa...@us...> * libjpeg/jpeg-data.[c,h]: jpeg_data_append_section changed from static to public Index: ChangeLog =================================================================== RCS file: /cvsroot/libexif/exif/ChangeLog,v retrieving revision 1.37 retrieving revision 1.38 diff -u -d -r1.37 -r1.38 --- ChangeLog 20 May 2004 10:51:58 -0000 1.37 +++ ChangeLog 24 May 2004 12:05:41 -0000 1.38 @@ -1,3 +1,8 @@ +2004-05-24 Jan Patera <pa...@us...> + + * libjpeg/jpeg-data.[c,h]: jpeg_data_append_section changed + from static to public + 2004-05-20 Lutz Mueller <lu...@us...> * exif/*: Support for maker notes. |
From: Jan P. <pa...@us...> - 2004-05-24 12:05:31
|
Update of /cvsroot/libexif/exif/libjpeg In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv29259 Modified Files: jpeg-data.c jpeg-data.h Log Message: jpeg_data_append_section changed from static to public Index: jpeg-data.c =================================================================== RCS file: /cvsroot/libexif/exif/libjpeg/jpeg-data.c,v retrieving revision 1.10 retrieving revision 1.11 diff -u -d -r1.10 -r1.11 --- jpeg-data.c 11 May 2004 14:27:52 -0000 1.10 +++ jpeg-data.c 24 May 2004 12:05:22 -0000 1.11 @@ -52,7 +52,7 @@ return (data); } -static void +void jpeg_data_append_section (JPEGData *data) { JPEGSection *s; Index: jpeg-data.h =================================================================== RCS file: /cvsroot/libexif/exif/libjpeg/jpeg-data.h,v retrieving revision 1.3 retrieving revision 1.4 diff -u -d -r1.3 -r1.4 --- jpeg-data.h 11 May 2004 14:27:52 -0000 1.3 +++ jpeg-data.h 24 May 2004 12:05:22 -0000 1.4 @@ -83,4 +83,6 @@ void jpeg_data_dump (JPEGData *data); +void jpeg_data_append_section (JPEGData *data); + #endif /* __JPEG_DATA_H__ */ |
From: Jan P. <pa...@us...> - 2004-05-21 14:29:06
|
Update of /cvsroot/libexif/libexif/libexif In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv32128 Modified Files: exif-log.c Log Message: proper size of memblock to clear Index: exif-log.c =================================================================== RCS file: /cvsroot/libexif/libexif/libexif/exif-log.c,v retrieving revision 1.1 retrieving revision 1.2 diff -u -d -r1.1 -r1.2 --- exif-log.c 20 May 2004 10:50:35 -0000 1.1 +++ exif-log.c 21 May 2004 14:28:56 -0000 1.2 @@ -63,7 +63,7 @@ exif_log_free (ExifLog *log) { if (!log) return; - memset (log, 0, sizeof (log)); + memset (log, 0, sizeof (ExifLog)); free (log); } |
From: Jan P. <pa...@us...> - 2004-05-21 14:23:16
|
Update of /cvsroot/libexif/libexif/libexif In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv30726 Modified Files: exif-data.c Log Message: strnicmp was not a typo. *nix compilers don't like it therefore I changed it to strncasecmp. Hopefully non-*nix developers will be able to replace it with strnicmp (e.g. via define in their config.h) Index: exif-data.c =================================================================== RCS file: /cvsroot/libexif/libexif/libexif/exif-data.c,v retrieving revision 1.44 retrieving revision 1.45 diff -u -d -r1.44 -r1.45 --- exif-data.c 20 May 2004 10:50:35 -0000 1.44 +++ exif-data.c 21 May 2004 14:23:07 -0000 1.45 @@ -689,7 +689,7 @@ /* Pentax & some variant of Nikon */ if ((e->size >= 2) && (e->data[0] == 0x00) && (e->data[1] == 0x1b)) { - if (em && !strncmp (exif_entry_get_value (em, value, sizeof(value)), "Nikon", 5)) { + if (em && !strncasecmp (exif_entry_get_value (em, value, sizeof(value)), "Nikon", 5)) { data->priv->md = exif_mnote_data_olympus_new (); } else { data->priv->md = exif_mnote_data_pentax_new (); |
From: Lutz M?l. <lu...@us...> - 2004-05-20 10:52:11
|
Update of /cvsroot/libexif/exif/exif In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv13917/exif Modified Files: actions.c actions.h main.c Log Message: 2004-05-20 Lutz Mueller <lu...@us...> * exif/*: Support for maker notes. * exif/main.c: Proposal for support of debugging messages. Index: main.c =================================================================== RCS file: /cvsroot/libexif/exif/exif/main.c,v retrieving revision 1.38 retrieving revision 1.39 diff -u -d -r1.38 -r1.39 --- main.c 3 Feb 2004 18:32:22 -0000 1.38 +++ main.c 20 May 2004 10:51:58 -0000 1.39 @@ -28,10 +28,7 @@ #include <libexif/exif-data.h> #include <libexif/exif-utils.h> - -#ifdef HAVE_MNOTE -#include <libmnote/mnote-data.h> -#endif +#include <libexif/exif-loader.h> #include "libjpeg/jpeg-data.h" @@ -69,21 +66,6 @@ exif_entry_dump(entry, 0); } -#ifdef HAVE_MNOTE - -static void -show_note_entry (MNoteData *note, MNoteTag tag) -{ - printf (_("MakerNote entry '%s' (0x%x, '%s'):"), - C(mnote_tag_get_title (note, tag)), tag, - C(mnote_tag_get_name (note, tag))); - printf ("\n"); - - mnote_data_dump_entry(note, tag, 0); -} - -#endif - static void search_entry (ExifData *ed, ExifTag tag) { @@ -210,13 +192,44 @@ return (0); } +#define COL_BLUE "\033[34m" +#define COL_GREEN "\033[32m" +#define COL_RED "\033[31m" +#define COL_NORMAL "\033[0m" + +static void +log_func (ExifLog *log, ExifLogCode code, const char *domain, + const char *format, va_list args, void *data) +{ + switch (code) { + case EXIF_LOG_CODE_DEBUG: + printf (COL_GREEN); + printf ("%s: ", domain); + vprintf (format, args); + printf (COL_NORMAL); + printf ("\n"); + break; + case EXIF_LOG_CODE_NO_MEMORY: + printf (COL_RED); + printf ("%s: ", domain); + vprintf (format, args); + printf (COL_NORMAL); + printf ("\n"); + break; + default: + printf (COL_BLUE); + printf ("%s: ", domain); + vprintf (format, args); + printf (COL_NORMAL); + printf ("\n"); + break; + } +} + typedef struct _ExifOptions ExifOptions; struct _ExifOptions { unsigned int use_ids; ExifTag tag; -#ifdef HAVE_MNOTE - MNoteTag ntag; -#endif }; /* @@ -228,21 +241,11 @@ static unsigned int list_tags = 0, show_description = 0, machine_readable = 0; static unsigned int extract_thumbnail = 0, remove_thumbnail = 0; static unsigned int remove_tag = 0; -#ifdef HAVE_MNOTE -static unsigned int list_ntags = 0; -#endif +static unsigned int list_mnote = 0, debug = 0; static const char *set_value = NULL, *ifd_string = NULL, *tag_string = NULL; -#ifdef HAVE_MNOTE -static const char *ntag_string = NULL; -#endif static ExifIfd ifd = -1; static ExifTag tag = 0; -#ifdef HAVE_MNOTE -static MNoteTag ntag = 0; -static ExifOptions eo = {0, 0, 0}; -#else static ExifOptions eo = {0, 0}; -#endif int main (int argc, const char **argv) @@ -257,18 +260,12 @@ N_("Show IDs instead of tag names"), NULL}, {"tag", 't', POPT_ARG_STRING, &tag_string, 0, N_("Select tag"), N_("tag")}, -#ifdef HAVE_MNOTE - {"ntag", '\0', POPT_ARG_STRING, &ntag_string, 0, - N_("Select MakerNote tag"), N_("ntag")}, -#endif {"ifd", '\0', POPT_ARG_STRING, &ifd_string, 0, N_("Select IFD"), N_("IFD")}, {"list-tags", 'l', POPT_ARG_NONE, &list_tags, 0, N_("List all EXIF tags"), NULL}, -#ifdef HAVE_MNOTE - {"list-ntags", '\0', POPT_ARG_NONE, &list_ntags, 0, - N_("List all EXIF MakerNote tags"), NULL}, -#endif + {"show-mnote", '|', POPT_ARG_NONE, &list_mnote, 0, + N_("Show contents of tag MakerNote"), NULL}, {"remove", '\0', POPT_ARG_NONE, &remove_tag, 0, N_("Remove tag or ifd"), NULL}, {"show-description", 's', POPT_ARG_NONE, &show_description, 0, @@ -286,14 +283,14 @@ {"machine-readable", 'm', POPT_ARG_NONE, &machine_readable, 0, N_("Output in a machine-readable (tab delimited) format"), NULL}, + {"debug", 'd', POPT_ARG_NONE, &debug, 0, + N_("Show debugging messages"), NULL}, POPT_TABLEEND}; ExifData *ed; ExifEntry *e; -#ifdef HAVE_MNOTE - MNoteData *md = 0; -#endif char fname[1024]; FILE *f; + ExifLog *log = NULL; #ifdef ENABLE_NLS #ifdef HAVE_LOCALE_H @@ -307,6 +304,11 @@ poptSetOtherOptionHelp (ctx, _("[OPTION...] file")); while (poptGetNextOpt (ctx) > 0); + if (debug) { + log = exif_log_new (); + exif_log_set_func (log, log_func, NULL); + } + /* Any option? */ if (argc <= 1) { poptPrintHelp (ctx, stdout, 0); @@ -335,11 +337,7 @@ } } - if (show_description -#ifdef HAVE_MNOTE - && !ntag_string -#endif - ) { + if (show_description) { if (!eo.tag) { fprintf (stderr, _("Please specify a tag!")); fputc ('\n', stderr); @@ -357,12 +355,17 @@ if (args) { while (*args) { + ExifLoader *l; /* * Try to read EXIF data from the file. * If there is no EXIF data, exit. */ - ed = exif_data_new_from_file (*args); + l = exif_loader_new (); + exif_loader_log (l, log); + exif_loader_write_file (l, *args); + ed = exif_loader_get_data (l); + exif_loader_unref (l); if (!ed) { fprintf (stderr, _("'%s' does not " "contain EXIF data!"), *args); @@ -370,26 +373,6 @@ exit (1); } -#ifdef HAVE_MNOTE - if (ntag_string || list_ntags || ntag) { - e = exif_content_get_entry(ed->ifd[EXIF_IFD_EXIF], - EXIF_TAG_MAKER_NOTE); - if (!e) { - fprintf (stderr, _("'%s' does not " - "contain EXIF MakerNote data!"), *args); - fputc ('\n', stderr); - exit (1); - } - - md = mnote_data_new_from_data (e->data, e->size); - if (!md) { - fprintf (stderr, "Could not parse EXIF tag MakerNote in '%s'!", *args); - fputc ('\n', stderr); - exit (1); - } - } -#endif - /* Where do we save the output? */ memset (fname, 0, sizeof (fname)); if (output) @@ -400,39 +383,8 @@ sizeof (fname) - 1); } -#ifdef HAVE_MNOTE - if (ntag_string) { - ntag = mnote_tag_from_string (md, ntag_string); - if (!ntag || !mnote_tag_get_name (md, ntag)) { - fprintf (stderr, _("Invalid MakerNote tag '%s'!"), ntag_string); - fputc ('\n', stderr); - return (1); - } - eo.ntag = ntag; - - } - - if (show_description && ntag_string) { - if (!eo.ntag) { - fprintf (stderr, _("Please specify a MakerNote tag!")); - fputc ('\n', stderr); - return (1); - } - printf (_("Tag '%s' (0x%04x, '%s'): %s"), - mnote_tag_get_title (md, eo.ntag), eo.ntag, - mnote_tag_get_name (md, eo.ntag), - mnote_tag_get_description (md, eo.ntag)); - printf ("\n"); - return (0); - } -#endif - if (list_tags) { action_tag_table (*args, ed); -#ifdef HAVE_MNOTE - } else if (list_ntags) { - action_ntag_table (*args, md); -#endif } else if (tag && !set_value) { if ((ifd >= EXIF_IFD_0) && (ifd < EXIF_IFD_COUNT)) { @@ -451,20 +403,6 @@ } else { search_entry (ed, eo.tag); } -#ifdef HAVE_MNOTE - } else if (ntag && !set_value) { - char *value = mnote_data_get_value (md, ntag); - if (value) - show_note_entry (md, ntag); - else { - fprintf (stderr, _("Makernote " - "does not contain tag " - "'%s'."), - ntag_string); - fputc ('\n', stderr); - return (1); - } -#endif } else if (extract_thumbnail) { /* No thumbnail? Exit. */ @@ -630,6 +568,8 @@ } else if (machine_readable) { action_tag_list_machine (*args, ed, eo.use_ids); + } else if (list_mnote) { + action_mnote_list (*args, ed); } else action_tag_list (*args, ed, eo.use_ids); exif_data_unref (ed); Index: actions.c =================================================================== RCS file: /cvsroot/libexif/exif/exif/actions.c,v retrieving revision 1.15 retrieving revision 1.16 diff -u -d -r1.15 -r1.16 --- actions.c 7 Jan 2004 23:38:07 -0000 1.15 +++ actions.c 20 May 2004 10:51:58 -0000 1.16 @@ -59,35 +59,6 @@ } } -#ifdef HAVE_MNOTE - -void -action_ntag_table (const char *filename, MNoteData *en) -{ - unsigned int tag; - const char *name; - char txt[1024]; - - memset (txt, 0, sizeof (txt)); - snprintf (txt, sizeof (txt) - 1, _("EXIF MakerNote tags in '%s':"), filename); - fprintf (stdout, "%-38.38s", txt); - fprintf (stdout, "%-7.7s", "MakerNote"); - fputc ('\n', stdout); - for (tag = 0; tag < 0xffff; tag++) { - name = mnote_tag_get_title (en, tag); - if (!name) - continue; - fprintf (stdout, " 0x%04x %-29.29s", tag, name); - if (mnote_data_get_value (en, tag, txt, 1)) - printf (ENTRY_FOUND); - else - printf (ENTRY_NOT_FOUND); - fputc ('\n', stdout); - } -} - -#endif - static void show_entry (ExifEntry *e, void *data) { @@ -114,30 +85,6 @@ exif_content_foreach_entry (content, show_entry, data); } -#ifdef HAVE_MNOTE - -static void -show_note_entry (MNoteData *note, MNoteTag tag, void *data) -{ - unsigned char *ids = data; - char v[73]; - - if (*ids) - fprintf (stdout, "0x%04x", tag); - else - fprintf (stdout, "%-20.20s", mnote_tag_get_title (note, tag)); - printf ("|"); - if (*ids) - fprintf (stdout, "%-72.72s", - mnote_data_get_value (note, tag, v, 73)); - else - fprintf (stdout, "%-58.58s", - mnote_data_get_value (note, tag, v, 58)); - fputc ('\n', stdout); -} - -#endif - static void print_hline (unsigned char ids) { @@ -151,6 +98,36 @@ } void +action_mnote_list (const char *filename, ExifData *ed) +{ + unsigned int i, bs = 1024, c; + char b[1024]; + ExifMnoteData *n; + + n = exif_data_get_mnote_data (ed); + if (!n) { + printf (_("Unknown MakerNote format.")); + return; + } + + c = exif_mnote_data_count (n); + switch (c) { + case 0: + printf (_("MakerNote does not contain any value.\n")); + break; + case 1: + printf (_("MakerNote contains 1 value:\n")); + break; + default: + printf (_("MakerNote contains %i values:\n"), c); + } + for (i = 0; i < c; i++) + printf ("%s: %s\n", C(exif_mnote_data_get_title (n, i)), + C(exif_mnote_data_get_value (n, i, b, bs))); + exif_mnote_data_unref (n); +} + +void action_tag_list (const char *filename, ExifData *ed, unsigned char ids) { ExifByteOrder order; @@ -211,35 +188,3 @@ if (ed->size) fprintf (stdout, _("ThumbnailSize\t%i\n"), ed->size); } - -#ifdef HAVE_MNOTE - -void -action_ntag_list (const char *filename, MNoteData *en, unsigned char ids) -{ - ExifByteOrder order; - - if (!en) - return; - - order = mnote_data_get_byte_order (en); - fprintf (stdout, _("EXIF MakerNote tags in '%s' ('%s' byte order):"), filename, - exif_byte_order_get_name (order)); - fputc ('\n', stdout); - print_hline (ids); - if (ids) - fprintf (stdout, "%-6.6s", _("Tag")); - else - fprintf (stdout, "%-20.20s", _("Tag")); - fputc ('|', stdout); - if (ids) - fprintf (stdout, "%-72.72s", _("Value")); - else - fprintf (stdout, "%-58.58s", _("Value")); - fputc ('\n', stdout); - print_hline (ids); - mnote_data_foreach_entry (en, show_note_entry, &ids); - print_hline (ids); -} - -#endif Index: actions.h =================================================================== RCS file: /cvsroot/libexif/exif/exif/actions.h,v retrieving revision 1.5 retrieving revision 1.6 diff -u -d -r1.5 -r1.6 --- actions.h 30 Sep 2003 22:43:00 -0000 1.5 +++ actions.h 20 May 2004 10:51:58 -0000 1.6 @@ -33,9 +33,6 @@ void action_tag_list_machine (const char *filename, ExifData *, unsigned char ids); -#ifdef HAVE_MNOTE -void action_ntag_table (const char *filename, MNoteData *en); -void action_ntag_list (const char *filename, MNoteData *en, unsigned char ids); -#endif +void action_mnote_list (const char *filename, ExifData *); #endif /* __ACTIONS_H__ */ |
From: Lutz M?l. <lu...@us...> - 2004-05-20 10:52:10
|
Update of /cvsroot/libexif/exif In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv13917 Modified Files: ChangeLog Log Message: 2004-05-20 Lutz Mueller <lu...@us...> * exif/*: Support for maker notes. * exif/main.c: Proposal for support of debugging messages. Index: ChangeLog =================================================================== RCS file: /cvsroot/libexif/exif/ChangeLog,v retrieving revision 1.36 retrieving revision 1.37 diff -u -d -r1.36 -r1.37 --- ChangeLog 11 May 2004 14:54:25 -0000 1.36 +++ ChangeLog 20 May 2004 10:51:58 -0000 1.37 @@ -1,3 +1,8 @@ +2004-05-20 Lutz Mueller <lu...@us...> + + * exif/*: Support for maker notes. + * exif/main.c: Proposal for support of debugging messages. + 2004-05-11 Jan Patera <pa...@us...> * libjpeg/jpeg-data.c: memory leak in jpeg_data_set_exif_data, |
From: Lutz M?l. <lu...@us...> - 2004-05-20 10:50:48
|
Update of /cvsroot/libexif/libexif/libexif In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv13633/libexif Modified Files: Makefile.am exif-data.c exif-data.h exif-loader.c exif-loader.h exif-mnote-data-priv.h exif-mnote-data.c exif-mnote-data.h Added Files: exif-log.c exif-log.h Log Message: 2004-05-15 Lutz Mueller <lu...@us...> * libexif/exif-log.[c,h]: New. Proposal for handling of debugging messages. --- NEW FILE: exif-log.c --- (This appears to be a binary file; contents omitted.) Index: exif-mnote-data.c =================================================================== RCS file: /cvsroot/libexif/libexif/libexif/exif-mnote-data.c,v retrieving revision 1.4 retrieving revision 1.5 diff -u -d -r1.4 -r1.5 --- exif-mnote-data.c 7 Jan 2004 15:12:12 -0000 1.4 +++ exif-mnote-data.c 20 May 2004 10:50:35 -0000 1.5 @@ -133,3 +133,12 @@ if (!d || !d->methods.get_value) return NULL; return d->methods.get_value (d, n, val, maxlen); } + +void +exif_mnote_data_log (ExifMnoteData *d, ExifLog *log) +{ + if (!d) return; + exif_log_unref (d->log); + d->log = log; + exif_log_ref (log); +} Index: Makefile.am =================================================================== RCS file: /cvsroot/libexif/libexif/libexif/Makefile.am,v retrieving revision 1.25 retrieving revision 1.26 diff -u -d -r1.25 -r1.26 --- Makefile.am 7 Apr 2004 00:39:10 -0000 1.25 +++ Makefile.am 20 May 2004 10:50:35 -0000 1.26 @@ -17,6 +17,7 @@ exif-format.c \ exif-ifd.c \ exif-loader.c \ + exif-log.c \ exif-mnote-data.c \ exif-mnote-data-priv.h \ exif-tag.c \ @@ -36,6 +37,7 @@ exif-format.h \ exif-ifd.h \ exif-loader.h \ + exif-log.h \ exif-mnote-data.h \ exif-result.h \ exif-tag.h \ Index: exif-data.c =================================================================== RCS file: /cvsroot/libexif/libexif/libexif/exif-data.c,v retrieving revision 1.43 retrieving revision 1.44 diff -u -d -r1.43 -r1.44 --- exif-data.c 18 May 2004 12:27:38 -0000 1.43 +++ exif-data.c 20 May 2004 10:50:35 -0000 1.44 @@ -27,6 +27,7 @@ #include "exif-utils.h" #include "exif-loader.h" #include "jpeg-marker.h" +#include <libexif/exif-log.h> #include <libexif/olympus/exif-mnote-data-olympus.h> #include <libexif/canon/exif-mnote-data-canon.h> @@ -49,6 +50,8 @@ ExifMnoteData *md; + ExifLog *log; + unsigned int ref_count; /* Temporarily used while loading data */ @@ -112,6 +115,10 @@ entry->format = exif_get_short (d + offset + 2, data->priv->order); entry->components = exif_get_long (d + offset + 4, data->priv->order); + exif_log (data->priv->log, EXIF_LOG_CODE_DEBUG, "ExifData", + "Loading entry 0x%x ('%s')...", entry->tag, + exif_tag_get_name (entry->tag)); + /* * Size? If bigger than 4 bytes, the actual data is not * in the entry but somewhere else (offset). @@ -128,20 +135,22 @@ if (size < doff + s) return; - entry->data = malloc (sizeof (char) * s); - if (!entry->data) + entry->data = malloc (s); + if (!entry->data) { + EXIF_LOG_NO_MEMORY (data->priv->log, "ExifData", s); return; + } entry->size = s; memcpy (entry->data, d + doff, s); /* If this is the MakerNote, remember the offset */ if (entry->tag == EXIF_TAG_MAKER_NOTE) { -#ifdef DEBUG - printf ("%02x %02x %02x %02x %02x %02x %02x\n", - entry->data[0], entry->data[1], entry->data[2], - entry->data[3], entry->data[4], entry->data[5], - entry->data[6]); -#endif + exif_log (data->priv->log, EXIF_LOG_CODE_DEBUG, "ExifData", + "MakerNote found (%02x %02x %02x %02x " + "%02x %02x %02x...).", + entry->data[0], entry->data[1], entry->data[2], + entry->data[3], entry->data[4], entry->data[5], + entry->data[6]); data->priv->offset_mnote = doff; } } @@ -184,8 +193,10 @@ doff = *ds - 6; *ds += s; *d = realloc (*d, *ds); - if (!*d) + if (!*d) { + EXIF_LOG_NO_MEMORY (data->priv->log, "ExifData", *ds); return; + } exif_set_long (*d + 6 + offset + 8, data->priv->order, doff); } else @@ -201,18 +212,19 @@ unsigned int ds, ExifLong offset, ExifLong size) { if (ds < offset + size) { -#ifdef DEBUG - printf ("Bogus thumbnail offset and size: %i < %i + %i.\n", - (int) ds, (int) offset, (int) size); -#endif + exif_log (data->priv->log, EXIF_LOG_CODE_DEBUG, "ExifData", + "Bogus thumbnail offset and size: %i < %i + %i.", + (int) ds, (int) offset, (int) size); return; } if (data->data) free (data->data); data->size = size; data->data = malloc (data->size); - if (!data->data) - return; + if (!data->data) { + EXIF_LOG_NO_MEMORY (data->priv->log, "ExifData", data->size); + return; + } memcpy (data->data, d + offset, data->size); } @@ -230,9 +242,8 @@ /* Read the number of entries */ if (offset >= ds - 1) return; n = exif_get_short (d + offset, data->priv->order); -#ifdef DEBUG - printf ("Loading %i entries...\n", n); -#endif + exif_log (data->priv->log, EXIF_LOG_CODE_DEBUG, "ExifData", + "Loading %i entries...", n); offset += 2; /* Check if we have enough data. */ @@ -241,10 +252,6 @@ for (i = 0; i < n; i++) { tag = exif_get_short (d + offset + 12 * i, data->priv->order); -#ifdef DEBUG - printf ("Loading entry '%s' (%i of %i)...\n", - exif_tag_get_name (tag), i + 1, n); -#endif switch (tag) { case EXIF_TAG_EXIF_IFD_POINTER: case EXIF_TAG_GPS_INFO_IFD_POINTER: @@ -360,8 +367,10 @@ */ *ds += (2 + (ifd->count + n_ptr + n_thumb) * 12 + 4); *d = realloc (*d, *ds); - if (!*d) + if (!*d) { + EXIF_LOG_NO_MEMORY (data->priv->log, "ExifData", *ds); return; + } /* Save the number of entries */ exif_set_short (*d + 6 + offset, data->priv->order, @@ -461,8 +470,11 @@ *ds - 6); *ds += data->size; *d = realloc (*d, *ds); - if (!*d) + if (!*d) { + EXIF_LOG_NO_MEMORY (data->priv->log, "ExifData", + *ds); return; + } memcpy (*d + *ds - data->size, data->data, data->size); offset += 12; #ifdef DEBUG @@ -697,11 +709,12 @@ * If we are able to interpret the maker note, do so. */ if (data->priv->md) { - exif_mnote_data_set_byte_order (data->priv->md, - data->priv->order); - exif_mnote_data_set_offset (data->priv->md, - data->priv->offset_mnote); - exif_mnote_data_load (data->priv->md, d, ds); + exif_mnote_data_log (data->priv->md, data->priv->log); + exif_mnote_data_set_byte_order (data->priv->md, + data->priv->order); + exif_mnote_data_set_offset (data->priv->md, + data->priv->offset_mnote); + exif_mnote_data_load (data->priv->md, d, ds); } } } @@ -752,24 +765,11 @@ ExifData * exif_data_new_from_file (const char *path) { - FILE *f; - int size; ExifData *edata; ExifLoader *loader; - unsigned char data[1024]; - - f = fopen (path, "rb"); - if (!f) - return (NULL); loader = exif_loader_new (); - while (1) { - size = fread (data, 1, sizeof (data), f); - if (size <= 0) break; - if (!exif_loader_write (loader, data, size)) break; - } - fclose (f); - + exif_loader_write_file (loader, path); edata = exif_loader_get_data (loader); exif_loader_unref (loader); @@ -975,3 +975,12 @@ if (data->priv->md) exif_mnote_data_set_byte_order (data->priv->md, order); } + +void +exif_data_log (ExifData *data, ExifLog *log) +{ + if (!data || !data->priv) return; + exif_log_unref (data->priv->log); + data->priv->log = log; + exif_log_ref (log); +} Index: exif-mnote-data-priv.h =================================================================== RCS file: /cvsroot/libexif/libexif/libexif/exif-mnote-data-priv.h,v retrieving revision 1.4 retrieving revision 1.5 diff -u -d -r1.4 -r1.5 --- exif-mnote-data-priv.h 7 Jan 2004 15:12:12 -0000 1.4 +++ exif-mnote-data-priv.h 20 May 2004 10:50:35 -0000 1.5 @@ -27,6 +27,7 @@ #include <libexif/exif-mnote-data.h> #include <libexif/exif-byte-order.h> +#include <libexif/exif-log.h> typedef struct _ExifMnoteDataMethods ExifMnoteDataMethods; struct _ExifMnoteDataMethods { @@ -55,6 +56,9 @@ ExifMnoteDataPriv *priv; ExifMnoteDataMethods methods; + + /* Logging */ + ExifLog *log; }; void exif_mnote_data_construct (ExifMnoteData *); Index: exif-data.h =================================================================== RCS file: /cvsroot/libexif/libexif/libexif/exif-data.h,v retrieving revision 1.7 retrieving revision 1.8 diff -u -d -r1.7 -r1.8 --- exif-data.h 26 Oct 2003 10:06:17 -0000 1.7 +++ exif-data.h 20 May 2004 10:50:35 -0000 1.8 @@ -25,9 +25,10 @@ extern "C" { #endif /* __cplusplus */ -#include <libexif/exif-tag.h> #include <libexif/exif-byte-order.h> #include <libexif/exif-ifd.h> +#include <libexif/exif-log.h> +#include <libexif/exif-tag.h> typedef struct _ExifData ExifData; typedef struct _ExifDataPrivate ExifDataPrivate; @@ -69,7 +70,9 @@ ExifDataForeachContentFunc func, void *user_data); -void exif_data_dump (ExifData *data); +/* For debugging purposes and error reporting */ +void exif_data_dump (ExifData *data); +void exif_data_log (ExifData *data, ExifLog *log); /* For your convenience */ #define exif_data_get_entry(d,t) \ Index: exif-mnote-data.h =================================================================== RCS file: /cvsroot/libexif/libexif/libexif/exif-mnote-data.h,v retrieving revision 1.2 retrieving revision 1.3 diff -u -d -r1.2 -r1.3 --- exif-mnote-data.h 7 Jan 2004 15:12:12 -0000 1.2 +++ exif-mnote-data.h 20 May 2004 10:50:35 -0000 1.3 @@ -25,6 +25,8 @@ extern "C" { #endif /* __cplusplus */ +#include <libexif/exif-log.h> + typedef struct _ExifMnoteData ExifMnoteData; void exif_mnote_data_ref (ExifMnoteData *); @@ -42,6 +44,8 @@ /* Returns NULL or val */ char *exif_mnote_data_get_value (ExifMnoteData *, unsigned int, char *val, unsigned int maxlen); +void exif_mnote_data_log (ExifMnoteData *, ExifLog *); + #ifdef __cplusplus } #endif /* __cplusplus */ --- NEW FILE: exif-log.h --- (This appears to be a binary file; contents omitted.) Index: exif-loader.c =================================================================== RCS file: /cvsroot/libexif/libexif/libexif/exif-loader.c,v retrieving revision 1.6 retrieving revision 1.7 diff -u -d -r1.6 -r1.7 --- exif-loader.c 2 Feb 2004 15:36:40 -0000 1.6 +++ exif-loader.c 20 May 2004 10:50:35 -0000 1.7 @@ -3,6 +3,9 @@ #include <stdlib.h> #include <string.h> +#include <stdio.h> + +#include <libexif/i18n.h> #include <libjpeg/jpeg-marker.h> @@ -24,16 +27,36 @@ unsigned int bytes_read; unsigned int ref_count; + + ExifLog *log; }; #undef MIN #define MIN(a, b) (((a) < (b)) ? (a) : (b)) -/* - * This function imitates code from libexif, written by Lutz - * Müller. See libexif/exif-data.c:exif_data_new_from_file. Here, it - * can cope with a sequence of data chunks. - */ +void +exif_loader_write_file (ExifLoader *l, const char *path) +{ + FILE *f; + int size; + unsigned char data[1024]; + + if (!l) return; + + f = fopen (path, "rb"); + if (!f) { + exif_log (l->log, EXIF_LOG_CODE_NONE, "ExifLoader", + _("The file '%s' could not be opened."), path); + return; + } + while (1) { + size = fread (data, 1, sizeof (data), f); + if (size <= 0) break; + if (!exif_loader_write (l, data, size)) break; + } + fclose (f); +} + unsigned char exif_loader_write (ExifLoader *eld, unsigned char *buf, unsigned int len) { @@ -43,6 +66,9 @@ if (eld->state == EL_FAILED) return 0; if (eld->size && eld->bytes_read == eld->size) return 0; + exif_log (eld->log, EXIF_LOG_CODE_DEBUG, "ExifLoader", + "Scanning %i byte(s) of data...", len); + for (i = 0; (i < len) && (eld->state != EL_EXIF_FOUND) && (eld->state != EL_FAILED); i++) switch (eld->state) { @@ -179,5 +205,22 @@ ExifData * exif_loader_get_data (ExifLoader *loader) { - return exif_data_new_from_data (loader->buf, loader->bytes_read); + ExifData *ed; + + if (!loader) return NULL; + + ed = exif_data_new (); + exif_data_log (ed, loader->log); + exif_data_load_data (ed, loader->buf, loader->bytes_read); + + return ed; +} + +void +exif_loader_log (ExifLoader *loader, ExifLog *log) +{ + if (!loader) return; + exif_log_unref (loader->log); + loader->log = log; + exif_log_ref (log); } Index: exif-loader.h =================================================================== RCS file: /cvsroot/libexif/libexif/libexif/exif-loader.h,v retrieving revision 1.1 retrieving revision 1.2 diff -u -d -r1.1 -r1.2 --- exif-loader.h 17 Mar 2003 20:39:20 -0000 1.1 +++ exif-loader.h 20 May 2004 10:50:35 -0000 1.2 @@ -22,6 +22,8 @@ #define __EXIF_LOADER_H__ #include <libexif/exif-data.h> +#include <libexif/exif-loader.h> +#include <libexif/exif-log.h> #ifdef __cplusplus extern "C" { @@ -33,6 +35,8 @@ void exif_loader_ref (ExifLoader *); void exif_loader_unref (ExifLoader *); +void exif_loader_write_file (ExifLoader *, const char *fname); + /* * Returns 1 while EXIF data is read (or while there is still * hope that there will be EXIF data later on), 0 otherwise. @@ -42,6 +46,8 @@ void exif_loader_reset (ExifLoader *); ExifData *exif_loader_get_data (ExifLoader *); +void exif_loader_log (ExifLoader *, ExifLog *); + #ifdef __cplusplus } #endif /* __cplusplus */ |
From: Lutz M?l. <lu...@us...> - 2004-05-20 10:50:47
|
Update of /cvsroot/libexif/libexif/libexif/olympus In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv13633/libexif/olympus Modified Files: exif-mnote-data-olympus.c Log Message: 2004-05-15 Lutz Mueller <lu...@us...> * libexif/exif-log.[c,h]: New. Proposal for handling of debugging messages. Index: exif-mnote-data-olympus.c =================================================================== RCS file: /cvsroot/libexif/libexif/libexif/olympus/exif-mnote-data-olympus.c,v retrieving revision 1.12 retrieving revision 1.13 diff -u -d -r1.12 -r1.13 --- exif-mnote-data-olympus.c 11 May 2004 15:11:17 -0000 1.12 +++ exif-mnote-data-olympus.c 20 May 2004 10:50:36 -0000 1.13 @@ -73,7 +73,7 @@ { ExifMnoteDataOlympus *n = (ExifMnoteDataOlympus *) ne; unsigned int i, o, s, doff, base = 0, o2 = 6; - int datao; + int datao = 0; if (!n || !buf || !buf_size) return; @@ -82,42 +82,43 @@ */ *buf_size = 6 + 2 + 2 + n->count * 12; switch (n->version) { - case 0: /* Olympus */ - *buf = malloc (*buf_size); - if (!*buf) return; - memset (*buf, 0, *buf_size); + case 0: /* Olympus */ + *buf = malloc (*buf_size); + if (!*buf) return; + memset (*buf, 0, *buf_size); - /* Write the header and the number of entries. */ - strcpy (*buf, "OLYMP"); - o2 += 2; - datao = n->offset; - break; - case 1: /* Nikon v1 */ - base = MNOTE_NIKON1_TAG_BASE; - *buf_size -= 8; - /* Fall through */ - case 2: /* Nikon v2 */ - *buf_size += 8; - *buf = malloc (*buf_size); - if (!*buf) return; - memset (*buf, 0, *buf_size); + /* Write the header and the number of entries. */ + strcpy (*buf, "OLYMP"); + o2 += 2; + datao = n->offset; + break; + case 1: /* Nikon v1 */ + base = MNOTE_NIKON1_TAG_BASE; + *buf_size -= 8; + /* Fall through */ + case 2: /* Nikon v2 */ + *buf_size += 8; + *buf = malloc (*buf_size); + if (!*buf) return; + memset (*buf, 0, *buf_size); - /* Write the header and the number of entries. */ - strcpy (*buf, "Nikon"); - (*buf)[6] = n->version; - o2 += 2; *buf_size += 2; - if (n->version == 2) { - exif_set_short (*buf + 10, n->order, (ExifShort) ((n->order == EXIF_BYTE_ORDER_INTEL) ? 'II' : 'MM')); - exif_set_short (*buf + 12, n->order, (ExifShort) 0x2A); - exif_set_long (*buf + 14, n->order, (ExifShort) 8); - o2 += 2 + 8; - } - datao = -10; - break; + /* Write the header and the number of entries. */ + strcpy (*buf, "Nikon"); + (*buf)[6] = n->version; + o2 += 2; *buf_size += 2; + if (n->version == 2) { + exif_set_short (*buf + 10, n->order, (ExifShort) ((n->order == EXIF_BYTE_ORDER_INTEL) ? 'II' : 'MM')); + exif_set_short (*buf + 12, n->order, (ExifShort) 0x2A); + exif_set_long (*buf + 14, n->order, (ExifShort) 8); + o2 += 2 + 8; + } + datao = -10; + break; } exif_set_short (*buf + o2, n->order, (ExifShort) n->count); - o2 += 2; + o2 += 2; + /* Save each entry */ for (i = 0; i < n->count; i++) { o = o2 + i * 12; @@ -159,6 +160,9 @@ if (!n || !buf) return; + exif_log (en->log, EXIF_LOG_CODE_DEBUG, "ExifMnoteOlympus", + "Trying to parse Olympus/Nikon maker note..."); + /* * Olympus headers start with "OLYMP" and need to have at least * a size of 22 bytes (6 for 'OLYMP', 2 other bytes, 2 for the @@ -212,8 +216,8 @@ /* Parse the entries */ for (i = 0; i < c; i++) { - o = o2 + 12 * i; - if (o + 12 > buf_size) return; + o = o2 + 12 * i; + if (o + 12 > buf_size) return; n->count = i + 1; n->entries[i].tag = exif_get_short (buf + o, n->order) + base; @@ -221,6 +225,10 @@ n->entries[i].components = exif_get_long (buf + o + 4, n->order); n->entries[i].order = n->order; + exif_log (en->log, EXIF_LOG_CODE_DEBUG, "ExifMnoteOlympus", + "Loading entry 0x%x ('%s')...", n->entries[i].tag, + mnote_olympus_tag_get_name (n->entries[i].tag)); + /* * Size? If bigger than 4 bytes, the actual data is not * in the entry but somewhere else (offset). |
From: Lutz M?l. <lu...@us...> - 2004-05-20 10:50:45
|
Update of /cvsroot/libexif/libexif In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv13633 Modified Files: ChangeLog Log Message: 2004-05-15 Lutz Mueller <lu...@us...> * libexif/exif-log.[c,h]: New. Proposal for handling of debugging messages. Index: ChangeLog =================================================================== RCS file: /cvsroot/libexif/libexif/ChangeLog,v retrieving revision 1.115 retrieving revision 1.116 diff -u -d -r1.115 -r1.116 --- ChangeLog 13 May 2004 13:58:23 -0000 1.115 +++ ChangeLog 20 May 2004 10:50:20 -0000 1.116 @@ -1,3 +1,8 @@ +2004-05-15 Lutz Mueller <lu...@us...> + + * libexif/exif-log.[c,h]: New. Proposal for handling of debugging + messages. + 2004-05-13 Jan Patera <pa...@us...> * libexif/exif-data.c: Fill tag data with zeros on save even |
From: J?rg H. <ho...@us...> - 2004-05-18 12:27:49
|
Update of /cvsroot/libexif/libexif/libexif In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv14130 Modified Files: exif-data.c Log Message: fixed typo (typical vi failure) Index: exif-data.c =================================================================== RCS file: /cvsroot/libexif/libexif/libexif/exif-data.c,v retrieving revision 1.42 retrieving revision 1.43 diff -u -d -r1.42 -r1.43 --- exif-data.c 16 May 2004 13:48:29 -0000 1.42 +++ exif-data.c 18 May 2004 12:27:38 -0000 1.43 @@ -677,7 +677,7 @@ /* Pentax & some variant of Nikon */ if ((e->size >= 2) && (e->data[0] == 0x00) && (e->data[1] == 0x1b)) { - if (em && !strnicmp (exif_entry_get_value (em, value, sizeof(value)), "Nikon", 5)) { + if (em && !strncmp (exif_entry_get_value (em, value, sizeof(value)), "Nikon", 5)) { data->priv->md = exif_mnote_data_olympus_new (); } else { data->priv->md = exif_mnote_data_pentax_new (); |
From: J?rg H. <ho...@us...> - 2004-05-16 14:06:50
|
Update of /cvsroot/libexif/libexif/libexif In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv3817 Modified Files: exif-content.c Log Message: added error handling on realloc added a missing realloc when removing entries Index: exif-content.c =================================================================== RCS file: /cvsroot/libexif/libexif/libexif/exif-content.c,v retrieving revision 1.9 retrieving revision 1.10 diff -u -d -r1.9 -r1.10 --- exif-content.c 26 Oct 2003 22:30:26 -0000 1.9 +++ exif-content.c 16 May 2004 14:06:37 -0000 1.10 @@ -109,6 +109,8 @@ entry->parent = content; content->entries = realloc (content->entries, sizeof (ExifEntry) * (content->count + 1)); + if (!content->entries) + return; content->entries[content->count] = entry; exif_entry_ref (entry); content->count++; @@ -132,6 +134,7 @@ c->count--; e->parent = NULL; exif_entry_unref (e); + c->entries = realloc(c->entries,sizeof(ExifEntry) * c->count); } ExifEntry * |
From: J?rg H. <ho...@us...> - 2004-05-16 13:48:38
|
Update of /cvsroot/libexif/libexif/libexif In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv32649 Modified Files: exif-data.c Log Message: added error handling on malloc/realloc Index: exif-data.c =================================================================== RCS file: /cvsroot/libexif/libexif/libexif/exif-data.c,v retrieving revision 1.41 retrieving revision 1.42 diff -u -d -r1.41 -r1.42 --- exif-data.c 15 May 2004 20:29:19 -0000 1.41 +++ exif-data.c 16 May 2004 13:48:29 -0000 1.42 @@ -183,7 +183,9 @@ if (s > 4) { doff = *ds - 6; *ds += s; - *d = realloc (*d, sizeof (char) * *ds); + *d = realloc (*d, *ds); + if (!*d) + return; exif_set_long (*d + 6 + offset + 8, data->priv->order, doff); } else @@ -208,7 +210,9 @@ if (data->data) free (data->data); data->size = size; - data->data = malloc (sizeof (char) * data->size); + data->data = malloc (data->size); + if (!data->data) + return; memcpy (data->data, d + offset, data->size); } @@ -355,7 +359,9 @@ * and the number of entries. */ *ds += (2 + (ifd->count + n_ptr + n_thumb) * 12 + 4); - *d = realloc (*d, sizeof (char) * *ds); + *d = realloc (*d, *ds); + if (!*d) + return; /* Save the number of entries */ exif_set_short (*d + 6 + offset, data->priv->order, @@ -454,7 +460,9 @@ exif_set_long (*d + 6 + offset + 8, data->priv->order, *ds - 6); *ds += data->size; - *d = realloc (*d, sizeof (char) * *ds); + *d = realloc (*d, *ds); + if (!*d) + return; memcpy (*d + *ds - data->size, data->data, data->size); offset += 12; #ifdef DEBUG @@ -707,6 +715,8 @@ /* Header */ *ds = 14; *d = malloc (*ds); + if (!*d) + return; memcpy (*d, ExifHeader, 6); /* Order (offset 6) */ |
From: J?rg H. <ho...@us...> - 2004-05-15 20:29:27
|
Update of /cvsroot/libexif/libexif/libexif In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv4043 Modified Files: exif-data.c Log Message: we know how much memory we need so we don't need to call realloc() all the time Index: exif-data.c =================================================================== RCS file: /cvsroot/libexif/libexif/libexif/exif-data.c,v retrieving revision 1.40 retrieving revision 1.41 diff -u -d -r1.40 -r1.41 --- exif-data.c 13 May 2004 13:58:23 -0000 1.40 +++ exif-data.c 15 May 2004 20:29:19 -0000 1.41 @@ -701,19 +701,15 @@ void exif_data_save_data (ExifData *data, unsigned char **d, unsigned int *ds) { - if (!data) - return; - if (!d || !ds) + if (!data || !d || !ds) return; /* Header */ - *ds = 6; - *d = malloc (sizeof (char) * *ds); + *ds = 14; + *d = malloc (*ds); memcpy (*d, ExifHeader, 6); /* Order (offset 6) */ - *ds += 2; - *d = realloc (*d, sizeof (char) * *ds); if (data->priv->order == EXIF_BYTE_ORDER_INTEL) { memcpy (*d + 6, "II", 2); } else { @@ -721,8 +717,6 @@ } /* Fixed value (2 bytes, offset 8) */ - *ds += 2; - *d = realloc (*d, sizeof (char) * *ds); exif_set_short (*d + 8, data->priv->order, 0x002a); /* @@ -731,8 +725,6 @@ * EXIF header (2 bytes for order, another 2 for the test, and * 4 bytes for the IFD 0 offset make 8 bytes together). */ - *ds += 4; - *d = realloc (*d, sizeof (char) * *ds); exif_set_long (*d + 10, data->priv->order, 8); /* Now save IFD 0. IFD 1 will be saved automatically. */ |
From: Jan P. <pa...@us...> - 2004-05-13 13:58:35
|
Update of /cvsroot/libexif/libexif/libexif In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv11513/libexif Modified Files: exif-data.c Log Message: 2004-05-13 Jan Patera <pa...@us...> * libexif/exif-data.c: Fill tag data with zeros on save even if 0 components (buggy Kodak-210) Index: exif-data.c =================================================================== RCS file: /cvsroot/libexif/libexif/libexif/exif-data.c,v retrieving revision 1.39 retrieving revision 1.40 diff -u -d -r1.39 -r1.40 --- exif-data.c 11 May 2004 15:15:26 -0000 1.39 +++ exif-data.c 13 May 2004 13:58:23 -0000 1.40 @@ -180,8 +180,6 @@ * the entry but somewhere else. */ s = exif_format_get_size (e->format) * e->components; - if (!s) - return; if (s > 4) { doff = *ds - 6; *ds += s; @@ -192,7 +190,7 @@ doff = offset + 8; /* Write the data. Fill unneeded bytes with 0. */ - memcpy (*d + 6 + doff, e->data, e->size); + memcpy (*d + 6 + doff, e->data, s); if (s < 4) memset (*d + 6 + doff + s, 0, (4 - s)); } |
From: Jan P. <pa...@us...> - 2004-05-13 13:58:32
|
Update of /cvsroot/libexif/libexif In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv11513 Modified Files: ChangeLog Log Message: 2004-05-13 Jan Patera <pa...@us...> * libexif/exif-data.c: Fill tag data with zeros on save even if 0 components (buggy Kodak-210) Index: ChangeLog =================================================================== RCS file: /cvsroot/libexif/libexif/ChangeLog,v retrieving revision 1.114 retrieving revision 1.115 diff -u -d -r1.114 -r1.115 --- ChangeLog 12 May 2004 12:03:45 -0000 1.114 +++ ChangeLog 13 May 2004 13:58:23 -0000 1.115 @@ -1,3 +1,8 @@ +2004-05-13 Jan Patera <pa...@us...> + + * libexif/exif-data.c: Fill tag data with zeros on save even + if 0 components (buggy Kodak-210) + 2004-05-12 Jan Patera <pa...@us...> * libexif/exif-utils.h: definition of MIN |
From: Jan P. <pa...@us...> - 2004-05-12 12:03:55
|
Update of /cvsroot/libexif/libexif/libexif/pentax In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv10435/libexif/pentax Modified Files: mnote-pentax-entry.c Log Message: 2004-05-12 Jan Patera <pa...@us...> * libexif/exif-utils.h: definition of MIN * libexif/pentax/mnote-pentax-entry.c: min -> MIN (found by Serge Droz <ser...@ps...>) Index: mnote-pentax-entry.c =================================================================== RCS file: /cvsroot/libexif/libexif/libexif/pentax/mnote-pentax-entry.c,v retrieving revision 1.5 retrieving revision 1.6 diff -u -d -r1.5 -r1.6 --- mnote-pentax-entry.c 10 May 2004 12:29:48 -0000 1.5 +++ mnote-pentax-entry.c 12 May 2004 12:03:47 -0000 1.6 @@ -187,7 +187,7 @@ default: switch (entry->format) { case EXIF_FORMAT_ASCII: - strncpy (val, entry->data, min(maxlen, entry->components)); + strncpy (val, entry->data, MIN(maxlen, entry->components)); break; case EXIF_FORMAT_SHORT: vs = exif_get_short (entry->data, entry->order); |
From: Jan P. <pa...@us...> - 2004-05-12 12:03:55
|
Update of /cvsroot/libexif/libexif/libexif In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv10435/libexif Modified Files: exif-utils.h Log Message: 2004-05-12 Jan Patera <pa...@us...> * libexif/exif-utils.h: definition of MIN * libexif/pentax/mnote-pentax-entry.c: min -> MIN (found by Serge Droz <ser...@ps...>) Index: exif-utils.h =================================================================== RCS file: /cvsroot/libexif/libexif/libexif/exif-utils.h,v retrieving revision 1.10 retrieving revision 1.11 diff -u -d -r1.10 -r1.11 --- exif-utils.h 7 Apr 2004 00:39:10 -0000 1.10 +++ exif-utils.h 12 May 2004 12:03:46 -0000 1.11 @@ -59,6 +59,9 @@ void exif_set_srational (unsigned char *b, ExifByteOrder order, ExifSRational value); +#undef MIN +#define MIN(a, b) (((a) < (b)) ? (a) : (b)) + /* For compatibility with older versions */ #define EXIF_TAG_SUBSEC_TIME EXIF_TAG_SUB_SEC_TIME |
From: Jan P. <pa...@us...> - 2004-05-12 12:03:55
|
Update of /cvsroot/libexif/libexif In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv10435 Modified Files: ChangeLog Log Message: 2004-05-12 Jan Patera <pa...@us...> * libexif/exif-utils.h: definition of MIN * libexif/pentax/mnote-pentax-entry.c: min -> MIN (found by Serge Droz <ser...@ps...>) Index: ChangeLog =================================================================== RCS file: /cvsroot/libexif/libexif/ChangeLog,v retrieving revision 1.113 retrieving revision 1.114 diff -u -d -r1.113 -r1.114 --- ChangeLog 11 May 2004 15:17:58 -0000 1.113 +++ ChangeLog 12 May 2004 12:03:45 -0000 1.114 @@ -1,3 +1,9 @@ +2004-05-12 Jan Patera <pa...@us...> + + * libexif/exif-utils.h: definition of MIN + * libexif/pentax/mnote-pentax-entry.c: min -> MIN + (found by Serge Droz <ser...@ps...>) + 2004-05-11 Jan Patera <pa...@us...> * libjpeg/jpeg-data.c: memory leak in jpeg_data_set_exif_data, |
From: Jan P. <pa...@us...> - 2004-05-11 15:18:08
|
Update of /cvsroot/libexif/libexif In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv19785 Modified Files: ChangeLog Log Message: 2004-05-11 Jan Patera <pa...@us...> * libjpeg/jpeg-data.c: memory leak in jpeg_data_set_exif_data, return type of jpeg_data_save_file * libexif/exif-entry.c: proper mnote size on save * libexif/olympus: saving Nikon mnote Index: ChangeLog =================================================================== RCS file: /cvsroot/libexif/libexif/ChangeLog,v retrieving revision 1.112 retrieving revision 1.113 diff -u -d -r1.112 -r1.113 --- ChangeLog 10 May 2004 12:31:01 -0000 1.112 +++ ChangeLog 11 May 2004 15:17:58 -0000 1.113 @@ -1,3 +1,10 @@ +2004-05-11 Jan Patera <pa...@us...> + + * libjpeg/jpeg-data.c: memory leak in jpeg_data_set_exif_data, + return type of jpeg_data_save_file + * libexif/exif-entry.c: proper mnote size on save + * libexif/olympus: saving Nikon mnote + 2004-05-10 Jan Patera <pa...@us...> * libexif: Support of Nikon maker note |
From: Jan P. <pa...@us...> - 2004-05-11 15:15:44
|
Update of /cvsroot/libexif/libexif/libexif In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv18752 Modified Files: exif-data.c Log Message: A fix of storing maker note on save. If the new mnote was longer than in the original file, the created file was corrupted. If it was shorter than originally, random rubbish was stored (could be viewed also as "padding"). Index: exif-data.c =================================================================== RCS file: /cvsroot/libexif/libexif/libexif/exif-data.c,v retrieving revision 1.38 retrieving revision 1.39 diff -u -d -r1.38 -r1.39 --- exif-data.c 10 May 2004 12:29:48 -0000 1.38 +++ exif-data.c 11 May 2004 15:15:26 -0000 1.39 @@ -161,6 +161,17 @@ data->priv->order, (ExifShort) e->tag); exif_set_short (*d + 6 + offset + 2, data->priv->order, (ExifShort) e->format); + + /* If this is the maker note tag, update it. */ + if ((e->tag == EXIF_TAG_MAKER_NOTE) && data->priv->md) { + free (e->data); + e->data = NULL; + e->size = 0; + exif_mnote_data_set_offset (data->priv->md, *ds - 6); + exif_mnote_data_save (data->priv->md, &e->data, &e->size); + e->components = e->size; + } + exif_set_long (*d + 6 + offset + 4, data->priv->order, e->components); @@ -172,23 +183,14 @@ if (!s) return; if (s > 4) { + doff = *ds - 6; *ds += s; *d = realloc (*d, sizeof (char) * *ds); - doff = *ds - 6 - s; exif_set_long (*d + 6 + offset + 8, data->priv->order, doff); } else doff = offset + 8; - /* If this is the maker note tag, update it. */ - if ((e->tag == EXIF_TAG_MAKER_NOTE) && data->priv->md) { - free (e->data); - e->data = NULL; - e->size = 0; - exif_mnote_data_set_offset (data->priv->md, doff); - exif_mnote_data_save (data->priv->md, &e->data, &e->size); - } - /* Write the data. Fill unneeded bytes with 0. */ memcpy (*d + 6 + doff, e->data, e->size); if (s < 4) memset (*d + 6 + doff + s, 0, (4 - s)); @@ -666,7 +668,7 @@ } else { char value[7]; em = exif_data_get_entry (data, EXIF_TAG_MAKE); - /* Pentax & some variant of Nikon */ + /* Pentax & some variant of Nikon */ if ((e->size >= 2) && (e->data[0] == 0x00) && (e->data[1] == 0x1b)) { if (em && !strnicmp (exif_entry_get_value (em, value, sizeof(value)), "Nikon", 5)) { |
From: Jan P. <pa...@us...> - 2004-05-11 15:11:32
|
Update of /cvsroot/libexif/libexif/libexif/olympus In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv18422 Modified Files: exif-mnote-data-olympus.c exif-mnote-data-olympus.h Log Message: Saving of Nikon v2 maker note Index: exif-mnote-data-olympus.h =================================================================== RCS file: /cvsroot/libexif/libexif/libexif/olympus/exif-mnote-data-olympus.h,v retrieving revision 1.2 retrieving revision 1.3 diff -u -d -r1.2 -r1.3 --- exif-mnote-data-olympus.h 26 Oct 2003 22:30:26 -0000 1.2 +++ exif-mnote-data-olympus.h 11 May 2004 15:11:17 -0000 1.3 @@ -35,6 +35,8 @@ ExifByteOrder order; unsigned int offset; + /* 0: Olympus; 1: Nikon v1; 2: Nikon v2 */ + int version; }; ExifMnoteData *exif_mnote_data_olympus_new (void); Index: exif-mnote-data-olympus.c =================================================================== RCS file: /cvsroot/libexif/libexif/libexif/olympus/exif-mnote-data-olympus.c,v retrieving revision 1.11 retrieving revision 1.12 diff -u -d -r1.11 -r1.12 --- exif-mnote-data-olympus.c 10 May 2004 12:28:48 -0000 1.11 +++ exif-mnote-data-olympus.c 11 May 2004 15:11:17 -0000 1.12 @@ -72,7 +72,8 @@ unsigned char **buf, unsigned int *buf_size) { ExifMnoteDataOlympus *n = (ExifMnoteDataOlympus *) ne; - unsigned int i, o, s, doff; + unsigned int i, o, s, doff, base = 0, o2 = 6; + int datao; if (!n || !buf || !buf_size) return; @@ -80,19 +81,48 @@ * Allocate enough memory for all entries and the number of entries. */ *buf_size = 6 + 2 + 2 + n->count * 12; - *buf = malloc (*buf_size); - if (!*buf) return; - memset (*buf, 0, *buf_size); + switch (n->version) { + case 0: /* Olympus */ + *buf = malloc (*buf_size); + if (!*buf) return; + memset (*buf, 0, *buf_size); - /* Write the header and the number of entries. */ - strcpy (*buf, "OLYMP"); - exif_set_short (*buf + 8, n->order, (ExifShort) n->count); + /* Write the header and the number of entries. */ + strcpy (*buf, "OLYMP"); + o2 += 2; + datao = n->offset; + break; + case 1: /* Nikon v1 */ + base = MNOTE_NIKON1_TAG_BASE; + *buf_size -= 8; + /* Fall through */ + case 2: /* Nikon v2 */ + *buf_size += 8; + *buf = malloc (*buf_size); + if (!*buf) return; + memset (*buf, 0, *buf_size); + + /* Write the header and the number of entries. */ + strcpy (*buf, "Nikon"); + (*buf)[6] = n->version; + o2 += 2; *buf_size += 2; + if (n->version == 2) { + exif_set_short (*buf + 10, n->order, (ExifShort) ((n->order == EXIF_BYTE_ORDER_INTEL) ? 'II' : 'MM')); + exif_set_short (*buf + 12, n->order, (ExifShort) 0x2A); + exif_set_long (*buf + 14, n->order, (ExifShort) 8); + o2 += 2 + 8; + } + datao = -10; + break; + } + exif_set_short (*buf + o2, n->order, (ExifShort) n->count); + o2 += 2; /* Save each entry */ for (i = 0; i < n->count; i++) { - o = 6 + 2 + 2 + i * 12; + o = o2 + i * 12; exif_set_short (*buf + o + 0, n->order, - (ExifShort) n->entries[i].tag); + (ExifShort) (n->entries[i].tag - base)); exif_set_short (*buf + o + 2, n->order, (ExifShort) n->entries[i].format); exif_set_long (*buf + o + 4, n->order, @@ -101,16 +131,21 @@ s = exif_format_get_size (n->entries[i].format) * n->entries[i].components; if (s > 4) { + doff = *buf_size; *buf_size += s; *buf = realloc (*buf, *buf_size); if (!*buf) return; - doff = *buf_size - s; - exif_set_long (*buf + o, n->order, n->offset + doff); + exif_set_long (*buf + o, n->order, datao + doff); } else doff = o; /* Write the data. */ - memcpy (*buf + doff, n->entries[i].data, s); + if (n->entries[i].data) { + memcpy (*buf + doff, n->entries[i].data, s); + } else { + /* Most certainly damaged input file */ + memset (*buf + doff, 0, s); + } } } @@ -138,18 +173,22 @@ if (!memcmp (buf + 6 + n->offset, "OLYMP", 5)) { o2 = 6 + n->offset + 8 + 2; c = exif_get_short (buf + 6 + n->offset + 8, n->order); + n->version = 0; } else if (!memcmp (buf + 6 + n->offset, "Nikon", 5)) { o2 = 6 + n->offset + 8 + 2; datao = o2; if (!memcmp(buf + o2 - 4, "\2\0\0\0II\x2A\0", 8)) { n->order = EXIF_BYTE_ORDER_INTEL; o2 += exif_get_long(buf + o2 + 4, n->order); + n->version = 2; } else if (!memcmp(buf + o2 - 4, "\2\0\0\0MM\0\x2A", 8)) { n->order = EXIF_BYTE_ORDER_MOTOROLA; o2 += exif_get_long(buf + o2 + 4, n->order); + n->version = 2; } else if (!memcmp(buf + o2 - 4, "\1\0", 2)) { o2 -= 2; base = MNOTE_NIKON1_TAG_BASE; + n->version = 1; } else { return; } @@ -160,6 +199,7 @@ o2 = 6 + n->offset; c = exif_get_short (buf + o2, n->order); o2 += 2; + n->version = 2; } else { return; } @@ -172,8 +212,8 @@ /* Parse the entries */ for (i = 0; i < c; i++) { - o = o2 + 12 * i; - if (o + 12 > buf_size) return; + o = o2 + 12 * i; + if (o + 12 > buf_size) return; n->count = i + 1; n->entries[i].tag = exif_get_short (buf + o, n->order) + base; @@ -187,14 +227,14 @@ */ s = exif_format_get_size (n->entries[i].format) * n->entries[i].components; - if (!s) return; + if (!s) continue; o += 8; if (s > 4) o = exif_get_long (buf + o, n->order) + datao; - if (o + s > buf_size) return; + if (o + s > buf_size) continue; /* Sanity check */ n->entries[i].data = malloc (s); - if (!n->entries[i].data) return; + if (!n->entries[i].data) continue; n->entries[i].size = s; memcpy (n->entries[i].data, buf + o, s); } |
From: Jan P. <pa...@us...> - 2004-05-11 14:54:35
|
Update of /cvsroot/libexif/exif In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv14212 Modified Files: ChangeLog Log Message: 2004-05-11 Jan Patera <pa...@us...> * libjpeg/jpeg-data.c: memory leak in jpeg_data_set_exif_data, return type of jpeg_data_save_file Index: ChangeLog =================================================================== RCS file: /cvsroot/libexif/exif/ChangeLog,v retrieving revision 1.35 retrieving revision 1.36 diff -u -d -r1.35 -r1.36 --- ChangeLog 4 Apr 2004 08:45:43 -0000 1.35 +++ ChangeLog 11 May 2004 14:54:25 -0000 1.36 @@ -1,3 +1,8 @@ +2004-05-11 Jan Patera <pa...@us...> + + * libjpeg/jpeg-data.c: memory leak in jpeg_data_set_exif_data, + return type of jpeg_data_save_file + 2004-04-04 Lutz Mueller lu...@us... * configure.in: libmnote is no longer separate from libexif. |