speechd-discuss
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[PATCH] Fix most warnings with gcc 4.4 on Linux


From: Boris Dusek
Subject: [PATCH] Fix most warnings with gcc 4.4 on Linux
Date: Tue, 7 Sep 2010 17:55:29 +0200

On Sep 7, 2010, at 4:18 PM, Bohdan R. Rau wrote:

>> src/server/history.c:38: warning: cast from pointer to integer of
>> different size
>> - I don't understand this one at all, the code seems correct. There is
> no
>> conversion from pointer to integer visible to me at all.
> 
> 
> Yes, there is.
> 
> the "value" is declared as pointer (64-bit in your architecture), and is
> casted to 32-bit int.
> 
> Try change "(int) value" into "(long) value". 
> 
> As the history code should be rewritten (in fact the history doesn't work
> at all) - it has no meaning now.

you are right, thanks for pointing this out. the problem with me was that
when I looked at the code and saw variable named "value" cast to int, the
name "value" confused me and I immediately thought "that can't be a pointer".

The resolution is quite different, the message_compare_id is an equality
predicate function supplied to g_list_find_custom below, and value is a
pointer to id. The correct fix is to dereference the value. So this compiler
warning was really to the point. Unless I am completely misunderstanding
something about history.

The patch is below, along with some other small cleanup.


reply via email to

[Prev in Thread] Current Thread [Next in Thread]