[Gnucash-changes] Heath Martin's x86_64 patch.

Derek Atkins warlord at cvs.gnucash.org
Sun Oct 31 20:36:49 EST 2004


Log Message:
-----------
Heath Martin's x86_64 patch.

	* src/engine/gnc-numeric.[ch]:
	  change string_to_gnc_numeric() to return gboolean.
	* src/app-utils/gnc-exp-parser.c:
	* src/backend/file/sixtp-dom-parsers.c:
	  use new string_to_gnc_numeric() API
	* src/gnome/dialog-scheduledxaction.c:
	* src/gnome/dialog-sxsincelast.c:
	* src/gnome/druid-loan.c:
	* src/gnome-utils/dialog-account.c:
	* src/gnome-utils/gnc-query-list.c:
	* src/import-export/import-match-map.c:
	  use GPOINTER_TO_INT and GINT_TO_POINTER macros to be 64-bit safe.

Tags:
----
gnucash-1-8-branch

Modified Files:
--------------
    gnucash:
        ChangeLog
    gnucash/src/app-utils:
        gnc-exp-parser.c
    gnucash/src/backend/file:
        sixtp-dom-parsers.c
    gnucash/src/engine:
        gnc-numeric.c
        gnc-numeric.h
    gnucash/src/gnome:
        dialog-scheduledxaction.c
        dialog-sxsincelast.c
        druid-loan.c
    gnucash/src/gnome-utils:
        dialog-account.c
        gnc-query-list.c
    gnucash/src/import-export:
        import-match-map.c

Revision Data
-------------
Index: ChangeLog
===================================================================
RCS file: /home/cvs/cvsroot/gnucash/ChangeLog,v
retrieving revision 1.1461.2.361
retrieving revision 1.1461.2.362
diff -LChangeLog -LChangeLog -u -r1.1461.2.361 -r1.1461.2.362
--- ChangeLog
+++ ChangeLog
@@ -3,6 +3,20 @@
 	* src/engine/gnc-pricedb.c:
 	  Phil Longstaff's patch to prevent duplicate pricedb entries.
 
+	Heath Martin's x86_64 patch:
+	* src/engine/gnc-numeric.[ch]:
+	  change string_to_gnc_numeric() to return gboolean.
+	* src/app-utils/gnc-exp-parser.c:
+	* src/backend/file/sixtp-dom-parsers.c:
+	  use new string_to_gnc_numeric() API
+	* src/gnome/dialog-scheduledxaction.c:
+	* src/gnome/dialog-sxsincelast.c:
+	* src/gnome/druid-loan.c:
+	* src/gnome-utils/dialog-account.c:
+	* src/gnome-utils/gnc-query-list.c:
+	* src/import-export/import-match-map.c:
+	  use GPOINTER_TO_INT and GINT_TO_POINTER macros to be 64-bit safe.
+
 2004-10-30  Christian Stimming  <stimming at tuhh.de>
 
 	* doc/README.HBCI: Updated HBCI readme.
Index: druid-loan.c
===================================================================
RCS file: /home/cvs/cvsroot/gnucash/src/gnome/druid-loan.c,v
retrieving revision 1.17.2.3
retrieving revision 1.17.2.4
diff -Lsrc/gnome/druid-loan.c -Lsrc/gnome/druid-loan.c -u -r1.17.2.3 -r1.17.2.4
--- src/gnome/druid-loan.c
+++ src/gnome/druid-loan.c
@@ -2587,8 +2587,8 @@
         RevRepaymentRow *rrr = g_new0( RevRepaymentRow, 1 );
         if ( !key || !val ) {
                 DEBUG( "%.8x, %.8x",
-                       (unsigned int)key,
-                       (unsigned int)val );
+                       GPOINTER_TO_UINT(key),
+                       GPOINTER_TO_UINT(val));
         }
         rrr->date = *(GDate*)key;
         rrr->numCells = (gnc_numeric*)val;
