From: <rw...@us...> - 2002-11-17 03:29:39
|
Update of /cvsroot/libexif/exif/exif In directory usw-pr-cvs1:/tmp/cvs-serv5992/exif Modified Files: actions.c actions.h main.c utils.c utils.h Log Message: Wrapped all libmnote-specific code in HAVE_MNOTE. Index: actions.c =================================================================== RCS file: /cvsroot/libexif/exif/exif/actions.c,v retrieving revision 1.9 retrieving revision 1.10 diff -u -d -r1.9 -r1.10 --- actions.c 17 Nov 2002 03:15:02 -0000 1.9 +++ actions.c 17 Nov 2002 03:29:36 -0000 1.10 @@ -77,6 +77,8 @@ } } +#ifdef HAVE_MNOTE + void action_ntag_table (const char *filename, MNoteData *en) { @@ -102,6 +104,8 @@ } } +#endif + static void show_entry (ExifEntry *entry, void *data) { @@ -125,6 +129,8 @@ exif_content_foreach_entry (content, show_entry, data); } +#ifdef HAVE_MNOTE + static void show_note_entry (MNoteData *note, MNoteTag tag, void *data) { @@ -142,6 +148,8 @@ fputc ('\n', stdout); } +#endif + static void print_hline (unsigned char ids) { @@ -189,6 +197,8 @@ } } +#ifdef HAVE_MNOTE + void action_ntag_list (const char *filename, MNoteData *en, unsigned char ids) { @@ -216,3 +226,5 @@ mnote_data_foreach_entry (en, show_note_entry, &ids); print_hline (ids); } + +#endif Index: actions.h =================================================================== RCS file: /cvsroot/libexif/exif/exif/actions.h,v retrieving revision 1.2 retrieving revision 1.3 diff -u -d -r1.2 -r1.3 --- actions.h 17 Nov 2002 03:15:02 -0000 1.2 +++ actions.h 17 Nov 2002 03:29:36 -0000 1.3 @@ -22,11 +22,17 @@ #define __ACTIONS_H__ #include <libexif/exif-data.h> + +#ifdef HAVE_MNOTE #include <libmnote/mnote-data.h> +#endif void action_tag_table (const char *filename, ExifData *ed); -void action_ntag_table (const char *filename, MNoteData *en); void action_tag_list (const char *filename, ExifData *ed, unsigned char ids); + +#ifdef HAVE_MNOTE +void action_ntag_table (const char *filename, MNoteData *en); void action_ntag_list (const char *filename, MNoteData *en, unsigned char ids); +#endif #endif /* __ACTIONS_H__ */ Index: main.c =================================================================== RCS file: /cvsroot/libexif/exif/exif/main.c,v retrieving revision 1.28 retrieving revision 1.29 diff -u -d -r1.28 -r1.29 --- main.c 17 Nov 2002 03:15:02 -0000 1.28 +++ main.c 17 Nov 2002 03:29:36 -0000 1.29 @@ -29,7 +29,9 @@ #include <libexif/exif-data.h> #include <libexif/exif-utils.h> +#ifdef HAVE_MNOTE #include <libmnote/mnote-data.h> +#endif #include "libjpeg/jpeg-data.h" @@ -75,6 +77,8 @@ exif_entry_dump(entry, 0); } +#ifdef HAVE_MNOTE + static void show_note_entry (MNoteData *note, MNoteTag tag) { @@ -86,6 +90,8 @@ mnote_data_dump_entry(note, tag, 0); } +#endif + static void search_entry (ExifData *ed, ExifTag tag) { @@ -143,22 +149,33 @@ struct _ExifOptions { unsigned char use_ids; ExifTag tag; +#ifdef HAVE_MNOTE MNoteTag ntag; +#endif }; int main (int argc, const char **argv) { /* POPT_ARG_NONE needs an int, not char! */ - unsigned int list_tags = 0, list_ntags = 0, show_description = 0; + unsigned int list_tags = 0, show_description = 0; +#ifdef HAVE_MNOTE + unsigned int list_ntags = 0; +#endif unsigned int extract_thumbnail = 0, remove_thumbnail = 0; unsigned int remove = 0; - const char *set_value = NULL, *ifd_string = NULL; - const char *tag_string = NULL, *ntag_string = NULL; + const char *set_value = NULL, *ifd_string = NULL, *tag_string = NULL; +#ifdef HAVE_MNOTE + const char *ntag_string = NULL; +#endif ExifIfd ifd = -1; ExifTag tag = 0; +#ifdef HAVE_MNOTE MNoteTag ntag = 0; ExifOptions eo = {0, 0, 0}; +#else + ExifOptions eo = {0, 0}; +#endif poptContext ctx; const char **args, *output = NULL; const char *ithumbnail = NULL; @@ -168,14 +185,18 @@ N_("Show IDs instead of tag names"), NULL}, {"tag", 't', POPT_ARG_STRING, &tag_string, 0, N_("Select tag"), N_("tag")}, +#ifdef HAVE_MNOTE {"ntag", '\0', POPT_ARG_STRING, &ntag_string, 0, N_("Select MakerNote tag"), N_("ntag")}, +#endif {"ifd", '\0', POPT_ARG_STRING, &ifd_string, 0, N_("Select IFD"), N_("IFD")}, {"list-tags", 'l', POPT_ARG_NONE, &list_tags, 0, N_("List all EXIF tags"), NULL}, +#ifdef HAVE_MNOTE {"list-ntags", '\0', POPT_ARG_NONE, &list_ntags, 0, N_("List all EXIF MakerNote tags"), NULL}, +#endif {"remove", '\0', POPT_ARG_NONE, &remove, 0, N_("Remove tag or ifd"), NULL}, {"show-description", 's', POPT_ARG_NONE, &show_description, 0, @@ -191,9 +212,11 @@ {"set-value", '\0', POPT_ARG_STRING, &set_value, 0, N_("Value"), NULL}, POPT_TABLEEND}; - ExifData *ed = NULL; - ExifEntry *e = NULL; - MNoteData *md = NULL; + ExifData *ed; + ExifEntry *e; +#ifdef HAVE_MNOTE + MNoteData *md; +#endif char fname[1024]; FILE *f; @@ -237,7 +260,11 @@ } } - if (show_description && !ntag_string) { + if (show_description +#ifdef HAVE_MNOTE + && !ntag_string +#endif + ) { if (!eo.tag) { fprintf (stderr, _("Please specify a tag!")); fputc ('\n', stderr); @@ -268,6 +295,7 @@ exit (1); } +#ifdef HAVE_MNOTE if (ntag_string || list_ntags || ntag) { e = exif_content_get_entry(ed->ifd[EXIF_IFD_EXIF], EXIF_TAG_MAKER_NOTE); @@ -285,6 +313,7 @@ exit (1); } } +#endif /* Where do we save the output? */ memset (fname, 0, sizeof (fname)); @@ -296,6 +325,7 @@ sizeof (fname) - 1); } +#ifdef HAVE_MNOTE if (ntag_string) { ntag = mnote_tag_from_string (md, ntag_string); if (!ntag || !mnote_tag_get_name (md, ntag)) { @@ -320,11 +350,14 @@ printf ("\n"); return (0); } +#endif if (list_tags) { action_tag_table (*args, ed); +#ifdef HAVE_MNOTE } else if (list_ntags) { action_ntag_table (*args, md); +#endif } else if (tag && !set_value) { if ((ifd >= EXIF_IFD_0) && (ifd < EXIF_IFD_COUNT)) { @@ -343,6 +376,7 @@ } else { search_entry (ed, eo.tag); } +#ifdef HAVE_MNOTE } else if (ntag && !set_value) { char *value = mnote_data_get_value (md, ntag); if (value) @@ -355,6 +389,7 @@ fputc ('\n', stderr); return (1); } +#endif } else if (extract_thumbnail) { /* No thumbnail? Exit. */ Index: utils.c =================================================================== RCS file: /cvsroot/libexif/exif/exif/utils.c,v retrieving revision 1.4 retrieving revision 1.5 diff -u -d -r1.4 -r1.5 --- utils.c 17 Nov 2002 03:15:02 -0000 1.4 +++ utils.c 17 Nov 2002 03:29:36 -0000 1.5 @@ -139,6 +139,8 @@ return (-1); } +#ifdef HAVE_MNOTE + MNoteTag mnote_tag_from_string (MNoteData *note, const char *string) { @@ -237,3 +239,5 @@ return (tag); } + +#endif Index: utils.h =================================================================== RCS file: /cvsroot/libexif/exif/exif/utils.h,v retrieving revision 1.3 retrieving revision 1.4 diff -u -d -r1.3 -r1.4 --- utils.h 17 Nov 2002 03:15:02 -0000 1.3 +++ utils.h 17 Nov 2002 03:29:36 -0000 1.4 @@ -23,12 +23,17 @@ #include <libexif/exif-tag.h> #include <libexif/exif-ifd.h> + +#ifdef HAVE_MNOTE #include <libmnote/mnote-data.h> +#endif ExifTag exif_tag_from_string (const char *string); ExifIfd exif_ifd_from_string (const char *string); +#ifdef HAVE_MNOTE MNoteTag mnote_tag_from_string (MNoteData *note, const char *string); +#endif #endif /* __UTILS_H__ */ |