gnunet-svn
[Top][All Lists]
Advanced

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

[GNUnet-SVN] r18797 - gnunet-gtk/src/fs


From: gnunet
Subject: [GNUnet-SVN] r18797 - gnunet-gtk/src/fs
Date: Sat, 24 Dec 2011 16:41:01 +0100

Author: grothoff
Date: 2011-12-24 16:41:01 +0100 (Sat, 24 Dec 2011)
New Revision: 18797

Modified:
   gnunet-gtk/src/fs/gnunet-fs-gtk-common.c
Log:
-LRN: better metadata insertion, check for string encoding errors

Modified: gnunet-gtk/src/fs/gnunet-fs-gtk-common.c
===================================================================
--- gnunet-gtk/src/fs/gnunet-fs-gtk-common.c    2011-12-24 15:38:38 UTC (rev 
18796)
+++ gnunet-gtk/src/fs/gnunet-fs-gtk-common.c    2011-12-24 15:41:01 UTC (rev 
18797)
@@ -59,11 +59,25 @@
     if (g_utf8_validate (data, data_len, NULL))
       data_to_insert = data;
     else
+    {
+      GNUNET_log (GNUNET_ERROR_TYPE_INFO,
+          "Failed to validate supposedly utf-8 string `%s' of length %u, 
assuming it to be a C string\n",
+          data, data_len);
       format = EXTRACTOR_METAFORMAT_C_STRING;
+    }
   }
   if (format == EXTRACTOR_METAFORMAT_C_STRING)
   {
-    free_data = g_locale_to_utf8 (data, data_len, &rd, &wr, NULL);
+    GError *gerr = NULL;
+    rd = wr = 0;
+    free_data = g_locale_to_utf8 (data, data_len, &rd, &wr, &gerr);
+    if (gerr != NULL)
+    {
+      GNUNET_log (GNUNET_ERROR_TYPE_INFO,
+          "Error when converting a C string `%s' of length %u to utf-8 
(converted %u to %u bytes): %s\n",
+          data, data_len, rd, wr, gerr->message);
+      g_error_free (gerr);
+    }
     data_to_insert = free_data;
   }
 




reply via email to

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