[Gnucash-changes] r13294 - gnucash/trunk - Make sure we use tabs, not spaces, in the transaction log (#331620)

Derek Atkins warlord at cvs.gnucash.org
Sun Feb 19 10:23:16 EST 2006


Author: warlord
Date: 2006-02-19 10:23:15 -0500 (Sun, 19 Feb 2006)
New Revision: 13294
Trac: http://svn.gnucash.org/trac/changeset/13294

Modified:
   gnucash/trunk/ChangeLog
   gnucash/trunk/src/engine/TransLog.c
   gnucash/trunk/src/import-export/log-replay/gnc-log-replay.c
Log:
Make sure we use tabs, not spaces, in the transaction log (#331620)

	* src/engine/TransLog.c:  use TABS not SPACES for column separators
	* src/import-export/log-replay/gnc-log-replay.c: use printf
	  so we don't have a tab->space conversion problem like we
	  did in TransLog.c
	  Fixes #331620.



Modified: gnucash/trunk/ChangeLog
===================================================================
--- gnucash/trunk/ChangeLog	2006-02-18 16:53:45 UTC (rev 13293)
+++ gnucash/trunk/ChangeLog	2006-02-19 15:23:15 UTC (rev 13294)
@@ -1,3 +1,11 @@
+2006-02-19  Derek Atkins  <derek at ihtfp.com>
+
+	* src/engine/TransLog.c:  use TABS not SPACES for column separators
+	* src/import-export/log-replay/gnc-log-replay.c: use printf
+	  so we don't have a tab->space conversion problem like we
+	  did in TransLog.c
+	  Fixes #331620.
+
 2006-02-18  Derek Atkins  <derek at ihtfp.com>
 
 	* intl-scm/xgettext.scm: remove the absolute path from filenames

Modified: gnucash/trunk/src/engine/TransLog.c
===================================================================
--- gnucash/trunk/src/engine/TransLog.c	2006-02-18 16:53:45 UTC (rev 13293)
+++ gnucash/trunk/src/engine/TransLog.c	2006-02-19 15:23:15 UTC (rev 13294)
@@ -139,12 +139,12 @@
    g_free (filename);
    g_free (timestamp);
 
-   /* use tab-separated fields */
-   fprintf (trans_log, "mod        trans_guid        split_guid        time_now        " \
-                       "date_entered        date_posted        " \
-                       "acc_guid        acc_name        num        description        " \
-                       "notes        memo        action        reconciled        " \
-                       "amount        value        date_reconciled\n");
+   /*  Note: this must match src/import-export/log-replay/gnc-log-replay.c */
+   fprintf (trans_log, "mod\ttrans_guid\tsplit_guid\ttime_now\t"
+                       "date_entered\tdate_posted\t"
+                       "acc_guid\tacc_name\tnum\tdescription\t"
+                       "notes\tmemo\taction\treconciled\t"
+                       "amount\tvalue\tdate_reconciled\n");
    fprintf (trans_log, "-----------------\n");
 }
 

Modified: gnucash/trunk/src/import-export/log-replay/gnc-log-replay.c
===================================================================
--- gnucash/trunk/src/import-export/log-replay/gnc-log-replay.c	2006-02-18 16:53:45 UTC (rev 13293)
+++ gnucash/trunk/src/import-export/log-replay/gnc-log-replay.c	2006-02-19 15:23:15 UTC (rev 13294)
@@ -501,9 +501,17 @@
   char read_buf[256];
   char *read_retval;
   FILE *log_file;
-  char * expected_header = "mod	trans_guid	split_guid	time_now	date_entered	date_posted	acc_guid	acc_name	num	description	notes	memo	action	reconciled	amount	value	date_reconciled";
   char * record_start_str = "===== START";
+  /* NOTE: This string must match src/engine/TransLog.c (sans newline) */
+  char * expected_header_orig = "mod\ttrans_guid\tsplit_guid\ttime_now\t"
+  	"date_entered\tdate_posted\tacc_guid\tacc_name\tnum\tdescription\t"
+  	"notes\tmemo\taction\treconciled\tamount\tvalue\tdate_reconciled";
+  static char *expected_header = NULL;
 
+  /* Use g_strdup_printf so we don't get accidental tab -> space conversion */
+  if (!expected_header)
+    expected_header = g_strdup_printf(expected_header_orig);
+
   gnc_set_log_level(GNC_MOD_IMPORT, GNC_LOG_DEBUG);
   ENTER(" ");
 



More information about the gnucash-changes mailing list