OpenWrt packages
Sign in or create your account | Project List | Help
OpenWrt packages Git Source Tree
Root/
| 1 | From 3f16ee03c97f63e4f00142a356fd4f968a490c62 Mon Sep 17 00:00:00 2001 |
| 2 | From: Joshua Judson Rosen <rozzin@geekspace.com> |
| 3 | Date: Wed, 27 Apr 2011 00:46:39 -0400 |
| 4 | Subject: [PATCH 13/17] Provide a "./configure --disable-latin1" option |
| 5 | for environments where UTF-8 is native and Latin-1 doesn't exist. |
| 6 | |
| 7 | --- |
| 8 | config.h.in | 3 +++ |
| 9 | configure.ac | 9 +++++++++ |
| 10 | util.c | 2 ++ |
| 11 | util.h | 7 +++++++ |
| 12 | 4 files changed, 21 insertions(+), 0 deletions(-) |
| 13 | |
| 14 | diff --git a/config.h.in b/config.h.in |
| 15 | index 8833d6c..143620f 100644 |
| 16 | --- a/config.h.in |
| 17 | +++ b/config.h.in |
| 18 | @@ -1,5 +1,8 @@ |
| 19 | /* config.h.in. Generated from configure.ac by autoheader. */ |
| 20 | |
| 21 | +/* Assume tag-strings are encoded in Latin-1 */ |
| 22 | +#undef ASSUME_LATIN1 |
| 23 | + |
| 24 | /* Define to 1 if translation of program messages to the user's native |
| 25 | language is requested. */ |
| 26 | #undef ENABLE_NLS |
| 27 | diff --git a/configure.ac b/configure.ac |
| 28 | index 462350f..68155ec 100644 |
| 29 | --- a/configure.ac |
| 30 | +++ b/configure.ac |
| 31 | @@ -38,6 +38,15 @@ if test "$enable_audclient" = "yes"; then |
| 32 | PKG_CHECK_MODULES([AUDACIOUS], [audacious]) |
| 33 | fi |
| 34 | |
| 35 | +AC_ARG_ENABLE([latin1], |
| 36 | + AS_HELP_STRING([--disable-latin1], |
| 37 | + [Disable handling of tags encoded in Latin-1, and assume tags are UTF-8 encoded.]), |
| 38 | + [assume_latin1=$enableval], |
| 39 | + [assume_latin1="yes"]) |
| 40 | +if test "$assume_latin1" = "yes"; then |
| 41 | + AC_DEFINE([ASSUME_LATIN1], [1], [Assume tag-strings are encoded in Latin-1]) |
| 42 | +fi |
| 43 | + |
| 44 | dnl Check for language stuff |
| 45 | AM_GNU_GETTEXT([external]) |
| 46 | AM_GNU_GETTEXT_VERSION([0.18.1]) |
| 47 | diff --git a/util.c b/util.c |
| 48 | index d5d7160..6b57e5b 100644 |
| 49 | --- a/util.c |
| 50 | +++ b/util.c |
| 51 | @@ -50,6 +50,7 @@ gjay_dlsym(void *handle, const char const *func_name) |
| 52 | /** |
| 53 | * Duplicate a string from one encoding to another |
| 54 | */ |
| 55 | +#ifdef ASSUME_LATIN1 |
| 56 | gchar * strdup_convert ( const gchar * str, |
| 57 | const gchar * enc_to, |
| 58 | const gchar * enc_from ) { |
| 59 | @@ -68,6 +69,7 @@ gchar * strdup_convert ( const gchar * str, |
| 60 | } |
| 61 | return conv; |
| 62 | } |
| 63 | +#endif /* ASSUME_LATIN1 */ |
| 64 | |
| 65 | /** |
| 66 | * Implement strtof, except make it locale agnostic w/r/t whether a |
| 67 | diff --git a/util.h b/util.h |
| 68 | index f422275..24c2170 100644 |
| 69 | --- a/util.h |
| 70 | +++ b/util.h |
| 71 | @@ -21,11 +21,18 @@ |
| 72 | #include <glib.h> |
| 73 | |
| 74 | void * gjay_dlsym(void *handle, const char const *func_name); |
| 75 | + |
| 76 | #define strdup_to_utf8(str) (strdup_convert(str, "UTF8", "LATIN1")) |
| 77 | #define strdup_to_latin1(str) (strdup_convert(str, "LATIN1", "UTF8")) |
| 78 | + |
| 79 | +#ifdef ASSUME_LATIN1 |
| 80 | gchar * strdup_convert ( const gchar * str, |
| 81 | const gchar * enc_to, |
| 82 | const gchar * enc_from ); |
| 83 | +#else |
| 84 | +#define strdup_convert(str, enc_to, enc_from) (g_strdup(str)) |
| 85 | +#endif /* ASSUME_LATIN1 */ |
| 86 | + |
| 87 | float strtof_gjay ( const char * nptr, |
| 88 | char ** endptr); |
| 89 | |
| 90 | -- |
| 91 | 1.7.2.5 |
| 92 | |
| 93 |
