[git] GPA - branch, master, updated. gpa-0.9.10-28-gdd43dd9

by Werner Koch cvs at cvs.gnupg.org
Tue Oct 16 19:33:04 CEST 2018


This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "The GNU Privacy Assistant".

The branch, master has been updated
       via  dd43dd9014995e9eae149d008d74ca246293c946 (commit)
      from  728f09629698bc86bfbcf89f1228bf6d4b0d441a (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.

- Log -----------------------------------------------------------------
commit dd43dd9014995e9eae149d008d74ca246293c946
Author: Werner Koch <wk at gnupg.org>
Date:   Tue Oct 16 19:31:02 2018 +0200

    Make sure valid utf-8 is passed to GtkTextView.
    
    * src/gpacontext.c (gpa_context_get_diag): Change and convert if
    needed.
    --
    
    On Windows we get the diagnostics in the native character set and thus
    we would need to convert them before passing to other Gtk functions.
    Given that this are only diagnostics we do a quick and safe
    transliterate instead.
    
    Signed-off-by: Werner Koch <wk at gnupg.org>

diff --git a/src/gpacontext.c b/src/gpacontext.c
index 951e7d1..37add22 100644
--- a/src/gpacontext.c
+++ b/src/gpacontext.c
@@ -252,6 +252,7 @@ gpa_context_get_diag (GpaContext *context)
   gpg_error_t err;
   gpgme_engine_info_t engine;
   gpgme_protocol_t proto;
+  int need_gpgme_free;
 
   if (!context)
     return NULL;
@@ -281,8 +282,22 @@ gpa_context_get_diag (GpaContext *context)
   gpgme_data_seek (diag, 0, SEEK_END);
   gpgme_data_write (diag, "", 1);
   buffer = gpgme_data_release_and_get_mem (diag, NULL);
+  need_gpgme_free = 1;
+  /* In case the diags do not return proper utf-8 we transliterate to
+   * ascii using the "C" locale which might help in bug tracking.  */
+  if (!g_utf8_validate (buffer, -1, NULL))
+    {
+      result = g_str_to_ascii (buffer, "C");
+      gpgme_free (buffer);
+      buffer = result;
+      need_gpgme_free = 0;
+    }
+  /* Prefix with the version info. */
   result = g_strconcat (info, buffer, NULL);
-  gpgme_free (buffer);
+  if (need_gpgme_free)
+    gpgme_free (buffer);
+  else
+    g_free (buffer);
   g_free (info);
 
   return result;

-----------------------------------------------------------------------

Summary of changes:
 src/gpacontext.c | 17 ++++++++++++++++-
 1 file changed, 16 insertions(+), 1 deletion(-)


hooks/post-receive
-- 
The GNU Privacy Assistant
http://git.gnupg.org




More information about the Gnupg-commits mailing list