r15772 - gnucash/gobject-engine-dev-warlord - Preparation for QofEntity -> QofInstance:

Derek Atkins warlord at cvs.gnucash.org
Sun Apr 1 18:18:33 EDT 2007


Author: warlord
Date: 2007-04-01 18:18:30 -0400 (Sun, 01 Apr 2007)
New Revision: 15772
Trac: http://svn.gnucash.org/trac/changeset/15772

Modified:
   gnucash/gobject-engine-dev-warlord/
   gnucash/gobject-engine-dev-warlord/lib/libqof/backend/file/qsf-backend.c
   gnucash/gobject-engine-dev-warlord/lib/libqof/backend/file/qsf-xml.c
   gnucash/gobject-engine-dev-warlord/lib/libqof/qof/qofid.c
   gnucash/gobject-engine-dev-warlord/lib/libqof/qof/qofid.h
   gnucash/gobject-engine-dev-warlord/lib/libqof/qof/qofinstance-p.h
   gnucash/gobject-engine-dev-warlord/lib/libqof/qof/qofinstance.c
   gnucash/gobject-engine-dev-warlord/lib/libqof/qof/qofreference.c
   gnucash/gobject-engine-dev-warlord/lib/libqof/qof/qofsession.c
   gnucash/gobject-engine-dev-warlord/src/backend/postgres/book.c
   gnucash/gobject-engine-dev-warlord/src/backend/postgres/events.c
   gnucash/gobject-engine-dev-warlord/src/business/business-core/gncInvoice.c
   gnucash/gobject-engine-dev-warlord/src/business/business-core/gncJob.c
   gnucash/gobject-engine-dev-warlord/src/business/business-core/gncOwner.c
   gnucash/gobject-engine-dev-warlord/src/engine/test/test-recursive.c
   gnucash/gobject-engine-dev-warlord/src/gnome/dialog-chart-export.c
   gnucash/gobject-engine-dev-warlord/src/gnome/druid-hierarchy.c
