* Added support for a new macro NO_VERBOSE_TAG_DATA to allow
authorDan Fandrich <dan@coneharvesters.com>
Wed, 14 Nov 2007 05:27:19 +0000 (21:27 -0800)
committerDan Fandrich <dan@coneharvesters.com>
Wed, 14 Nov 2007 05:27:19 +0000 (21:27 -0800)
  some size reduction but still retain the ability to properly
  interpret each tag.
* Added an end-of-table marker in the Canon color_information
  makernote table that could otherwise potentially cause a crash
  on a bad image.

ChangeLog
NEWS
libexif/canon/mnote-canon-entry.c
libexif/canon/mnote-canon-tag.c
libexif/exif-entry.c
libexif/olympus/mnote-olympus-entry.c
libexif/pentax/mnote-pentax-entry.c
libexif/pentax/mnote-pentax-tag.c

index 21e99ee..c5cd4dd 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,11 @@
+2007-11-13  Dan Fandrich <dan@coneharvesters.com>
+       * Added support for a new macro NO_VERBOSE_TAG_DATA to allow
+         some size reduction but still retain the ability to properly
+         interpret each tag.
+       * Added an end-of-table marker in the Canon color_information
+         makernote table that could otherwise potentially cause a crash 
+         on a bad image.
+
 2007-11-12  Dan Fandrich <dan@coneharvesters.com>
        * Added support for more Olympus makernotes, based on data on
          Phil Harvey's ExifTool page at
diff --git a/NEWS b/NEWS
index 900bbbc..4dbaed1 100644 (file)
--- a/NEWS
+++ b/NEWS
@@ -4,8 +4,8 @@ libexif-0.6.16.2:
   * Bug fixes: #1773810, #1774626
   * Enhanced support of Canon and Olympus makernotes 
   * Added support for Sanyo makernotes
-  * Added support for the NO_VERBOSE_TAG_STRINGS macro for embedded
-    applications
+  * Added support for the NO_VERBOSE_TAG_STRINGS and NO_VERBOSE_TAG_DATA
+    macros to reduce size for embedded applications
 
 
 libexif-0.6.16 (2007-06-12) since 0.6.1.15 (2007-05-23):
