From: Jan P. <pa...@us...> - 2007-05-09 06:15:26
|
Update of /cvsroot/libexif/libexif/libexif/canon In directory sc8-pr-cvs6.sourceforge.net:/tmp/cvs-serv12201 Modified Files: exif-mnote-data-canon.c exif-mnote-data-canon.h mnote-canon-tag.c mnote-canon-tag.h Log Message: Fix of Bug #1617991: EXIF_DATA_OPTION_IGNORE_UNKNOWN_TAGS is now propagated to Canon makernote and used to ignore unknown subtags of Settings1, Settings2, FocalLength & Panorama makernote tags. Index: mnote-canon-tag.c =================================================================== RCS file: /cvsroot/libexif/libexif/libexif/canon/mnote-canon-tag.c,v retrieving revision 1.11 retrieving revision 1.12 diff -u -p -d -r1.11 -r1.12 --- mnote-canon-tag.c 16 Oct 2006 09:56:50 -0000 1.11 +++ mnote-canon-tag.c 9 May 2007 06:15:23 -0000 1.12 @@ -127,13 +127,22 @@ mnote_canon_tag_get_name (MnoteCanonTag } const char * -mnote_canon_tag_get_name_sub (MnoteCanonTag t, unsigned int s) +mnote_canon_tag_get_name_sub (MnoteCanonTag t, unsigned int s, ExifDataOption o) { unsigned int i; - for (i = 0; i < sizeof (table_sub) / sizeof (table_sub[0]); i++) - if ((table_sub[i].tag == t) && (table_sub[i].subtag == s)) - return table_sub[i].name; - return mnote_canon_tag_get_name (t); + int tag_found = 0; + + for (i = 0; i < sizeof (table_sub) / sizeof (table_sub[0]); i++) { + if (table_sub[i].tag == t) { + if (table_sub[i].subtag == s) + return table_sub[i].name; + tag_found = 1; + } + } + if (!tag_found || !(o & EXIF_DATA_OPTION_IGNORE_UNKNOWN_TAGS)) + return mnote_canon_tag_get_name (t); + else + return NULL; } const char * @@ -148,13 +157,22 @@ mnote_canon_tag_get_title (MnoteCanonTag } const char * -mnote_canon_tag_get_title_sub (MnoteCanonTag t, unsigned int s) +mnote_canon_tag_get_title_sub (MnoteCanonTag t, unsigned int s, ExifDataOption o) { unsigned int i; - for (i = 0; i < sizeof (table_sub) / sizeof (table_sub[0]); i++) - if ((table_sub[i].tag == t) && (table_sub[i].subtag == s)) - return _(table_sub[i].name); - return mnote_canon_tag_get_title (t); + int tag_found = 0; + + for (i = 0; i < sizeof (table_sub) / sizeof (table_sub[0]); i++) { + if (table_sub[i].tag == t) { + if (table_sub[i].subtag == s) + return _(table_sub[i].name); + tag_found = 1; + } + } + if (!tag_found || !(o & EXIF_DATA_OPTION_IGNORE_UNKNOWN_TAGS)) + return mnote_canon_tag_get_title (t); + else + return NULL; } const char * Index: mnote-canon-tag.h =================================================================== RCS file: /cvsroot/libexif/libexif/libexif/canon/mnote-canon-tag.h,v retrieving revision 1.3 retrieving revision 1.4 diff -u -p -d -r1.3 -r1.4 --- mnote-canon-tag.h 17 Sep 2006 10:18:29 -0000 1.3 +++ mnote-canon-tag.h 9 May 2007 06:15:23 -0000 1.4 @@ -21,6 +21,8 @@ #ifndef __MNOTE_CANON_TAG_H__ #define __MNOTE_CANON_TAG_H__ +#include <libexif/exif-data.h> + #ifdef __cplusplus extern "C" { #endif /* __cplusplus */ @@ -44,9 +46,9 @@ enum _MnoteCanonTag { typedef enum _MnoteCanonTag MnoteCanonTag; const char *mnote_canon_tag_get_name (MnoteCanonTag); -const char *mnote_canon_tag_get_name_sub (MnoteCanonTag, unsigned int); +const char *mnote_canon_tag_get_name_sub (MnoteCanonTag, unsigned int, ExifDataOption); const char *mnote_canon_tag_get_title (MnoteCanonTag); -const char *mnote_canon_tag_get_title_sub (MnoteCanonTag, unsigned int); +const char *mnote_canon_tag_get_title_sub (MnoteCanonTag, unsigned int, ExifDataOption); const char *mnote_canon_tag_get_description (MnoteCanonTag); #ifdef __cplusplus Index: exif-mnote-data-canon.c =================================================================== RCS file: /cvsroot/libexif/libexif/libexif/canon/exif-mnote-data-canon.c,v retrieving revision 1.14 retrieving revision 1.15 diff -u -p -d -r1.14 -r1.15 --- exif-mnote-data-canon.c 22 Aug 2005 22:59:57 -0000 1.14 +++ exif-mnote-data-canon.c 9 May 2007 06:15:23 -0000 1.15 @@ -257,7 +257,7 @@ exif_mnote_data_canon_get_name (ExifMnot if (!dc) return NULL; exif_mnote_data_canon_get_tags (dc, i, &m, &s); if (m >= dc->count) return NULL; - return mnote_canon_tag_get_name_sub (dc->entries[m].tag, s); + return mnote_canon_tag_get_name_sub (dc->entries[m].tag, s, dc->options); } static const char * @@ -269,7 +269,7 @@ exif_mnote_data_canon_get_title (ExifMno if (!dc) return NULL; exif_mnote_data_canon_get_tags (dc, i, &m, &s); if (m >= dc->count) return NULL; - return mnote_canon_tag_get_title_sub (dc->entries[m].tag, s); + return mnote_canon_tag_get_title_sub (dc->entries[m].tag, s, dc->options); } static const char * @@ -285,9 +285,10 @@ exif_mnote_data_canon_get_description (E } ExifMnoteData * -exif_mnote_data_canon_new (ExifMem *mem) +exif_mnote_data_canon_new (ExifMem *mem, ExifDataOption o) { ExifMnoteData *d; + ExifMnoteDataCanon *dc; if (!mem) return NULL; @@ -309,5 +310,7 @@ exif_mnote_data_canon_new (ExifMem *mem) d->methods.get_description = exif_mnote_data_canon_get_description; d->methods.get_value = exif_mnote_data_canon_get_value; + dc = (ExifMnoteDataCanon*)d; + dc->options = o; return d; } Index: exif-mnote-data-canon.h =================================================================== RCS file: /cvsroot/libexif/libexif/libexif/canon/exif-mnote-data-canon.h,v retrieving revision 1.3 retrieving revision 1.4 diff -u -p -d -r1.3 -r1.4 --- exif-mnote-data-canon.h 4 Oct 2004 06:26:59 -0000 1.3 +++ exif-mnote-data-canon.h 9 May 2007 06:15:23 -0000 1.4 @@ -25,6 +25,7 @@ #include <libexif/exif-mnote-data.h> #include <libexif/exif-mnote-data-priv.h> #include <libexif/exif-mem.h> +#include <libexif/exif-data.h> typedef struct _ExifMnoteDataCanon ExifMnoteDataCanon; @@ -38,8 +39,10 @@ struct _ExifMnoteDataCanon { ExifByteOrder order; unsigned int offset; + + ExifDataOption options; }; -ExifMnoteData *exif_mnote_data_canon_new (ExifMem *mem); +ExifMnoteData *exif_mnote_data_canon_new (ExifMem *mem, ExifDataOption o); #endif /* __EXIF_MNOTE_DATA_CANON_H__ */ |