Log:
Preparation for QofEntity -> QofInstance:
- Convert (QofEntity*)x to QOF_ENTITY(x)
- Move qof_entity_init() and friends into qof_instance and rename
- Move QofEntity contents into QofInstance
(note:  this doesn't compile)



Property changes on: gnucash/gobject-engine-dev-warlord
___________________________________________________________________
Name: svk:merge
   - 3889ce50-311e-0410-a464-f059747ec5d1:/local/gnucash/branches/swig-redo:802
3889ce50-311e-0410-a464-f059747ec5d1:/local/gnucash/trunk:1037
d2ab10a8-8a95-4986-baff-8d511d9f15b2:/local/gnucash/trunk:14282
d2ab10a8-8a95-4986-baff-8d511d9f15b2:/local/gnucash/trunk2:13366
   + 3889ce50-311e-0410-a464-f059747ec5d1:/local/gnucash/branches/swig-redo:802
3889ce50-311e-0410-a464-f059747ec5d1:/local/gnucash/trunk:1037
d2ab10a8-8a95-4986-baff-8d511d9f15b2:/local/gnucash/branches/gobject-engine-dev-warlord:14364
d2ab10a8-8a95-4986-baff-8d511d9f15b2:/local/gnucash/trunk:14282
d2ab10a8-8a95-4986-baff-8d511d9f15b2:/local/gnucash/trunk2:13366

Modified: gnucash/gobject-engine-dev-warlord/lib/libqof/backend/file/qsf-backend.c
===================================================================
--- gnucash/gobject-engine-dev-warlord/lib/libqof/backend/file/qsf-backend.c	2007-04-01 13:23:54 UTC (rev 15771)
+++ gnucash/gobject-engine-dev-warlord/lib/libqof/backend/file/qsf-backend.c	2007-04-01 22:18:30 UTC (rev 15772)
@@ -739,7 +739,7 @@
 		g_free(ref_name);
 	}
 	else {
-		ent = (QofEntity*)ref_param->param_getfcn(ent, ref_param);
+		ent = QOF_ENTITY(ref_param->param_getfcn(ent, ref_param));
 		if(!ent) { return; }
 		if((0 == safe_strcmp(ref_param->param_type, QOF_TYPE_COLLECT)) ||
 			(0 == safe_strcmp(ref_param->param_type, QOF_TYPE_CHOICE)))
@@ -827,7 +827,7 @@
 		if(0 == safe_strcmp(qof_param->param_type, QOF_TYPE_CHOICE))
 		{
 			/** \todo use the reference list here. */
-			choice_ent = (QofEntity*)qof_param->param_getfcn(ent, qof_param);
+			choice_ent = QOF_ENTITY(qof_param->param_getfcn(ent, qof_param));
 			if(!choice_ent) {
 				param_list = g_slist_next(param_list);
 				continue;

Modified: gnucash/gobject-engine-dev-warlord/lib/libqof/backend/file/qsf-xml.c
===================================================================
--- gnucash/gobject-engine-dev-warlord/lib/libqof/backend/file/qsf-xml.c	2007-04-01 13:23:54 UTC (rev 15771)
+++ gnucash/gobject-engine-dev-warlord/lib/libqof/backend/file/qsf-xml.c	2007-04-01 22:18:30 UTC (rev 15772)
@@ -355,7 +355,7 @@
 			DEBUG (" trying to set book GUID");
 			buffer = g_strdup((gchar*)xmlNodeGetContent(child_node));
 			g_return_if_fail(TRUE == string_to_guid(buffer, &book_guid));
-			qof_entity_set_guid((QofEntity*)params->book, &book_guid);
+			qof_entity_set_guid(QOF_ENTITY(params->book), &book_guid);
 			xmlNewChild(params->output_node, params->qsf_ns, 
 			BAD_CAST QSF_BOOK_GUID, BAD_CAST buffer);
 			g_free(buffer);

Modified: gnucash/gobject-engine-dev-warlord/lib/libqof/qof/qofid.c
===================================================================
--- gnucash/gobject-engine-dev-warlord/lib/libqof/qof/qofid.c	2007-04-01 13:23:54 UTC (rev 15771)
+++ gnucash/gobject-engine-dev-warlord/lib/libqof/qof/qofid.c	2007-04-01 22:18:30 UTC (rev 15772)
@@ -58,67 +58,6 @@
 
 /* =============================================================== */
 
-static void qof_collection_remove_entity (QofEntity *ent);
-
-void
-qof_entity_init (QofEntity *ent, QofIdType type, QofCollection * tab)
-{
-  g_return_if_fail (NULL != tab);
-  
-  /* XXX We passed redundant info to this routine ... but I think that's
-   * OK, it might eliminate programming errors. */
-  if (safe_strcmp(tab->e_type, type))
-  {
-    PERR ("attempt to insert \"%s\" into \"%s\"", type, tab->e_type);
-    return;
-  }
-  ent->e_type = CACHE_INSERT (type);
-
-  do
-  {
-    guid_new(&ent->guid);
-
-    if (NULL == qof_collection_lookup_entity (tab, &ent->guid)) break;
-
-    PWARN("duplicate id created, trying again");
-  } while(1);
- 
-  ent->collection = tab;
-
-  qof_collection_insert_entity (tab, ent);
-}
-
-void
-qof_entity_release (QofEntity *ent)
-{
-  if (!ent->collection) return;
-  qof_collection_remove_entity (ent);
-  CACHE_REMOVE (ent->e_type);
-  ent->e_type = NULL;
-}
-
-
-/* This is a restricted function, should be used only during 
- * read from file */
-void
-qof_entity_set_guid (QofEntity *ent, const GUID *guid)
-{
-  QofCollection *col;
-  if (guid_equal (guid, &ent->guid)) return;
-
-  col = ent->collection;
-  qof_collection_remove_entity (ent);
-  ent->guid = *guid;
-  qof_collection_insert_entity (col, ent);
-}
-
-const GUID *
-qof_entity_get_guid (const QofEntity *ent)
-{
-  if (!ent) return guid_null();
-  return &ent->guid;
-}
-
 /* =============================================================== */
 
 static guint
@@ -189,7 +128,7 @@
 
 /* =============================================================== */
 
-static void
+void
 qof_collection_remove_entity (QofEntity *ent)
 {
   QofCollection *col;
@@ -322,7 +261,7 @@
 	coll = qof_collection_new(type);
 	for(list = glist; list != NULL; list = list->next)
 	{
-		ent = (QofEntity*)list->data;
+		ent = QOF_ENTITY(list->data);
 		if(FALSE == qof_collection_add_entity(coll, ent))
 		{
 			return NULL;

Modified: gnucash/gobject-engine-dev-warlord/lib/libqof/qof/qofid.h
===================================================================
--- gnucash/gobject-engine-dev-warlord/lib/libqof/qof/qofid.h	2007-04-01 13:23:54 UTC (rev 15771)
+++ gnucash/gobject-engine-dev-warlord/lib/libqof/qof/qofid.h	2007-04-01 22:18:30 UTC (rev 15772)
@@ -83,15 +83,15 @@
 /** QofLogModule declaration */
 typedef const gchar* QofLogModule;
 
+/* Forward declaration for later */
+typedef struct QofInstance_s QofInstance;
+
 #define QOF_ID_NONE           NULL
 #define QOF_ID_NULL           "null"
 
 #define QOF_ID_BOOK           "Book"
 #define QOF_ID_SESSION        "Session"
 
-/** simple,cheesy cast but holds water for now */
-#define QOF_ENTITY(object) ((QofEntity *)(object))
-
 /** Inline string comparision; compiler will optimize away most of this */
 #define QSTRCMP(da,db) ({                \
   gint val = 0;                          \
@@ -124,8 +124,6 @@
      (obj);                                                   \
   }))
 
-/** QofEntity declaration */
-typedef struct QofEntity_s QofEntity;
 /** QofCollection declaration 
 
 @param e_type QofIdType
@@ -136,20 +134,6 @@
 */
 typedef struct QofCollection_s QofCollection;
 
-/** QofEntity structure
-
- at param e_type 	Entity type
- at param guid		GUID for the entity
- at param collection	Entity collection
-*/
-
-struct QofEntity_s
-{
-	QofIdType        e_type;
-	GUID             guid;
-	QofCollection  * collection;
-};
-
 /** @name QOF Entity Initialization & Shutdown 
  @{ */
 /** Initialise the memory associated with an entity */
@@ -198,7 +182,7 @@
 /** Find the entity going only from its guid */
 QofEntity * qof_collection_lookup_entity (const QofCollection *, const GUID *);
 
-/** Callback type for qof_entity_foreach */
+/** Callback type for qof_collection_foreach */
 typedef void (*QofEntityForeachCB) (QofEntity *, gpointer user_data);
 
 /** Call the callback for each entity in the collection. */
@@ -240,6 +224,8 @@
 gboolean
 qof_collection_add_entity (QofCollection *coll, QofEntity *ent);
 
+void qof_collection_remove_entity (QofEntity *ent);
+
 /** \brief Merge two QOF_TYPE_COLLECT of the same type.
 
 \note \b NOT the same as the main collections in the book.

Modified: gnucash/gobject-engine-dev-warlord/lib/libqof/qof/qofinstance-p.h
===================================================================
--- gnucash/gobject-engine-dev-warlord/lib/libqof/qof/qofinstance-p.h	2007-04-01 13:23:54 UTC (rev 15771)
+++ gnucash/gobject-engine-dev-warlord/lib/libqof/qof/qofinstance-p.h	2007-04-01 22:18:30 UTC (rev 15772)
@@ -40,7 +40,9 @@
 struct QofInstance_s
 {
    /* Globally unique id identifying this instance */
-   QofEntity entity;
+   QofIdType        e_type;		   /**<	Entity type */
+   GUID             guid;		   /**< GUID for the entity */
+   QofCollection  * collection;		   /**< Entity collection */
 
    /* The entity_table in which this instance is stored */
    QofBook * book;

Modified: gnucash/gobject-engine-dev-warlord/lib/libqof/qof/qofinstance.c
===================================================================
--- gnucash/gobject-engine-dev-warlord/lib/libqof/qof/qofinstance.c	2007-04-01 13:23:54 UTC (rev 15771)
+++ gnucash/gobject-engine-dev-warlord/lib/libqof/qof/qofinstance.c	2007-04-01 22:18:30 UTC (rev 15772)
@@ -39,6 +39,67 @@
 
 /* ========================================================== */
 
+static void
+qof_int_entity_init (QofEntity *ent, QofIdType type, QofCollection * tab)
+{
+  g_return_if_fail (NULL != tab);
+  
+  /* XXX We passed redundant info to this routine ... but I think that's
+   * OK, it might eliminate programming errors. */
+  if (safe_strcmp(tab->e_type, type))
+  {
+    PERR ("attempt to insert \"%s\" into \"%s\"", type, tab->e_type);
+    return;
+  }
+  ent->e_type = CACHE_INSERT (type);
+
+  do
+   {
+    guid_new(&ent->guid);
+
+    if (NULL == qof_collection_lookup_entity (tab, &ent->guid)) break;
+
+    PWARN("duplicate id created, trying again");
+  } while(1);
+ 
+  ent->collection = tab;
+
+  qof_collection_insert_entity (tab, ent);
+}
+
+void
+qof_int_entity_release (QofEntity *ent)
+{
+  if (!ent->collection) return;
+  qof_collection_remove_entity (ent);
+  CACHE_REMOVE (ent->e_type);
+  ent->e_type = NULL;
+}
+
+
+/* This is a restricted function, should be used only during 
+ * read from file */
+void
+qof_entity_set_guid (QofEntity *ent, const GUID *guid)
+{
+  QofCollection *col;
+  if (guid_equal (guid, &ent->guid)) return;
+
+  col = ent->collection;
+  qof_collection_remove_entity (ent);
+  ent->guid = *guid;
+  qof_collection_insert_entity (col, ent);
+}
+
+const GUID *
+qof_entity_get_guid (const QofEntity *ent)
+{
+  if (!ent) return guid_null();
+  return &ent->guid;
+}
+
+/* ========================================================== */
+
 QofInstance*
 qof_instance_create (QofIdType type, QofBook *book)
 {
@@ -49,6 +110,8 @@
 	return inst;
 }
 
+
+
 void
 qof_instance_init (QofInstance *inst, QofIdType type, QofBook *book)
 {
@@ -64,7 +127,7 @@
 	inst->infant = TRUE;
 
 	col = qof_book_get_collection (book, type);
-	qof_entity_init (&inst->entity, type, col);
+	qof_int_entity_init (&inst->entity, type, col);
 }
 
 void
@@ -75,7 +138,7 @@
 	inst->editlevel = 0;
 	inst->do_free = FALSE;
 	inst->dirty = FALSE;
-	qof_entity_release (&inst->entity);
+	qof_int_entity_release (&inst->entity);
 }
 
 const GUID *

Modified: gnucash/gobject-engine-dev-warlord/lib/libqof/qof/qofreference.c
===================================================================
--- gnucash/gobject-engine-dev-warlord/lib/libqof/qof/qofreference.c	2007-04-01 13:23:54 UTC (rev 15771)
+++ gnucash/gobject-engine-dev-warlord/lib/libqof/qof/qofreference.c	2007-04-01 22:18:30 UTC (rev 15772)
@@ -122,7 +122,7 @@
 	char                cm_sa[GUID_ENCODING_LENGTH + 1];
 	gchar              *cm_string;
 
-	ref_ent = (QofEntity*)param->param_getfcn(ent, param);
+	ref_ent = QOF_ENTITY(param->param_getfcn(ent, param));
 	if(!ref_ent) { return NULL; }
 	reference = g_new0(QofEntityReference, 1);
 	reference->type = ent->e_type;

Modified: gnucash/gobject-engine-dev-warlord/lib/libqof/qof/qofsession.c
===================================================================
--- gnucash/gobject-engine-dev-warlord/lib/libqof/qof/qofsession.c	2007-04-01 13:23:54 UTC (rev 15771)
+++ gnucash/gobject-engine-dev-warlord/lib/libqof/qof/qofsession.c	2007-04-01 22:18:30 UTC (rev 15772)
@@ -514,7 +514,7 @@
 		registered_type = TRUE;
 	}
 	if(registered_type == FALSE) {
-/*		referenceEnt = (QofEntity*)cm_param->param_getfcn(importEnt, cm_param);
+/*		referenceEnt = QOF_ENTITY(cm_param->param_getfcn(importEnt, cm_param));
 		if(!referenceEnt) { return; }
 		if(!referenceEnt->e_type) { return; }*/
 		reference = qof_entity_get_reference_from(importEnt, cm_param);
@@ -555,7 +555,7 @@
 	const GUID *g;
 	
 	g_return_if_fail(data != NULL);
-	original = (QofEntity*)data;
+	original = QOF_ENTITY(data);
 	g_return_if_fail(user_data != NULL);
 	qecd = (QofEntityCopyData*)user_data;
 	if(qof_entity_guid_match(qecd->new_session, original)) { return; }
@@ -756,7 +756,7 @@
 			}
 			continue;
 		}
