[Gnucash-changes] r13654 - gnucash/trunk - Fix return value of get_corr_account_split and reverse the tests of its callers. Fix 334801.

Andreas Koehler andi5 at cvs.gnucash.org
Fri Mar 17 09:37:20 EST 2006


Author: andi5
Date: 2006-03-17 09:37:19 -0500 (Fri, 17 Mar 2006)
New Revision: 13654
Trac: http://svn.gnucash.org/trac/changeset/13654

Modified:
   gnucash/trunk/ChangeLog
   gnucash/trunk/src/engine/Split.c
Log:
Fix return value of get_corr_account_split and reverse the tests of its callers. Fix 334801.


Modified: gnucash/trunk/ChangeLog
===================================================================
--- gnucash/trunk/ChangeLog	2006-03-17 05:37:33 UTC (rev 13653)
+++ gnucash/trunk/ChangeLog	2006-03-17 14:37:19 UTC (rev 13654)
@@ -1,3 +1,8 @@
+2006-03-17  Andreas Köhler  <andi5.py at gmx.net>
+
+	* src/engine/Split.c: Fix return value of get_corr_account_split
+	  and reverse the tests of its callers. Fix 334801.
+
 2006-03-16  David Hampton  <hampton at employees.org>
 
 	* src/gnome-utils/gnc-tree-view-account.c:

Modified: gnucash/trunk/src/engine/Split.c
===================================================================
--- gnucash/trunk/src/engine/Split.c	2006-03-17 05:37:33 UTC (rev 13653)
+++ gnucash/trunk/src/engine/Split.c	2006-03-17 14:37:19 UTC (rev 13654)
@@ -1155,10 +1155,10 @@
   const Split *current_split;
   GList *node;
   gnc_numeric sa_value, current_value;
-  gboolean sa_value_positive, current_value_positive, seen_different = FALSE;
+  gboolean sa_value_positive, current_value_positive, seen_one = FALSE;
 
   *retval = NULL;
-  g_return_val_if_fail(sa, TRUE);
+  g_return_val_if_fail(sa, FALSE);
   
   sa_value = xaccSplitGetValue (sa);
   sa_value_positive = gnc_numeric_positive_p(sa_value);
@@ -1173,16 +1173,16 @@
     current_value_positive = gnc_numeric_positive_p(current_value);
     if ((sa_value_positive && !current_value_positive) || 
         (!sa_value_positive && current_value_positive)) {
-        if (seen_different) {
+        if (seen_one) {
             *retval = NULL;
-            return TRUE;
+            return FALSE;
         } else {
             *retval = current_split;
-            seen_different = TRUE;
+            seen_one = TRUE;
         }
     }
   }
-  return FALSE;
+  return seen_one;
 }
 
 /* TODO: these static consts can be shared. */
@@ -1192,7 +1192,7 @@
   static const char *split_const = NULL;
   const Split *other_split;
 
-  if (get_corr_account_split(sa, &other_split))
+  if (!get_corr_account_split(sa, &other_split))
   {
     if (!split_const)
       split_const = _("-- Split Transaction --");
@@ -1209,7 +1209,7 @@
   static const char *split_const = NULL;
   const Split *other_split;
 
-  if (get_corr_account_split(sa, &other_split))
+  if (!get_corr_account_split(sa, &other_split))
   {
     if (!split_const)
       split_const = _("-- Split Transaction --");
@@ -1225,7 +1225,7 @@
   static const char *split_const = NULL;
   const Split *other_split;
 
-  if (get_corr_account_split(sa, &other_split))
+  if (!get_corr_account_split(sa, &other_split))
   {
     if (!split_const)
       split_const = _("Split");



More information about the gnucash-changes mailing list