From: Lutz M. <lu...@us...> - 2008-02-22 01:58:36
|
Update of /cvsroot/libexif/exif/exif In directory sc8-pr-cvs6.sourceforge.net:/tmp/cvs-serv30001/exif Modified Files: main.c actions.c Log Message: 2008-02-22 Lutz Mueller <lu...@us...> Make libexif-testsuite pass again (thanks to Dan Fandrich <da...@co...> for alerting me): * exif/actions.c: (action_remove_tag) Make both ifd and tag optional. (action_show_tag) Make ifd optional. * exif/main.c: (main) Don't require an ifd for the --remove option. Index: main.c =================================================================== RCS file: /cvsroot/libexif/exif/exif/main.c,v retrieving revision 1.63 retrieving revision 1.64 diff -u -p -d -r1.63 -r1.64 --- main.c 17 Feb 2008 18:17:08 -0000 1.63 +++ main.c 22 Feb 2008 01:58:32 -0000 1.64 @@ -259,7 +259,7 @@ main (int argc, const char **argv) return 1; } if (((p.ifd < EXIF_IFD_0) || (p.ifd >= EXIF_IFD_COUNT)) && - (p.set_value || remove_tag || show_description)) { + (p.set_value || show_description)) { exif_log (log, -1, "exif", _("You need to specify an IFD!")); return 1; } Index: actions.c =================================================================== RCS file: /cvsroot/libexif/exif/exif/actions.c,v retrieving revision 1.32 retrieving revision 1.33 diff -u -p -d -r1.32 -r1.33 --- actions.c 17 Feb 2008 18:17:08 -0000 1.32 +++ actions.c 22 Feb 2008 01:58:32 -0000 1.33 @@ -221,21 +221,28 @@ action_set_value (ExifData *ed, ExifLog void action_remove_tag (ExifData *ed, ExifLog *log, ExifParams p) { + ExifIfd ifd; ExifEntry *e; - if (!p.tag) { + /* We do have 2 optional parameters: ifd and tag */ + if (!p.tag && (p.ifd < EXIF_IFD_0 || p.ifd >= EXIF_IFD_COUNT)) + for (ifd = EXIF_IFD_0; ifd < EXIF_IFD_COUNT; ifd++) + while (ed->ifd[ifd] && ed->ifd[ifd]->count) + exif_content_remove_entry (ed->ifd[ifd], + ed->ifd[ifd]->entries[0]); + else if (!p.tag) while (ed->ifd[p.ifd] && ed->ifd[p.ifd]->count) - exif_content_remove_entry ( - ed->ifd[p.ifd], - ed->ifd[p.ifd]->entries[0]); - } else { - if (!((e = exif_content_get_entry (ed->ifd[p.ifd], p.tag)))) - exif_log (log, -1, "exif", _("IFD '%s' does not contain a " - "tag '%s'!"), exif_ifd_get_name (p.ifd), + exif_content_remove_entry (ed->ifd[p.ifd], + ed->ifd[p.ifd]->entries[0]); + else if (p.ifd < EXIF_IFD_0 || p.ifd >= EXIF_IFD_COUNT) + while ((e = exif_data_get_entry (ed, p.tag))) + exif_content_remove_entry (e->parent, e); + else if (!((e = exif_content_get_entry (ed->ifd[p.ifd], p.tag)))) + exif_log (log, -1, "exif", _("IFD '%s' does not contain a " + "tag '%s'!"), exif_ifd_get_name (p.ifd), exif_tag_get_name_in_ifd (p.tag, p.ifd)); - else - exif_content_remove_entry (ed->ifd[p.ifd], e); - } + else + exif_content_remove_entry (ed->ifd[p.ifd], e); } void @@ -292,6 +299,7 @@ action_show_tag (ExifData *ed, ExifLog * if (!ed) return; + /* We have one optional parameter: ifd */ if ((p.ifd >= EXIF_IFD_0) && (p.ifd < EXIF_IFD_COUNT)) { if ((e = exif_content_get_entry (ed->ifd[p.ifd], p.tag))) show_entry (e, p.machine_readable); @@ -301,7 +309,11 @@ action_show_tag (ExifData *ed, ExifLog * exif_ifd_get_name (p.ifd), exif_tag_get_name (p.tag)); } else { - for (i = 0; i < EXIF_IFD_COUNT; i++) + if (!exif_data_get_entry (ed, p.tag)) + exif_log (log, -1, "exif", _("'%s' does not contain " + "tag '%s'."), p.fin, + exif_tag_get_name (p.tag)); + else for (i = 0; i < EXIF_IFD_COUNT; i++) if ((e = exif_content_get_entry (ed->ifd[i], p.tag))) show_entry (e, p.machine_readable); } |