-		ref_ent = (QofEntity*)ref_param->param_getfcn(ent, ref_param);
+		ref_ent = QOF_ENTITY(ref_param->param_getfcn(ent, ref_param));
 		if((ref_ent)&&(ref_ent->e_type))
 		{
 			store->success = qof_entity_copy_to_session(session, ref_ent);
@@ -766,7 +766,7 @@
 	for(i = ent_list; i != NULL; i = i->next)
 	{
 		if(i->data == NULL) { continue; }
-		child_ent = (QofEntity*)i->data;
+		child_ent = QOF_ENTITY(i->data);
 		if(child_ent == NULL) { continue; }
 		ref_list = qof_class_get_referenceList(child_ent->e_type);
 		for(j = ref_list; j != NULL; j = j->next)
@@ -784,7 +784,7 @@
 	for(i = child_list; i != NULL; i = i->next)
 	{
 		if(i->data == NULL) { continue; }
-		ref_ent = (QofEntity*)i->data;
+		ref_ent = QOF_ENTITY(i->data);
 		if(ref_ent == NULL) { continue; }
 		ref_list = qof_class_get_referenceList(ref_ent->e_type);
 		for(j = ref_list; j != NULL; j = j->next)

Modified: gnucash/gobject-engine-dev-warlord/src/backend/postgres/book.c
===================================================================
--- gnucash/gobject-engine-dev-warlord/src/backend/postgres/book.c	2007-04-01 13:23:54 UTC (rev 15771)
+++ gnucash/gobject-engine-dev-warlord/src/backend/postgres/book.c	2007-04-01 22:18:30 UTC (rev 15772)
@@ -139,7 +139,7 @@
    guid = nullguid;  /* just in case the read fails ... */
    string_to_guid (DB_GET_VAL("bookGuid",j), &guid);
 
-   qof_entity_set_guid ((QofEntity*)book, &guid);
+   qof_entity_set_guid (QOF_ENTITY(book), &guid);
 
    if((DB_GET_VAL("book_open",j))[0] == 'n')
    {
@@ -208,14 +208,14 @@
    for (node=blist; node; node=node->next)
    {
       book = node->data;
-      if (guid_equal (qof_entity_get_guid((QofEntity*)book), &guid)) break;
+      if (guid_equal (qof_entity_get_guid(QOF_ENTITY(book)), &guid)) break;
       book = NULL;
    }
    
    if (!book) 
    {
       book = qof_book_new();
-      qof_entity_set_guid ((QofEntity*)book, &guid);
+      qof_entity_set_guid (QOF_ENTITY(book), &guid);
    }
 
    if((DB_GET_VAL("book_open",j))[0] == 'n')

Modified: gnucash/gobject-engine-dev-warlord/src/backend/postgres/events.c
===================================================================
--- gnucash/gobject-engine-dev-warlord/src/backend/postgres/events.c	2007-04-01 13:23:54 UTC (rev 15771)
+++ gnucash/gobject-engine-dev-warlord/src/backend/postgres/events.c	2007-04-01 22:18:30 UTC (rev 15772)
@@ -290,14 +290,14 @@
 
                /* if the remote user created an account, mirror it here */
                acc = pgendCopyAccountToEngine (be, &(ev->guid));
-               ent = (QofEntity*)acc;
+               ent = QOF_ENTITY(acc);
                break;
             }
             case QOF_EVENT_DESTROY: {
                Account * acc = pgendAccountLookup (be, &(ev->guid));
                xaccAccountBeginEdit (acc);
                xaccAccountDestroy (acc);
-               ent = (QofEntity*)acc;
+               ent = QOF_ENTITY(acc);
                break;
             }
          }
@@ -319,7 +319,7 @@
                /* don't mirror transaction creations. If a register needs
                 * it, it will do a query. */
                trans = pgendTransLookup (be, &(ev->guid));
-               ent = (QofEntity*)trans;
+               ent = QOF_ENTITY(trans);
                PINFO ("create transaction");
                break;
 			}
@@ -327,7 +327,7 @@
                Transaction *trans;
                trans = pgendTransLookup (be, &(ev->guid));
                pgendCopyTransactionToEngine (be, &(ev->guid));
-               ent = (QofEntity*)trans;
+               ent = QOF_ENTITY(trans);
                break;
 			}
             case QOF_EVENT_DESTROY: {
@@ -336,7 +336,7 @@
                /* mark trans for freeing */
                xaccTransDestroy (trans);
                xaccTransCommitEdit (trans);
-               ent = (QofEntity*)trans;
+               ent = QOF_ENTITY(trans);
                break;
             }
          }

