[Geany-Devel] [geany/geany] 0c7cf8: Fix gcc warning 'cast to pointer from integer of different size'
Lex Trotman
elextr at xxxxx
Mon Aug 12 00:03:46 UTC 2013
On 11 August 2013 23:31, Nick Treleaven <git-noreply at geany.org> wrote:
> Branch: refs/heads/master
> Author: Nick Treleaven <nick.treleaven at btinternet.com>
> Committer: Nick Treleaven <nick.treleaven at btinternet.com>
> Date: Sun, 11 Aug 2013 13:31:30 UTC
> Commit: 0c7cf8df103232a5ccee7da4e46d611b35eae033
>
> https://github.com/geany/geany/commit/0c7cf8df103232a5ccee7da4e46d611b35eae033
>
> Log Message:
> -----------
> Fix gcc warning 'cast to pointer from integer of different size'
>
>
> Modified Paths:
> --------------
> tagmanager/src/tm_workspace.c
>
> Modified: tagmanager/src/tm_workspace.c
> 2 files changed, 1 insertions(+), 1 deletions(-)
> ===================================================================
> @@ -207,7 +207,7 @@ static guint tm_file_inode_hash(gconstpointer key)
> #ifdef TM_DEBUG
> g_message ("Hash for '%s' is '%d'\n", filename,
> file_stat.st_ino);
> #endif
> - return g_direct_hash (GUINT_TO_POINTER (file_stat.st_ino));
> + return g_direct_hash (GUINT_TO_POINTER
> ((guint)file_stat.st_ino));
>
Hi Nick,
On 64 bit Linux ino_t is 64 bits, but guint is 32 bits so this has the
potential to truncate inode numbers, you should cast to gulong.
Note from the Glib docs on GUINT_TO_POINTER "#define GUINT_TO_POINTER(u)
((gpointer) (gulong) (u))"
Cheers
Lex
> } else {
> return 0;
> }
>
>
>
> --------------
> This E-Mail was brought to you by github_commit_mail.py (Source:
> https://github.com/geany/infrastructure).
> _______________________________________________
> Commits mailing list
> Commits at lists.geany.org
> https://lists.geany.org/cgi-bin/mailman/listinfo/commits
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.geany.org/pipermail/devel/attachments/20130812/007e4404/attachment.html>
More information about the Devel
mailing list