[cairo] Warnings on Win32

Bobby Salazar bobby8934 at inbox.com
Fri Mar 14 10:23:11 PDT 2008


>> This change will fix the warning:
>> 
>> static inline uint32_t
>> cpu_to_be32(uint32_t v)
>> {
>>     return (v << 16) | (v >> 16);
>> }
> 
> This change is not correct. This function is required to reverse the
> four bytes in a 32-bit word. eg
> 
>   abcd => dcba
> 
> Your code would change this to:
> 
>   abcd => cdab

Oops, you are correct. How does this look instead:

static inline uint32_t
cpu_to_be32(uint32_t v)
{
    return (cpu_to_be16 ((uint16_t)v) << 16) | cpu_to_be16 ((uint16_t)(v >> 16));
}

>> Also, in case anyone cares, here are the other 78 warnings I get on
>> MSVC++ 6.0 (after fixing the function above):
> 
> You can add a #pragma to disable these warnings. eg
> 
>   #pragma warning( disable : 4244 4146 4101 4761 )

I don't think it's appropriate to disable warnings like this. These warnings are there for a reason, and the code should be fixed. For example, this warning: "warning C4146: unary minus operator applied to unsigned type, result still unsigned" is probably a good indicator that the programmer has made a mistake.

____________________________________________________________
Receive Notifications of Incoming Messages
Easily monitor multiple email accounts & access them with a click.
Visit http://www.inbox.com/notifier and check it out!


More information about the cairo mailing list