Update of /cvsroot/libexif/libexif/libexif
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv16977/libexif
Modified Files:
exif-tag.c exif-format.c
Log Message:
portability: replace problematic ?: syntax and (temporarily) deactivate bind_textdomain_codeset
Index: exif-tag.c
===================================================================
RCS file: /cvsroot/libexif/libexif/libexif/exif-tag.c,v
retrieving revision 1.27
retrieving revision 1.28
diff -u -p -d -r1.27 -r1.28
--- exif-tag.c 30 Apr 2005 00:55:42 -0000 1.27
+++ exif-tag.c 2 May 2005 19:29:14 -0000 1.28
@@ -720,7 +720,12 @@ exif_tag_get_title_in_ifd (ExifTag tag,
unsigned int i;
/* FIXME: This belongs to somewhere else. */
- bind_textdomain_codeset (GETTEXT_PACKAGE, "UTF-8");
+ /* libexif should use the default system locale.
+ * If an application specifically requires UTF-8, then we
+ * must give the application a way to tell libexif that.
+ *
+ * bind_textdomain_codeset (GETTEXT_PACKAGE, "UTF-8");
+ */
bindtextdomain (GETTEXT_PACKAGE, LOCALEDIR);
if (ifd >= EXIF_IFD_COUNT) return NULL;
@@ -734,7 +739,12 @@ exif_tag_get_description_in_ifd (ExifTag
{
unsigned int i;
- bind_textdomain_codeset (GETTEXT_PACKAGE, "UTF-8");
+ /* libexif should use the default system locale.
+ * If an application specifically requires UTF-8, then we
+ * must give the application a way to tell libexif that.
+ *
+ * bind_textdomain_codeset (GETTEXT_PACKAGE, "UTF-8");
+ */
bindtextdomain (GETTEXT_PACKAGE, LOCALEDIR);
if (ifd >= EXIF_IFD_COUNT) return NULL;
@@ -743,39 +753,55 @@ exif_tag_get_description_in_ifd (ExifTag
return _(ExifTagTable[i].description);
}
+
+/**********************************************************************
+ * convenience functions
+ **********************************************************************/
+
+/* generic part: iterate through IFD list and return first result */
+typedef const char * (*get_stuff_func) (ExifTag tag, ExifIfd ifd);
+
+static const char *
+exif_tag_get_stuff (ExifTag tag, get_stuff_func func)
+{
+ const static ExifIfd ifds[5] = {
+ EXIF_IFD_0,
+ EXIF_IFD_1,
+ EXIF_IFD_EXIF,
+ EXIF_IFD_INTEROPERABILITY,
+ EXIF_IFD_GPS
+ };
+ int i;
+ for (i=0; i<5; i++) {
+ const char *result = func(tag, ifds[i]);
+ if (result != NULL) {
+ return result;
+ }
+ }
+ return (const char *) NULL;
+}
+
+/* explicit functions */
const char *
exif_tag_get_name (ExifTag tag)
{
- return
- exif_tag_get_name_in_ifd (tag, EXIF_IFD_0) ? :
- exif_tag_get_name_in_ifd (tag, EXIF_IFD_1) ? :
- exif_tag_get_name_in_ifd (tag, EXIF_IFD_EXIF) ? :
- exif_tag_get_name_in_ifd (tag, EXIF_IFD_INTEROPERABILITY) ? :
- exif_tag_get_name_in_ifd (tag, EXIF_IFD_GPS);
+ return exif_tag_get_stuff(tag, exif_tag_get_name_in_ifd);
}
const char *
exif_tag_get_title (ExifTag tag)
{
- return
- exif_tag_get_title_in_ifd (tag, EXIF_IFD_0) ? :
- exif_tag_get_title_in_ifd (tag, EXIF_IFD_1) ? :
- exif_tag_get_title_in_ifd (tag, EXIF_IFD_EXIF) ? :
- exif_tag_get_title_in_ifd (tag, EXIF_IFD_INTEROPERABILITY) ? :
- exif_tag_get_title_in_ifd (tag, EXIF_IFD_GPS);
+ return exif_tag_get_stuff(tag, exif_tag_get_title_in_ifd);
}
const char *
exif_tag_get_description (ExifTag tag)
{
- return
- exif_tag_get_description_in_ifd (tag, EXIF_IFD_0) ? :
- exif_tag_get_description_in_ifd (tag, EXIF_IFD_1) ? :
- exif_tag_get_description_in_ifd (tag, EXIF_IFD_EXIF) ? :
- exif_tag_get_description_in_ifd (tag, EXIF_IFD_INTEROPERABILITY) ? :
- exif_tag_get_description_in_ifd (tag, EXIF_IFD_GPS);
+ return exif_tag_get_stuff (tag, exif_tag_get_description_in_ifd);
}
+
+
ExifTag
exif_tag_from_name (const char *name)
{
Index: exif-format.c
===================================================================
RCS file: /cvsroot/libexif/libexif/libexif/exif-format.c,v
retrieving revision 1.13
retrieving revision 1.14
diff -u -p -d -r1.13 -r1.14
--- exif-format.c 25 Mar 2005 04:13:02 -0000 1.13
+++ exif-format.c 2 May 2005 19:29:14 -0000 1.14
@@ -51,7 +51,12 @@ exif_format_get_name (ExifFormat format)
unsigned int i;
/* FIXME: This belongs to somewhere else. */
- bind_textdomain_codeset (GETTEXT_PACKAGE, "UTF-8");
+ /* libexif should use the default system locale.
+ * If an application specifically requires UTF-8, then we
+ * must give the application a way to tell libexif that.
+ *
+ * bind_textdomain_codeset (GETTEXT_PACKAGE, "UTF-8");
+ */
bindtextdomain (GETTEXT_PACKAGE, LOCALEDIR);
for (i = 0; ExifFormatTable[i].name; i++)
|