Skip to content

Commit

Permalink
MSVC compatibility: Disable "C99 designated initializers" by a compil…
Browse files Browse the repository at this point in the history
…er-dependent macro

Same as r18755.

git-svn-id: svn+ssh://svn.gnucash.org/repo/gnucash/trunk@18840 57a11ea4-9604-0410-9ed3-97b8803252fd
  • Loading branch information
cstim committed Mar 5, 2010
1 parent 249a8c5 commit 8b646bb
Show file tree
Hide file tree
Showing 11 changed files with 120 additions and 110 deletions.
22 changes: 11 additions & 11 deletions src/business/business-core/gncAddress.c
Original file line number Diff line number Diff line change
Expand Up @@ -457,17 +457,17 @@ int gncAddressCompare (const GncAddress *a, const GncAddress *b)

static QofObject GncAddressDesc =
{
.interface_version = QOF_OBJECT_VERSION,
.e_type = GNC_ID_ADDRESS,
.type_label = "Address",
.create = (gpointer)qofAddressCreate,
.book_begin = NULL,
.book_end = NULL,
.is_dirty = qof_collection_is_dirty,
.mark_clean = qof_collection_mark_clean,
.foreach = qof_collection_foreach,
.printable = NULL,
.version_cmp = (int (*)(gpointer, gpointer)) qof_instance_version_cmp,
DI(.interface_version =) QOF_OBJECT_VERSION,
DI(.e_type =) GNC_ID_ADDRESS,
DI(.type_label =) "Address",
DI(.create =) (gpointer)qofAddressCreate,
DI(.book_begin =) NULL,
DI(.book_end =) NULL,
DI(.is_dirty =) qof_collection_is_dirty,
DI(.mark_clean =) qof_collection_mark_clean,
DI(.foreach =) qof_collection_foreach,
DI(.printable =) NULL,
DI(.version_cmp =) (int (*)(gpointer, gpointer)) qof_instance_version_cmp,
};

gboolean gncAddressRegister (void)
Expand Down
22 changes: 11 additions & 11 deletions src/business/business-core/gncBillTerm.c
Original file line number Diff line number Diff line change
Expand Up @@ -793,17 +793,17 @@ static void _gncBillTermDestroy (QofBook *book)

static QofObject gncBillTermDesc =
{
.interface_version = QOF_OBJECT_VERSION,
.e_type = _GNC_MOD_NAME,
.type_label = "Billing Term",
.create = (gpointer)gncBillTermCreate,
.book_begin = _gncBillTermCreate,
.book_end = _gncBillTermDestroy,
.is_dirty = qof_collection_is_dirty,
.mark_clean = qof_collection_mark_clean,
.foreach = qof_collection_foreach,
.printable = NULL,
.version_cmp = (int (*)(gpointer, gpointer)) qof_instance_version_cmp,
DI(.interface_version =) QOF_OBJECT_VERSION,
DI(.e_type =) _GNC_MOD_NAME,
DI(.type_label =) "Billing Term",
DI(.create =) (gpointer)gncBillTermCreate,
DI(.book_begin =) _gncBillTermCreate,
DI(.book_end =) _gncBillTermDestroy,
DI(.is_dirty =) qof_collection_is_dirty,
DI(.mark_clean =) qof_collection_mark_clean,
DI(.foreach =) qof_collection_foreach,
DI(.printable =) NULL,
DI(.version_cmp =) (int (*)(gpointer, gpointer)) qof_instance_version_cmp,
};

gboolean gncBillTermRegister (void)
Expand Down
10 changes: 10 additions & 0 deletions src/business/business-core/gncBusiness.h
Original file line number Diff line number Diff line change
Expand Up @@ -47,4 +47,14 @@
#define GNC_TAXTABLE_MODULE_NAME GNC_ID_TAXTABLE
#define GNC_VENDOR_MODULE_NAME GNC_ID_VENDOR

#ifndef DI
# ifdef _MSC_VER
/* MSVC compiler doesn't have C99 "designated initializers"
* so we wrap them in a macro that is empty on MSVC. */
# define DI(x) /* */
# else
# define DI(x) x
# endif
#endif