index 5ae939a..9b8afe6 100644 (file)
@@ -72,6 +72,7 @@ static const struct canon_entry_table_t {
   ExifShort value;
   const char *name;
 } entries_settings_1 [] = {
+#ifndef NO_VERBOSE_TAG_DATA
   { 0,  1, N_("Macro")},
   { 0,  2, N_("Normal")},
   { 2,  1, N_("Economy")},
@@ -312,14 +313,18 @@ static const struct canon_entry_table_t {
   {40, 0x0500, N_("Full")},
   {40, 0x0502, N_("2/3")},
   {40, 0x0504, N_("1/3")},
+#endif
   { 0,  0, NULL}
 },
 entries_focal_length [] = {
+#ifndef NO_VERBOSE_TAG_DATA
        {0, 1, N_("Fixed")},
        {0, 2, N_("Zoom")},
+#endif
        {0, 0, NULL}
 },
 entries_settings_2 [] = {
+#ifndef NO_VERBOSE_TAG_DATA
   { 6,  0, N_("Auto")},
   { 6,  1, N_("Sunny")},
   { 6,  2, N_("Cloudy")},
@@ -368,17 +373,21 @@ entries_settings_2 [] = {
   { 32,  0x0014, N_("1/3")},
   { 32,  0x008c, N_("2/3")},
   { 32,  0x07d0, N_("Full")},
+#endif
   {0, 0, NULL}
 },
 entries_panorama [] = {
+#ifndef NO_VERBOSE_TAG_DATA
        {0, 0, N_("Left to right")},
        {0, 1, N_("Right to left")},
        {0, 2, N_("Bottom to top")},
        {0, 3, N_("Top to bottom")},
        {0, 4, N_("2x2 matrix (clockwise)")},
+#endif
        {0, 0, NULL}
 },
 color_information [] = {
+#ifndef NO_VERBOSE_TAG_DATA
   {0, 0, N_("Standard")},
   {0, 1, N_("Manual")},
   {0, 2, N_("Custom")},
@@ -422,6 +431,8 @@ color_information [] = {
   {9, 0x84, N_("Neutral")},
   {9, 0x85, N_("Faithful")},
   {9, 0x86, N_("Monochrome")},
+#endif
+  {0, 0, NULL}
 };
 
 static void
index 4bea697..2c8b4e2 100644 (file)
@@ -31,6 +31,7 @@ static const struct {
        const char *title;
        const char *description;
 } table[] = {
+#ifndef NO_VERBOSE_TAG_STRINGS
        {MNOTE_CANON_TAG_SETTINGS_1, "Settings1", N_("Settings (first part)"), ""},
        {MNOTE_CANON_TAG_FOCAL_LENGTH, "FocalLength", N_("Focal length"), ""},
        {MNOTE_CANON_TAG_SETTINGS_2, "Settings2", N_("Settings (second part)"), ""},
@@ -42,6 +43,7 @@ static const struct {
        {MNOTE_CANON_TAG_COLOR_INFORMATION, "ColorInformation", N_("Color information"), ""},
        {MNOTE_CANON_TAG_SERIAL_NUMBER, "SerialNumber", N_("Serial number"), ""},
        {MNOTE_CANON_TAG_CUSTOM_FUNCS, "CustomFunctions", N_("Custom functions"), ""},
+#endif
        {0, NULL, NULL, NULL}
 };
 
@@ -50,6 +52,7 @@ static const struct {
        unsigned int subtag;
        const char *name;
 } table_sub[] = {
+#ifndef NO_VERBOSE_TAG_STRINGS
        {MNOTE_CANON_TAG_SETTINGS_1,  0, N_("Macro mode")},
        {MNOTE_CANON_TAG_SETTINGS_1,  1, N_("Self-timer")},
        {MNOTE_CANON_TAG_SETTINGS_1,  2, N_("Quality")},
@@ -119,6 +122,7 @@ static const struct {
        {MNOTE_CANON_TAG_COLOR_INFORMATION, 2, N_("Sharpness frequency")},
        {MNOTE_CANON_TAG_COLOR_INFORMATION, 7, N_("White balance")},
        {MNOTE_CANON_TAG_COLOR_INFORMATION, 9, N_("Picture style")},
+#endif
        {0, 0, NULL}
 };
 
index 221662c..cecb749 100644 (file)
@@ -392,7 +392,7 @@ static const struct {
        ExifTag tag;
        const char *strings[10];
 } list[] = {
-#ifndef NO_VERBOSE_TAG_STRINGS
+#ifndef NO_VERBOSE_TAG_DATA
   { EXIF_TAG_PLANAR_CONFIGURATION,
     { N_("chunky format"), N_("planar format"), NULL}},
   { EXIF_TAG_SENSING_METHOD,
@@ -436,7 +436,7 @@ static const struct {
     const char *values[4];
   } elem[25];
 } list2[] = {
-#ifndef NO_VERBOSE_TAG_STRINGS
+#ifndef NO_VERBOSE_TAG_DATA
   { EXIF_TAG_METERING_MODE,
     { {  0, {N_("Unknown"), NULL}},
       {  1, {N_("Average"), N_("avg"), NULL}},
index 6f10fd6..27fd2df 100644 (file)
@@ -84,7 +84,7 @@ static const struct {
                const char *string;
        } elem[10];
 } items[] = {
-#ifndef NO_VERBOSE_TAG_STRINGS
+#ifndef NO_VERBOSE_TAG_DATA
   { MNOTE_NIKON_TAG_LENSTYPE, EXIF_FORMAT_BYTE,
     { {0, N_("AF non D Lens")},
       {1, N_("Manual")},
index 86689af..6833a08 100644 (file)
@@ -72,6 +72,7 @@ static const struct {
                const char *string;
        } elem[33];
 } items[] = {
+#ifndef NO_VERBOSE_TAG_DATA
   { MNOTE_PENTAX_TAG_MODE,
     { {0, N_("Auto")},
       {1, N_("Night-scene")},
@@ -259,6 +260,7 @@ static const struct {
     { {0, N_("Off")},
       {1, N_("On")},
       {0, NULL}}},
+#endif
   {0, {{0, NULL}}}
 };
 
@@ -270,6 +272,7 @@ static const struct {
                const char *string;
        } elem[39];
 } items2[] = {
+#ifndef NO_VERBOSE_TAG_DATA
   { MNOTE_PENTAX2_TAG_IMAGE_SIZE,
     { {0, 0, "2304x1728"},
       {4, 0, "1600x1200"},
@@ -297,6 +300,7 @@ static const struct {
       {5,   2, N_("Portrait")},
       {6,   2, N_("Landscape")},
       {0,   0, NULL}}},
+#endif
   {0, {{0, 0, NULL}}}
 };
 
@@ -342,7 +346,8 @@ mnote_pentax_entry_get_value (MnotePentaxEntry *entry,
                        /* search the tag */
                        for (i = 0; (items[i].tag && items[i].tag != entry->tag); i++);
                        if (!items[i].tag) {
-                               strncpy (val, _("Internal error"), maxlen);
+                               snprintf (val, maxlen,
+                                         _("Internal error (unknown value %i)"), vs);
                                break;
                        }
 
@@ -365,7 +370,8 @@ mnote_pentax_entry_get_value (MnotePentaxEntry *entry,
                        /* search the tag */
                        for (i = 0; (items2[i].tag && items2[i].tag != entry->tag); i++);
                        if (!items2[i].tag) {
-                               strncpy (val, _("Internal error"), maxlen);
+                               snprintf (val, maxlen,
+                                         _("Internal error (unknown value %i %i)"), vs, vs2);
                                break;
                        }
 
index 1234049..9a02293 100644 (file)
@@ -31,6 +31,7 @@ static const struct {
        const char *title;
        const char *description;
 } table[] = {
+#ifndef NO_VERBOSE_TAG_STRINGS
        {MNOTE_PENTAX_TAG_MODE, "Mode", N_("Capture Mode"), ""},
        {MNOTE_PENTAX_TAG_QUALITY, "Quality", N_("Quality Level"), ""},
        {MNOTE_PENTAX_TAG_FOCUS, "Focus", N_("Focus Mode"), ""},
@@ -70,6 +71,7 @@ static const struct {
        {MNOTE_CASIO2_TAG_OBJECT_DISTANCE, "ObjectDistance", N_("Object Distance"), N_("Distance of photographed object in millimeters.")},
        {MNOTE_CASIO2_TAG_TIME_ZONE, "TimeZone", N_("Time Zone"), ""},
        {MNOTE_CASIO2_TAG_BESTSHOT_MODE, "BestshotMode", N_("Bestshot mode"), ""},
+#endif
        {0, NULL, NULL, NULL}
 };