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: Lutz M?l. <lu...@us...> - 2003-10-27 22:38:06
|
Update of /cvsroot/libexif/libexif/libexif/canon In directory sc8-pr-cvs1:/tmp/cvs-serv7105/libexif/canon Modified Files: exif-mnote-data-canon.c mnote-canon-entry.c Log Message: 2003-10-27 Lutz Mueller <lu...@us...> * libexif: Canon maker notes seem to work now (both loading and saving). Index: mnote-canon-entry.c =================================================================== RCS file: /cvsroot/libexif/libexif/libexif/canon/mnote-canon-entry.c,v retrieving revision 1.2 retrieving revision 1.3 diff -u -d -r1.2 -r1.3 --- mnote-canon-entry.c 27 Oct 2003 20:07:11 -0000 1.2 +++ mnote-canon-entry.c 27 Oct 2003 22:34:30 -0000 1.3 @@ -69,13 +69,13 @@ switch (entry->tag) { case MNOTE_CANON_TAG_SETTINGS_1: CF (entry->format, EXIF_FORMAT_SHORT, v); - n = exif_get_short (data, entry->order)/2; - data+=2; + n = exif_get_short (data, entry->order) / 2; + data += 2; CC (entry->components, n, v); for (i = 1; i < n; i++) { vs = exif_get_short (data, entry->order); data += 2; - switch(i) { + switch (i) { case 1: strncpy (v, _("Macro mode : "), sizeof (v) - 1); switch (vs) { Index: exif-mnote-data-canon.c =================================================================== RCS file: /cvsroot/libexif/libexif/libexif/canon/exif-mnote-data-canon.c,v retrieving revision 1.3 retrieving revision 1.4 diff -u -d -r1.3 -r1.4 --- exif-mnote-data-canon.c 27 Oct 2003 20:07:11 -0000 1.3 +++ exif-mnote-data-canon.c 27 Oct 2003 22:34:30 -0000 1.4 @@ -65,7 +65,7 @@ ExifMnoteDataCanon *cnote = (ExifMnoteDataCanon *) note; if (!note) return NULL; - if (cnote->count >= n) return NULL; + if (cnote->count <= n) return NULL; return mnote_canon_entry_get_value (&cnote->entries[n]); } @@ -146,6 +146,52 @@ } static void +exif_mnote_data_canon_save (ExifMnoteData *ne, + unsigned char **buf, unsigned int *buf_size) +{ + ExifMnoteDataCanon *n = (ExifMnoteDataCanon *) ne; + unsigned int i, o, s, doff; + + if (!n || !buf || !buf_size) return; + + /* + * Allocate enough memory for all entries and the number + * of entries. + */ + *buf_size = 2 + n->count * 12 + 4; + *buf = malloc (sizeof (char) * *buf_size); + if (!*buf) return; + memset (*buf, 0, sizeof (char) * *buf_size); + + /* Save the number of entries */ + exif_set_short (*buf, n->order, n->count); + + /* Save each entry */ + for (i = 0; i < n->count; i++) { + o = 2 + i * 12; + exif_set_short (*buf + o + 0, n->order, n->entries[i].tag); + exif_set_short (*buf + o + 2, n->order, n->entries[i].format); + exif_set_long (*buf + o + 4, n->order, + n->entries[i].components); + o += 8; + s = exif_format_get_size (n->entries[i].format) * + n->entries[i].components; + if (s > 4) { + *buf_size += s; + *buf = realloc (*buf, sizeof (char) * *buf_size); + if (!*buf) return; + doff = *buf_size - s; + exif_set_long (*buf + o, n->order, n->offset + doff); + } else + doff = o; + + /* Write the data. Fill unneeded bytes with 0. */ + memcpy (*buf + doff, n->entries[i].data, s); + if (s < 4) memset (*buf + doff + s, 0, (4 - s)); + } +} + +static void exif_mnote_data_canon_load (ExifMnoteData *ne, const unsigned char *buf, unsigned int buf_size) { @@ -186,13 +232,10 @@ /* Sanity check */ n->entries[i].data = malloc (sizeof (char) * s); if (!n->entries[i].data) return; + memset (n->entries[i].data, 0, sizeof (char) * s); n->entries[i].size = s; memcpy (n->entries[i].data, buf + o, s); } - -#ifdef DEBUG - printf ("Loaded %i entries.\n", n->count); -#endif } static unsigned int @@ -246,6 +289,7 @@ d->methods.set_byte_order = exif_mnote_data_canon_set_byte_order; d->methods.set_offset = exif_mnote_data_canon_set_offset; d->methods.load = exif_mnote_data_canon_load; + d->methods.save = exif_mnote_data_canon_save; d->methods.count = exif_mnote_data_canon_count; d->methods.get_name = exif_mnote_data_canon_get_name; d->methods.get_title = exif_mnote_data_canon_get_title; |
From: Lutz M?l. <lu...@us...> - 2003-10-27 22:38:06
|
Update of /cvsroot/libexif/libexif In directory sc8-pr-cvs1:/tmp/cvs-serv7105 Modified Files: ChangeLog Log Message: 2003-10-27 Lutz Mueller <lu...@us...> * libexif: Canon maker notes seem to work now (both loading and saving). Index: ChangeLog =================================================================== RCS file: /cvsroot/libexif/libexif/ChangeLog,v retrieving revision 1.81 retrieving revision 1.82 diff -u -d -r1.81 -r1.82 --- ChangeLog 27 Oct 2003 20:07:11 -0000 1.81 +++ ChangeLog 27 Oct 2003 22:34:29 -0000 1.82 @@ -1,5 +1,10 @@ 2003-10-27 Lutz Mueller <lu...@us...> + * libexif: Canon maker notes seem to work now (both loading and + saving). + +2003-10-27 Lutz Mueller <lu...@us...> + * libexif: The code now compiles and loads the canon maker note, but crashes if you query its contents. |
From: Lutz M?l. <lu...@us...> - 2003-10-27 22:37:28
|
Update of /cvsroot/libexif/libexif/libexif In directory sc8-pr-cvs1:/tmp/cvs-serv7105/libexif Modified Files: exif-data.c exif-mnote-data-priv.h Log Message: 2003-10-27 Lutz Mueller <lu...@us...> * libexif: Canon maker notes seem to work now (both loading and saving). Index: exif-data.c =================================================================== RCS file: /cvsroot/libexif/libexif/libexif/exif-data.c,v retrieving revision 1.31 retrieving revision 1.32 diff -u -d -r1.31 -r1.32 --- exif-data.c 27 Oct 2003 20:07:11 -0000 1.31 +++ exif-data.c 27 Oct 2003 22:34:29 -0000 1.32 @@ -147,7 +147,7 @@ } static void -exif_data_save_data_entry (ExifData *data, ExifEntry *entry, +exif_data_save_data_entry (ExifData *data, ExifEntry *e, unsigned char **d, unsigned int *ds, unsigned int offset) { @@ -158,30 +158,39 @@ * already been allocated. */ exif_set_short (*d + 6 + offset + 0, - data->priv->order, entry->tag); + data->priv->order, e->tag); exif_set_short (*d + 6 + offset + 2, - data->priv->order, entry->format); + data->priv->order, e->format); exif_set_long (*d + 6 + offset + 4, - data->priv->order, entry->components); + data->priv->order, e->components); /* * Size? If bigger than 4 bytes, the actual data is not in * the entry but somewhere else. */ - s = exif_format_get_size (entry->format) * entry->components; + s = exif_format_get_size (e->format) * e->components; if (!s) return; if (s > 4) { - *ds += entry->size; + *ds += s; *d = realloc (*d, sizeof (char) * *ds); - doff = *ds - 6 - entry->size; + 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, entry->data, entry->size); + memcpy (*d + 6 + doff, e->data, e->size); if (s < 4) memset (*d + 6 + doff + s, 0, (4 - s)); } @@ -480,21 +489,6 @@ exif_set_long (*d + 6 + offset, data->priv->order, 0); } -static void -exif_data_remove_entry (ExifData *d, ExifTag t) -{ - exif_content_remove_entry (d->ifd[EXIF_IFD_0], - exif_content_get_entry (d->ifd[EXIF_IFD_0], t)); - exif_content_remove_entry (d->ifd[EXIF_IFD_1], - exif_content_get_entry (d->ifd[EXIF_IFD_1], t)); - exif_content_remove_entry (d->ifd[EXIF_IFD_EXIF], - exif_content_get_entry (d->ifd[EXIF_IFD_EXIF], t)); - exif_content_remove_entry (d->ifd[EXIF_IFD_GPS], - exif_content_get_entry (d->ifd[EXIF_IFD_GPS], t)); - exif_content_remove_entry (d->ifd[EXIF_IFD_INTEROPERABILITY], - exif_content_get_entry (d->ifd[EXIF_IFD_INTEROPERABILITY], t)); -} - void exif_data_load_data (ExifData *data, const unsigned char *d_orig, unsigned int ds_orig) @@ -679,9 +673,7 @@ } /* - * If we are able to interpret the maker note, interpret it and - * remove the corresponding entry as it may contain invalid - * pointers after this function here returns. + * If we are able to interpret the maker note, do so. */ if (data->priv->md) { exif_mnote_data_set_byte_order (data->priv->md, @@ -689,7 +681,6 @@ exif_mnote_data_set_offset (data->priv->md, data->priv->offset_mnote); exif_mnote_data_load (data->priv->md, d, ds); - exif_data_remove_entry (data, EXIF_TAG_MAKER_NOTE); } } } Index: exif-mnote-data-priv.h =================================================================== RCS file: /cvsroot/libexif/libexif/libexif/exif-mnote-data-priv.h,v retrieving revision 1.2 retrieving revision 1.3 diff -u -d -r1.2 -r1.3 --- exif-mnote-data-priv.h 26 Oct 2003 22:30:26 -0000 1.2 +++ exif-mnote-data-priv.h 27 Oct 2003 22:34:29 -0000 1.3 @@ -52,9 +52,9 @@ struct _ExifMnoteData { - ExifMnoteDataMethods methods; - ExifMnoteDataPriv *priv; + + ExifMnoteDataMethods methods; }; void exif_mnote_data_construct (ExifMnoteData *); |
From: Lutz M?l. <lu...@us...> - 2003-10-27 22:37:28
|
Update of /cvsroot/libexif/libexif/test In directory sc8-pr-cvs1:/tmp/cvs-serv7105/test Modified Files: test-mnote.c Log Message: 2003-10-27 Lutz Mueller <lu...@us...> * libexif: Canon maker notes seem to work now (both loading and saving). Index: test-mnote.c =================================================================== RCS file: /cvsroot/libexif/libexif/test/test-mnote.c,v retrieving revision 1.2 retrieving revision 1.3 diff -u -d -r1.2 -r1.3 --- test-mnote.c 27 Oct 2003 20:07:11 -0000 1.2 +++ test-mnote.c 27 Oct 2003 22:34:30 -0000 1.3 @@ -5,28 +5,15 @@ #include <libexif/exif-data.h> -int -main (int argc, char **argv) +static int +test_exif_data (ExifData *d) { - ExifData *d; - ExifMnoteData *md; - unsigned int c, i; + unsigned int i, c; char *v; + ExifMnoteData *md; - if (argc <= 1) { - fprintf (stderr, "You need to supply a filename!\n"); - return 1; - } - - fprintf (stdout, "Loading '%s'...\n", argv[1]); - d = exif_data_new_from_file (argv[1]); - if (!d) { - fprintf (stderr, "Could not load data from '%s'!\n", argv[1]); - return 1; - } - fprintf (stdout, "Loaded '%s'.\n", argv[1]); fprintf (stdout, "Byte order: %s\n", - exif_byte_order_get_name (exif_data_get_byte_order (d))); + exif_byte_order_get_name (exif_data_get_byte_order (d))); fprintf (stdout, "Parsing maker note...\n"); md = exif_data_get_mnote_data (d); @@ -44,20 +31,60 @@ fprintf (stdout, "Counting entries...\n"); c = exif_mnote_data_count (md); + fprintf (stdout, "Found %i entries.\n", c); for (i = 0; i < c; i++) { - fprintf (stdout, "%s", exif_mnote_data_get_name (md, i)); - fprintf (stdout, " Title: %s", - exif_mnote_data_get_title (md, i)); - fprintf (stdout, " Description: %s", - exif_mnote_data_get_description (md, i)); + fprintf (stdout, "Dumping entry number %i...\n", i); + fprintf (stdout, " Name: '%s'\n", + exif_mnote_data_get_name (md, i)); + fprintf (stdout, " Title: '%s'\n", + exif_mnote_data_get_title (md, i)); + fprintf (stdout, " Description: '%s'\n", + exif_mnote_data_get_description (md, i)); v = exif_mnote_data_get_value (md, i); if (v) { - fprintf (stdout, " Value: '%s'", v); + fprintf (stdout, " Value: '%s'\n", v); free (v); } } + return 0; +} + +int +main (int argc, char **argv) +{ + ExifData *d; + unsigned int buf_size; + unsigned char *buf; + int r; + + if (argc <= 1) { + fprintf (stderr, "You need to supply a filename!\n"); + return 1; + } + + fprintf (stdout, "Loading '%s'...\n", argv[1]); + d = exif_data_new_from_file (argv[1]); + if (!d) { + fprintf (stderr, "Could not load data from '%s'!\n", argv[1]); + return 1; + } + fprintf (stdout, "Loaded '%s'.\n", argv[1]); + + fprintf (stdout, "######### Test 1 #########\n"); + r = test_exif_data (d); + if (r) return r; + + exif_data_save_data (d, &buf, &buf_size); exif_data_unref (d); + d = exif_data_new_from_data (buf, buf_size); + free (buf); + + fprintf (stdout, "######### Test 2 #########\n"); + r = test_exif_data (d); + if (r) return r; + + fprintf (stdout, "Test successful!\n"); return 1; } |
From: Lutz M?l. <lu...@us...> - 2003-10-27 20:10:13
|
Update of /cvsroot/libexif/libexif/libexif/canon In directory sc8-pr-cvs1:/tmp/cvs-serv6680/libexif/canon Modified Files: exif-mnote-data-canon.c mnote-canon-entry.c Log Message: 2003-10-27 Lutz Mueller <lu...@us...> * libexif: The code now compiles and loads the canon maker note, but crashes if you query its contents. Index: mnote-canon-entry.c =================================================================== RCS file: /cvsroot/libexif/libexif/libexif/canon/mnote-canon-entry.c,v retrieving revision 1.1 retrieving revision 1.2 diff -u -d -r1.1 -r1.2 --- mnote-canon-entry.c 26 Oct 2003 10:06:17 -0000 1.1 +++ mnote-canon-entry.c 27 Oct 2003 20:07:11 -0000 1.2 @@ -32,41 +32,6 @@ /* #define DEBUG */ -#if 0 -void -mnote_canon_entry_dump (MnoteEntry *e, unsigned int indent) -{ - MnoteCanonEntry *entry = (MnoteCanonEntry *)e; - - char buf[1024]; - unsigned int i; - - for (i = 0; i < 2 * indent; i++) - buf[i] = ' '; - buf[i] = '\0'; - - if (!e) - return; -#ifndef DEBUG - if (mnote_canon_tag_get_name (entry->tag)!=NULL) - { -#endif - printf ("%sTag: 0x%x ('%s')\n", buf, entry->tag, - mnote_canon_tag_get_name (entry->tag)); -#ifdef DEBUG - printf ("%s Format: %i ('%s')\n", buf, entry->format, - exif_format_get_name (entry->format)); - printf ("%s Components: %i\n", buf, (int) entry->components); - printf ("%s Size: %i\n", buf, entry->size); -#endif - printf ("%s Value: %s\n", buf, mnote_canon_entry_get_value (entry)); -#ifndef DEBUG - } -#endif -} - -#endif - #define CF(format,target,v) \ { \ if (format != target) { \ @@ -94,306 +59,297 @@ { char v[1024], buf[1024]; ExifLong vl; - ExifShort vs,n; + ExifShort vs, n; int i; unsigned char *data = entry->data; - if (!entry) - return (NULL); + if (!entry) return NULL; memset (v, 0, sizeof (v)); -#ifdef DEBUG - printf ("Processing Tag %x\n",entry->tag); -#endif switch (entry->tag) { case MNOTE_CANON_TAG_SETTINGS_1: CF (entry->format, EXIF_FORMAT_SHORT, v); n = exif_get_short (data, entry->order)/2; data+=2; CC (entry->components, n, v); -#ifdef DEBUG - printf ("Setting1 size %d %d\n",n,entry->size); -#endif - for (i=1;i<n;i++) - { - vs = exif_get_short (data, entry->order); - data+=2; - switch(i) { + for (i = 1; i < n; i++) { + vs = exif_get_short (data, entry->order); + data += 2; + switch(i) { + case 1: + strncpy (v, _("Macro mode : "), sizeof (v) - 1); + switch (vs) { case 1: - strncpy (v, _("Macro mode : "), sizeof (v) - 1); - switch (vs) { - case 1: - strncat (v, _("Macro"), sizeof (v) - 1 - strlen(v)); - break; - case 2: - strncat (v, _("Normal"), sizeof (v) - 1 - strlen(v)); - break; - default: - snprintf (buf, sizeof (buf), "%i???", vs); - strncat (v,buf, sizeof (v) - 1 - strlen(v)); - } - break; + strncat (v, _("Macro"), sizeof (v) - 1 - strlen(v)); + break; case 2: - if (vs) - { - snprintf (buf, sizeof (buf), _(" / Self Timer : %i (ms)"), vs*100); - strncat (v,buf, sizeof (v) - 1 - strlen(v)); - } - break; + strncat (v, _("Normal"), sizeof (v) - 1 - strlen(v)); + break; + default: + snprintf (buf, sizeof (buf), "%i???", vs); + strncat (v,buf, sizeof (v) - 1 - strlen(v)); + } + break; + case 2: + if (vs) { + snprintf (buf, sizeof (buf), + _(" / Self Timer : %i (ms)"), vs*100); + strncat (v,buf, sizeof (v) - 1 - strlen(v)); + } + break; + case 4: + strncat (v,_(" / Flash mode : "), sizeof (v) - 1 - strlen(v)); + switch (vs) { + case 0: + strncat (v, _("Flash not fired"), sizeof (v) - 1 - strlen(v)); + break; + case 1: + strncat (v, _("auto"), sizeof (v) - 1 - strlen(v)); + break; + case 2: + strncat (v, _("on"), sizeof (v) - 1 - strlen(v)); + break; + case 3: + strncat (v, _("red eyes reduction"), sizeof (v) - 1 - strlen(v)); + break; case 4: - strncat (v,_(" / Flash mode : "), sizeof (v) - 1 - strlen(v)); - switch (vs) { - case 0: - strncat (v, _("Flash not fired"), sizeof (v) - 1 - strlen(v)); - break; - case 1: - strncat (v, _("auto"), sizeof (v) - 1 - strlen(v)); - break; - case 2: - strncat (v, _("on"), sizeof (v) - 1 - strlen(v)); - break; - case 3: - strncat (v, _("red eyes reduction"), sizeof (v) - 1 - strlen(v)); - break; - case 4: - strncat (v, _("slow synchro"), sizeof (v) - 1 - strlen(v)); - break; - case 5: - strncat (v, _("auto + red eyes reduction"), sizeof (v) - 1 - strlen(v)); - break; - case 6: - strncat (v, _("on + red eyes reduction"), sizeof (v) - 1 - strlen(v)); - break; - case 16: - strncat (v, _("external"), sizeof (v) - 1 - strlen(v)); - break; - default: - snprintf (buf, sizeof (buf), "%i???", vs); - strncat (v,buf, sizeof (v) - 1 - strlen(v)); - } - break; + strncat (v, _("slow synchro"), sizeof (v) - 1 - strlen(v)); + break; case 5: - strncat (v, _(" / Continuous drive mode : "), sizeof (v) - 1 - strlen(v)); - switch (vs) { - case 0: - strncat (v, _("single or timer"), sizeof (v) - 1 - strlen(v)); - break; - case 1: - strncat (v, _("continuous"), sizeof (v) - 1 - strlen(v)); - break; - default: - snprintf (buf, sizeof (buf), "%i???", vs); - strncat (v, buf, sizeof (v) - 1 - strlen(v)); - } - break; + strncat (v, _("auto + red eyes reduction"), sizeof (v) - 1 - strlen(v)); + break; + case 6: + strncat (v, _("on + red eyes reduction"), sizeof (v) - 1 - strlen(v)); + break; + case 16: + strncat (v, _("external"), sizeof (v) - 1 - strlen(v)); + break; + default: + snprintf (buf, sizeof (buf), "%i???", vs); + strncat (v,buf, sizeof (v) - 1 - strlen(v)); + } + break; + case 5: + strncat (v, _(" / Continuous drive mode : "), sizeof (v) - 1 - strlen(v)); + switch (vs) { + case 0: + strncat (v, _("single or timer"), sizeof (v) - 1 - strlen(v)); + break; + case 1: + strncat (v, _("continuous"), sizeof (v) - 1 - strlen(v)); + break; + default: + snprintf (buf, sizeof (buf), "%i???", vs); + strncat (v, buf, sizeof (v) - 1 - strlen(v)); + } + break; + case 7: + strncat (v, _(" / Focus mode : "), sizeof (v) - 1 - strlen(v)); + switch (vs) { + case 0: + strncat (v, _("One-Shot"), sizeof (v) - 1 - strlen(v)); + break; + case 1: + strncat (v, _("AI Servo"), sizeof (v) - 1 - strlen(v)); + break; + case 2: + strncat (v, _("AI Focus"), sizeof (v) - 1 - strlen(v)); + break; + case 3: + strncat (v, _("MF"), sizeof (v) - 1 - strlen(v)); + break; + case 4: + strncat (v, _("Single"), sizeof (v) - 1 - strlen(v)); + break; + case 5: + strncat (v, _("Continuous"), sizeof (v) - 1 - strlen(v)); + break; + case 6: + strncat (v, _("MF"), sizeof (v) - 1 - strlen(v)); + break; + default: + snprintf (buf, sizeof (buf), "%i???", vs); + strncat (v,buf, sizeof (v) - 1 - strlen(v)); + } + break; + case 10: + strncat (v, _(" / Image size : "), sizeof (v) - 1 - strlen(v)); + switch (vs) { + case 0: + strncat (v, _("Large"), sizeof (v) - 1 - strlen(v)); + break; + case 1: + strncat (v, _("Medium"), sizeof (v) - 1 - strlen(v)); + break; + case 2: + strncat (v, _("Small"), sizeof (v) - 1 - strlen(v)); + break; + default: + snprintf (buf, sizeof (buf), "%i???", vs); + strncat (v,buf, sizeof (v) - 1 - strlen(v)); + } + break; + case 11: + strncat (v, _(" / Easy shooting mode : "), sizeof (v) - 1 - strlen(v)); + switch (vs) { + case 0: + strncat (v, _("Full Auto"), sizeof (v) - 1 - strlen(v)); + break; + case 1: + strncat (v, _("Manual"), sizeof (v) - 1 - strlen(v)); + break; + case 2: + strncat (v, _("Landscape"), sizeof (v) - 1 - strlen(v)); + break; + case 3: + strncat (v, _("Fast Shutter"), sizeof (v) - 1 - strlen(v)); + break; + case 4: + strncat (v, _("Slow Shutter"), sizeof (v) - 1 - strlen(v)); + break; + case 5: + strncat (v, _("Night"), sizeof (v) - 1 - strlen(v)); + break; + case 6: + strncat (v, _("Black & White"), sizeof (v) - 1 - strlen(v)); + break; case 7: - strncat (v, _(" / Focus mode : "), sizeof (v) - 1 - strlen(v)); - switch (vs) { - case 0: - strncat (v, _("One-Shot"), sizeof (v) - 1 - strlen(v)); - break; - case 1: - strncat (v, _("AI Servo"), sizeof (v) - 1 - strlen(v)); - break; - case 2: - strncat (v, _("AI Focus"), sizeof (v) - 1 - strlen(v)); - break; - case 3: - strncat (v, _("MF"), sizeof (v) - 1 - strlen(v)); - break; - case 4: - strncat (v, _("Single"), sizeof (v) - 1 - strlen(v)); - break; - case 5: - strncat (v, _("Continuous"), sizeof (v) - 1 - strlen(v)); - break; - case 6: - strncat (v, _("MF"), sizeof (v) - 1 - strlen(v)); - break; - default: - snprintf (buf, sizeof (buf), "%i???", vs); - strncat (v,buf, sizeof (v) - 1 - strlen(v)); - } - break; + strncat (v, _("Sepia"), sizeof (v) - 1 - strlen(v)); + break; + case 8: + strncat (v, _("Portrait"), sizeof (v) - 1 - strlen(v)); + break; + case 9: + strncat (v, _("Sports"), sizeof (v) - 1 - strlen(v)); + break; case 10: - strncat (v, _(" / Image size : "), sizeof (v) - 1 - strlen(v)); - switch (vs) { - case 0: - strncat (v, _("Large"), sizeof (v) - 1 - strlen(v)); - break; - case 1: - strncat (v, _("Medium"), sizeof (v) - 1 - strlen(v)); - break; - case 2: - strncat (v, _("Small"), sizeof (v) - 1 - strlen(v)); - break; - default: - snprintf (buf, sizeof (buf), "%i???", vs); - strncat (v,buf, sizeof (v) - 1 - strlen(v)); - } - break; + strncat (v, _("Macro / Close-Up"), sizeof (v) - 1 - strlen(v)); + break; case 11: - strncat (v, _(" / Easy shooting mode : "), sizeof (v) - 1 - strlen(v)); - switch (vs) { - case 0: - strncat (v, _("Full Auto"), sizeof (v) - 1 - strlen(v)); - break; - case 1: - strncat (v, _("Manual"), sizeof (v) - 1 - strlen(v)); - break; - case 2: - strncat (v, _("Landscape"), sizeof (v) - 1 - strlen(v)); - break; - case 3: - strncat (v, _("Fast Shutter"), sizeof (v) - 1 - strlen(v)); - break; - case 4: - strncat (v, _("Slow Shutter"), sizeof (v) - 1 - strlen(v)); - break; - case 5: - strncat (v, _("Night"), sizeof (v) - 1 - strlen(v)); - break; - case 6: - strncat (v, _("Black & White"), sizeof (v) - 1 - strlen(v)); - break; - case 7: - strncat (v, _("Sepia"), sizeof (v) - 1 - strlen(v)); - break; - case 8: - strncat (v, _("Portrait"), sizeof (v) - 1 - strlen(v)); - break; - case 9: - strncat (v, _("Sports"), sizeof (v) - 1 - strlen(v)); - break; - case 10: - strncat (v, _("Macro / Close-Up"), sizeof (v) - 1 - strlen(v)); - break; - case 11: - strncat (v, _("Pan Focus"), sizeof (v) - 1 - strlen(v)); - break; - default: - snprintf (buf, sizeof (buf), "%i???", vs); - strncat (v,buf, sizeof (v) - 1 - strlen(v)); - } - break; - case 13: - strncat (v, _(" / Contrast : "), sizeof (v) - 1 - strlen(v)); - switch (vs) { - case 0xffff: - strncat (v, _("Low"), sizeof (v) - 1 - strlen(v)); - break; - case 0x0000: - strncat (v, _("Normal"), sizeof (v) - 1 - strlen(v)); - break; - case 0x0001: - strncat (v, _("High"), sizeof (v) - 1 - strlen(v)); - break; - default: - snprintf (buf, sizeof (buf), "%i???", vs); - strncat (v,buf, sizeof (v) - 1 - strlen(v)); - } + strncat (v, _("Pan Focus"), sizeof (v) - 1 - strlen(v)); + break; + default: + snprintf (buf, sizeof (buf), "%i???", vs); + strncat (v,buf, sizeof (v) - 1 - strlen(v)); + } + break; + case 13: + strncat (v, _(" / Contrast : "), sizeof (v) - 1 - strlen(v)); + switch (vs) { + case 0xffff: + strncat (v, _("Low"), sizeof (v) - 1 - strlen(v)); + break; + case 0x0000: + strncat (v, _("Normal"), sizeof (v) - 1 - strlen(v)); + break; + case 0x0001: + strncat (v, _("High"), sizeof (v) - 1 - strlen(v)); + break; + default: + snprintf (buf, sizeof (buf), "%i???", vs); + strncat (v,buf, sizeof (v) - 1 - strlen(v)); + } + break; + case 14: + strncat (v, _(" / Saturation : "), sizeof (v) - 1 - strlen(v)); + switch (vs) { + case 0xffff: + strncat (v, _("Low"), sizeof (v) - 1 - strlen(v)); + break; + case 0x0000: + strncat (v, _("Normal"), sizeof (v) - 1 - strlen(v)); + break; + case 0x0001: + strncat (v, _("High"), sizeof (v) - 1 - strlen(v)); + break; + default: + snprintf (buf, sizeof (buf), "%i???", vs); + strncat (v,buf, sizeof (v) - 1 - strlen(v)); + } + break; + case 15: + strncat (v, _(" / Sharpness : "), sizeof (v) - 1 - strlen(v)); + switch (vs) { + case 0xffff: + strncat (v, _("Low"), sizeof (v) - 1 - strlen(v)); + break; + case 0x0000: + strncat (v, _("Normal"), sizeof (v) - 1 - strlen(v)); + break; + case 0x0001: + strncat (v, _("High"), sizeof (v) - 1 - strlen(v)); + break; + default: + snprintf (buf, sizeof (buf), "%i???", vs); + strncat (v,buf, sizeof (v) - 1 - strlen(v)); + } + break; + case 16: + if (vs) { + strncat (v, _(" / ISO : "), sizeof (v) - 1 - strlen(v)); + switch (vs) { + case 15: + strncat (v, _("auto"), sizeof (v) - 1 - strlen(v)); break; - case 14: - strncat (v, _(" / Saturation : "), sizeof (v) - 1 - strlen(v)); - switch (vs) { - case 0xffff: - strncat (v, _("Low"), sizeof (v) - 1 - strlen(v)); - break; - case 0x0000: - strncat (v, _("Normal"), sizeof (v) - 1 - strlen(v)); - break; - case 0x0001: - strncat (v, _("High"), sizeof (v) - 1 - strlen(v)); - break; - default: - snprintf (buf, sizeof (buf), "%i???", vs); - strncat (v,buf, sizeof (v) - 1 - strlen(v)); - } + case 16: + strncat (v, _("50"), sizeof (v) - 1 - strlen(v)); break; - case 15: - strncat (v, _(" / Sharpness : "), sizeof (v) - 1 - strlen(v)); - switch (vs) { - case 0xffff: - strncat (v, _("Low"), sizeof (v) - 1 - strlen(v)); - break; - case 0x0000: - strncat (v, _("Normal"), sizeof (v) - 1 - strlen(v)); - break; - case 0x0001: - strncat (v, _("High"), sizeof (v) - 1 - strlen(v)); - break; - default: - snprintf (buf, sizeof (buf), "%i???", vs); - strncat (v,buf, sizeof (v) - 1 - strlen(v)); - } + case 17: + strncat (v, _("100"), sizeof (v) - 1 - strlen(v)); break; - case 16: - if (vs) - { - strncat (v, _(" / ISO : "), sizeof (v) - 1 - strlen(v)); - switch (vs) { - case 15: - strncat (v, _("auto"), sizeof (v) - 1 - strlen(v)); - break; - case 16: - strncat (v, _("50"), sizeof (v) - 1 - strlen(v)); - break; - case 17: - strncat (v, _("100"), sizeof (v) - 1 - strlen(v)); - break; - case 18: - strncat (v, _("200"), sizeof (v) - 1 - strlen(v)); - break; - case 19: - strncat (v, _("400"), sizeof (v) - 1 - strlen(v)); - break; - default: - snprintf (buf, sizeof (buf), "%i???", vs); - strncat (v,buf, sizeof (v) - 1 - strlen(v)); - } - break; - } - case 17: - strncat (v, _(" / Metering mode : "), sizeof (v) - 1 - strlen(v)); - switch (vs) { - case 3: - strncat (v, _("Evaluative"), sizeof (v) - 1 - strlen(v)); - break; - case 4: - strncat (v, _("Partial"), sizeof (v) - 1 - strlen(v)); - break; - case 5: - strncat (v, _("Center-weighted"), sizeof (v) - 1 - strlen(v)); - break; - default: - snprintf (buf, sizeof (buf), "%i???", vs); - strncat (v,buf, sizeof (v) - 1 - strlen(v)); - } + case 18: + strncat (v, _("200"), sizeof (v) - 1 - strlen(v)); break; - case 19: - strncat (v, _(" / AF point selected : "), sizeof (v) - 1 - strlen(v)); - switch (vs) { - case 0x3000: - strncat (v, _("none (MF)"), sizeof (v) - 1 - strlen(v)); - break; - case 0x3001: - strncat (v, _("auto-selected"), sizeof (v) - 1 - strlen(v)); - break; - case 0x3002: - strncat (v, _("right"), sizeof (v) - 1 - strlen(v)); - break; - case 0x3003: - strncat (v, _("center"), sizeof (v) - 1 - strlen(v)); - break; - case 0x3004: - strncat (v, _("left"), sizeof (v) - 1 - strlen(v)); - break; - default: - snprintf (buf, sizeof (buf), "0x%x???", vs); - strncat (v,buf, sizeof (v) - 1 - strlen(v)); - } + case 19: + strncat (v, _("400"), sizeof (v) - 1 - strlen(v)); break; - case 20: + default: + snprintf (buf, sizeof (buf), "%i???", vs); + strncat (v,buf, sizeof (v) - 1 - strlen(v)); + } + break; + } + case 17: + strncat (v, _(" / Metering mode : "), sizeof (v) - 1 - strlen(v)); + switch (vs) { + case 3: + strncat (v, _("Evaluative"), sizeof (v) - 1 - strlen(v)); + break; + case 4: + strncat (v, _("Partial"), sizeof (v) - 1 - strlen(v)); + break; + case 5: + strncat (v, _("Center-weighted"), sizeof (v) - 1 - strlen(v)); + break; + default: + snprintf (buf, sizeof (buf), "%i???", vs); + strncat (v,buf, sizeof (v) - 1 - strlen(v)); + } + break; + case 19: + strncat (v, _(" / AF point selected : "), sizeof (v) - 1 - strlen(v)); + switch (vs) { + case 0x3000: + strncat (v, _("none (MF)"), sizeof (v) - 1 - strlen(v)); + break; + case 0x3001: + strncat (v, _("auto-selected"), sizeof (v) - 1 - strlen(v)); + break; + case 0x3002: + strncat (v, _("right"), sizeof (v) - 1 - strlen(v)); + break; + case 0x3003: + strncat (v, _("center"), sizeof (v) - 1 - strlen(v)); + break; + case 0x3004: + strncat (v, _("left"), sizeof (v) - 1 - strlen(v)); + break; + default: + snprintf (buf, sizeof (buf), "0x%x???", vs); + strncat (v,buf, sizeof (v) - 1 - strlen(v)); + } + break; + case 20: strncat (v, _(" / Exposure mode : "), sizeof (v) - 1 - strlen(v)); switch (vs) { case 0: @@ -552,6 +508,7 @@ break; case MNOTE_CANON_TAG_IMAGE_TYPE: + case MNOTE_CANON_TAG_OWNER: CF (entry->format, EXIF_FORMAT_ASCII, v); CC (entry->components, 32, v); strncpy (v,data,sizeof (v)); @@ -568,12 +525,6 @@ CC (entry->components, 1, v); vl = exif_get_long (data, entry->order); snprintf (v, sizeof (v), "%03lu-%04lu", vl/10000,vl%10000); - break; - - case MNOTE_CANON_TAG_OWNER: - CF (entry->format, EXIF_FORMAT_ASCII, v); - CC (entry->components, 32, v); - strncpy (v,data,sizeof (v)); break; case MNOTE_CANON_TAG_SERIAL_NUMBER: Index: exif-mnote-data-canon.c =================================================================== RCS file: /cvsroot/libexif/libexif/libexif/canon/exif-mnote-data-canon.c,v retrieving revision 1.2 retrieving revision 1.3 diff -u -d -r1.2 -r1.3 --- exif-mnote-data-canon.c 26 Oct 2003 22:30:26 -0000 1.2 +++ exif-mnote-data-canon.c 27 Oct 2003 20:07:11 -0000 1.3 @@ -33,23 +33,30 @@ #define DEBUG static void -exif_mnote_data_canon_free (ExifMnoteData *n) +exif_mnote_data_canon_clear (ExifMnoteDataCanon *n) { - ExifMnoteDataCanon *note = (ExifMnoteDataCanon *) n; - unsigned int i; + unsigned int i; if (!n) return; - if (note->entries) { - for (i = 0; i < note->count; i++) - if (note->entries[i].data) { - free (note->entries[i].data); - note->entries[i].data = NULL; + if (n->entries) { + for (i = 0; i < n->count; i++) + if (n->entries[i].data) { + free (n->entries[i].data); + n->entries[i].data = NULL; } - free (note->entries); - note->entries = NULL; - note->count = 0; - } + free (n->entries); + n->entries = NULL; + n->count = 0; + } +} + +static void +exif_mnote_data_canon_free (ExifMnoteData *n) +{ + if (!n) return; + + exif_mnote_data_canon_clear ((ExifMnoteDataCanon *) n); } static char * @@ -63,9 +70,73 @@ } static void -exif_mnote_data_canon_set_byte_order (ExifMnoteData *n, ExifByteOrder o) +exif_mnote_data_canon_set_byte_order (ExifMnoteData *d, ExifByteOrder o) { - if (n) ((ExifMnoteDataCanon *) n)->order = o; + ExifByteOrder o_orig; + ExifMnoteDataCanon *n = (ExifMnoteDataCanon *) d; + unsigned int i, fs; + ExifShort s; + ExifLong l; + ExifSLong sl; + ExifRational r; + ExifSRational sr; + + if (!n) return; + + o_orig = n->order; + n->order = o; + for (i = 0; i < n->count; i++) { + n->entries[i].order = o; + fs = exif_format_get_size (n->entries[i].format); + switch (n->entries[i].format) { + case EXIF_FORMAT_SHORT: + for (i = 0; i < n->entries[i].components; i++) { + s = exif_get_short (n->entries[i].data + (i*fs), + o_orig); + exif_set_short (n->entries[i].data + (i * fs), + o, s); + } + break; + case EXIF_FORMAT_LONG: + for (i = 0; i < n->entries[i].components; i++) { + l = exif_get_long (n->entries[i].data + (i*fs), + o_orig); + exif_set_long (n->entries[i].data + (i * fs), + o, l); + } + break; + case EXIF_FORMAT_RATIONAL: + for (i = 0; i < n->entries[i].components; i++) { + r = exif_get_rational (n->entries[i].data + + (i * fs), o_orig); + exif_set_rational (n->entries[i].data + + (i * fs), o, r); + } + break; + case EXIF_FORMAT_SLONG: + for (i = 0; i < n->entries[i].components; i++) { + sl = exif_get_slong (n->entries[i].data + + (i * fs), o_orig); + exif_set_slong (n->entries[i].data + + (i * fs), o, sl); + } + break; + case EXIF_FORMAT_SRATIONAL: + for (i = 0; i < n->entries[i].components; i++) { + sr = exif_get_srational (n->entries[i].data + + (i * fs), o_orig); + exif_set_srational (n->entries[i].data + + (i * fs), o, sr); + } + break; + case EXIF_FORMAT_UNDEFINED: + case EXIF_FORMAT_BYTE: + case EXIF_FORMAT_ASCII: + default: + /* Nothing here. */ + break; + } + } } static void @@ -75,105 +146,53 @@ } static void -exif_mnote_data_canon_load_entry_with_exif (ExifMnoteDataCanon *note, - MnoteCanonEntry *entry, - const unsigned char *d, - unsigned int size, unsigned int offset, - const unsigned char *exifdata, - unsigned int exifsize) -{ - unsigned int s, doff, sizetmp = size; - const unsigned char *temp = d; - - entry->tag = exif_get_short (d + offset + 0, note->order); - entry->format = exif_get_short (d + offset + 2, note->order); - entry->components = exif_get_long (d + offset + 4, note->order); - - /* - * Size? If bigger than 4 bytes, the actual data is not - * in the entry but somewhere else (offset). - */ - s = exif_format_get_size (entry->format) * entry->components; - if (!s) - return; - if (s > 4) - { - doff = exif_get_long (d + offset + 8, note->order) + 0xC; - sizetmp = exifsize; - temp = exifdata; - } - else - doff = offset + 8; - -#ifdef DEBUG - printf ("Comp %x %d %d %x %x\n",doff, s, sizetmp,temp[doff],temp[doff+1]); -#endif - /* Sanity check */ - if (sizetmp < doff + s) - return; - entry->data = malloc (sizeof (char) * s); - if (!entry->data) - return; - entry->size = s; - memcpy (entry->data, temp + doff, s); - entry->order = note->order; -} - -static void exif_mnote_data_canon_load (ExifMnoteData *ne, const unsigned char *buf, unsigned int buf_size) { - ExifMnoteDataCanon *data = (ExifMnoteDataCanon *) ne; - const unsigned char *d = buf; - ExifShort n; - unsigned int i; - unsigned int size = buf_size; - MnoteCanonTag tag; - - if (!data) - return; - if (!buf || !buf_size) - return; + ExifMnoteDataCanon *n = (ExifMnoteDataCanon *) ne; + ExifShort c; + unsigned int i, o, s; -#ifdef DEBUG - printf ("Parsing %i byte(s) data at offset %i...\n", size, - data->offset); -#endif -#if 0 - int j; - for (j=0;j<size;j++) - { - if (!(j%16)) printf("\n"); - printf("%02X ",d[j]);} + if (!n || !buf || !buf_size || (buf_size < 6 + n->offset + 2)) return; - printf("\n%d\n",size); - printf("%d\n",data->order); -#endif + /* Read the number of entries and remove old ones. */ + c = exif_get_short (buf + 6 + n->offset, n->order); + exif_mnote_data_canon_clear (n); - /* Read the number of entries */ - n = exif_get_short (buf + 6 + data->offset, data->order); -#ifdef DEBUG - printf ("Loading %i entries...\n", n); -#endif - d += 2; - size -= 2; + /* Parse the entries */ + for (i = 0; i < c; i++) { + o = 6 + 2 + n->offset + 12 * i; + if (o + 8 > buf_size) return; - if (12 * n > size) return; + n->count = i + 1; + n->entries = realloc (n->entries, sizeof (MnoteCanonEntry) * (i+1)); + memset (&n->entries[i], 0, sizeof (MnoteCanonEntry)); + n->entries[i].tag = exif_get_short (buf + o, n->order); + n->entries[i].format = exif_get_short (buf + o + 2, n->order); + n->entries[i].components = exif_get_long (buf + o + 4, n->order); + n->entries[i].order = n->order; - for (i = 0; i < n; i++) { + /* + * Size? If bigger than 4 bytes, the actual data is not + * in the entry but somewhere else (offset). + */ + s = exif_format_get_size (n->entries[i].format) * + n->entries[i].components; + if (!s) return; + o += 8; + if (s > 4) o = exif_get_long (buf + o, n->order) + 6; + if (o + s > buf_size) return; + + /* Sanity check */ + n->entries[i].data = malloc (sizeof (char) * s); + if (!n->entries[i].data) return; + n->entries[i].size = s; + memcpy (n->entries[i].data, buf + o, s); + } - tag = exif_get_short (d + 12 * i, data->order); #ifdef DEBUG - printf ("Loading entry '%s' (%i of %i)...\n", - mnote_canon_tag_get_name (tag), i + 1, n); + printf ("Loaded %i entries.\n", n->count); #endif - data->count++; - data->entries = realloc (data->entries, - sizeof (MnoteCanonEntry) * data->count); - exif_mnote_data_canon_load_entry_with_exif (data, - &data->entries[data->count - 1], - d, size, 12 * i, buf, buf_size); - } } static unsigned int |
From: Lutz M?l. <lu...@us...> - 2003-10-27 20:10:13
|
Update of /cvsroot/libexif/libexif In directory sc8-pr-cvs1:/tmp/cvs-serv6680 Modified Files: ChangeLog Log Message: 2003-10-27 Lutz Mueller <lu...@us...> * libexif: The code now compiles and loads the canon maker note, but crashes if you query its contents. Index: ChangeLog =================================================================== RCS file: /cvsroot/libexif/libexif/ChangeLog,v retrieving revision 1.80 retrieving revision 1.81 diff -u -d -r1.80 -r1.81 --- ChangeLog 26 Oct 2003 22:30:26 -0000 1.80 +++ ChangeLog 27 Oct 2003 20:07:11 -0000 1.81 @@ -1,3 +1,8 @@ +2003-10-27 Lutz Mueller <lu...@us...> + + * libexif: The code now compiles and loads the canon maker note, + but crashes if you query its contents. + 2003-10-26 Lutz Mueller <lu...@us...> * test/test-mnote.c: New. |
From: Lutz M?l. <lu...@us...> - 2003-10-27 20:10:12
|
Update of /cvsroot/libexif/libexif/libexif In directory sc8-pr-cvs1:/tmp/cvs-serv6680/libexif Modified Files: exif-data.c exif-mnote-data.c Log Message: 2003-10-27 Lutz Mueller <lu...@us...> * libexif: The code now compiles and loads the canon maker note, but crashes if you query its contents. Index: exif-data.c =================================================================== RCS file: /cvsroot/libexif/libexif/libexif/exif-data.c,v retrieving revision 1.30 retrieving revision 1.31 diff -u -d -r1.30 -r1.31 --- exif-data.c 26 Oct 2003 22:30:26 -0000 1.30 +++ exif-data.c 27 Oct 2003 20:07:11 -0000 1.31 @@ -135,8 +135,15 @@ memcpy (entry->data, d + doff, s); /* If this is the MakerNote, remember the offset */ - if (entry->tag == EXIF_TAG_MAKER_NOTE) + 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 data->priv->offset_mnote = doff; + } } static void @@ -958,4 +965,6 @@ d.new = order; exif_data_foreach_content (data, content_set_byte_order, &d); data->priv->order = order; + if (data->priv->md) + exif_mnote_data_set_byte_order (data->priv->md, order); } Index: exif-mnote-data.c =================================================================== RCS file: /cvsroot/libexif/libexif/libexif/exif-mnote-data.c,v retrieving revision 1.2 retrieving revision 1.3 diff -u -d -r1.2 -r1.3 --- exif-mnote-data.c 26 Oct 2003 22:30:26 -0000 1.2 +++ exif-mnote-data.c 27 Oct 2003 20:07:11 -0000 1.3 @@ -39,7 +39,6 @@ if (!d->priv) return; memset (d->priv, 0, sizeof (ExifMnoteDataPriv)); d->priv->ref_count = 1; - memset (&d->methods, 0, sizeof (ExifMnoteDataMethods)); } void |
From: Lutz M?l. <lu...@us...> - 2003-10-27 20:10:08
|
Update of /cvsroot/libexif/libexif/test In directory sc8-pr-cvs1:/tmp/cvs-serv6680/test Modified Files: test-mnote.c Log Message: 2003-10-27 Lutz Mueller <lu...@us...> * libexif: The code now compiles and loads the canon maker note, but crashes if you query its contents. Index: test-mnote.c =================================================================== RCS file: /cvsroot/libexif/libexif/test/test-mnote.c,v retrieving revision 1.1 retrieving revision 1.2 diff -u -d -r1.1 -r1.2 --- test-mnote.c 26 Oct 2003 22:30:27 -0000 1.1 +++ test-mnote.c 27 Oct 2003 20:07:11 -0000 1.2 @@ -24,6 +24,9 @@ fprintf (stderr, "Could not load data from '%s'!\n", argv[1]); return 1; } + fprintf (stdout, "Loaded '%s'.\n", argv[1]); + fprintf (stdout, "Byte order: %s\n", + exif_byte_order_get_name (exif_data_get_byte_order (d))); fprintf (stdout, "Parsing maker note...\n"); md = exif_data_get_mnote_data (d); @@ -33,6 +36,13 @@ return 1; } + fprintf (stdout, "Increasing ref-count...\n"); + exif_mnote_data_ref (md); + + fprintf (stdout, "Decreasing ref-count...\n"); + exif_mnote_data_unref (md); + + fprintf (stdout, "Counting entries...\n"); c = exif_mnote_data_count (md); for (i = 0; i < c; i++) { fprintf (stdout, "%s", exif_mnote_data_get_name (md, i)); @@ -48,4 +58,6 @@ } exif_data_unref (d); + + return 1; } |
From: Hans U. N. <hu...@us...> - 2003-10-27 17:35:03
|
Update of /cvsroot/libexif/libexif In directory sc8-pr-cvs1:/tmp/cvs-serv8014 Modified Files: configure.in Log Message: po/Makefile.in gets added by gettextize Index: configure.in =================================================================== RCS file: /cvsroot/libexif/libexif/configure.in,v retrieving revision 1.57 retrieving revision 1.58 diff -u -d -r1.57 -r1.58 --- configure.in 26 Oct 2003 10:18:31 -0000 1.57 +++ configure.in 27 Oct 2003 17:31:14 -0000 1.58 @@ -63,7 +63,6 @@ libjpeg/Makefile test/Makefile libexif/libexif.pc - po/Makefile.in ]) echo " |
From: Hans U. N. <hu...@us...> - 2003-10-27 17:34:20
|
Update of /cvsroot/libexif/libexif In directory sc8-pr-cvs1:/tmp/cvs-serv8226 Modified Files: Makefile.am Log Message: intl subdir gets added by gettextize Index: Makefile.am =================================================================== RCS file: /cvsroot/libexif/libexif/Makefile.am,v retrieving revision 1.24 retrieving revision 1.25 diff -u -d -r1.24 -r1.25 --- Makefile.am 26 Oct 2003 10:18:31 -0000 1.24 +++ Makefile.am 27 Oct 2003 17:32:32 -0000 1.25 @@ -1,3 +1,3 @@ -SUBDIRS = libexif libjpeg test po intl +SUBDIRS = libexif libjpeg test po EXTRA_DIST = @PACKAGE@.spec |
From: Lutz M?l. <lu...@us...> - 2003-10-26 22:34:20
|
Update of /cvsroot/libexif/libexif/libexif In directory sc8-pr-cvs1:/tmp/cvs-serv21845/libexif Modified Files: Makefile.am exif-content.c exif-data.c exif-mnote-data-priv.h exif-mnote-data.c Log Message: 2003-10-26 Lutz Mueller <lu...@us...> * test/test-mnote.c: New. * libexif: The code now both compiles and doesn't crash, but at least the canon maker note still doesn't get parsed. Index: exif-data.c =================================================================== RCS file: /cvsroot/libexif/libexif/libexif/exif-data.c,v retrieving revision 1.29 retrieving revision 1.30 diff -u -d -r1.29 -r1.30 --- exif-data.c 26 Oct 2003 10:06:17 -0000 1.29 +++ exif-data.c 26 Oct 2003 22:30:26 -0000 1.30 @@ -50,8 +50,17 @@ ExifMnoteData *md; unsigned int ref_count; + + /* Temporarily used while loading data */ + unsigned int offset_mnote; }; +ExifMnoteData * +exif_data_get_mnote_data (ExifData *d) +{ + return (d && d->priv) ? d->priv->md : NULL; +} + ExifData * exif_data_new (void) { @@ -124,6 +133,10 @@ 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) + data->priv->offset_mnote = doff; } static void @@ -484,22 +497,22 @@ ExifShort n; ExifEntry *e, *em; const unsigned char *d = d_orig; - unsigned int size = ds_orig, len; + unsigned int ds = ds_orig, len; if (!data) return; - if (!d || !size) + if (!d || !ds) return; #ifdef DEBUG - printf ("Parsing %i byte(s) EXIF data...\n", size); + printf ("Parsing %i byte(s) EXIF data...\n", ds); #endif /* * It can be that the data starts with the EXIF header. If it does * not, search the EXIF marker. */ - if (size < 6) { + if (ds < 6) { #ifdef DEBUG printf ("Size too small.\n"); #endif @@ -515,27 +528,27 @@ "0x%x...\n", d[0], d[1], d[2], d[3], d[4], d[5], d[6]); #endif while (1) { - while ((d[0] == 0xff) && size) { + while ((d[0] == 0xff) && ds) { d++; - size--; + ds--; } /* JPEG_MARKER_SOI */ if (d[0] == JPEG_MARKER_SOI) { d++; - size--; + ds--; continue; } /* JPEG_MARKER_APP0 */ if (d[0] == JPEG_MARKER_APP0) { d++; - size--; + ds--; l = (d[0] << 8) | d[1]; - if (l > size) + if (l > ds) return; d += l; - size -= l; + ds -= l; continue; } @@ -550,8 +563,8 @@ return; } d++; - size--; - if (size < 2) { + ds--; + if (ds < 2) { #ifdef DEBUG printf ("Size too small.\n"); #endif @@ -562,14 +575,14 @@ printf ("We have to deal with %i byte(s) of EXIF data.\n", len); #endif d += 2; - size -= 2; + ds -= 2; } /* * Verify the exif header * (offset 2, length 6). */ - if (size < 6) { + if (ds < 6) { #ifdef DEBUG printf ("Size too small.\n"); #endif @@ -587,7 +600,7 @@ #endif /* Byte order (offset 6, length 2) */ - if (size < 12) + if (ds < 12) return; if (!memcmp (d + 6, "II", 2)) data->priv->order = EXIF_BYTE_ORDER_INTEL; @@ -608,7 +621,7 @@ /* Parse the actual exif data (offset 14) */ exif_data_load_data_content (data, data->ifd[EXIF_IFD_0], d + 6, - size - 6, offset); + ds - 6, offset); /* IFD 1 offset */ n = exif_get_short (d + 6 + offset, data->priv->order); @@ -619,7 +632,7 @@ #endif /* Sanity check. */ - if (offset > size - 6) { + if (offset > ds - 6) { #ifdef DEBUG printf ("Bogus offset!\n"); #endif @@ -627,7 +640,7 @@ } exif_data_load_data_content (data, data->ifd[EXIF_IFD_1], d + 6, - size - 6, offset); + ds - 6, offset); } /* @@ -641,14 +654,12 @@ /* Olympus */ if ((e->size >= 5) && (!memcmp (e->data, "OLYMP", 5))) - data->priv->md = exif_mnote_data_olympus_new ( - data->priv->order); + data->priv->md = exif_mnote_data_olympus_new (); /* Pentax */ else if ((e->size >= 2) && (e->data[0] == 0x00) && (e->data[1] == 0x1b)) - data->priv->md = exif_mnote_data_pentax_new ( - data->priv->order); + data->priv->md = exif_mnote_data_pentax_new (); else { em = exif_data_get_entry (data, EXIF_TAG_MAKE); @@ -656,8 +667,7 @@ /* Canon */ if (!strcmp (exif_entry_get_value (em), "Canon")) - data->priv->md = exif_mnote_data_canon_new ( - data->priv->order); + data->priv->md = exif_mnote_data_canon_new (); } } @@ -667,7 +677,11 @@ * pointers after this function here returns. */ if (data->priv->md) { - exif_mnote_data_load (data->priv->md, d_orig, ds_orig); + 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_data_remove_entry (data, EXIF_TAG_MAKER_NOTE); } } Index: exif-mnote-data-priv.h =================================================================== RCS file: /cvsroot/libexif/libexif/libexif/exif-mnote-data-priv.h,v retrieving revision 1.1 retrieving revision 1.2 diff -u -d -r1.1 -r1.2 --- exif-mnote-data-priv.h 26 Oct 2003 10:06:17 -0000 1.1 +++ exif-mnote-data-priv.h 26 Oct 2003 22:30:26 -0000 1.2 @@ -26,6 +26,7 @@ #endif /* __cplusplus */ #include <libexif/exif-mnote-data.h> +#include <libexif/exif-byte-order.h> typedef struct _ExifMnoteDataMethods ExifMnoteDataMethods; struct _ExifMnoteDataMethods { @@ -36,6 +37,8 @@ /* Modification */ void (* save) (ExifMnoteData *, unsigned char **, unsigned int *); void (* load) (ExifMnoteData *, const unsigned char *, unsigned int); + void (* set_offset) (ExifMnoteData *, unsigned int); + void (* set_byte_order) (ExifMnoteData *, ExifByteOrder); /* Query */ unsigned int (* count) (ExifMnoteData *); @@ -54,7 +57,9 @@ ExifMnoteDataPriv *priv; }; -void exif_mnote_data_construct (ExifMnoteData *); +void exif_mnote_data_construct (ExifMnoteData *); +void exif_mnote_data_set_byte_order (ExifMnoteData *, ExifByteOrder); +void exif_mnote_data_set_offset (ExifMnoteData *, unsigned int); #ifdef __cplusplus } Index: exif-content.c =================================================================== RCS file: /cvsroot/libexif/libexif/libexif/exif-content.c,v retrieving revision 1.8 retrieving revision 1.9 diff -u -d -r1.8 -r1.9 --- exif-content.c 17 Sep 2003 11:31:06 -0000 1.8 +++ exif-content.c 26 Oct 2003 22:30:26 -0000 1.9 @@ -115,25 +115,23 @@ } void -exif_content_remove_entry (ExifContent *content, ExifEntry *entry) +exif_content_remove_entry (ExifContent *c, ExifEntry *e) { unsigned int i; - if (entry->parent != content) - return; - - for (i = 0; i < content->count; i++) - if (content->entries[i] == entry) - break; - if (i == content->count) - return; + if (!c || !e) return; + if (e->parent != c) return; - memmove (&content->entries[i], &content->entries[i + 1], - sizeof (ExifEntry) * (content->count - i - 1)); - content->count--; + /* Search the entry */ + for (i = 0; i < c->count; i++) if (c->entries[i] == e) break; + if (i == c->count) return; - entry->parent = NULL; - exif_entry_unref (entry); + /* Remove the entry */ + memmove (&c->entries[i], &c->entries[i + 1], + sizeof (ExifEntry) * (c->count - i - 1)); + c->count--; + e->parent = NULL; + exif_entry_unref (e); } ExifEntry * Index: Makefile.am =================================================================== RCS file: /cvsroot/libexif/libexif/libexif/Makefile.am,v retrieving revision 1.22 retrieving revision 1.23 diff -u -d -r1.22 -r1.23 --- Makefile.am 26 Oct 2003 10:11:31 -0000 1.22 +++ Makefile.am 26 Oct 2003 22:30:26 -0000 1.23 @@ -23,9 +23,9 @@ exif-utils.c \ i18n.h libexif_la_LIBADD = -lm \ - canon/libmnote-canon.a \ - olympus/libmnote-olympus.a \ - pentax/libmnote-pentax.a + canon/libmnote-canon.la \ + olympus/libmnote-olympus.la \ + pentax/libmnote-pentax.la libexifincludedir = $(includedir)/libexif libexifinclude_HEADERS = \ Index: exif-mnote-data.c =================================================================== RCS file: /cvsroot/libexif/libexif/libexif/exif-mnote-data.c,v retrieving revision 1.1 retrieving revision 1.2 diff -u -d -r1.1 -r1.2 --- exif-mnote-data.c 26 Oct 2003 10:06:17 -0000 1.1 +++ exif-mnote-data.c 26 Oct 2003 22:30:26 -0000 1.2 @@ -86,6 +86,20 @@ d->methods.save (d, buf, buf_size); } +void +exif_mnote_data_set_byte_order (ExifMnoteData *d, ExifByteOrder o) +{ + if (!d || !d->methods.set_byte_order) return; + d->methods.set_byte_order (d, o); +} + +void +exif_mnote_data_set_offset (ExifMnoteData *d, unsigned int o) +{ + if (!d || !d->methods.set_offset) return; + d->methods.set_offset (d, o); +} + unsigned int exif_mnote_data_count (ExifMnoteData *d) { |
From: Lutz M?l. <lu...@us...> - 2003-10-26 22:34:17
|
Update of /cvsroot/libexif/libexif/test In directory sc8-pr-cvs1:/tmp/cvs-serv21845/test Modified Files: Makefile.am Added Files: test-mnote.c Log Message: 2003-10-26 Lutz Mueller <lu...@us...> * test/test-mnote.c: New. * libexif: The code now both compiles and doesn't crash, but at least the canon maker note still doesn't get parsed. --- NEW FILE: test-mnote.c --- #include <config.h> #include <stdio.h> #include <stdlib.h> #include <libexif/exif-data.h> int main (int argc, char **argv) { ExifData *d; ExifMnoteData *md; unsigned int c, i; char *v; if (argc <= 1) { fprintf (stderr, "You need to supply a filename!\n"); return 1; } fprintf (stdout, "Loading '%s'...\n", argv[1]); d = exif_data_new_from_file (argv[1]); if (!d) { fprintf (stderr, "Could not load data from '%s'!\n", argv[1]); return 1; } fprintf (stdout, "Parsing maker note...\n"); md = exif_data_get_mnote_data (d); if (!md) { fprintf (stderr, "Could not parse maker note!\n"); exif_data_unref (d); return 1; } c = exif_mnote_data_count (md); for (i = 0; i < c; i++) { fprintf (stdout, "%s", exif_mnote_data_get_name (md, i)); fprintf (stdout, " Title: %s", exif_mnote_data_get_title (md, i)); fprintf (stdout, " Description: %s", exif_mnote_data_get_description (md, i)); v = exif_mnote_data_get_value (md, i); if (v) { fprintf (stdout, " Value: '%s'", v); free (v); } } exif_data_unref (d); } Index: Makefile.am =================================================================== RCS file: /cvsroot/libexif/libexif/test/Makefile.am,v retrieving revision 1.7 retrieving revision 1.8 diff -u -d -r1.7 -r1.8 --- Makefile.am 22 Nov 2002 16:47:56 -0000 1.7 +++ Makefile.am 26 Oct 2003 22:30:27 -0000 1.8 @@ -3,15 +3,8 @@ -I$(top_srcdir)intl \ -I$(top_srcdir) -noinst_PROGRAMS = \ - test-mem \ - test-tree - -test_tree_LDADD = \ - ../libjpeg/libjpeg.la \ - ../libexif/libexif.la \ - $(INTLLIBS) +noinst_PROGRAMS = test-mem test-tree test-mnote -test_mem_LDADD = \ - ../libexif/libexif.la \ - $(INTLLIBS) +test_tree_LDADD = ../libjpeg/libjpeg.la ../libexif/libexif.la $(INTLLIBS) +test_mem_LDADD = ../libexif/libexif.la $(INTLLIBS) +test_mnote_LDADD = ../libexif/libexif.la $(INTLLIBS) |
From: Lutz M?l. <lu...@us...> - 2003-10-26 22:34:15
|
Update of /cvsroot/libexif/libexif In directory sc8-pr-cvs1:/tmp/cvs-serv21845 Modified Files: ChangeLog Log Message: 2003-10-26 Lutz Mueller <lu...@us...> * test/test-mnote.c: New. * libexif: The code now both compiles and doesn't crash, but at least the canon maker note still doesn't get parsed. Index: ChangeLog =================================================================== RCS file: /cvsroot/libexif/libexif/ChangeLog,v retrieving revision 1.79 retrieving revision 1.80 diff -u -d -r1.79 -r1.80 --- ChangeLog 26 Oct 2003 10:18:31 -0000 1.79 +++ ChangeLog 26 Oct 2003 22:30:26 -0000 1.80 @@ -1,5 +1,11 @@ 2003-10-26 Lutz Mueller <lu...@us...> + * test/test-mnote.c: New. + * libexif: The code now both compiles and doesn't crash, + but at least the canon maker note still doesn't get parsed. + +2003-10-26 Lutz Mueller <lu...@us...> + * configure.in * Makefile.am: Remove PO_DIRS. Otherwise, automake complains about po and intl not being in SUBDIRS |
From: Lutz M?l. <lu...@us...> - 2003-10-26 22:31:53
|
Update of /cvsroot/libexif/libexif/libexif/pentax In directory sc8-pr-cvs1:/tmp/cvs-serv21845/libexif/pentax Modified Files: exif-mnote-data-pentax.c exif-mnote-data-pentax.h Log Message: 2003-10-26 Lutz Mueller <lu...@us...> * test/test-mnote.c: New. * libexif: The code now both compiles and doesn't crash, but at least the canon maker note still doesn't get parsed. Index: exif-mnote-data-pentax.c =================================================================== RCS file: /cvsroot/libexif/libexif/libexif/pentax/exif-mnote-data-pentax.c,v retrieving revision 1.1 retrieving revision 1.2 diff -u -d -r1.1 -r1.2 --- exif-mnote-data-pentax.c 26 Oct 2003 10:06:17 -0000 1.1 +++ exif-mnote-data-pentax.c 26 Oct 2003 22:30:27 -0000 1.2 @@ -161,20 +161,33 @@ return mnote_pentax_tag_get_description (note->entries[n].tag); } +static void +exif_mnote_data_pentax_set_offset (ExifMnoteData *d, unsigned int o) +{ + if (d) ((ExifMnoteDataPentax *) d)->offset = o; +} + +static void +exif_mnote_data_pentax_set_byte_order (ExifMnoteData *d, ExifByteOrder o) +{ + if (d) ((ExifMnoteDataPentax *) d)->order = o; +} + ExifMnoteData * -exif_mnote_data_pentax_new (ExifByteOrder order) +exif_mnote_data_pentax_new (void) { ExifMnoteData *n; n = malloc (sizeof (ExifMnoteDataPentax)); if (!n) return NULL; memset (n, 0, sizeof (ExifMnoteDataPentax)); - exif_mnote_data_construct (n); - ((ExifMnoteDataPentax *) n)->order = order; + exif_mnote_data_construct (n); /* Set up function pointers */ n->methods.free = exif_mnote_data_pentax_free; + n->methods.set_byte_order = exif_mnote_data_pentax_set_byte_order; + n->methods.set_offset = exif_mnote_data_pentax_set_offset; n->methods.load = exif_mnote_data_pentax_load; n->methods.count = exif_mnote_data_pentax_count; n->methods.get_name = exif_mnote_data_pentax_get_name; Index: exif-mnote-data-pentax.h =================================================================== RCS file: /cvsroot/libexif/libexif/libexif/pentax/exif-mnote-data-pentax.h,v retrieving revision 1.1 retrieving revision 1.2 diff -u -d -r1.1 -r1.2 --- exif-mnote-data-pentax.h 26 Oct 2003 10:06:17 -0000 1.1 +++ exif-mnote-data-pentax.h 26 Oct 2003 22:30:27 -0000 1.2 @@ -35,8 +35,9 @@ unsigned int count; ExifByteOrder order; + unsigned int offset; }; -ExifMnoteData *exif_mnote_data_pentax_new (ExifByteOrder); +ExifMnoteData *exif_mnote_data_pentax_new (void); #endif /* __EXIF_MNOTE_DATA_PENTAX_H__ */ |
From: Lutz M?l. <lu...@us...> - 2003-10-26 22:31:50
|
Update of /cvsroot/libexif/libexif/libexif/olympus In directory sc8-pr-cvs1:/tmp/cvs-serv21845/libexif/olympus Modified Files: exif-mnote-data-olympus.c exif-mnote-data-olympus.h Log Message: 2003-10-26 Lutz Mueller <lu...@us...> * test/test-mnote.c: New. * libexif: The code now both compiles and doesn't crash, but at least the canon maker note still doesn't get parsed. Index: exif-mnote-data-olympus.c =================================================================== RCS file: /cvsroot/libexif/libexif/libexif/olympus/exif-mnote-data-olympus.c,v retrieving revision 1.1 retrieving revision 1.2 diff -u -d -r1.1 -r1.2 --- exif-mnote-data-olympus.c 26 Oct 2003 10:06:17 -0000 1.1 +++ exif-mnote-data-olympus.c 26 Oct 2003 22:30:26 -0000 1.2 @@ -223,20 +223,33 @@ return mnote_olympus_tag_get_title (n->entries[i].tag); } +static void +exif_mnote_data_olympus_set_byte_order (ExifMnoteData *n, ExifByteOrder o) +{ + if (n) ((ExifMnoteDataOlympus *) n)->order = o; +} + +static void +exif_mnote_data_olympus_set_offset (ExifMnoteData *n, unsigned int o) +{ + if (n) ((ExifMnoteDataOlympus *) n)->offset = o; +} + ExifMnoteData * -exif_mnote_data_olympus_new (ExifByteOrder order) +exif_mnote_data_olympus_new (void) { ExifMnoteData *n; n = malloc (sizeof (ExifMnoteDataOlympus)); if (!n) return NULL; memset (n, 0, sizeof (ExifMnoteDataOlympus)); - exif_mnote_data_construct (n); - ((ExifMnoteDataOlympus *) n)->order = order; + exif_mnote_data_construct (n); /* Set up the function pointers */ n->methods.free = exif_mnote_data_olympus_free; + n->methods.set_byte_order = exif_mnote_data_olympus_set_byte_order; + n->methods.set_offset = exif_mnote_data_olympus_set_offset; n->methods.load = exif_mnote_data_olympus_load; n->methods.count = exif_mnote_data_olympus_count; n->methods.get_name = exif_mnote_data_olympus_get_name; Index: exif-mnote-data-olympus.h =================================================================== RCS file: /cvsroot/libexif/libexif/libexif/olympus/exif-mnote-data-olympus.h,v retrieving revision 1.1 retrieving revision 1.2 diff -u -d -r1.1 -r1.2 --- exif-mnote-data-olympus.h 26 Oct 2003 10:06:17 -0000 1.1 +++ exif-mnote-data-olympus.h 26 Oct 2003 22:30:26 -0000 1.2 @@ -34,8 +34,9 @@ unsigned int count; ExifByteOrder order; + unsigned int offset; }; -ExifMnoteData *exif_mnote_data_olympus_new (ExifByteOrder); +ExifMnoteData *exif_mnote_data_olympus_new (void); #endif /* __MNOTE_OLYMPUS_CONTENT_H__ */ |
From: Lutz M?l. <lu...@us...> - 2003-10-26 22:31:48
|
Update of /cvsroot/libexif/libexif/libexif/canon In directory sc8-pr-cvs1:/tmp/cvs-serv21845/libexif/canon Modified Files: exif-mnote-data-canon.c exif-mnote-data-canon.h Log Message: 2003-10-26 Lutz Mueller <lu...@us...> * test/test-mnote.c: New. * libexif: The code now both compiles and doesn't crash, but at least the canon maker note still doesn't get parsed. Index: exif-mnote-data-canon.h =================================================================== RCS file: /cvsroot/libexif/libexif/libexif/canon/exif-mnote-data-canon.h,v retrieving revision 1.1 retrieving revision 1.2 diff -u -d -r1.1 -r1.2 --- exif-mnote-data-canon.h 26 Oct 2003 10:06:17 -0000 1.1 +++ exif-mnote-data-canon.h 26 Oct 2003 22:30:26 -0000 1.2 @@ -36,8 +36,9 @@ unsigned int count; ExifByteOrder order; + unsigned int offset; }; -ExifMnoteData *exif_mnote_data_canon_new (ExifByteOrder); +ExifMnoteData *exif_mnote_data_canon_new (void); #endif /* __EXIF_MNOTE_DATA_CANON_H__ */ Index: exif-mnote-data-canon.c =================================================================== RCS file: /cvsroot/libexif/libexif/libexif/canon/exif-mnote-data-canon.c,v retrieving revision 1.1 retrieving revision 1.2 diff -u -d -r1.1 -r1.2 --- exif-mnote-data-canon.c 26 Oct 2003 10:06:17 -0000 1.1 +++ exif-mnote-data-canon.c 26 Oct 2003 22:30:26 -0000 1.2 @@ -30,7 +30,7 @@ #include <libexif/exif-utils.h> #include <libexif/exif-data.h> -/* #define DEBUG */ +#define DEBUG static void exif_mnote_data_canon_free (ExifMnoteData *n) @@ -63,6 +63,18 @@ } static void +exif_mnote_data_canon_set_byte_order (ExifMnoteData *n, ExifByteOrder o) +{ + if (n) ((ExifMnoteDataCanon *) n)->order = o; +} + +static void +exif_mnote_data_canon_set_offset (ExifMnoteData *n, unsigned int o) +{ + if (n) ((ExifMnoteDataCanon *) n)->offset = o; +} + +static void exif_mnote_data_canon_load_entry_with_exif (ExifMnoteDataCanon *note, MnoteCanonEntry *entry, const unsigned char *d, @@ -108,53 +120,11 @@ } static void -exif_mnote_data_canon_load_entry (ExifMnoteDataCanon *note, - MnoteCanonEntry *entry, - const unsigned char *d, - unsigned int size, unsigned int offset) -{ - unsigned int s, doff; - - entry->tag = exif_get_short (d + offset + 0, note->order); - entry->format = exif_get_short (d + offset + 2, note->order); - entry->components = exif_get_long (d + offset + 4, note->order); - - /* - * Size? If bigger than 4 bytes, the actual data is not - * in the entry but somewhere else (offset). - */ - s = exif_format_get_size (entry->format) * entry->components; - if (!s) - return; - if (s > 4) - /* FIXME works on g3, but other should send exif data... */ - doff = exif_get_long (d + offset + 8, note->order)-0x3B0 ; - else - doff = offset + 8; - -#ifdef DEBUG - printf ("Comp %x %d %d %x %x\n",doff, s,size,d[doff],d[doff+1]); -#endif - /* Sanity check */ - if (size < doff + s) - return; - entry->data = malloc (sizeof (char) * s); - if (!entry->data) - return; - entry->size = s; - memcpy (entry->data, d + doff, s); - -} - -static void exif_mnote_data_canon_load (ExifMnoteData *ne, const unsigned char *buf, unsigned int buf_size) { ExifMnoteDataCanon *data = (ExifMnoteDataCanon *) ne; - const unsigned char *d = buf; - ExifData *ed = NULL; - ExifEntry *e = NULL; ExifShort n; unsigned int i; unsigned int size = buf_size; @@ -165,25 +135,11 @@ if (!buf || !buf_size) return; - /* If we got EXIF data, go to the MakerNote tag. */ - ed = exif_data_new_from_data (buf, size); - if (ed) { - e = exif_content_get_entry (ed->ifd[EXIF_IFD_EXIF], - EXIF_TAG_MAKER_NOTE); - if (e) - { - d = e->data; - size = e->size; -#ifdef DEBUG - printf ("Exif data\n"); -#endif - } - } - #ifdef DEBUG - printf ("Parsing %i byte(s) Mnote data...\n", size); + printf ("Parsing %i byte(s) data at offset %i...\n", size, + data->offset); #endif -#ifdef DEBUG +#if 0 int j; for (j=0;j<size;j++) { @@ -195,37 +151,29 @@ #endif /* Read the number of entries */ - n = exif_get_short (d ,data->order); + n = exif_get_short (buf + 6 + data->offset, data->order); #ifdef DEBUG printf ("Loading %i entries...\n", n); #endif - d+=2; - size-=2; + d += 2; + size -= 2; - if ( 12 * n > size ) - return; + if (12 * n > size) return; for (i = 0; i < n; i++) { tag = exif_get_short (d + 12 * i, data->order); #ifdef DEBUG printf ("Loading entry '%s' (%i of %i)...\n", - exif_mnote_data_canon_tag_get_name (tag), i + 1, n); + mnote_canon_tag_get_name (tag), i + 1, n); #endif data->count++; data->entries = realloc (data->entries, sizeof (MnoteCanonEntry) * data->count); - if (e) /* we have exif data */ - exif_mnote_data_canon_load_entry_with_exif (data, + exif_mnote_data_canon_load_entry_with_exif (data, &data->entries[data->count - 1], d, size, 12 * i, buf, buf_size); - else - exif_mnote_data_canon_load_entry (data, - &data->entries[data->count - 1], - d, size, 12 * i); } - exif_data_unref (ed); - } static unsigned int @@ -264,19 +212,20 @@ } ExifMnoteData * -exif_mnote_data_canon_new (ExifByteOrder order) +exif_mnote_data_canon_new (void) { ExifMnoteData *d; d = malloc (sizeof (ExifMnoteDataCanon)); if (!d) return NULL; - - ((ExifMnoteDataCanon *) d)->order = order; + memset (d, 0, sizeof (ExifMnoteDataCanon)); exif_mnote_data_construct (d); /* Set up function pointers */ d->methods.free = exif_mnote_data_canon_free; + d->methods.set_byte_order = exif_mnote_data_canon_set_byte_order; + d->methods.set_offset = exif_mnote_data_canon_set_offset; d->methods.load = exif_mnote_data_canon_load; d->methods.count = exif_mnote_data_canon_count; d->methods.get_name = exif_mnote_data_canon_get_name; |
From: Lutz M?l. <lu...@us...> - 2003-10-26 10:26:57
|
Update of /cvsroot/libexif/libexif/po In directory sc8-pr-cvs1:/tmp/cvs-serv28940/po Modified Files: .cvsignore Log Message: Index: .cvsignore =================================================================== RCS file: /cvsroot/libexif/libexif/po/.cvsignore,v retrieving revision 1.2 retrieving revision 1.3 diff -u -d -r1.2 -r1.3 --- .cvsignore 1 Dec 2002 19:58:52 -0000 1.2 +++ .cvsignore 26 Oct 2003 10:24:26 -0000 1.3 @@ -1,3 +1,4 @@ ChangeLog *.gmo libexif.pot +po/Makevars |
From: Lutz M?l. <lu...@us...> - 2003-10-26 10:22:52
|
Update of /cvsroot/libexif/libexif In directory sc8-pr-cvs1:/tmp/cvs-serv28262 Modified Files: ChangeLog Makefile.am configure.in Log Message: 2003-10-26 Lutz Mueller <lu...@us...> * configure.in * Makefile.am: Remove PO_DIRS. Otherwise, automake complains about po and intl not being in SUBDIRS Index: configure.in =================================================================== RCS file: /cvsroot/libexif/libexif/configure.in,v retrieving revision 1.56 retrieving revision 1.57 diff -u -d -r1.56 -r1.57 --- configure.in 26 Oct 2003 10:06:16 -0000 1.56 +++ configure.in 26 Oct 2003 10:18:31 -0000 1.57 @@ -38,13 +38,10 @@ then sed -e "s/^DOMAIN.*/DOMAIN = ${GETTEXT_PACKAGE}/" < po/Makevars.template > po/Makevars AC_MSG_RESULT([yes. done.]) - PO_DIR=po else AC_MSG_RESULT([no]) - PO_DIR= fi AM_GNU_GETTEXT -AC_SUBST([PO_DIR]) dnl --------------------------------------------------------------------------- dnl Warnings @@ -66,6 +63,7 @@ libjpeg/Makefile test/Makefile libexif/libexif.pc + po/Makefile.in ]) echo " Index: Makefile.am =================================================================== RCS file: /cvsroot/libexif/libexif/Makefile.am,v retrieving revision 1.23 retrieving revision 1.24 diff -u -d -r1.23 -r1.24 --- Makefile.am 28 Sep 2003 17:35:13 -0000 1.23 +++ Makefile.am 26 Oct 2003 10:18:31 -0000 1.24 @@ -1,3 +1,3 @@ -SUBDIRS = libexif libjpeg test $(PO_DIR) +SUBDIRS = libexif libjpeg test po intl EXTRA_DIST = @PACKAGE@.spec Index: ChangeLog =================================================================== RCS file: /cvsroot/libexif/libexif/ChangeLog,v retrieving revision 1.78 retrieving revision 1.79 diff -u -d -r1.78 -r1.79 --- ChangeLog 26 Oct 2003 10:06:16 -0000 1.78 +++ ChangeLog 26 Oct 2003 10:18:31 -0000 1.79 @@ -1,5 +1,11 @@ 2003-10-26 Lutz Mueller <lu...@us...> + * configure.in + * Makefile.am: Remove PO_DIRS. Otherwise, automake complains about + po and intl not being in SUBDIRS + +2003-10-26 Lutz Mueller <lu...@us...> + * libexif/olympus * libexif/canon * libexif/pentax: Merge libmnote with libexif. The code compiles but |
From: Lutz M?l. <lu...@us...> - 2003-10-26 10:14:33
|
Update of /cvsroot/libexif/libexif/libexif In directory sc8-pr-cvs1:/tmp/cvs-serv27365/libexif Modified Files: Makefile.am Log Message: 2003-10-26 Lutz Mueller <lu...@us...> * libexif/olympus * libexif/canon * libexif/pentax: Merge libmnote with libexif. The code compiles but is completely untested. Index: Makefile.am =================================================================== RCS file: /cvsroot/libexif/libexif/libexif/Makefile.am,v retrieving revision 1.21 retrieving revision 1.22 diff -u -d -r1.21 -r1.22 --- Makefile.am 26 Oct 2003 10:06:17 -0000 1.21 +++ Makefile.am 26 Oct 2003 10:11:31 -0000 1.22 @@ -25,7 +25,7 @@ libexif_la_LIBADD = -lm \ canon/libmnote-canon.a \ olympus/libmnote-olympus.a \ - olympus/libmnote-pentax.a + pentax/libmnote-pentax.a libexifincludedir = $(includedir)/libexif libexifinclude_HEADERS = \ |
From: Lutz M?l. <lu...@us...> - 2003-10-26 10:14:32
|
Update of /cvsroot/libexif/libexif/libexif/canon In directory sc8-pr-cvs1:/tmp/cvs-serv27365/libexif/canon Modified Files: Makefile.am Log Message: 2003-10-26 Lutz Mueller <lu...@us...> * libexif/olympus * libexif/canon * libexif/pentax: Merge libmnote with libexif. The code compiles but is completely untested. Index: Makefile.am =================================================================== RCS file: /cvsroot/libexif/libexif/libexif/canon/Makefile.am,v retrieving revision 1.5 retrieving revision 1.6 diff -u -d -r1.5 -r1.6 --- Makefile.am 26 Oct 2003 10:06:17 -0000 1.5 +++ Makefile.am 26 Oct 2003 10:11:31 -0000 1.6 @@ -3,8 +3,8 @@ -I$(top_srcdir) \ -I$(top_srcdir)/intl -noinst_LIBRARIES = libmnote-canon.a -libmnote_canon_a_SOURCES = \ +noinst_LTLIBRARIES = libmnote-canon.la +libmnote_canon_la_SOURCES = \ exif-mnote-data-canon.c exif-mnote-data-canon.h \ mnote-canon-entry.c mnote-canon-entry.h \ mnote-canon-tag.c mnote-canon-tag.h |
From: Lutz M?l. <lu...@us...> - 2003-10-26 10:14:32
|
Update of /cvsroot/libexif/libexif/libexif/olympus In directory sc8-pr-cvs1:/tmp/cvs-serv27365/libexif/olympus Modified Files: Makefile.am Log Message: 2003-10-26 Lutz Mueller <lu...@us...> * libexif/olympus * libexif/canon * libexif/pentax: Merge libmnote with libexif. The code compiles but is completely untested. Index: Makefile.am =================================================================== RCS file: /cvsroot/libexif/libexif/libexif/olympus/Makefile.am,v retrieving revision 1.5 retrieving revision 1.6 diff -u -d -r1.5 -r1.6 --- Makefile.am 26 Oct 2003 10:06:17 -0000 1.5 +++ Makefile.am 26 Oct 2003 10:11:31 -0000 1.6 @@ -3,8 +3,8 @@ -I$(top_srcdir) \ -I$(top_srcdir)/intl -noinst_LIBRARIES = libmnote-olympus.a -libmnote_olympus_a_SOURCES = \ +noinst_LTLIBRARIES = libmnote-olympus.la +libmnote_olympus_la_SOURCES = \ mnote-olympus-entry.c mnote-olympus-entry.h \ exif-mnote-data-olympus.c exif-mnote-data-olympus.h \ mnote-olympus-tag.c mnote-olympus-tag.h |
From: Lutz M?l. <lu...@us...> - 2003-10-26 10:14:32
|
Update of /cvsroot/libexif/libexif/libexif/pentax In directory sc8-pr-cvs1:/tmp/cvs-serv27365/libexif/pentax Modified Files: Makefile.am Log Message: 2003-10-26 Lutz Mueller <lu...@us...> * libexif/olympus * libexif/canon * libexif/pentax: Merge libmnote with libexif. The code compiles but is completely untested. Index: Makefile.am =================================================================== RCS file: /cvsroot/libexif/libexif/libexif/pentax/Makefile.am,v retrieving revision 1.1 retrieving revision 1.2 diff -u -d -r1.1 -r1.2 --- Makefile.am 26 Oct 2003 10:06:17 -0000 1.1 +++ Makefile.am 26 Oct 2003 10:11:31 -0000 1.2 @@ -3,8 +3,8 @@ -I$(top_srcdir) \ -I$(top_srcdir)/intl -noinst_LIBRARIES = libmnote-pentax.a -libmnote_pentax_a_SOURCES = \ +noinst_LTLIBRARIES = libmnote-pentax.la +libmnote_pentax_la_SOURCES = \ mnote-pentax-entry.c mnote-pentax-entry.h \ exif-mnote-data-pentax.c exif-mnote-data-pentax.h \ mnote-pentax-tag.c mnote-pentax-tag.h |
From: Lutz M?l. <lu...@us...> - 2003-10-26 10:14:04
|
Update of /cvsroot/libexif/libexif/po In directory sc8-pr-cvs1:/tmp/cvs-serv27365/po Modified Files: POTFILES.in de.po es.po fr.po Log Message: 2003-10-26 Lutz Mueller <lu...@us...> * libexif/olympus * libexif/canon * libexif/pentax: Merge libmnote with libexif. The code compiles but is completely untested. Index: de.po =================================================================== RCS file: /cvsroot/libexif/libexif/po/de.po,v retrieving revision 1.14 retrieving revision 1.15 diff -u -d -r1.14 -r1.15 --- de.po 4 Aug 2003 19:51:53 -0000 1.14 +++ de.po 26 Oct 2003 10:11:32 -0000 1.15 @@ -6,7 +6,7 @@ msgstr "" "Project-Id-Version: libexif vers\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2003-07-30 23:40+0200\n" +"POT-Creation-Date: 2003-10-26 12:31+0100\n" "PO-Revision-Date: 2002-09-12 19:48+0200\n" "Last-Translator: Hans Ulrich Niedermann <gp...@n-...>\n" "Language-Team: Deutsch <de...@li...>\n" @@ -22,12 +22,16 @@ msgid "Intel" msgstr "" [...1542 lines suppressed...] +msgid "Best" +msgstr "" + +#: libexif/pentax/mnote-pentax-entry.c:154 +#, fuzzy +msgid "Flash On" +msgstr "Blitz" + +#: libexif/pentax/mnote-pentax-entry.c:157 +#, fuzzy +msgid "Flash Off" +msgstr "Blitz" + +#: libexif/pentax/mnote-pentax-entry.c:160 +msgid "Red-eye Reduction" +msgstr "" + +#: libexif/pentax/mnote-pentax-entry.c:292 +msgid "Full" msgstr "" Index: fr.po =================================================================== RCS file: /cvsroot/libexif/libexif/po/fr.po,v retrieving revision 1.8 retrieving revision 1.9 diff -u -d -r1.8 -r1.9 --- fr.po 4 Aug 2003 19:51:53 -0000 1.8 +++ fr.po 26 Oct 2003 10:11:32 -0000 1.9 @@ -7,7 +7,7 @@ msgstr "" "Project-Id-Version: libexif\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2003-07-30 23:40+0200\n" +"POT-Creation-Date: 2003-10-26 12:31+0100\n" "PO-Revision-Date: 2002-11-21 10:02+0100\n" "Last-Translator: Arnaud Launay <as...@la...>\n" "Language-Team: Français <tr...@tr...>\n" @@ -23,12 +23,16 @@ msgid "Intel" msgstr "Intel" [...1572 lines suppressed...] +msgid "Best" +msgstr "" + +#: libexif/pentax/mnote-pentax-entry.c:154 +#, fuzzy +msgid "Flash On" +msgstr "Flash" + +#: libexif/pentax/mnote-pentax-entry.c:157 +#, fuzzy +msgid "Flash Off" +msgstr "Flash" + +#: libexif/pentax/mnote-pentax-entry.c:160 +msgid "Red-eye Reduction" +msgstr "" + +#: libexif/pentax/mnote-pentax-entry.c:292 +msgid "Full" +msgstr "" Index: POTFILES.in =================================================================== RCS file: /cvsroot/libexif/libexif/po/POTFILES.in,v retrieving revision 1.4 retrieving revision 1.5 diff -u -d -r1.4 -r1.5 --- POTFILES.in 3 Dec 2002 07:48:10 -0000 1.4 +++ POTFILES.in 26 Oct 2003 10:11:32 -0000 1.5 @@ -2,3 +2,9 @@ libexif/exif-entry.c libexif/exif-format.c libexif/exif-tag.c +libexif/canon/mnote-canon-tag.c +libexif/canon/mnote-canon-entry.c +libexif/olympus/mnote-olympus-tag.c +libexif/olympus/mnote-olympus-entry.c +libexif/pentax/mnote-pentax-tag.c +libexif/pentax/mnote-pentax-entry.c Index: es.po =================================================================== RCS file: /cvsroot/libexif/libexif/po/es.po,v retrieving revision 1.7 retrieving revision 1.8 diff -u -d -r1.7 -r1.8 --- es.po 4 Aug 2003 19:51:53 -0000 1.7 +++ es.po 26 Oct 2003 10:11:32 -0000 1.8 @@ -6,7 +6,7 @@ msgstr "" "Project-Id-Version: libexif\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2003-07-30 23:40+0200\n" +"POT-Creation-Date: 2003-10-26 12:31+0100\n" "PO-Revision-Date: 2002-09-05 22:28-0300\n" "Last-Translator: Fabian Mandelbaum <fa...@ma...>\n" "Language-Team: Spanish <es...@li...>\n" @@ -22,12 +22,16 @@ msgid "Intel" msgstr "" [...1575 lines suppressed...] +msgid "Best" +msgstr "" + +#: libexif/pentax/mnote-pentax-entry.c:154 +#, fuzzy +msgid "Flash On" +msgstr "Flash" + +#: libexif/pentax/mnote-pentax-entry.c:157 +#, fuzzy +msgid "Flash Off" +msgstr "Flash" + +#: libexif/pentax/mnote-pentax-entry.c:160 +msgid "Red-eye Reduction" +msgstr "" + +#: libexif/pentax/mnote-pentax-entry.c:292 +msgid "Full" +msgstr "" |
From: Lutz M?l. <lu...@us...> - 2003-10-26 10:10:30
|
Update of /cvsroot/libexif/libexif/libexif In directory sc8-pr-cvs1:/tmp/cvs-serv26651/libexif Modified Files: Makefile.am exif-data.c exif-data.h Added Files: exif-mnote-data-priv.h exif-mnote-data.c exif-mnote-data.h Log Message: 2003-10-26 Lutz Mueller <lu...@us...> * libexif/olympus * libexif/canon * libexif/pentax: Merge libmnote with libexif. The code compiles but is completely untested. Index: exif-data.h =================================================================== RCS file: /cvsroot/libexif/libexif/libexif/exif-data.h,v retrieving revision 1.6 retrieving revision 1.7 diff -u -d -r1.6 -r1.7 --- exif-data.h 15 Dec 2002 11:41:11 -0000 1.6 +++ exif-data.h 26 Oct 2003 10:06:17 -0000 1.7 @@ -33,6 +33,7 @@ typedef struct _ExifDataPrivate ExifDataPrivate; #include <libexif/exif-content.h> +#include <libexif/exif-mnote-data.h> struct _ExifData { @@ -61,12 +62,27 @@ ExifByteOrder exif_data_get_byte_order (ExifData *data); void exif_data_set_byte_order (ExifData *data, ExifByteOrder order); +ExifMnoteData *exif_data_get_mnote_data (ExifData *); + typedef void (* ExifDataForeachContentFunc) (ExifContent *, void *user_data); void exif_data_foreach_content (ExifData *data, ExifDataForeachContentFunc func, void *user_data); void exif_data_dump (ExifData *data); + +/* For your convenience */ +#define exif_data_get_entry(d,t) \ + (exif_content_get_entry(d->ifd[EXIF_IFD_0],t) ? \ + exif_content_get_entry(d->ifd[EXIF_IFD_0],t) : \ + exif_content_get_entry(d->ifd[EXIF_IFD_1],t) ? \ + exif_content_get_entry(d->ifd[EXIF_IFD_1],t) : \ + exif_content_get_entry(d->ifd[EXIF_IFD_EXIF],t) ? \ + exif_content_get_entry(d->ifd[EXIF_IFD_EXIF],t) : \ + exif_content_get_entry(d->ifd[EXIF_IFD_GPS],t) ? \ + exif_content_get_entry(d->ifd[EXIF_IFD_GPS],t) : \ + exif_content_get_entry(d->ifd[EXIF_IFD_INTEROPERABILITY],t) ? \ + exif_content_get_entry(d->ifd[EXIF_IFD_INTEROPERABILITY],t) : NULL) #ifdef __cplusplus } --- NEW FILE: exif-mnote-data.h --- (This appears to be a binary file; contents omitted.) Index: Makefile.am =================================================================== RCS file: /cvsroot/libexif/libexif/libexif/Makefile.am,v retrieving revision 1.20 retrieving revision 1.21 diff -u -d -r1.20 -r1.21 --- Makefile.am 17 Mar 2003 20:38:46 -0000 1.20 +++ Makefile.am 26 Oct 2003 10:06:17 -0000 1.21 @@ -1,3 +1,4 @@ +SUBDIRS = canon olympus pentax INCLUDES = \ -DLIBEXIF_LOCALEDIR=\""$(datadir)/locale"\" \ -I$(top_srcdir)/libexif \ @@ -16,10 +17,15 @@ exif-format.c \ exif-ifd.c \ exif-loader.c \ + exif-mnote-data.c \ + exif-mnote-data-priv.h \ exif-tag.c \ exif-utils.c \ i18n.h -libexif_la_LIBADD = -lm +libexif_la_LIBADD = -lm \ + canon/libmnote-canon.a \ + olympus/libmnote-olympus.a \ + olympus/libmnote-pentax.a libexifincludedir = $(includedir)/libexif libexifinclude_HEADERS = \ @@ -30,6 +36,7 @@ exif-format.h \ exif-ifd.h \ exif-loader.h \ + exif-mnote-data.h \ exif-result.h \ exif-tag.h \ exif-utils.h Index: exif-data.c =================================================================== RCS file: /cvsroot/libexif/libexif/libexif/exif-data.c,v retrieving revision 1.28 retrieving revision 1.29 diff -u -d -r1.28 -r1.29 --- exif-data.c 8 Oct 2003 18:08:01 -0000 1.28 +++ exif-data.c 26 Oct 2003 10:06:17 -0000 1.29 @@ -18,13 +18,20 @@ * Boston, MA 02111-1307, USA. */ -#include "config.h" +#include <config.h> +#include "exif-mnote-data.h" + #include "exif-data.h" #include "exif-ifd.h" +#include "exif-mnote-data-priv.h" #include "exif-utils.h" #include "exif-loader.h" #include "jpeg-marker.h" +#include <libexif/olympus/exif-mnote-data-olympus.h> +#include <libexif/canon/exif-mnote-data-canon.h> +#include <libexif/pentax/exif-mnote-data-pentax.h> + #include <stdlib.h> #include <stdio.h> #include <string.h> @@ -40,6 +47,8 @@ { ExifByteOrder order; + ExifMnoteData *md; + unsigned int ref_count; }; @@ -451,12 +460,31 @@ exif_set_long (*d + 6 + offset, data->priv->order, 0); } +static void +exif_data_remove_entry (ExifData *d, ExifTag t) +{ + exif_content_remove_entry (d->ifd[EXIF_IFD_0], + exif_content_get_entry (d->ifd[EXIF_IFD_0], t)); + exif_content_remove_entry (d->ifd[EXIF_IFD_1], + exif_content_get_entry (d->ifd[EXIF_IFD_1], t)); + exif_content_remove_entry (d->ifd[EXIF_IFD_EXIF], + exif_content_get_entry (d->ifd[EXIF_IFD_EXIF], t)); + exif_content_remove_entry (d->ifd[EXIF_IFD_GPS], + exif_content_get_entry (d->ifd[EXIF_IFD_GPS], t)); + exif_content_remove_entry (d->ifd[EXIF_IFD_INTEROPERABILITY], + exif_content_get_entry (d->ifd[EXIF_IFD_INTEROPERABILITY], t)); +} + void -exif_data_load_data (ExifData *data, const unsigned char *d, unsigned int size) +exif_data_load_data (ExifData *data, const unsigned char *d_orig, + unsigned int ds_orig) { - unsigned int l, len = size; + unsigned int l; ExifLong offset; ExifShort n; + ExifEntry *e, *em; + const unsigned char *d = d_orig; + unsigned int size = ds_orig, len; if (!data) return; @@ -601,6 +629,48 @@ exif_data_load_data_content (data, data->ifd[EXIF_IFD_1], d + 6, size - 6, offset); } + + /* + * If we got an EXIF_TAG_MAKER_NOTE, try to interpret it. Some + * cameras use pointers in the maker note tag that point to the + * space between IFDs. Here is the only place where we have access + * to that data. + */ + e = exif_data_get_entry (data, EXIF_TAG_MAKER_NOTE); + if (e) { + + /* Olympus */ + if ((e->size >= 5) && (!memcmp (e->data, "OLYMP", 5))) + data->priv->md = exif_mnote_data_olympus_new ( + data->priv->order); + + /* Pentax */ + else if ((e->size >= 2) && (e->data[0] == 0x00) + && (e->data[1] == 0x1b)) + data->priv->md = exif_mnote_data_pentax_new ( + data->priv->order); + + else { + em = exif_data_get_entry (data, EXIF_TAG_MAKE); + if (em) { + + /* Canon */ + if (!strcmp (exif_entry_get_value (em), "Canon")) + data->priv->md = exif_mnote_data_canon_new ( + data->priv->order); + } + } + + /* + * If we are able to interpret the maker note, interpret it and + * remove the corresponding entry as it may contain invalid + * pointers after this function here returns. + */ + if (data->priv->md) { + exif_mnote_data_load (data->priv->md, d_orig, ds_orig); + exif_data_remove_entry (data, EXIF_TAG_MAKER_NOTE); + } + } } void @@ -718,6 +788,10 @@ data->data = NULL; } if (data->priv) { + if (data->priv->md) { + exif_mnote_data_unref (data->priv->md); + data->priv->md = NULL; + } free (data->priv); data->priv = NULL; } --- NEW FILE: exif-mnote-data-priv.h --- (This appears to be a binary file; contents omitted.) --- NEW FILE: exif-mnote-data.c --- (This appears to be a binary file; contents omitted.) |
From: Lutz M?l. <lu...@us...> - 2003-10-26 10:10:30
|
Update of /cvsroot/libexif/libexif/libexif/pentax In directory sc8-pr-cvs1:/tmp/cvs-serv26651/libexif/pentax Added Files: .cvsignore Makefile.am exif-mnote-data-pentax.c exif-mnote-data-pentax.h mnote-pentax-entry.c mnote-pentax-entry.h mnote-pentax-tag.c mnote-pentax-tag.h Log Message: 2003-10-26 Lutz Mueller <lu...@us...> * libexif/olympus * libexif/canon * libexif/pentax: Merge libmnote with libexif. The code compiles but is completely untested. --- NEW FILE: Makefile.am --- INCLUDES= \ -DLIBMNOTE_LOCALEDIR=\""$(datadir)/locale"\" \ -I$(top_srcdir) \ -I$(top_srcdir)/intl noinst_LIBRARIES = libmnote-pentax.a libmnote_pentax_a_SOURCES = \ mnote-pentax-entry.c mnote-pentax-entry.h \ exif-mnote-data-pentax.c exif-mnote-data-pentax.h \ mnote-pentax-tag.c mnote-pentax-tag.h --- NEW FILE: mnote-pentax-entry.c --- (This appears to be a binary file; contents omitted.) --- NEW FILE: mnote-pentax-tag.h --- (This appears to be a binary file; contents omitted.) --- NEW FILE: exif-mnote-data-pentax.h --- (This appears to be a binary file; contents omitted.) --- NEW FILE: mnote-pentax-entry.h --- (This appears to be a binary file; contents omitted.) --- NEW FILE: exif-mnote-data-pentax.c --- (This appears to be a binary file; contents omitted.) --- NEW FILE: mnote-pentax-tag.c --- (This appears to be a binary file; contents omitted.) --- NEW FILE: .cvsignore --- Makefile.in |