r18254 - gnucash/trunk/src/backend/sql - Fix CRIT messages when loading budgets

Phil Longstaff plongstaff at rogers.com
Mon Aug 17 11:23:15 EDT 2009


It can.  It is supposed to match type QofSetterFunc which takes a gpointer 2nd argument.  There are plenty of places that I cast to/from QofSetterFunc, though.

When I check in the fix, I'll use gint to match the other "set int" functions.




________________________________
From: Herbert Thoma <herbert.thoma at iis.fraunhofer.de>
To: Phil Longstaff <plongstaff at rogers.com>
Cc: gnucash-devel at gnucash.org
Sent: Monday, August 17, 2009 11:17:50 AM
Subject: Re: r18254 - gnucash/trunk/src/backend/sql - Fix CRIT messages when loading budgets

One more (may be stupid) question:

Herbert Thoma schrieb:
> Phil Longstaff schrieb:
>> No, it should be info->period_num = GPOINTER_TO_UINT(val).  It is passed
>> by value, not reference.

Why is val a gpointer then? Why can't the type just be uint?

static void
set_period_num( gpointer pObj, gpointer val )
{
    budget_amount_info_t* info = (budget_amount_info_t*)pObj;

    g_return_if_fail( pObj != NULL );

    info->period_num = GPOINTER_TO_UINT(val);
}

> OK, that fixed the compiler error.
> 
> I guess you will commit the fix to svn.
> 
> Thanks,
>  Herbert.
> 
>> Phil
>>
>> ------------------------------------------------------------------------
>> *From:* Herbert Thoma <herbert.thoma at iis.fraunhofer.de>
>> *To:* gnucash-devel at gnucash.org; Phil Longstaff <plongstaff at rogers.com>
>> *Sent:* Monday, August 17, 2009 10:49:11 AM
>> *Subject:* Re: r18254 - gnucash/trunk/src/backend/sql - Fix CRIT
>> messages when loading budgets
>>
>> Hi Phil,
>>
>> I don't know if it is caused by this change, but I get a
>> compiler error:
>>
>> gnc-budget-sql.c: In function ‘set_period_num’:
>> gnc-budget-sql.c:156: error: cast from pointer to integer of different size
>>
>> The offending line is:
>>
>>         info->period_num = (guint)val;
>>
>> Perhaps you meant something like this:
>>
>>         info->period_num = *((guint *)val);
>>
>> Herbert.
>>
>> Phil Longstaff schrieb:
>>> Author: plongstaff
>>> Date: 2009-08-16 13:09:28 -0400 (Sun, 16 Aug 2009)
>>> New Revision: 18254
>>> Trac: http://svn.gnucash.org/trac/changeset/18254
>>>
>>> Modified:
>>>    gnucash/trunk/src/backend/sql/gnc-budget-sql.c
>>> Log:
>>> Fix CRIT messages when loading budgets
>>>
>>>
>>> _______________________________________________
>>> gnucash-patches mailing list
>>> gnucash-patches at gnucash.org <mailto:gnucash-patches at gnucash.org>
>>> https://lists.gnucash.org/mailman/listinfo/gnucash-patches
>>>
>> -- 
>> Herbert Thoma
>> Dipl.-Ing., MBA
>> Head of Video Group
>> Multimedia Realtime Systems Department
>> Fraunhofer IIS
>> Am Wolfsmantel 33, 91058 Erlangen, Germany
>> Phone: +49-9131-776-6130
>> Fax:  +49-9131-776-6099
>> email: tma at iis.fhg.de <mailto:tma at iis.fhg.de>
>> www: http://www.iis.fhg.de/
> 

-- 
Herbert Thoma
Dipl.-Ing., MBA
Head of Video Group
Multimedia Realtime Systems Department
Fraunhofer IIS
Am Wolfsmantel 33, 91058 Erlangen, Germany
Phone: +49-9131-776-6130
Fax:   +49-9131-776-6099
email: tma at iis.fhg.de
www: http://www.iis.fhg.de/


More information about the gnucash-devel mailing list