gnucash maint: Multiple changes pushed

John Ralls jralls at code.gnucash.org
Sun Dec 4 15:36:27 EST 2016


Updated	 via  https://github.com/Gnucash/gnucash/commit/f3826953 (commit)
	 via  https://github.com/Gnucash/gnucash/commit/755c42a0 (commit)
	from  https://github.com/Gnucash/gnucash/commit/27f529e7 (commit)



commit f382695345743dd0e9cbd71c5b72f17fcf6cd69b
Author: John Ralls <jralls at ceridwen.us>
Date:   Sun Dec 4 12:35:42 2016 -0800

    Bug 775567 - Importing QIF file from PayPal crashes GnuCash 2.6.14 on Windows XP service pack 3
    
    Guile-1.8 doesn't know about BOM so check for one and strip it if it's there.

diff --git a/src/import-export/qif-imp/qif-file.scm b/src/import-export/qif-imp/qif-file.scm
index e03fc9a..e428068 100644
--- a/src/import-export/qif-imp/qif-file.scm
+++ b/src/import-export/qif-imp/qif-file.scm
@@ -96,6 +96,25 @@
                           (string-append str "\n" (_ "Read aborted.")))
           (set! abort-read #t)))
 
+      (define (strip-bom)
+	(let ((c1 (read-char)))
+	  (if (char=? c1 (integer->char #xEF))
+	    (let ((c2 (read-char)))
+	      (if (char=? c2 (integer->char #xBB))
+		  (let ((c3 (read-char)))
+		    (if (char=? c3 (integer->char #xBF)) #t
+			(begin
+			  (unread-char c3)
+			  (unread-char c2)
+			  (unread-char c1)
+			#f)))
+		  (begin
+		    (unread-char c2)
+		    (unread-char c1)
+		    #f)))
+	    (begin
+	      (unread-char c1)
+	      #f))))
 
       (qif-file:set-path! self path)
       (if (not (access? path R_OK))
@@ -112,6 +131,7 @@
 
       (with-input-from-file path
         (lambda ()
+	  (strip-bom)
           ;; loop over lines
           (let line-loop ()
             (set! line (read-delimited delimiters))

commit 755c42a087bcee3eff4ad0b144a4f0e95385a311
Author: John Ralls <jralls at ceridwen.us>
Date:   Sat Dec 3 17:50:38 2016 -0800

    Prevent crash when there's an error loading a qif import file.

diff --git a/src/import-export/qif-imp/assistant-qif-import.c b/src/import-export/qif-imp/assistant-qif-import.c
index 4389757..941d746 100644
--- a/src/import-export/qif-imp/assistant-qif-import.c
+++ b/src/import-export/qif-imp/assistant-qif-import.c
@@ -1698,7 +1698,7 @@ gnc_ui_qif_import_load_progress_start_cb(GtkButton * button,
     SCM parse_results   = scm_c_eval_string("qif-file:parse-fields-results");
     SCM scm_qiffile;
     SCM imported_files = SCM_EOL;
-    SCM load_return, parse_return;
+    SCM load_return = SCM_BOOL_F, parse_return = SCM_BOOL_F;
     SCM progress;
 
     /* Raise the busy flag so the assistant can't be canceled unexpectedly. */
@@ -1804,11 +1804,15 @@ gnc_ui_qif_import_load_progress_start_cb(GtkButton * button,
      */
 
     /* This step will fill the remainder of the bar. */
-    gnc_progress_dialog_push(wind->load_progress, 1);
-    parse_return = scm_call_2(qif_file_parse, SCM_CAR(imported_files), progress);
-    gnc_progress_dialog_pop(wind->load_progress);
-    wind->ask_date_format = FALSE;
-    wind->date_format = NULL;
+    if (!wind->load_stop)
+    {
+	gnc_progress_dialog_push(wind->load_progress, 1);
+	parse_return = scm_call_2(qif_file_parse, SCM_CAR(imported_files),
+				  progress);
+	gnc_progress_dialog_pop(wind->load_progress);
+	wind->ask_date_format = FALSE;
+	wind->date_format = NULL;
+    }
     if (parse_return == SCM_BOOL_T)
     {
         /* Canceled by the user. */



Summary of changes:
 src/import-export/qif-imp/assistant-qif-import.c | 16 ++++++++++------
 src/import-export/qif-imp/qif-file.scm           | 20 ++++++++++++++++++++
 2 files changed, 30 insertions(+), 6 deletions(-)



More information about the gnucash-changes mailing list