Marko Nikolic wrote:
> sizeof expresion always return unsigned type, so it is casted
> when comparing with signed values.
This is ugly.
> ---
> dlls/avifil32/wavfile.c | 4 ++--
> 1 files changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/dlls/avifil32/wavfile.c b/dlls/avifil32/wavfile.c
> index fd6d9ec..3fc934c 100644
> --- a/dlls/avifil32/wavfile.c
> +++ b/dlls/avifil32/wavfile.c
> @@ -803,7 +803,7 @@ static HRESULT WINAPI IAVIStream_fnSetFormat(IAVIStream *iface, LONG pos,
> TRACE("(%p,%d,%p,%d)\n", iface, pos, format, formatsize);
>
> /* check parameters */
> - if (format == NULL || formatsize <= sizeof(PCMWAVEFORMAT))
> + if (format == NULL || formatsize <= (LONG)sizeof(PCMWAVEFORMAT))
IMHO gcc is *wrong* in emitting a warning there. sizeof(PCMWAVEFORMAT)
is a compile time constant and gcc can see that sizeof(PCMWAVEFORMAT)
falls well inside the number range expressible by a LONG. Logically
there is no difference between
formatsize <= sizeof(PCMWAVEFORMAT)
and
formatsize <= 16
One gives a bogus warning and the other doesn't.
bye
michael