ole32: Use BOOL type where appropriate
Frédéric Delanoy
frederic.delanoy at gmail.com
Mon Oct 14 17:27:16 CDT 2013
---
dlls/ole32/bindctx.c | 7 +++----
dlls/ole32/filemoniker.c | 12 ++++++------
dlls/ole32/ifs.c | 32 ++++++++++++++++----------------
dlls/ole32/storage32.c | 20 ++++++++++----------
dlls/ole32/storage32.h | 6 +++---
dlls/ole32/stubmanager.c | 2 +-
6 files changed, 39 insertions(+), 40 deletions(-)
diff --git a/dlls/ole32/bindctx.c b/dlls/ole32/bindctx.c
index ed6269d..5e7fe8f 100644
--- a/dlls/ole32/bindctx.c
+++ b/dlls/ole32/bindctx.c
@@ -432,9 +432,8 @@ static HRESULT BindCtxImpl_GetObjectIndex(BindCtxImpl* This,
LPOLESTR pszkey,
DWORD *index)
{
-
DWORD i;
- BYTE found=0;
+ BOOL found = FALSE;
TRACE("(%p,%p,%p,%p)\n",This,punk,pszkey,index);
@@ -451,14 +450,14 @@ static HRESULT BindCtxImpl_GetObjectIndex(BindCtxImpl* This,
)
)
- found=1;
+ found = TRUE;
}
}
else
/* search object identified by a moniker*/
for(i=0; ( (i<This->bindCtxTableLastIndex) && (!found));i++)
if(This->bindCtxTable[i].pObj==punk)
- found=1;
+ found = TRUE;
if (index != NULL)
*index=i-1;
diff --git a/dlls/ole32/filemoniker.c b/dlls/ole32/filemoniker.c
index 7a97100..8905c55 100644
--- a/dlls/ole32/filemoniker.c
+++ b/dlls/ole32/filemoniker.c
@@ -1360,7 +1360,7 @@ static HRESULT FileMonikerImpl_Construct(FileMonikerImpl* This, LPCOLESTR lpszPa
LPOLESTR *tabStr=0;
static const WCHAR twoPoint[]={'.','.',0};
static const WCHAR bkSlash[]={'\\',0};
- BYTE addBkSlash;
+ BOOL addBkSlash;
TRACE("(%p,%s)\n",This,debugstr_w(lpszPathName));
@@ -1381,14 +1381,14 @@ static HRESULT FileMonikerImpl_Construct(FileMonikerImpl* This, LPCOLESTR lpszPa
if (nb > 0 ){
- addBkSlash=1;
+ addBkSlash = TRUE;
if (lstrcmpW(tabStr[0],twoPoint)!=0)
- addBkSlash=0;
+ addBkSlash = FALSE;
else
for(i=0;i<nb;i++){
if ( (lstrcmpW(tabStr[i],twoPoint)!=0) && (lstrcmpW(tabStr[i],bkSlash)!=0) ){
- addBkSlash=0;
+ addBkSlash = FALSE;
break;
}
else
@@ -1396,13 +1396,13 @@ static HRESULT FileMonikerImpl_Construct(FileMonikerImpl* This, LPCOLESTR lpszPa
if (lstrcmpW(tabStr[i],bkSlash)==0 && i<nb-1 && lstrcmpW(tabStr[i+1],bkSlash)==0){
*tabStr[i]=0;
sizeStr--;
- addBkSlash=0;
+ addBkSlash = FALSE;
break;
}
}
if (lstrcmpW(tabStr[nb-1],bkSlash)==0)
- addBkSlash=0;
+ addBkSlash = FALSE;
This->filePathName=HeapReAlloc(GetProcessHeap(),0,This->filePathName,(sizeStr+1)*sizeof(WCHAR));
diff --git a/dlls/ole32/ifs.c b/dlls/ole32/ifs.c
index 35ed04b..696a7b8 100644
--- a/dlls/ole32/ifs.c
+++ b/dlls/ole32/ifs.c
@@ -73,7 +73,7 @@ static CRITICAL_SECTION_DEBUG critsect_debug =
static CRITICAL_SECTION IMalloc32_SpyCS = { &critsect_debug, -1, 0, 0, 0, 0 };
/* resize the old table */
-static int SetSpyedBlockTableLength ( DWORD NewLength )
+static BOOL SetSpyedBlockTableLength ( DWORD NewLength )
{
LPVOID *NewSpyedBlocks;
@@ -88,14 +88,13 @@ static int SetSpyedBlockTableLength ( DWORD NewLength )
}
/* add a location to the table */
-static int AddMemoryLocation(LPVOID * pMem)
+static BOOL AddMemoryLocation(LPVOID * pMem)
{
LPVOID * Current;
/* allocate the table if not already allocated */
- if (!Malloc32.SpyedBlockTableLength) {
- if (!SetSpyedBlockTableLength(0x1000)) return 0;
- }
+ if (!Malloc32.SpyedBlockTableLength && !SetSpyedBlockTableLength(0x1000))
+ return FALSE;
/* find a free location */
Current = Malloc32.SpyedBlocks;
@@ -104,7 +103,8 @@ static int AddMemoryLocation(LPVOID * pMem)
if (Current >= Malloc32.SpyedBlocks + Malloc32.SpyedBlockTableLength) {
/* no more space in table, grow it */
DWORD old_length = Malloc32.SpyedBlockTableLength;
- if (!SetSpyedBlockTableLength( Malloc32.SpyedBlockTableLength + 0x1000 )) return 0;
+ if (!SetSpyedBlockTableLength( Malloc32.SpyedBlockTableLength + 0x1000))
+ return FALSE;
Current = Malloc32.SpyedBlocks + old_length;
}
};
@@ -113,31 +113,31 @@ static int AddMemoryLocation(LPVOID * pMem)
*Current = pMem;
Malloc32.SpyedAllocationsLeft++;
/*TRACE("%lu\n",Malloc32.SpyedAllocationsLeft);*/
- return 1;
+ return TRUE;
}
-static int RemoveMemoryLocation(LPCVOID pMem)
+static BOOL RemoveMemoryLocation(LPCVOID pMem)
{
LPVOID * Current;
/* allocate the table if not already allocated */
- if (!Malloc32.SpyedBlockTableLength) {
- if (!SetSpyedBlockTableLength(0x1000)) return 0;
- }
+ if (!Malloc32.SpyedBlockTableLength && !SetSpyedBlockTableLength(0x1000))
+ return FALSE;
Current = Malloc32.SpyedBlocks;
/* find the location */
while (*Current != pMem) {
Current++;
- if (Current >= Malloc32.SpyedBlocks + Malloc32.SpyedBlockTableLength) return 0; /* not found */
+ if (Current >= Malloc32.SpyedBlocks + Malloc32.SpyedBlockTableLength)
+ return FALSE; /* not found */
}
/* location found */
Malloc32.SpyedAllocationsLeft--;
/*TRACE("%lu\n",Malloc32.SpyedAllocationsLeft);*/
*Current = NULL;
- return 1;
+ return TRUE;
}
/******************************************************************************
@@ -252,7 +252,7 @@ static LPVOID WINAPI IMalloc_fnRealloc(LPMALLOC iface,LPVOID pv,DWORD cb) {
*/
static VOID WINAPI IMalloc_fnFree(LPMALLOC iface,LPVOID pv) {
- BOOL fSpyed = 0;
+ BOOL fSpyed = FALSE;
TRACE("(%p)\n",pv);
@@ -289,7 +289,7 @@ static VOID WINAPI IMalloc_fnFree(LPMALLOC iface,LPVOID pv) {
static DWORD WINAPI IMalloc_fnGetSize(LPMALLOC iface,LPVOID pv) {
DWORD cb;
- BOOL fSpyed = 0;
+ BOOL fSpyed = FALSE;
TRACE("(%p)\n",pv);
@@ -313,7 +313,7 @@ static DWORD WINAPI IMalloc_fnGetSize(LPMALLOC iface,LPVOID pv) {
*/
static INT WINAPI IMalloc_fnDidAlloc(LPMALLOC iface,LPVOID pv) {
- BOOL fSpyed = 0;
+ BOOL fSpyed = FALSE;
int didAlloc;
TRACE("(%p)\n",pv);
diff --git a/dlls/ole32/storage32.c b/dlls/ole32/storage32.c
index bd076ce..fa2d3c0 100644
--- a/dlls/ole32/storage32.c
+++ b/dlls/ole32/storage32.c
@@ -1423,7 +1423,7 @@ static HRESULT insertIntoTree(
* The root storage contains some element, therefore, start the research
* for the appropriate location.
*/
- BOOL found = 0;
+ BOOL found = FALSE;
DirRef current, next, previous, currentEntryId;
/*
@@ -1442,7 +1442,7 @@ static HRESULT insertIntoTree(
next = currentEntry.rightChild;
current = currentEntryId;
- while (found == 0)
+ while (!found)
{
LONG diff = entryNameCmp( newEntry.name, currentEntry.name);
@@ -1461,7 +1461,7 @@ static HRESULT insertIntoTree(
StorageBaseImpl_WriteDirEntry(This,
current,
¤tEntry);
- found = 1;
+ found = TRUE;
}
}
else if (diff > 0)
@@ -1479,7 +1479,7 @@ static HRESULT insertIntoTree(
StorageBaseImpl_WriteDirEntry(This,
current,
¤tEntry);
- found = 1;
+ found = TRUE;
}
}
else
@@ -2786,7 +2786,7 @@ static HRESULT StorageImpl_Construct(
else
This->base.lockingrole = SWMR_None;
- This->base.reverted = 0;
+ This->base.reverted = FALSE;
/*
* Initialize the big block cache.
@@ -3016,7 +3016,7 @@ static void StorageImpl_Invalidate(StorageBaseImpl* iface)
StorageBaseImpl_DeleteAll(&This->base);
- This->base.reverted = 1;
+ This->base.reverted = TRUE;
}
static void StorageImpl_Destroy(StorageBaseImpl* iface)
@@ -4850,7 +4850,7 @@ static void TransactedSnapshotImpl_Invalidate(StorageBaseImpl* This)
{
TRACE("Storage invalidated (stg=%p)\n", This);
- This->reverted = 1;
+ This->reverted = TRUE;
StorageBaseImpl_DeleteAll(This);
}
@@ -5255,7 +5255,7 @@ static void StorageInternalImpl_Invalidate( StorageBaseImpl *base )
{
TRACE("Storage invalidated (stg=%p)\n", This);
- This->base.reverted = 1;
+ This->base.reverted = TRUE;
This->parentStorage = NULL;
@@ -5740,7 +5740,7 @@ static StorageInternalImpl* StorageInternalImpl_Construct(
newStorage->base.baseVtbl = &StorageInternalImpl_BaseVtbl;
newStorage->base.openFlags = (openFlags & ~STGM_CREATE);
- newStorage->base.reverted = 0;
+ newStorage->base.reverted = FALSE;
newStorage->base.ref = 1;
@@ -5751,7 +5751,7 @@ static StorageInternalImpl* StorageInternalImpl_Construct(
*/
newStorage->base.storageDirEntry = storageDirEntry;
- newStorage->base.create = 0;
+ newStorage->base.create = FALSE;
return newStorage;
}
diff --git a/dlls/ole32/storage32.h b/dlls/ole32/storage32.h
index 8cb330f..ba46aff 100644
--- a/dlls/ole32/storage32.h
+++ b/dlls/ole32/storage32.h
@@ -200,7 +200,7 @@ struct StorageBaseImpl
/*
* TRUE if this object has been invalidated
*/
- int reverted;
+ BOOL reverted;
/*
* Index of the directory entry of this storage
@@ -222,8 +222,8 @@ struct StorageBaseImpl
*/
DWORD stateBits;
- BOOL create; /* Was the storage created or opened.
- The behaviour of STGM_SIMPLE depends on this */
+ BOOL create; /* Was the storage created or opened.
+ The behaviour of STGM_SIMPLE depends on this */
/*
* If this storage was opened in transacted mode, the object that implements
* the transacted snapshot or cache.
diff --git a/dlls/ole32/stubmanager.c b/dlls/ole32/stubmanager.c
index 57a33b0..973114e 100644
--- a/dlls/ole32/stubmanager.c
+++ b/dlls/ole32/stubmanager.c
@@ -331,7 +331,7 @@ struct stub_manager *get_stub_manager_from_object(APARTMENT *apt, void *object)
* threads have a reference to it */
void apartment_disconnectobject(struct apartment *apt, void *object)
{
- int found = FALSE;
+ BOOL found = FALSE;
struct stub_manager *stubmgr;
EnterCriticalSection(&apt->cs);
--
1.8.4
More information about the wine-patches
mailing list