From: Jan P. <pa...@us...> - 2007-05-09 06:09:16
|
Update of /cvsroot/libexif/libexif/libexif In directory sc8-pr-cvs6.sourceforge.net:/tmp/cvs-serv9609 Modified Files: exif-data.c exif-data.h Log Message: Saving unmodified makernote no longer controlled at compile time by #ifdef EXIF_DONT_CHANGE_MAKER_NOTE, but at run-time by newly introduced option EXIF_DATA_OPTION_DONT_CHANGE_MAKER_NOTE Index: exif-data.c =================================================================== RCS file: /cvsroot/libexif/libexif/libexif/exif-data.c,v retrieving revision 1.88 retrieving revision 1.89 diff -u -p -d -r1.88 -r1.89 --- exif-data.c 8 May 2007 09:09:06 -0000 1.88 +++ exif-data.c 9 May 2007 06:09:05 -0000 1.89 @@ -222,17 +222,17 @@ exif_data_save_data_entry (ExifData *dat exif_set_short (*d + 6 + offset + 2, data->priv->order, (ExifShort) e->format); -#ifndef EXIF_DONT_CHANGE_MAKER_NOTE - /* If this is the maker note tag, update it. */ - if ((e->tag == EXIF_TAG_MAKER_NOTE) && data->priv->md) { - exif_mem_free (data->priv->mem, 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; + if (!(data->priv->options & EXIF_DATA_OPTION_DONT_CHANGE_MAKER_NOTE)) { + /* If this is the maker note tag, update it. */ + if ((e->tag == EXIF_TAG_MAKER_NOTE) && data->priv->md) { + exif_mem_free (data->priv->mem, 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; + } } -#endif exif_set_long (*d + 6 + offset + 4, data->priv->order, e->components); @@ -847,7 +847,7 @@ exif_data_load_data (ExifData *data, con data->priv->md = exif_mnote_data_pentax_new (data->priv->mem); break; case EXIF_DATA_TYPE_MAKER_NOTE_CANON: - data->priv->md = exif_mnote_data_canon_new (data->priv->mem); + data->priv->md = exif_mnote_data_canon_new (data->priv->mem, data->priv->options); break; default: break; @@ -1102,6 +1102,9 @@ static struct { {EXIF_DATA_OPTION_FOLLOW_SPECIFICATION, N_("Follow specification"), N_("Add, correct and remove entries to get EXIF data that follows " "the specification.")}, + {EXIF_DATA_OPTION_DONT_CHANGE_MAKER_NOTE, N_("Don not change maker note"), + N_("When loading and resaving Exif data, save the maker note unmodified." + " Be aware that the maker note can get corrupted.")}, {0, NULL, NULL} }; Index: exif-data.h =================================================================== RCS file: /cvsroot/libexif/libexif/libexif/exif-data.h,v retrieving revision 1.12 retrieving revision 1.13 diff -u -p -d -r1.12 -r1.13 --- exif-data.h 30 Apr 2005 00:55:42 -0000 1.12 +++ exif-data.h 9 May 2007 06:09:05 -0000 1.13 @@ -84,7 +84,8 @@ void exif_data_foreach_content typedef enum { EXIF_DATA_OPTION_IGNORE_UNKNOWN_TAGS = 1 << 0, - EXIF_DATA_OPTION_FOLLOW_SPECIFICATION = 1 << 1 + EXIF_DATA_OPTION_FOLLOW_SPECIFICATION = 1 << 1, + EXIF_DATA_OPTION_DONT_CHANGE_MAKER_NOTE = 1 << 2 } ExifDataOption; const char *exif_data_option_get_name (ExifDataOption); |