r21366 - gnucash/trunk/src/engine - Add some const where applicable.

Christian Stimming cstim at code.gnucash.org
Fri Sep 30 14:47:43 EDT 2011


Author: cstim
Date: 2011-09-30 14:47:43 -0400 (Fri, 30 Sep 2011)
New Revision: 21366
Trac: http://svn.gnucash.org/trac/changeset/21366

Modified:
   gnucash/trunk/src/engine/gncOwner.c
   gnucash/trunk/src/engine/gncOwner.h
Log:
Add some const where applicable.

Modified: gnucash/trunk/src/engine/gncOwner.c
===================================================================
--- gnucash/trunk/src/engine/gncOwner.c	2011-09-29 14:22:19 UTC (rev 21365)
+++ gnucash/trunk/src/engine/gncOwner.c	2011-09-30 18:47:43 UTC (rev 21366)
@@ -714,7 +714,9 @@
 static gboolean
 gnc_lot_match_invoice_owner (GNCLot *lot, gpointer user_data)
 {
-    GncOwner owner_def, *owner, *this_owner = user_data;
+    GncOwner owner_def;
+    const GncOwner *owner;
+    const GncOwner *this_owner = user_data;
     GncInvoice *invoice;
 
     /* If this lot is not for this owner, then ignore it */
@@ -722,7 +724,7 @@
     if (invoice)
     {
         owner = gncInvoiceGetOwner (invoice);
-        owner = gncOwnerGetEndOwner (owner);
+        owner = gncOwnerGetEndOwner ((GncOwner*)owner);
     }
     else
     {
@@ -754,7 +756,7 @@
  * (bank or other asset) and the posted_account (A/R or A/P).
  */
 Transaction *
-gncOwnerApplyPayment (GncOwner *owner, GncInvoice* invoice,
+gncOwnerApplyPayment (const GncOwner *owner, GncInvoice* invoice,
                       Account *posted_acc, Account *xfer_acc,
                       gnc_numeric amount, gnc_numeric exch, Timespec date,
                       const char *memo, const char *num)
@@ -778,7 +780,7 @@
 
     /* Compute the ancillary data */
     book = gnc_account_get_book (posted_acc);
-    name = gncOwnerGetName (gncOwnerGetEndOwner (owner));
+    name = gncOwnerGetName (gncOwnerGetEndOwner ((GncOwner*)owner));
     commodity = gncOwnerGetCurrency (owner);
     reverse = (gncOwnerGetType (owner) == GNC_OWNER_CUSTOMER);
 
@@ -823,7 +825,7 @@
      */
 
     fifo = xaccAccountFindOpenLots (posted_acc, gnc_lot_match_invoice_owner,
-                                    owner,
+                                    (gpointer)owner,
                                     (GCompareFunc)gnc_lot_sort_func);
 
     /* Check if an invoice was passed in, and if so, does it match the
@@ -994,7 +996,7 @@
  * convert it to the desired currency.
  */
 gnc_numeric
-gncOwnerGetBalanceInCurrency (GncOwner *owner,
+gncOwnerGetBalanceInCurrency (const GncOwner *owner,
                               const gnc_commodity *report_currency)
 {
     gnc_numeric balance = gnc_numeric_zero ();
@@ -1027,7 +1029,7 @@
 
         /* Get a list of open lots for this owner and account */
         lot_list = xaccAccountFindOpenLots (account, gnc_lot_match_invoice_owner,
-                                            owner,
+                                            (gpointer)owner,
                                             (GCompareFunc)gnc_lot_sort_func);
         /* For each lot */
         for (lot_node = lot_list; lot_node; lot_node = lot_node->next)

Modified: gnucash/trunk/src/engine/gncOwner.h
===================================================================
--- gnucash/trunk/src/engine/gncOwner.h	2011-09-29 14:22:19 UTC (rev 21365)
+++ gnucash/trunk/src/engine/gncOwner.h	2011-09-30 18:47:43 UTC (rev 21366)
@@ -185,7 +185,7 @@
  * payment to that invoice first before any other invoice.
  */
 Transaction *
-gncOwnerApplyPayment (GncOwner *owner, GncInvoice *invoice,
+gncOwnerApplyPayment (const GncOwner *owner, GncInvoice *invoice,
                       Account *posted_acc, Account *xfer_acc,
                       gnc_numeric amount, gnc_numeric exch, Timespec date,
                       const char *memo, const char *num);
@@ -201,7 +201,7 @@
  *  convert it to the desired currency.
  */
 gnc_numeric
-gncOwnerGetBalanceInCurrency (GncOwner *owner,
+gncOwnerGetBalanceInCurrency (const GncOwner *owner,
                               const gnc_commodity *report_currency);
 
 #define OWNER_TYPE        "type"



More information about the gnucash-changes mailing list