gnucash maint: Transcode non-constant strings before passing them to scm_eval_string.

John Ralls jralls at code.gnucash.org
Mon Apr 29 18:01:03 EDT 2019


Updated	 via  https://github.com/Gnucash/gnucash/commit/114efe59 (commit)
	from  https://github.com/Gnucash/gnucash/commit/1c1fa360 (commit)



commit 114efe593614b5d38f8b9fdd6a70704bae946e94
Author: John Ralls <jralls at ceridwen.us>
Date:   Mon Apr 29 14:58:56 2019 -0700

    Transcode non-constant strings before passing them to scm_eval_string.
    
    Instead of using scm_c_eval_string, which transcodes with
    scm_from_locale_string. That doesn't work on Windows.

diff --git a/gnucash/report/report-gnome/gnc-plugin-page-report.c b/gnucash/report/report-gnome/gnc-plugin-page-report.c
index 2ff828e1e..be2997629 100644
--- a/gnucash/report/report-gnome/gnc-plugin-page-report.c
+++ b/gnucash/report/report-gnome/gnc-plugin-page-report.c
@@ -932,8 +932,7 @@ gnc_plugin_page_report_recreate_page (GtkWidget *window,
             LEAVE("bad value");
             return NULL;
         }
-
-        scm_id = scm_c_eval_string(option_string);
+        scm_id = scm_eval_string(scm_from_utf8_string(option_string));
         g_free(option_string);
 
         if (!scm_integer_p(scm_id))
diff --git a/libgnucash/app-utils/gnc-gsettings.c b/libgnucash/app-utils/gnc-gsettings.c
index d2f0fc69d..9c144aa7c 100644
--- a/libgnucash/app-utils/gnc-gsettings.c
+++ b/libgnucash/app-utils/gnc-gsettings.c
@@ -809,7 +809,7 @@ static void gnc_gsettings_migrate_from_gconf (void)
     command = g_strconcat ("(use-modules (migrate-prefs))(migration-prepare \"",
                            base_dir, "\")", NULL);
     DEBUG ("command = %s", command);
-    migration_ok = scm_is_true (scm_c_eval_string (command));
+    migration_ok = scm_is_true (scm_eval_string (scm_from_utf8_string (command)));
     g_free (command);
     if (!migration_ok)
     {
@@ -867,7 +867,7 @@ static void gnc_gsettings_migrate_from_gconf (void)
     command = g_strconcat ("(use-modules (migrate-prefs))(migration-cleanup \"",
                            base_dir, "\")", NULL);
     DEBUG ("command = %s", command);
-    migration_ok = scm_is_true (scm_c_eval_string (command));
+    migration_ok = scm_is_true (scm_eval_string (scm_from_utf8_string (command)));
     g_free (command);
     if (!migration_ok) /* Cleanup step failed, not critical */
         PWARN ("Cleanup step failed. You may need to delete %s/.gnc-migration-tmp manually.", base_dir);
diff --git a/libgnucash/app-utils/test/test-scm-query-string.cpp b/libgnucash/app-utils/test/test-scm-query-string.cpp
index b9f2a82e3..e7d381641 100644
--- a/libgnucash/app-utils/test/test-scm-query-string.cpp
+++ b/libgnucash/app-utils/test/test-scm-query-string.cpp
@@ -55,7 +55,7 @@ test_query (Query *q, SCM val2str)
     str2 = gnc_scm_to_utf8_string (str_q);
     if (str2)
     {
-        res_q = scm_c_eval_string (str2);
+        res_q = scm_eval_string (str_q);
     }
     else
     {



Summary of changes:
 gnucash/report/report-gnome/gnc-plugin-page-report.c | 3 +--
 libgnucash/app-utils/gnc-gsettings.c                 | 4 ++--
 libgnucash/app-utils/test/test-scm-query-string.cpp  | 2 +-
 3 files changed, 4 insertions(+), 5 deletions(-)



More information about the gnucash-changes mailing list