Modified: gnucash/gobject-engine-dev-warlord/src/business/business-core/gncInvoice.c
===================================================================
--- gnucash/gobject-engine-dev-warlord/src/business/business-core/gncInvoice.c	2007-04-01 13:23:54 UTC (rev 15771)
+++ gnucash/gobject-engine-dev-warlord/src/business/business-core/gncInvoice.c	2007-04-01 22:18:30 UTC (rev 15772)
@@ -463,14 +463,14 @@
 qofInvoiceGetOwner (GncInvoice *invoice)
 {
 	if(!invoice) { return NULL; }
-	return (QofEntity*)&invoice->owner;
+	return QOF_ENTITY(&invoice->owner);
 }
 
 static QofEntity*
 qofInvoiceGetBillTo (GncInvoice *invoice)
 {
 	if(!invoice) { return NULL; }
-	return (QofEntity*)&invoice->billto;
+	return QOF_ENTITY(&invoice->billto);
 }
 
 Timespec gncInvoiceGetDateOpened (GncInvoice *invoice)
@@ -660,7 +660,7 @@
 	entry_coll = qof_collection_new(GNC_ID_ENTRY);
 	for(list = gncInvoiceGetEntries(invoice); list != NULL; list = list->next)
 	{
-		entry = (QofEntity*)list->data;
+		entry = QOF_ENTITY(list->data);
 		qof_collection_add_entity(entry_coll, entry);
 	}
 	return entry_coll;