#endif /* GNC_BUSINESS_H_ */
22 changes: 11 additions & 11 deletions src/business/business-core/gncCustomer.c
Original file line number Diff line number Diff line change
Expand Up @@ -715,17 +715,17 @@ static const char * _gncCustomerPrintable (gpointer item)

static QofObject gncCustomerDesc =
{
.interface_version = QOF_OBJECT_VERSION,
.e_type = _GNC_MOD_NAME,
.type_label = "Customer",
.create = (gpointer)gncCustomerCreate,
.book_begin = NULL,
.book_end = NULL,
.is_dirty = qof_collection_is_dirty,
.mark_clean = qof_collection_mark_clean,
.foreach = qof_collection_foreach,
.printable = (const char * (*)(gpointer))gncCustomerGetName,
.version_cmp = (int (*)(gpointer, gpointer)) qof_instance_version_cmp,
DI(.interface_version =) QOF_OBJECT_VERSION,
DI(.e_type =) _GNC_MOD_NAME,
DI(.type_label =) "Customer",
DI(.create =) (gpointer)gncCustomerCreate,
DI(.book_begin =) NULL,
DI(.book_end =) NULL,
DI(.is_dirty =) qof_collection_is_dirty,
DI(.mark_clean =) qof_collection_mark_clean,
DI(.foreach =) qof_collection_foreach,
DI(.printable =) (const char * (*)(gpointer))gncCustomerGetName,
DI(.version_cmp =) (int (*)(gpointer, gpointer)) qof_instance_version_cmp,
};

