oleaut32: Use BOOL type where appropriate

Frédéric Delanoy frederic.delanoy at gmail.com
Sat Feb 22 11:14:39 CST 2014


On Sat, Feb 22, 2014 at 12:36 PM, Nikolay Sivov <bunglehead at gmail.com> wrote:
> On 2/22/2014 15:22, Frédéric Delanoy wrote:
>>
>> ---
>>   dlls/oleaut32/varformat.c | 8 ++++----
>>   dlls/oleaut32/vartype.c   | 2 +-
>>   2 files changed, 5 insertions(+), 5 deletions(-)
>>
>> diff --git a/dlls/oleaut32/varformat.c b/dlls/oleaut32/varformat.c
>> index e72a170..a6a10cf 100644
>> --- a/dlls/oleaut32/varformat.c
>> +++ b/dlls/oleaut32/varformat.c
>> @@ -2303,9 +2303,9 @@ HRESULT WINAPI VarFormatNumber(LPVARIANT pVarIn, INT
>> nDigits, INT nLeading, INT
>>       if (nLeading == -2)
>>         GETLOCALENUMBER(LOCALE_ILZERO, LeadingZero);
>>       else if (nLeading == -1)
>> -      numfmt.LeadingZero = 1;
>> +      numfmt.LeadingZero = TRUE;
>>       else
>> -      numfmt.LeadingZero = 0;
>> +      numfmt.LeadingZero = FALSE;
>>         if (nGrouping == -2)
>>       {
>> @@ -2484,9 +2484,9 @@ HRESULT WINAPI VarFormatCurrency(LPVARIANT pVarIn,
>> INT nDigits, INT nLeading,
>>       if (nLeading == -2)
>>         GETLOCALENUMBER(LOCALE_ILZERO, LeadingZero);
>>       else if (nLeading == -1)
>> -      numfmt.LeadingZero = 1;
>> +      numfmt.LeadingZero = TRUE;
>>       else
>> -      numfmt.LeadingZero = 0;
>> +      numfmt.LeadingZero = FALSE;
>>
>
> That's not a case when it's appropriate - 'LeadingZero' is UINT, not BOOL.
> Somewhat improved variant of above conditions could look like that:
>
> ---
>      else
>        numfmt.LeadingZero = nLeading == -1;

According to MSDN, it's either 0 for non-leading zero, or 1 for
leading.zero (hence TRUE/FALSE def'd to 1/0 in windef)
Now obviously the field type can't be modified, but in other places in
the code, booleans are stored e.g. in unsigned foo:1, or other
unsigned type.

cf.
http://msdn.microsoft.com/en-us/library/windows/desktop/dd319095%28v=vs.85%29.aspx
http://msdn.microsoft.com/en-us/library/windows/desktop/dd373784%28v=vs.85%29.aspx

Frédéric



More information about the wine-devel mailing list