Modified: gnucash/gobject-engine-dev-warlord/src/business/business-core/gncJob.c
===================================================================
--- gnucash/gobject-engine-dev-warlord/src/business/business-core/gncJob.c	2007-04-01 13:23:54 UTC (rev 15771)
+++ gnucash/gobject-engine-dev-warlord/src/business/business-core/gncJob.c	2007-04-01 22:18:30 UTC (rev 15772)
@@ -319,7 +319,7 @@
 qofJobGetOwner (GncJob *job)
 {
 	if(!job) { return NULL; }
-	return (QofEntity*)qofOwnerGetOwner(&job->owner);
+	return QOF_ENTITY(qofOwnerGetOwner(&job->owner));
 }
 
 /* Other functions */

Modified: gnucash/gobject-engine-dev-warlord/src/business/business-core/gncOwner.c
===================================================================
--- gnucash/gobject-engine-dev-warlord/src/business/business-core/gncOwner.c	2007-04-01 13:23:54 UTC (rev 15771)
+++ gnucash/gobject-engine-dev-warlord/src/business/business-core/gncOwner.c	2007-04-01 22:18:30 UTC (rev 15772)
@@ -154,19 +154,19 @@
 			break;
 		}
 		case GNC_OWNER_CUSTOMER : {
-			ent = (QofEntity*)owner->owner.customer;
+			ent = QOF_ENTITY(owner->owner.customer);
 			break;
 		}
 		case GNC_OWNER_JOB : {
-			ent = (QofEntity*)owner->owner.job;
+			ent = QOF_ENTITY(owner->owner.job);
 			break;
 		}
 		case GNC_OWNER_VENDOR : {
-			ent = (QofEntity*)owner->owner.vendor;
+			ent = QOF_ENTITY(owner->owner.vendor);
 			break;
 		}
 		case GNC_OWNER_EMPLOYEE : {
-			ent = (QofEntity*)owner->owner.employee;
+			ent = QOF_ENTITY(owner->owner.employee);
 			break;
 		}
 	}

