From 9d6160cfd41c9be2fbda12ea60b1f418843f3e01 Mon Sep 17 00:00:00 2001 From: Christian Stimming Date: Sat, 27 Feb 2010 18:41:28 +0000 Subject: [PATCH] MSVC compatiblity: Struct initialization doesn't work as expected. Somehow, the struct initialization containing a gnc_numeric doesn't work. As an exception, we hand-initialize that member afterwards. git-svn-id: svn+ssh://svn.gnucash.org/repo/gnucash/trunk@18754 57a11ea4-9604-0410-9ed3-97b8803252fd --- src/engine/Account.c | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/src/engine/Account.c b/src/engine/Account.c index 57facef72c..e77ac4994e 100644 --- a/src/engine/Account.c +++ b/src/engine/Account.c @@ -3311,7 +3311,15 @@ xaccAccountGetXxxBalanceInCurrencyRecursive (const Account *acc, /* If needed, sum up the children converting to the *requested* commodity. */ if (include_children) { +#ifdef _MSC_VER + /* MSVC compiler: Somehow, the struct initialization containing a + gnc_numeric doesn't work. As an exception, we hand-initialize + that member afterwards. */ + CurrencyBalance cb = { report_commodity, { 0 }, fn, NULL, 0 }; + cb.balance = balance; +#else CurrencyBalance cb = { report_commodity, balance, fn, NULL, 0 }; +#endif gnc_account_foreach_descendant (acc, xaccAccountBalanceHelper, &cb); balance = cb.balance; @@ -3339,7 +3347,15 @@ xaccAccountGetXxxBalanceAsOfDateInCurrencyRecursive ( /* If needed, sum up the children converting to the *requested* commodity. */ if (include_children) { +#ifdef _MSC_VER + /* MSVC compiler: Somehow, the struct initialization containing a + gnc_numeric doesn't work. As an exception, we hand-initialize + that member afterwards. */ + CurrencyBalance cb = { report_commodity, 0, NULL, fn, date }; + cb.balance = balance; +#else CurrencyBalance cb = { report_commodity, balance, NULL, fn, date }; +#endif gnc_account_foreach_descendant (acc, xaccAccountBalanceAsOfDateHelper, &cb); balance = cb.balance;