+2007-10-29 Dan Fandrich <dan@coneharvesters.com>
+ * Fixed some typos in messages
+ * Made some structs const
+ * Support compiling away the detailed tag tables and log messages when
+ the NO_VERBOSE_TAG_STRINGS macro is defined to reduce the size of
+ the library for use in embedded applications where space is at
+ a premium
+ * Display the raw value of a tag when the tag is unknown
+
2007-09-12 Jan Patera <patera@users.sourceforge.net>
* Enhancements to Canon makernote parsers submitted by Thorsten Kukuk
/* This function is hidden in exif-data.c */
ExifLog *exif_data_get_log (ExifData *);
+#ifndef NO_VERBOSE_TAG_STRINGS
static void
exif_entry_log (ExifEntry *e, ExifLogCode code, const char *format, ...)
{
exif_logv (l, code, "ExifEntry", format, args);
va_end (args);
}
+#else
+#if defined(__STDC_VERSION__) && __STDC_VERSION__ >= 199901L
+#define exif_entry_log(...) do { } while (0)
+#elif defined(__GNUC__)
+#define exif_entry_log(x...) do { } while (0)
+#else
+#define exif_entry_log (void)
+#endif
+#endif
static void *
exif_entry_alloc (ExifEntry *e, unsigned int i)
} \
}
-static struct {
+static const struct {
ExifTag tag;
const char *strings[10];
} list[] = {
+#ifndef NO_VERBOSE_TAG_STRINGS
{ EXIF_TAG_PLANAR_CONFIGURATION,
{ N_("chunky format"), N_("planar format"), NULL}},
{ EXIF_TAG_SENSING_METHOD,
{ N_("Normal"), N_("Low saturation"), N_("High saturation"), NULL}},
{ EXIF_TAG_CONTRAST , {N_("Normal"), N_("Soft"), N_("Hard"), NULL}},
{ EXIF_TAG_SHARPNESS, {N_("Normal"), N_("Soft"), N_("Hard"), NULL}},
+#endif
{ 0, {NULL}}
};
-static struct {
+static const struct {
ExifTag tag;
struct {
int index;
const char *values[4];
} elem[25];
} list2[] = {
+#ifndef NO_VERBOSE_TAG_STRINGS
{ EXIF_TAG_METERING_MODE,
{ { 0, {N_("Unknown"), NULL}},
{ 1, {N_("Average"), N_("avg"), NULL}},
{2, {N_("Adobe RGB"), NULL}},
{0xffff, {N_("Uncalibrated"), NULL}},
{0x0000, {NULL}}}},
+#endif
{0, { { 0, {NULL}}} }
};
ExifByteOrder o;
double d;
ExifEntry *entry;
- static struct {
- char *label;
+ static const struct {
+ const char *label;
char major, minor;
} versions[] = {
{"0110", 1, 1},
/* Search the tag */
for (i = 0; list2[i].tag && (list2[i].tag != e->tag); i++);
if (!list2[i].tag) {
- strncpy (val, _("Internal error"), maxlen);
+ snprintf (val, maxlen, _("Internal error (unknown "
+ "value %i)"), v_short);
break;
}
/* Search the tag */
for (i = 0; list[i].tag && (list[i].tag != e->tag); i++);
if (!list[i].tag) {
- strncpy (val, _("Internal error"), maxlen);
+ snprintf (val, maxlen, _("Internal error (unknown "
+ "value %i)"), v_short);
break;
}
*/
void exif_log_set_func (ExifLog *log, ExifLogFunc func, void *data);
+#ifndef NO_VERBOSE_TAG_STRINGS
void exif_log (ExifLog *log, ExifLogCode, const char *domain,
const char *format, ...)
#ifdef __GNUC__
__attribute__((__format__(printf,4,5)))
#endif
;
+#else
+#if defined(__STDC_VERSION__) && __STDC_VERSION__ >= 199901L
+#define exif_log(...) do { } while (0)
+#elif defined(__GNUC__)
+#define exif_log(x...) do { } while (0)
+#else
+#define exif_log (void)
+#endif
+#endif
void exif_logv (ExifLog *log, ExifLogCode, const char *domain,
const char *format, va_list args);
#define ESL_NNNO { EXIF_SUPPORT_LEVEL_NOT_RECORDED, EXIF_SUPPORT_LEVEL_NOT_RECORDED, EXIF_SUPPORT_LEVEL_NOT_RECORDED, EXIF_SUPPORT_LEVEL_OPTIONAL }
#define ESL_GPS { ESL_NNNN, ESL_NNNN, ESL_NNNN, ESL_OOOO, ESL_NNNN }
-static struct {
+static const struct {
ExifTag tag;
const char *name;
const char *title;
const char *description;
ExifSupportLevel esl[EXIF_IFD_COUNT][4];
} ExifTagTable[] = {
+#ifndef NO_VERBOSE_TAG_STRINGS
{EXIF_TAG_NEW_SUBFILE_TYPE, "NewSubfileType",
"New Subfile Type", N_("A general indication of the kind of data "
"contained in this subfile.")},
{EXIF_TAG_UNKNOWN_C4A5, "UnknownC4A5", N_("Unknown"),
N_("Unknown (related to Epson's PRINT Image Matching technology)")},
{0, NULL, NULL, NULL}
+#endif
};
/* For now, do not use these functions. */