diff options
author | LRN <lrn1986@gmail.com> | 2012-10-30 22:12:03 +0000 |
---|---|---|
committer | LRN <lrn1986@gmail.com> | 2012-10-30 22:12:03 +0000 |
commit | 9df886ed8497002e564ba018d7ceab36bfd04ddd (patch) | |
tree | 4ce33c4fad5486af3d45ececb47aff7110ed8c74 | |
parent | 3b9cf09a1fbae43883b61c9fd0d33083fa7a6b6c (diff) | |
download | gnunet-9df886ed8497002e564ba018d7ceab36bfd04ddd.tar.gz gnunet-9df886ed8497002e564ba018d7ceab36bfd04ddd.zip |
Fix ENABLE_NLS usage
ENABLE_NLS is for gettext only, it's not an indicator of nl_langinfo
availability.
Use unistring instead of nl_langinfo, since unistring is always there.
GNUnet supports UTF-8 now (or should support), so most conversions are
unnecessary anyway.
-rw-r--r-- | src/datacache/plugin_datacache_sqlite.c | 8 | ||||
-rw-r--r-- | src/datastore/plugin_datastore_sqlite.c | 9 | ||||
-rw-r--r-- | src/fs/fs_getopt.c | 11 | ||||
-rw-r--r-- | src/namestore/plugin_namestore_sqlite.c | 9 |
4 files changed, 12 insertions, 25 deletions
diff --git a/src/datacache/plugin_datacache_sqlite.c b/src/datacache/plugin_datacache_sqlite.c index 49bdc017e..62d5445b4 100644 --- a/src/datacache/plugin_datacache_sqlite.c +++ b/src/datacache/plugin_datacache_sqlite.c | |||
@@ -370,12 +370,8 @@ libgnunet_plugin_datacache_sqlite_init (void *cls) | |||
370 | GNUNET_break (0); | 370 | GNUNET_break (0); |
371 | return NULL; | 371 | return NULL; |
372 | } | 372 | } |
373 | #ifdef ENABLE_NLS | 373 | /* fn should be UTF-8-encoded. If it isn't, it's a bug. */ |
374 | fn_utf8 = GNUNET_STRINGS_to_utf8 (fn, strlen (fn), nl_langinfo (CODESET)); | 374 | fn_utf8 = GNUNET_strdup (fn); |
375 | #else | ||
376 | /* good luck */ | ||
377 | fn_utf8 = GNUNET_STRINGS_to_utf8 (fn, strlen (fn), "UTF-8"); | ||
378 | #endif | ||
379 | if (SQLITE_OK != sqlite3_open (fn_utf8, &dbh)) | 375 | if (SQLITE_OK != sqlite3_open (fn_utf8, &dbh)) |
380 | { | 376 | { |
381 | GNUNET_free (fn); | 377 | GNUNET_free (fn); |
diff --git a/src/datastore/plugin_datastore_sqlite.c b/src/datastore/plugin_datastore_sqlite.c index 54414a8b0..01f6b9188 100644 --- a/src/datastore/plugin_datastore_sqlite.c +++ b/src/datastore/plugin_datastore_sqlite.c | |||
@@ -243,13 +243,8 @@ database_setup (const struct GNUNET_CONFIGURATION_Handle *cfg, | |||
243 | /* database is new or got deleted, reset payload to zero! */ | 243 | /* database is new or got deleted, reset payload to zero! */ |
244 | plugin->env->duc (plugin->env->cls, 0); | 244 | plugin->env->duc (plugin->env->cls, 0); |
245 | } | 245 | } |
246 | #ifdef ENABLE_NLS | 246 | /* afsdir should be UTF-8-encoded. If it isn't, it's a bug */ |
247 | plugin->fn = | 247 | plugin->fn = afsdir; |
248 | GNUNET_STRINGS_to_utf8 (afsdir, strlen (afsdir), nl_langinfo (CODESET)); | ||
249 | #else | ||
250 | plugin->fn = GNUNET_STRINGS_to_utf8 (afsdir, strlen (afsdir), "UTF-8"); /* good luck */ | ||
251 | #endif | ||
252 | GNUNET_free (afsdir); | ||
253 | 248 | ||
254 | /* Open database and precompile statements */ | 249 | /* Open database and precompile statements */ |
255 | if (sqlite3_open (plugin->fn, &plugin->dbh) != SQLITE_OK) | 250 | if (sqlite3_open (plugin->fn, &plugin->dbh) != SQLITE_OK) |
diff --git a/src/fs/fs_getopt.c b/src/fs/fs_getopt.c index 03747742b..6cc402115 100644 --- a/src/fs/fs_getopt.c +++ b/src/fs/fs_getopt.c | |||
@@ -139,11 +139,12 @@ GNUNET_FS_getopt_set_metadata (struct GNUNET_GETOPT_CommandLineProcessorContext | |||
139 | *mm = meta; | 139 | *mm = meta; |
140 | } | 140 | } |
141 | 141 | ||
142 | #if ENABLE_NLS | 142 | /* Use GNUNET_STRINGS_get_utf8_args() in main() to acquire utf-8-encoded |
143 | tmp = GNUNET_STRINGS_to_utf8 (value, strlen (value), nl_langinfo (CODESET)); | 143 | * commandline arguments, so that the following line is not needed. |
144 | #else | 144 | */ |
145 | tmp = GNUNET_STRINGS_to_utf8 (value, strlen (value), "utf-8"); | 145 | /*tmp = GNUNET_STRINGS_to_utf8 (value, strlen (value), locale_charset ());*/ |
146 | #endif | 146 | tmp = GNUNET_strdup (value); |
147 | |||
147 | type = EXTRACTOR_metatype_get_max (); | 148 | type = EXTRACTOR_metatype_get_max (); |
148 | while (type > 0) | 149 | while (type > 0) |
149 | { | 150 | { |
diff --git a/src/namestore/plugin_namestore_sqlite.c b/src/namestore/plugin_namestore_sqlite.c index 477e7bb16..f0deb7fa9 100644 --- a/src/namestore/plugin_namestore_sqlite.c +++ b/src/namestore/plugin_namestore_sqlite.c | |||
@@ -213,13 +213,8 @@ database_setup (struct Plugin *plugin) | |||
213 | return GNUNET_SYSERR; | 213 | return GNUNET_SYSERR; |
214 | } | 214 | } |
215 | } | 215 | } |
216 | #ifdef ENABLE_NLS | 216 | /* afsdir should be UTF-8-encoded. If it isn't, it's a bug */ |
217 | plugin->fn = | 217 | plugin->fn = afsdir; |
218 | GNUNET_STRINGS_to_utf8 (afsdir, strlen (afsdir), nl_langinfo (CODESET)); | ||
219 | #else | ||
220 | plugin->fn = GNUNET_STRINGS_to_utf8 (afsdir, strlen (afsdir), "UTF-8"); /* good luck */ | ||
221 | #endif | ||
222 | GNUNET_free (afsdir); | ||
223 | 218 | ||
224 | /* Open database and precompile statements */ | 219 | /* Open database and precompile statements */ |
225 | if (sqlite3_open (plugin->fn, &plugin->dbh) != SQLITE_OK) | 220 | if (sqlite3_open (plugin->fn, &plugin->dbh) != SQLITE_OK) |