gnunet-svn
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[GNUnet-SVN] r24624 - in gnunet/src: datacache datastore fs namestore


From: gnunet
Subject: [GNUnet-SVN] r24624 - in gnunet/src: datacache datastore fs namestore
Date: Tue, 30 Oct 2012 23:12:03 +0100

Author: LRN
Date: 2012-10-30 23:12:03 +0100 (Tue, 30 Oct 2012)
New Revision: 24624

Modified:
   gnunet/src/datacache/plugin_datacache_sqlite.c
   gnunet/src/datastore/plugin_datastore_sqlite.c
   gnunet/src/fs/fs_getopt.c
   gnunet/src/namestore/plugin_namestore_sqlite.c
Log:
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.

Modified: gnunet/src/datacache/plugin_datacache_sqlite.c
===================================================================
--- gnunet/src/datacache/plugin_datacache_sqlite.c      2012-10-30 22:11:56 UTC 
(rev 24623)
+++ gnunet/src/datacache/plugin_datacache_sqlite.c      2012-10-30 22:12:03 UTC 
(rev 24624)
@@ -370,12 +370,8 @@
     GNUNET_break (0);
     return NULL;
   }
-#ifdef ENABLE_NLS
-  fn_utf8 = GNUNET_STRINGS_to_utf8 (fn, strlen (fn), nl_langinfo (CODESET));
-#else
-  /* good luck */
-  fn_utf8 = GNUNET_STRINGS_to_utf8 (fn, strlen (fn), "UTF-8");
-#endif
+  /* fn should be UTF-8-encoded. If it isn't, it's a bug. */
+  fn_utf8 = GNUNET_strdup (fn);
   if (SQLITE_OK != sqlite3_open (fn_utf8, &dbh))
   {
     GNUNET_free (fn);

Modified: gnunet/src/datastore/plugin_datastore_sqlite.c
===================================================================
--- gnunet/src/datastore/plugin_datastore_sqlite.c      2012-10-30 22:11:56 UTC 
(rev 24623)
+++ gnunet/src/datastore/plugin_datastore_sqlite.c      2012-10-30 22:12:03 UTC 
(rev 24624)
@@ -243,13 +243,8 @@
     /* database is new or got deleted, reset payload to zero! */
     plugin->env->duc (plugin->env->cls, 0);
   }
-#ifdef ENABLE_NLS
-  plugin->fn =
-      GNUNET_STRINGS_to_utf8 (afsdir, strlen (afsdir), nl_langinfo (CODESET));
-#else
-  plugin->fn = GNUNET_STRINGS_to_utf8 (afsdir, strlen (afsdir), "UTF-8");      
 /* good luck */
-#endif
-  GNUNET_free (afsdir);
+  /* afsdir should be UTF-8-encoded. If it isn't, it's a bug */
+  plugin->fn = afsdir;
 
   /* Open database and precompile statements */
   if (sqlite3_open (plugin->fn, &plugin->dbh) != SQLITE_OK)

Modified: gnunet/src/fs/fs_getopt.c
===================================================================
--- gnunet/src/fs/fs_getopt.c   2012-10-30 22:11:56 UTC (rev 24623)
+++ gnunet/src/fs/fs_getopt.c   2012-10-30 22:12:03 UTC (rev 24624)
@@ -139,11 +139,12 @@
     *mm = meta;
   }
 
-#if ENABLE_NLS
-  tmp = GNUNET_STRINGS_to_utf8 (value, strlen (value), nl_langinfo (CODESET));
-#else
-  tmp = GNUNET_STRINGS_to_utf8 (value, strlen (value), "utf-8");
-#endif
+  /* Use GNUNET_STRINGS_get_utf8_args() in main() to acquire utf-8-encoded
+   * commandline arguments, so that the following line is not needed.
+   */
+  /*tmp = GNUNET_STRINGS_to_utf8 (value, strlen (value), locale_charset ());*/
+  tmp = GNUNET_strdup (value);
+
   type = EXTRACTOR_metatype_get_max ();
   while (type > 0)
   {

Modified: gnunet/src/namestore/plugin_namestore_sqlite.c
===================================================================
--- gnunet/src/namestore/plugin_namestore_sqlite.c      2012-10-30 22:11:56 UTC 
(rev 24623)
+++ gnunet/src/namestore/plugin_namestore_sqlite.c      2012-10-30 22:12:03 UTC 
(rev 24624)
@@ -213,13 +213,8 @@
       return GNUNET_SYSERR;
     }
   }
-#ifdef ENABLE_NLS
-  plugin->fn =
-      GNUNET_STRINGS_to_utf8 (afsdir, strlen (afsdir), nl_langinfo (CODESET));
-#else
-  plugin->fn = GNUNET_STRINGS_to_utf8 (afsdir, strlen (afsdir), "UTF-8");      
 /* good luck */
-#endif
-  GNUNET_free (afsdir);
+  /* afsdir should be UTF-8-encoded. If it isn't, it's a bug */
+  plugin->fn = afsdir;
 
   /* Open database and precompile statements */
   if (sqlite3_open (plugin->fn, &plugin->dbh) != SQLITE_OK)




reply via email to

[Prev in Thread] Current Thread [Next in Thread]