qemu-devel
[Top][All Lists]
Advanced

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

Re: [Qemu-devel] [PATCH v3] glib: fix g_poll early timeout on windows


From: Alex Bligh
Subject: Re: [Qemu-devel] [PATCH v3] glib: fix g_poll early timeout on windows
Date: Wed, 7 May 2014 09:49:41 +0100

On 7 May 2014, at 09:36, Stanislav Vorobiov wrote:

> Hi,
> 
> Hm, but (int)res expression is not unsigned, it's signed. I've also had this 
> warning,
> but with this expression: (res < WAIT_OBJECT_0), that's why I put (int) 
> there. Could it be that
> for some reason your compiler treats "int" and "unsigned int", that would be 
> really strange though...

I suspect the problem is that WAIT_OBJECT_0 is defined as an unsigned long:

#define WAIT_OBJECT_0       ((STATUS_WAIT_0 ) + 0 )

#define STATUS_WAIT_0       ((DWORD)0x00000000L)

So IIRC under the 'usual conversions', and int compared with it will be cast to 
an unsigned long too.

I think you want to cast WAIT_OBJECT_0 to a long or similar.

Alex


> On 05/07/2014 12:02 PM, Stefan Hajnoczi wrote:
>> On Fri, Apr 18, 2014 at 08:24:03PM +0400, Stanislav Vorobiov wrote:
>> 
>> Please fix the following compiler warning with gcc 4.8.2:
>> 
>>> +        } else if ((res == WAIT_TIMEOUT) || (res == WAIT_IO_COMPLETION) ||
>>> +                   ((int)res < WAIT_OBJECT_0) ||
>>> +                   (res >= (WAIT_OBJECT_0 + nhandles))) {
>>> +            break;
>>> +        }
>> 
>> util/oslib-win32.c: In function 'g_poll_fixed':
>> util/oslib-win32.c:324:21: warning: comparison of unsigned expression < 0 is 
>> always false [-Wtype-limits]
>>                    ((int)res < WAIT_OBJECT_0) ||
>>                                       ^
>> 
> 
> 
> 

-- 
Alex Bligh







reply via email to

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