oleaut32: Use BOOL type where appropriate
Frédéric Delanoy
frederic.delanoy at gmail.com
Fri Oct 18 04:25:00 CDT 2013
Note: Changed return value of VARIANT_DI_tostringW to return TRUE on success
(return values from calls to this function weren't checked, but that's another issue)
---
dlls/oleaut32/olefont.c | 6 +++---
dlls/oleaut32/typelib.c | 9 +++++----
dlls/oleaut32/vartype.c | 28 ++++++++++++++--------------
3 files changed, 22 insertions(+), 21 deletions(-)
diff --git a/dlls/oleaut32/olefont.c b/dlls/oleaut32/olefont.c
index b5c0cb4..c0925a2 100644
--- a/dlls/oleaut32/olefont.c
+++ b/dlls/oleaut32/olefont.c
@@ -353,9 +353,9 @@ HRESULT WINAPI OleCreateFontIndirect(
fd.cySize.s.Hi = 0;
fd.sWeight = 0;
fd.sCharset = 0;
- fd.fItalic = 0;
- fd.fUnderline = 0;
- fd.fStrikethrough = 0;
+ fd.fItalic = FALSE;
+ fd.fUnderline = FALSE;
+ fd.fStrikethrough = FALSE;
lpFontDesc = &fd;
}
diff --git a/dlls/oleaut32/typelib.c b/dlls/oleaut32/typelib.c
index a807eb3..07da928 100644
--- a/dlls/oleaut32/typelib.c
+++ b/dlls/oleaut32/typelib.c
@@ -2407,7 +2407,7 @@ static void MSFT_GetTdesc(TLBContext *pcx, INT type, TYPEDESC *pTd)
TRACE_(typelib)("vt type = %X\n", pTd->vt);
}
-static int TLB_is_propgetput(INVOKEKIND invkind)
+static BOOL TLB_is_propgetput(INVOKEKIND invkind)
{
return (invkind == INVOKE_PROPERTYGET ||
invkind == INVOKE_PROPERTYPUT ||
@@ -5428,7 +5428,8 @@ static HRESULT WINAPI ITypeLibComp_fnBind(
BINDPTR * pBindPtr)
{
ITypeLibImpl *This = impl_from_ITypeComp(iface);
- int typemismatch=0, i;
+ BOOL typemismatch = FALSE;
+ int i;
TRACE("(%p)->(%s, 0x%x, 0x%x, %p, %p, %p)\n", This, debugstr_w(szName), lHash, wFlags, ppTInfo, pDescKind, pBindPtr);
@@ -5469,7 +5470,7 @@ static HRESULT WINAPI ITypeLibComp_fnBind(
return S_OK;
}
else if (hr == TYPE_E_TYPEMISMATCH)
- typemismatch = 1;
+ typemismatch = TRUE;
}
if ((pTypeInfo->typekind == TKIND_COCLASS) &&
@@ -5540,7 +5541,7 @@ static HRESULT WINAPI ITypeLibComp_fnBind(
return S_OK;
}
else if (hr == TYPE_E_TYPEMISMATCH)
- typemismatch = 1;
+ typemismatch = TRUE;
}
}
diff --git a/dlls/oleaut32/vartype.c b/dlls/oleaut32/vartype.c
index e1672a1..d492e7d 100644
--- a/dlls/oleaut32/vartype.c
+++ b/dlls/oleaut32/vartype.c
@@ -4682,10 +4682,10 @@ static unsigned char VARIANT_int_divbychar(DWORD * p, unsigned int n, unsigned c
}
/* check to test if encoded number is a zero. Returns 1 if zero, 0 for nonzero */
-static int VARIANT_int_iszero(const DWORD * p, unsigned int n)
+static BOOL VARIANT_int_iszero(const DWORD * p, unsigned int n)
{
- for (; n > 0; n--) if (*p++ != 0) return 0;
- return 1;
+ for (; n > 0; n--) if (*p++ != 0) return FALSE;
+ return TRUE;
}
/* multiply two DECIMALS, without changing either one, and place result in third
@@ -4695,7 +4695,7 @@ static int VARIANT_int_iszero(const DWORD * p, unsigned int n)
*/
static int VARIANT_DI_mul(const VARIANT_DI * a, const VARIANT_DI * b, VARIANT_DI * result)
{
- int r_overflow = 0;
+ BOOL r_overflow = FALSE;
DWORD running[6];
signed int mulstart;
@@ -4786,12 +4786,12 @@ static int VARIANT_DI_mul(const VARIANT_DI * a, const VARIANT_DI * b, VARIANT_DI
}
/* cast DECIMAL into string. Any scale should be handled properly. en_US locale is
- hardcoded (period for decimal separator, dash as negative sign). Returns 0 for
- success, nonzero if insufficient space in output buffer.
+ hardcoded (period for decimal separator, dash as negative sign). Returns TRUE for
+ success, FALSE if insufficient space in output buffer.
*/
-static int VARIANT_DI_tostringW(const VARIANT_DI * a, WCHAR * s, unsigned int n)
+static BOOL VARIANT_DI_tostringW(const VARIANT_DI * a, WCHAR * s, unsigned int n)
{
- int overflow = 0;
+ BOOL overflow = FALSE;
DWORD quotient[3];
unsigned char remainder;
unsigned int i;
@@ -4802,7 +4802,7 @@ static int VARIANT_DI_tostringW(const VARIANT_DI * a, WCHAR * s, unsigned int n)
*s++ = '-';
n--;
}
- else overflow = 1;
+ else overflow = TRUE;
}
/* prepare initial 0 */
@@ -4810,7 +4810,7 @@ static int VARIANT_DI_tostringW(const VARIANT_DI * a, WCHAR * s, unsigned int n)
if (n >= 2) {
s[0] = '0';
s[1] = '\0';
- } else overflow = 1;
+ } else overflow = TRUE;
}
i = 0;
@@ -4818,7 +4818,7 @@ static int VARIANT_DI_tostringW(const VARIANT_DI * a, WCHAR * s, unsigned int n)
while (!overflow && !VARIANT_int_iszero(quotient, sizeof(quotient) / sizeof(DWORD))) {
remainder = VARIANT_int_divbychar(quotient, sizeof(quotient) / sizeof(DWORD), 10);
if (i + 2 > n) {
- overflow = 1;
+ overflow = TRUE;
} else {
s[i++] = '0' + remainder;
s[i] = '\0';
@@ -4839,7 +4839,7 @@ static int VARIANT_DI_tostringW(const VARIANT_DI * a, WCHAR * s, unsigned int n)
if (i <= a->scale) {
unsigned int numzeroes = a->scale + 1 - i;
if (i + 1 + numzeroes >= n) {
- overflow = 1;
+ overflow = TRUE;
} else {
memmove(s + numzeroes, s, (i + 1) * sizeof(WCHAR));
i += numzeroes;
@@ -4853,7 +4853,7 @@ static int VARIANT_DI_tostringW(const VARIANT_DI * a, WCHAR * s, unsigned int n)
if (a->scale > 0) {
unsigned int periodpos = i - a->scale;
if (i + 2 >= n) {
- overflow = 1;
+ overflow = TRUE;
} else {
memmove(s + periodpos + 1, s + periodpos, (i + 1 - periodpos) * sizeof(WCHAR));
s[periodpos] = '.'; i++;
@@ -4865,7 +4865,7 @@ static int VARIANT_DI_tostringW(const VARIANT_DI * a, WCHAR * s, unsigned int n)
}
}
- return overflow;
+ return !overflow;
}
/* shift the bits of a DWORD array to the left. p[0] is assumed LSB */
--
1.8.4
More information about the wine-patches
mailing list