Revision: 1284
          http://geeqie.svn.sourceforge.net/geeqie/?rev=1284&view=rev
Author:   zas_
Date:     2008-11-27 19:10:59 +0000 (Thu, 27 Nov 2008)

Log Message:
-----------
Do not hardcode exif formatted prefix.

Modified Paths:
--------------
    trunk/src/bar_exif.c
    trunk/src/exif-common.c
    trunk/src/exif.h

Modified: trunk/src/bar_exif.c
===================================================================
--- trunk/src/bar_exif.c        2008-11-27 12:34:39 UTC (rev 1283)
+++ trunk/src/bar_exif.c        2008-11-27 19:10:59 UTC (rev 1284)
@@ -30,24 +30,24 @@
 #define BAR_EXIF_DATA_COLUMN_WIDTH 250
 
 ExifUI ExifUIList[]={
-       { 0, 0, EXIF_UI_IFSET,  "formatted.Camera"},
-       { 0, 0, EXIF_UI_IFSET,  "formatted.DateTime"},
-       { 0, 0, EXIF_UI_IFSET,  "formatted.ShutterSpeed"},
-       { 0, 0, EXIF_UI_IFSET,  "formatted.Aperture"},
-       { 0, 0, EXIF_UI_IFSET,  "formatted.ExposureBias"},
-       { 0, 0, EXIF_UI_IFSET,  "formatted.ISOSpeedRating"},
-       { 0, 0, EXIF_UI_IFSET,  "formatted.FocalLength"},
-       { 0, 0, EXIF_UI_IFSET,  "formatted.FocalLength35mmFilm"},
-       { 0, 0, EXIF_UI_IFSET,  "formatted.Flash"},
+       { 0, 0, EXIF_UI_IFSET,  EXIF_FORMATTED("Camera")},
+       { 0, 0, EXIF_UI_IFSET,  EXIF_FORMATTED("DateTime")},
+       { 0, 0, EXIF_UI_IFSET,  EXIF_FORMATTED("ShutterSpeed")},
+       { 0, 0, EXIF_UI_IFSET,  EXIF_FORMATTED("Aperture")},
+       { 0, 0, EXIF_UI_IFSET,  EXIF_FORMATTED("ExposureBias")},
+       { 0, 0, EXIF_UI_IFSET,  EXIF_FORMATTED("ISOSpeedRating")},
+       { 0, 0, EXIF_UI_IFSET,  EXIF_FORMATTED("FocalLength")},
+       { 0, 0, EXIF_UI_IFSET,  EXIF_FORMATTED("FocalLength35mmFilm")},
+       { 0, 0, EXIF_UI_IFSET,  EXIF_FORMATTED("Flash")},
        { 0, 0, EXIF_UI_IFSET,  "Exif.Photo.ExposureProgram"},
        { 0, 0, EXIF_UI_IFSET,  "Exif.Photo.MeteringMode"},
        { 0, 0, EXIF_UI_IFSET,  "Exif.Photo.LightSource"},
-       { 0, 0, EXIF_UI_IFSET,  "formatted.ColorProfile"},
-       { 0, 0, EXIF_UI_IFSET,  "formatted.SubjectDistance"},
-       { 0, 0, EXIF_UI_IFSET,  "formatted.Resolution"},
+       { 0, 0, EXIF_UI_IFSET,  EXIF_FORMATTED("ColorProfile")},
+       { 0, 0, EXIF_UI_IFSET,  EXIF_FORMATTED("SubjectDistance")},
+       { 0, 0, EXIF_UI_IFSET,  EXIF_FORMATTED("Resolution")},
        { 0, 0, EXIF_UI_IFSET,  "Exif.Image.Orientation"},
-       { 0, 0, EXIF_UI_IFSET,  "formatted.GPSPosition"},
-       { 0, 0, EXIF_UI_IFSET,  "formatted.GPSAltitude"},
+       { 0, 0, EXIF_UI_IFSET,  EXIF_FORMATTED("GPSPosition")},
+       { 0, 0, EXIF_UI_IFSET,  EXIF_FORMATTED("GPSAltitude")},
        { 0, 0, EXIF_UI_IFSET,  "Exif.Image.ImageDescription"},
        { 0, 0, EXIF_UI_IFSET,  "Exif.Image.Copyright"},
        { 0, 0, EXIF_UI_OFF,    NULL}

Modified: trunk/src/exif-common.c
===================================================================
--- trunk/src/exif-common.c     2008-11-27 12:34:39 UTC (rev 1283)
+++ trunk/src/exif-common.c     2008-11-27 19:10:59 UTC (rev 1284)
@@ -503,7 +503,7 @@
 
 
 /* List of custom formatted pseudo-exif tags */
-#define EXIF_FORMATTED_TAG(name, label) { "formatted."#name, label, 
exif_build_formatted##_##name }
+#define EXIF_FORMATTED_TAG(name, label) { EXIF_FORMATTED()#name, label, 
exif_build_formatted##_##name }
 
 ExifFormattedText ExifFormattedList[] = {
        EXIF_FORMATTED_TAG(Camera,              N_("Camera")),
@@ -525,15 +525,15 @@
 
 gchar *exif_get_formatted_by_key(ExifData *exif, const gchar *key, gint 
*key_valid)
 {
-       if (strncmp(key, "formatted.", 10) == 0)
+       if (strncmp(key, EXIF_FORMATTED(), EXIF_FORMATTED_LEN) == 0)
                {
                gint i;
 
                if (key_valid) *key_valid = TRUE;
 
-               key += 10;
+               key += EXIF_FORMATTED_LEN;
                for (i = 0; ExifFormattedList[i].key; i++)
-                       if (strcmp(key, ExifFormattedList[i].key + 10) == 0)
+                       if (strcmp(key, ExifFormattedList[i].key + 
EXIF_FORMATTED_LEN) == 0)
                                return ExifFormattedList[i].build_func(exif);
                }
 
@@ -545,13 +545,13 @@
 {
        if (!key) return NULL;
 
-       if (strncmp(key, "formatted.", 10) == 0)
+       if (strncmp(key, EXIF_FORMATTED(), EXIF_FORMATTED_LEN) == 0)
                {
                gint i;
 
-               key += 10;
+               key += EXIF_FORMATTED_LEN;
                for (i = 0; ExifFormattedList[i].key; i++)
-                       if (strcmp(key, ExifFormattedList[i].key + 10) == 0)
+                       if (strcmp(key, ExifFormattedList[i].key + 
EXIF_FORMATTED_LEN) == 0)
                                return 
g_strdup(_(ExifFormattedList[i].description));
                }
 

Modified: trunk/src/exif.h
===================================================================
--- trunk/src/exif.h    2008-11-27 12:34:39 UTC (rev 1283)
+++ trunk/src/exif.h    2008-11-27 19:10:59 UTC (rev 1284)
@@ -27,6 +27,8 @@
 #ifndef __EXIF_H
 #define __EXIF_H
 
+#define EXIF_FORMATTED(x) "formatted."x
+#define EXIF_FORMATTED_LEN (sizeof(EXIF_FORMATTED()) - 1)
 
 /*
  *-----------------------------------------------------------------------------


This was sent by the SourceForge.net collaborative development platform, the 
world's largest Open Source development site.

-------------------------------------------------------------------------
This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
Build the coolest Linux based applications with Moblin SDK & win great prizes
Grand prize is a trip for two to an Open Source event anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100&url=/
_______________________________________________
Geeqie-svn mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/geeqie-svn

Reply via email to