Modified: gnucash/gobject-engine-dev-warlord/src/engine/test/test-recursive.c
===================================================================
--- gnucash/gobject-engine-dev-warlord/src/engine/test/test-recursive.c	2007-04-01 13:23:54 UTC (rev 15771)
+++ gnucash/gobject-engine-dev-warlord/src/engine/test/test-recursive.c	2007-04-01 22:18:30 UTC (rev 15772)
@@ -258,7 +258,7 @@
 	col = qof_collection_new(CHILD_MODULE_NAME);
 	for(list = g_list_copy(g->descend);list;list=list->next)
 	{
-		ent = (QofEntity*)list->data;
+		ent = QOF_ENTITY(list->data);
 		if(!ent) { break; }
 		do_test(0 == safe_strcmp(ent->e_type, CHILD_MODULE_NAME), "wrong entity");
 		qof_collection_add_entity(col, ent);
@@ -871,7 +871,7 @@
 			{
 				QofEntity *ent;
 
-				ent = (QofEntity*)child1;
+				ent = QOF_ENTITY(child1);
 				qof_collection_add_entity(coll, ent);
 				grand_setDescend(grand1, coll);
 				qof_collection_destroy(coll);
@@ -913,7 +913,7 @@
 	c->collect = qof_collection_count(coll);
 	if(c->book) { qof_book_set_references(c->book); }
 	param = qof_class_get_parameter(GRAND_MODULE_NAME, OBJ_RELATIVE);
-	parent = (QofEntity*)param->param_getfcn(ent, param);
+	parent = QOF_ENTITY(param->param_getfcn(ent, param));
 	testp = grand_getChild((mygrand*)ent);
 	/* not all grandparents have family so just keep count. */
 	if(!parent) { c->nulls++; return; }

Modified: gnucash/gobject-engine-dev-warlord/src/gnome/dialog-chart-export.c
===================================================================
--- gnucash/gobject-engine-dev-warlord/src/gnome/dialog-chart-export.c	2007-04-01 13:23:54 UTC (rev 15771)
+++ gnucash/gobject-engine-dev-warlord/src/gnome/dialog-chart-export.c	2007-04-01 22:18:30 UTC (rev 15772)
@@ -151,7 +151,7 @@
 	xaccSplitSetValue (split, balance);
 	ref = qof_class_get_referenceList(GNC_ID_SPLIT);
 	while(ref != NULL) {
-		ent_ref = qof_entity_get_reference_from((QofEntity*)split, ref->data);
+		ent_ref = qof_entity_get_reference_from(QOF_ENTITY(split), ref->data);
 		qof_session_update_reference_list(data->chart_session, ent_ref);
 		ref = g_list_next(ref);
 	}
@@ -168,14 +168,14 @@
 	xaccAccountCommitEdit (acc_ent);
 	ref = qof_class_get_referenceList(GNC_ID_TRANS);
 	while(ref != NULL) {
-		ent_ref = qof_entity_get_reference_from((QofEntity*)trans, ref->data);
+		ent_ref = qof_entity_get_reference_from(QOF_ENTITY(trans), ref->data);
 		qof_session_update_reference_list(data->chart_session, ent_ref);
 		ref = g_list_next(ref);
 	}
 	g_list_free(ref);
 	ref = qof_class_get_referenceList(GNC_ID_SPLIT);
 	while(ref != NULL) {
-		ent_ref = qof_entity_get_reference_from((QofEntity*)split, ref->data);
+		ent_ref = qof_entity_get_reference_from(QOF_ENTITY(split), ref->data);
 		qof_session_update_reference_list(data->chart_session, ent_ref);
 		ref = g_list_next(ref);
 	}

Modified: gnucash/gobject-engine-dev-warlord/src/gnome/druid-hierarchy.c
===================================================================
--- gnucash/gobject-engine-dev-warlord/src/gnome/druid-hierarchy.c	2007-04-01 13:23:54 UTC (rev 15771)
+++ gnucash/gobject-engine-dev-warlord/src/gnome/druid-hierarchy.c	2007-04-01 22:18:30 UTC (rev 15772)
@@ -754,7 +754,7 @@
 	  g_object_set (G_OBJECT(cell), "text", "", NULL);
 	}
 	set_final_balance (data->balance_hash, account, amount);
-	qof_event_gen ((QofEntity*)account, QOF_EVENT_MODIFY, NULL);
+	qof_event_gen (QOF_ENTITY(account), QOF_EVENT_MODIFY, NULL);
 }
 
 static void



More information about the gnucash-changes mailing list