gboolean gncCustomerRegister (void)
Expand Down
22 changes: 11 additions & 11 deletions src/business/business-core/gncEmployee.c
Original file line number Diff line number Diff line change
Expand Up @@ -544,17 +544,17 @@ listen_for_address_events(QofInstance *entity, QofEventId event_type,

static QofObject gncEmployeeDesc =
{
.interface_version = QOF_OBJECT_VERSION,
.e_type = _GNC_MOD_NAME,
.type_label = "Employee",
.create = (gpointer)gncEmployeeCreate,
.book_begin = NULL,
.book_end = NULL,
.is_dirty = qof_collection_is_dirty,
.mark_clean = qof_collection_mark_clean,
.foreach = qof_collection_foreach,
.printable = _gncEmployeePrintable,
.version_cmp = (int (*)(gpointer, gpointer)) qof_instance_version_cmp,
DI(.interface_version =) QOF_OBJECT_VERSION,
DI(.e_type =) _GNC_MOD_NAME,
DI(.type_label =) "Employee",
DI(.create =) (gpointer)gncEmployeeCreate,
DI(.book_begin =) NULL,
DI(.book_end =) NULL,
DI(.is_dirty =) qof_collection_is_dirty,
DI(.mark_clean =) qof_collection_mark_clean,
DI(.foreach =) qof_collection_foreach,
DI(.printable =) _gncEmployeePrintable,
DI(.version_cmp =) (int (*)(gpointer, gpointer)) qof_instance_version_cmp,
};

gboolean gncEmployeeRegister (void)
Expand Down
22 changes: 11 additions & 11 deletions src/business/business-core/gncEntry.c
Original file line number Diff line number Diff line change
Expand Up @@ -1341,17 +1341,17 @@ int gncEntryCompare (const GncEntry *a, const GncEntry *b)

static QofObject gncEntryDesc =
{
.interface_version = QOF_OBJECT_VERSION,
.e_type = _GNC_MOD_NAME,
.type_label = "Order/Invoice/Bill Entry",
.create = (gpointer)gncEntryCreate,
.book_begin = NULL,
.book_end = NULL,
.is_dirty = qof_collection_is_dirty,
.mark_clean = qof_collection_mark_clean,
.foreach = qof_collection_foreach,
.printable = NULL,
.version_cmp = (int (*)(gpointer, gpointer)) qof_instance_version_cmp,
DI(.interface_version =) QOF_OBJECT_VERSION,
DI(.e_type =) _GNC_MOD_NAME,
DI(.type_label =) "Order/Invoice/Bill Entry",
DI(.create =) (gpointer)gncEntryCreate,
DI(.book_begin =) NULL,
DI(.book_end =) NULL,
DI(.is_dirty =) qof_collection_is_dirty,
DI(.mark_clean =) qof_collection_mark_clean,
DI(.foreach =) qof_collection_foreach,
DI(.printable =) NULL,
DI(.version_cmp =) (int (*)(gpointer, gpointer)) qof_instance_version_cmp,
};

gboolean gncEntryRegister (void)
Expand Down
22 changes: 11 additions & 11 deletions src/business/business-core/gncInvoice.c
Original file line number Diff line number Diff line change
Expand Up @@ -1829,17 +1829,17 @@ static const char * _gncInvoicePrintable (gpointer obj)

static QofObject gncInvoiceDesc =
{
.interface_version = QOF_OBJECT_VERSION,
.e_type = _GNC_MOD_NAME,
.type_label = "Invoice",
.create = (gpointer)gncInvoiceCreate,
.book_begin = NULL,
.book_end = NULL,
.is_dirty = qof_collection_is_dirty,
.mark_clean = qof_collection_mark_clean,
.foreach = qof_collection_foreach,
.printable = _gncInvoicePrintable,
.version_cmp = (int (*)(gpointer, gpointer)) qof_instance_version_cmp,
DI(.interface_version =) QOF_OBJECT_VERSION,
DI(.e_type =) _GNC_MOD_NAME,
DI(.type_label =) "Invoice",
DI(.create =) (gpointer)gncInvoiceCreate,
DI(.book_begin =) NULL,
DI(.book_end =) NULL,
DI(.is_dirty =) qof_collection_is_dirty,
DI(.mark_clean =) qof_collection_mark_clean,
DI(.foreach =) qof_collection_foreach,
DI(.printable =) _gncInvoicePrintable,
DI(.version_cmp =) (int (*)(gpointer, gpointer)) qof_instance_version_cmp,
};

static void
Expand Down
22 changes: 11 additions & 11 deletions src/business/business-core/gncJob.c
Original file line number Diff line number Diff line change
Expand Up @@ -455,17 +455,17 @@ static const char * _gncJobPrintable (gpointer item)

static QofObject gncJobDesc =
{
.interface_version = QOF_OBJECT_VERSION,
.e_type = _GNC_MOD_NAME,
.type_label = "Job",
.create = (gpointer)gncJobCreate,
.book_begin = NULL,
.book_end = NULL,
.is_dirty = qof_collection_is_dirty,
.mark_clean = qof_collection_mark_clean,
.foreach = qof_collection_foreach,
.printable = _gncJobPrintable,
.version_cmp = (int (*)(gpointer, gpointer)) qof_instance_version_cmp,
DI(.interface_version =) QOF_OBJECT_VERSION,
DI(.e_type =) _GNC_MOD_NAME,
DI(.type_label =) "Job",
DI(.create =) (gpointer)gncJobCreate,
DI(.book_begin =) NULL,
DI(.book_end =) NULL,
DI(.is_dirty =) qof_collection_is_dirty,
DI(.mark_clean =) qof_collection_mark_clean,
DI(.foreach =) qof_collection_foreach,
DI(.printable =) _gncJobPrintable,
DI(.version_cmp =) (int (*)(gpointer, gpointer)) qof_instance_version_cmp,
};

gboolean gncJobRegister (void)
Expand Down
22 changes: 11 additions & 11 deletions src/business/business-core/gncOrder.c
Original file line number Diff line number Diff line change
Expand Up @@ -502,17 +502,17 @@ _gncOrderPrintable (gpointer obj)

static QofObject gncOrderDesc =
{
.interface_version = QOF_OBJECT_VERSION,
.e_type = _GNC_MOD_NAME,
.type_label = "Order",
.create = (gpointer)gncOrderCreate,
.book_begin = NULL,
.book_end = NULL,
.is_dirty = qof_collection_is_dirty,
.mark_clean = qof_collection_mark_clean,
.foreach = qof_collection_foreach,
.printable = _gncOrderPrintable,
.version_cmp = (int (*)(gpointer, gpointer)) qof_instance_version_cmp,
DI(.interface_version =) QOF_OBJECT_VERSION,
DI(.e_type =) _GNC_MOD_NAME,
DI(.type_label =) "Order",
DI(.create =) (gpointer)gncOrderCreate,
DI(.book_begin =) NULL,
DI(.book_end =) NULL,
DI(.is_dirty =) qof_collection_is_dirty,
DI(.mark_clean =) qof_collection_mark_clean,
DI(.foreach =) qof_collection_foreach,
DI(.printable =) _gncOrderPrintable,
DI(.version_cmp =) (int (*)(gpointer, gpointer)) qof_instance_version_cmp,
};

gboolean gncOrderRegister (void)
Expand Down
22 changes: 11 additions & 11 deletions src/business/business-core/gncTaxTable.c
Original file line number Diff line number Diff line change
Expand Up @@ -890,17 +890,17 @@ static void _gncTaxTableDestroy (QofBook *book)

static QofObject gncTaxTableDesc =
{
.interface_version = QOF_OBJECT_VERSION,
.e_type = _GNC_MOD_NAME,
.type_label = "Tax Table",
.create = (gpointer)gncTaxTableCreate,
.book_begin = _gncTaxTableCreate,
.book_end = _gncTaxTableDestroy,
.is_dirty = qof_collection_is_dirty,
.mark_clean = qof_collection_mark_clean,
.foreach = qof_collection_foreach,
.printable = NULL,
.version_cmp = (int (*)(gpointer, gpointer)) qof_instance_version_cmp,
DI(.interface_version =) QOF_OBJECT_VERSION,
DI(.e_type =) _GNC_MOD_NAME,
DI(.type_label =) "Tax Table",
DI(.create =) (gpointer)gncTaxTableCreate,
DI(.book_begin =) _gncTaxTableCreate,
DI(.book_end =) _gncTaxTableDestroy,
DI(.is_dirty =) qof_collection_is_dirty,
DI(.mark_clean =) qof_collection_mark_clean,
DI(.foreach =) qof_collection_foreach,
DI(.printable =) NULL,
DI(.version_cmp =) (int (*)(gpointer, gpointer)) qof_instance_version_cmp,
};

gboolean gncTaxTableRegister (void)
Expand Down
22 changes: 11 additions & 11 deletions src/business/business-core/gncVendor.c
Original file line number Diff line number Diff line change
Expand Up @@ -653,17 +653,17 @@ static const char * _gncVendorPrintable (gpointer item)

static QofObject gncVendorDesc =
{
.interface_version = QOF_OBJECT_VERSION,
.e_type = _GNC_MOD_NAME,
.type_label = "Vendor",
.create = (gpointer)gncVendorCreate,
.book_begin = NULL,
.book_end = NULL,
.is_dirty = qof_collection_is_dirty,
.mark_clean = qof_collection_mark_clean,
.foreach = qof_collection_foreach,
.printable = _gncVendorPrintable,
.version_cmp = (int (*)(gpointer, gpointer)) qof_instance_version_cmp,
DI(.interface_version =) QOF_OBJECT_VERSION,
DI(.e_type =) _GNC_MOD_NAME,
DI(.type_label =) "Vendor",
DI(.create =) (gpointer)gncVendorCreate,
DI(.book_begin =) NULL,
DI(.book_end =) NULL,
DI(.is_dirty =) qof_collection_is_dirty,
DI(.mark_clean =) qof_collection_mark_clean,
DI(.foreach =) qof_collection_foreach,
DI(.printable =) _gncVendorPrintable,
DI(.version_cmp =) (int (*)(gpointer, gpointer)) qof_instance_version_cmp,
};

gboolean gncVendorRegister (void)
Expand Down

0 comments on commit 8b646bb

Please sign in to comment.