Index: dialog-sxsincelast.c
===================================================================
RCS file: /home/cvs/cvsroot/gnucash/src/gnome/dialog-sxsincelast.c,v
retrieving revision 1.65.2.3
retrieving revision 1.65.2.4
diff -Lsrc/gnome/dialog-sxsincelast.c -Lsrc/gnome/dialog-sxsincelast.c -u -r1.65.2.3 -r1.65.2.4
--- src/gnome/dialog-sxsincelast.c
+++ src/gnome/dialog-sxsincelast.c
@@ -1334,7 +1334,7 @@
                       toDelPtr;
                       toDelPtr = toDelPtr->next ) {
 
-                        row = (gint)toDelPtr->data;
+                        row = GPOINTER_TO_INT(toDelPtr->data);
                         tdt = (toDeleteTuple*)gtk_clist_get_row_data( cl, row );
                         elt = g_list_find( sxList, tdt->sx );
                         sxList = g_list_remove_link( sxList, elt );
@@ -3048,7 +3048,7 @@
 print_vars_helper( gpointer key, gpointer value, gpointer user_data )
 {
         DEBUG( "\"%s\" -> %.8x [%s]",
-               (gchar*)key, (unsigned int)value,
+               (gchar*)key, GPOINTER_TO_UINT(value),
                gnc_numeric_to_string( *(gnc_numeric*)value ) );
 }
 
Index: dialog-scheduledxaction.c
===================================================================
RCS file: /home/cvs/cvsroot/gnucash/src/gnome/dialog-scheduledxaction.c,v
retrieving revision 1.70.2.7
retrieving revision 1.70.2.8
diff -Lsrc/gnome/dialog-scheduledxaction.c -Lsrc/gnome/dialog-scheduledxaction.c -u -r1.70.2.7 -r1.70.2.8
--- src/gnome/dialog-scheduledxaction.c
+++ src/gnome/dialog-scheduledxaction.c
@@ -1776,7 +1776,7 @@
         sxd = (SchedXactionDialog*)d;
         cl = GTK_CLIST(glade_xml_get_widget( sxd->gxml, SX_LIST ));
         for( sel = cl->selection; sel; sel = g_list_next(sel) ) {
-                row = (int)sel->data;
+                row = GPOINTER_TO_INT(sel->data);
                 /* get the clist row for this listitem */
                 sx = (SchedXaction*)gtk_clist_get_row_data( cl, row );
                 /* get the object UD */
@@ -1813,7 +1813,7 @@
         realConfDelOpenMsg = g_string_new( beingEditedMessage );
         beingEditedList = NULL;
         for ( ; sel ; sel = sel->next ) {
-                sx = (SchedXaction*)gtk_clist_get_row_data( cl, (int)sel->data );
+                sx = (SchedXaction*)gtk_clist_get_row_data( cl, GPOINTER_TO_INT(sel->data));
                 g_string_sprintfa( realConfDeleteMsg, "\n\"%s\"",
                                    xaccSchedXactionGetName( sx ) );
                 if ( (l = gnc_find_gui_components( DIALOG_SCHEDXACTION_EDITOR_CM_CLASS,
@@ -1876,7 +1876,7 @@
                         gpointer unused;
                         gboolean foundP;
 
-                        sx = (SchedXaction*)gtk_clist_get_row_data( cl, (int)sel->data );
+                        sx = (SchedXaction*)gtk_clist_get_row_data( cl, GPOINTER_TO_INT(sel->data));
                         sxList = g_list_remove( sxList, (gpointer)sx );
                         foundP = g_hash_table_lookup_extended( sxd->sxData, sx,
                                                                &unused,
@@ -1897,7 +1897,7 @@
                 sel = g_list_reverse( sel );
                 gtk_clist_unselect_all( cl );
                 for ( ; sel; sel = sel->next ) {
-                        gtk_clist_remove( cl, (int)sel->data );
+                        gtk_clist_remove( cl, GPOINTER_TO_INT(sel->data) );
                 }
                 g_list_free( sel );
                 sel = NULL;
Index: dialog-account.c
===================================================================
RCS file: /home/cvs/cvsroot/gnucash/src/gnome-utils/dialog-account.c,v
retrieving revision 1.5.2.2
retrieving revision 1.5.2.3
diff -Lsrc/gnome-utils/dialog-account.c -Lsrc/gnome-utils/dialog-account.c -u -r1.5.2.2 -r1.5.2.3
--- src/gnome-utils/dialog-account.c
+++ src/gnome-utils/dialog-account.c
@@ -1258,7 +1258,7 @@
     {
       text[0] = (gchar *) xaccAccountGetTypeStr(acct_type);
       row = gtk_clist_append(type_list, text);
-      gtk_clist_set_row_data(type_list, row, (gpointer)acct_type);
+      gtk_clist_set_row_data(type_list, row, GINT_TO_POINTER(acct_type));
     }
   }
   else
@@ -1281,7 +1281,7 @@
   if (aw->valid_types == NULL)
     return last_used_account_type;
 
-  if (g_list_index (aw->valid_types, (gpointer)last_used_account_type) != -1)
+  if (g_list_index (aw->valid_types, GINT_TO_POINTER(last_used_account_type)) != -1)
     return last_used_account_type;
 
   return ((GNCAccountType)(aw->valid_types->data));
Index: gnc-query-list.c
===================================================================
RCS file: /home/cvs/cvsroot/gnucash/src/gnome-utils/gnc-query-list.c,v
retrieving revision 1.5.2.2
retrieving revision 1.5.2.3
diff -Lsrc/gnome-utils/gnc-query-list.c -Lsrc/gnome-utils/gnc-query-list.c -u -r1.5.2.2 -r1.5.2.3
--- src/gnome-utils/gnc-query-list.c
+++ src/gnome-utils/gnc-query-list.c
@@ -175,7 +175,7 @@
     if (safe_strcmp (type, QUERYCORE_BOOLEAN))
       continue;
 
-    result = (gboolean)(gnc_search_param_compute_value(param, entry));
+    result = (gboolean) GPOINTER_TO_INT(gnc_search_param_compute_value(param, entry));
     gnc_clist_set_check (clist, row, i, result);
   }
 }
Index: sixtp-dom-parsers.c
===================================================================
RCS file: /home/cvs/cvsroot/gnucash/src/backend/file/sixtp-dom-parsers.c,v
retrieving revision 1.12.2.1
retrieving revision 1.12.2.2
diff -Lsrc/backend/file/sixtp-dom-parsers.c -Lsrc/backend/file/sixtp-dom-parsers.c -u -r1.12.2.1 -r1.12.2.2
--- src/backend/file/sixtp-dom-parsers.c
+++ src/backend/file/sixtp-dom-parsers.c
@@ -480,7 +480,7 @@
 
     ret = g_new(gnc_numeric, 1);
 
-    if(string_to_gnc_numeric(content, ret) != NULL)
+    if(string_to_gnc_numeric(content, ret))
     {
         g_free(content);
         return ret;
Index: gnc-numeric.c
===================================================================
RCS file: /home/cvs/cvsroot/gnucash/src/engine/gnc-numeric.c,v
retrieving revision 1.26
retrieving revision 1.26.2.1
diff -Lsrc/engine/gnc-numeric.c -Lsrc/engine/gnc-numeric.c -u -r1.26 -r1.26.2.1
--- src/engine/gnc-numeric.c
+++ src/engine/gnc-numeric.c
@@ -1105,22 +1105,22 @@
   return result;
 }
 
-const gchar *
+gboolean
 string_to_gnc_numeric(const gchar* str, gnc_numeric *n) {
   int num_read;
   long long int tmpnum;
   long long int tmpdenom;
     
-  if(!str) return NULL;
+  if(!str) return FALSE;
 
   /* must use "<" here because %n's effects aren't well defined */
   if(sscanf(str, " " GNC_SCANF_LLD "/" GNC_SCANF_LLD "%n",
             &tmpnum, &tmpdenom, &num_read) < 2) {
-    return(NULL);
+    return FALSE;
   }
   n->num = tmpnum;
   n->denom = tmpdenom;
-  return(str + num_read);
+  return TRUE;
 }
 
 #ifdef _GNC_NUMERIC_TEST
Index: gnc-numeric.h
===================================================================
RCS file: /home/cvs/cvsroot/gnucash/src/engine/gnc-numeric.h,v
retrieving revision 1.8
retrieving revision 1.8.4.1
diff -Lsrc/engine/gnc-numeric.h -Lsrc/engine/gnc-numeric.h -u -r1.8 -r1.8.4.1
--- src/engine/gnc-numeric.h
+++ src/engine/gnc-numeric.h
@@ -160,8 +160,8 @@
 gchar *gnc_numeric_to_string(gnc_numeric n);
 
 /* Read a gnc_numeric from str, skipping any leading whitespace, and
-   returning a pointer to just past the last byte read.  Return NULL
+   returning TRUE on success with the value in "n".  Return FALSE
    on error. */
-const gchar *string_to_gnc_numeric(const gchar* str, gnc_numeric *n);
+gboolean string_to_gnc_numeric(const gchar* str, gnc_numeric *n);
 
 #endif
Index: gnc-exp-parser.c
===================================================================
RCS file: /home/cvs/cvsroot/gnucash/src/app-utils/gnc-exp-parser.c,v
retrieving revision 1.6
retrieving revision 1.6.2.1
diff -Lsrc/app-utils/gnc-exp-parser.c -Lsrc/app-utils/gnc-exp-parser.c -u -r1.6 -r1.6.2.1
--- src/app-utils/gnc-exp-parser.c
+++ src/app-utils/gnc-exp-parser.c
@@ -107,12 +107,12 @@
         else if (gh_string_p (val_scm))
           {
             char *s;
-            const char *err;
+            gboolean err;
 
             s = gh_scm2newstr (val_scm, NULL);
 
             err = string_to_gnc_numeric (s, &value);
-            if (err == NULL)
+            if (err == FALSE)
               good = FALSE;
 
             free (s);
Index: import-match-map.c
===================================================================
RCS file: /home/cvs/cvsroot/gnucash/src/import-export/import-match-map.c,v
retrieving revision 1.4.2.2
retrieving revision 1.4.2.3
diff -Lsrc/import-export/import-match-map.c -Lsrc/import-export/import-match-map.c -u -r1.4.2.2 -r1.4.2.3
--- src/import-export/import-match-map.c
+++ src/import-export/import-match-map.c
@@ -234,7 +234,7 @@
 
     PINFO("P('%s') = '%d'\n", (char*)key, probability);
 
-    g_hash_table_insert(final_probabilities, key, (gpointer)probability);
+    g_hash_table_insert(final_probabilities, key, GINT_TO_POINTER(probability));
 }
 
 /* Frees an array of the same time that buildProperties built */
@@ -266,10 +266,10 @@
   struct account_info *account_i = (struct account_info*)data;
 
   /* if the current probability is greater than the stored, store the current */
-  if((gint32)value > account_i->probability)
+  if(GPOINTER_TO_INT(value) > account_i->probability)
     {
       /* Save the new highest probability and the assoaciated account name */
-      account_i->probability = (gint32)value;
+      account_i->probability = GPOINTER_TO_INT(value);
       account_i->account_name = key;
     }
 }


More information about the gnucash-changes mailing list