dlls/msi/string.c -- fix use of signed versus unsigned (RESEND)

James Hawkins truiken at gmail.com
Thu Nov 15 09:59:43 CST 2007


On 11/14/07, Gerald Pfeifer <gerald at pfeifer.com> wrote:
> Last one for today, promised. ;-)
>
> Gerald
>
> ---------- Forwarded message ----------
> From: Gerald Pfeifer <gerald at pfeifer.com>
> To:  <wine-patches at winehq.org>
> Date: Sat, 3 Nov 2007 20:02:18 +0100 (CET)
> Subject: dlls/msi/string.c -- fix use of signed versus unsigned
>
> This was a bit more tricky, but I hope I got it right.  Basically the
> problem here was that we used a parameter/variable n of type UINT both
> as a true unsigned (the return of the hash function) and as a true signed
> variable (comparing against -1).
>
> This removes the following three compiler diagnostics that I've been
> seeing.  In other words, this is also addressing very real issues!
>
>   string.c: In function 'msi_addstring':
>   string.c:208: warning: comparison of unsigned expression < 0 is always false
>   string.c: In function 'msi_addstringW':
>   string.c:260: warning: comparison of unsigned expression < 0 is always false
>   string.c: In function 'msi_string2idW':
>   string.c:400: warning: comparison between signed and unsigned
>
> Gerald
>
> ChangeLog:
> Fix use of signed versus unsigned variables.
>

This change is unnecessarily complicated.  Also, the only actual bug
of this type that was in string.c (comparison..always false) has been
fixed:

commit 1c1cf26997cdf491642b2086ad817a79ced99a2e
Author: James Hawkins <truiken at gmail.com>
Date:   Mon Nov 5 04:49:07 2007 -0500

    msi: Explicitly check the returned value against -1 as the
variable is unsigned.

All these patches to silence extraneous warnings makes me wonder
whether you really understand the code or if you're just trying to get
rid of warnings...

-- 
James Hawkins



More information about the wine-devel mailing list