Signed-off-by: Michael Stefaniuc mstefani@winehq.org --- dlls/ole32/classmoniker.c | 6 +++--- dlls/ole32/clipboard.c | 2 +- dlls/ole32/datacache.c | 2 +- dlls/ole32/moniker.c | 2 +- dlls/ole32/ole2.c | 2 +- dlls/ole32/ole2impl.c | 2 +- dlls/ole32/rpc.c | 4 ++-- dlls/ole32/storage32.c | 9 ++++----- dlls/ole32/usrmarshal.c | 4 ++-- 9 files changed, 16 insertions(+), 17 deletions(-)
diff --git a/dlls/ole32/classmoniker.c b/dlls/ole32/classmoniker.c index ebad7947c6..30a24d23e5 100644 --- a/dlls/ole32/classmoniker.c +++ b/dlls/ole32/classmoniker.c @@ -536,14 +536,14 @@ static HRESULT WINAPI ClassMoniker_GetDisplayName(IMoniker* iface,
*ppszDisplayName = CoTaskMemAlloc(sizeof(wszClsidPrefix) + (CHARS_IN_GUID-2) * sizeof(WCHAR));
- StringFromGUID2(&This->clsid, *ppszDisplayName+sizeof(wszClsidPrefix)/sizeof(WCHAR)-2, CHARS_IN_GUID); + StringFromGUID2(&This->clsid, *ppszDisplayName+ARRAY_SIZE(wszClsidPrefix)-2, CHARS_IN_GUID);
/* note: this overwrites the opening curly bracket of the CLSID string generated above */ memcpy(*ppszDisplayName, wszClsidPrefix, sizeof(wszClsidPrefix)-sizeof(WCHAR));
/* note: this overwrites the closing curly bracket of the CLSID string generated above */ - (*ppszDisplayName)[sizeof(wszClsidPrefix)/sizeof(WCHAR)-2+CHARS_IN_GUID-2] = ':'; - (*ppszDisplayName)[sizeof(wszClsidPrefix)/sizeof(WCHAR)-2+CHARS_IN_GUID-1] = '\0'; + (*ppszDisplayName)[ARRAY_SIZE(wszClsidPrefix)-2+CHARS_IN_GUID-2] = ':'; + (*ppszDisplayName)[ARRAY_SIZE(wszClsidPrefix)-2+CHARS_IN_GUID-1] = '\0';
TRACE("string is %s\n", debugstr_w(*ppszDisplayName)); return S_OK; diff --git a/dlls/ole32/clipboard.c b/dlls/ole32/clipboard.c index 919d9e3604..cb005d384f 100644 --- a/dlls/ole32/clipboard.c +++ b/dlls/ole32/clipboard.c @@ -1197,7 +1197,7 @@ static HRESULT get_priv_data(ole_priv_data **data) for(cf = 0; (cf = EnumClipboardFormats(cf)) != 0; count++) { WCHAR buf[256]; - if (GetClipboardFormatNameW(cf, buf, sizeof(buf) / sizeof(WCHAR))) + if (GetClipboardFormatNameW(cf, buf, ARRAY_SIZE(buf))) TRACE("cf %04x %s\n", cf, debugstr_w(buf)); else TRACE("cf %04x\n", cf); diff --git a/dlls/ole32/datacache.c b/dlls/ole32/datacache.c index b72b8ff2ef..3eff56908d 100644 --- a/dlls/ole32/datacache.c +++ b/dlls/ole32/datacache.c @@ -2667,7 +2667,7 @@ static HRESULT WINAPI DataCache_UpdateCache( IOleCache2 *iface, IDataObject *dat } else { - for (i = 0; i < sizeof(view_list) / sizeof(view_list[0]); i++) + for (i = 0; i < ARRAY_SIZE(view_list); i++) { fmt.cfFormat = view_list[i]; fmt.tymed = tymed_from_cf( fmt.cfFormat ); diff --git a/dlls/ole32/moniker.c b/dlls/ole32/moniker.c index ffbaa61e50..c1312d1e1e 100644 --- a/dlls/ole32/moniker.c +++ b/dlls/ole32/moniker.c @@ -1152,7 +1152,7 @@ HRESULT WINAPI MkParseDisplayName(LPBC pbc, LPCOLESTR szDisplayName, *pchEaten = 0; *ppmk = NULL;
- if (!strncmpiW(szDisplayName, wszClsidColon, sizeof(wszClsidColon)/sizeof(wszClsidColon[0]))) + if (!strncmpiW(szDisplayName, wszClsidColon, ARRAY_SIZE(wszClsidColon))) { hr = ClassMoniker_CreateFromDisplayName(pbc, szDisplayName, &chEaten, &moniker); if (FAILED(hr) && (hr != MK_E_SYNTAX)) diff --git a/dlls/ole32/ole2.c b/dlls/ole32/ole2.c index c7a9b272cb..2de9edbb80 100644 --- a/dlls/ole32/ole2.c +++ b/dlls/ole32/ole2.c @@ -967,7 +967,7 @@ static HRESULT WINAPI EnumOLEVERB_Next( LPWSTR pwszOLEVERB; LPWSTR pwszMenuFlags; LPWSTR pwszAttribs; - LONG res = RegEnumKeyW(This->hkeyVerb, This->index, wszSubKey, sizeof(wszSubKey)/sizeof(wszSubKey[0])); + LONG res = RegEnumKeyW(This->hkeyVerb, This->index, wszSubKey, ARRAY_SIZE(wszSubKey)); if (res == ERROR_NO_MORE_ITEMS) { hr = S_FALSE; diff --git a/dlls/ole32/ole2impl.c b/dlls/ole32/ole2impl.c index ccf31fa4f5..fa5777beb0 100644 --- a/dlls/ole32/ole2impl.c +++ b/dlls/ole32/ole2impl.c @@ -135,7 +135,7 @@ static HRESULT get_storage(IDataObject *data, IStorage *stg, UINT *src_cf, BOOL
if (other_fmts) { - for (i = 0; i < sizeof(fmt_id)/sizeof(fmt_id[0]); i++) + for (i = 0; i < ARRAY_SIZE(fmt_id); i++) { init_fmtetc(&fmt, fmt_id[i], TYMED_ISTORAGE); hr = IDataObject_QueryGetData(data, &fmt); diff --git a/dlls/ole32/rpc.c b/dlls/ole32/rpc.c index a73d23ce68..9aa945b367 100644 --- a/dlls/ole32/rpc.c +++ b/dlls/ole32/rpc.c @@ -1658,7 +1658,7 @@ static HRESULT create_server(REFCLSID rclsid, HANDLE *process) static const WCHAR embedding[] = { ' ', '-','E','m','b','e','d','d','i','n','g',0 }; HKEY key; HRESULT hres; - WCHAR command[MAX_PATH+sizeof(embedding)/sizeof(WCHAR)]; + WCHAR command[MAX_PATH+ARRAY_SIZE(embedding)]; DWORD size = (MAX_PATH+1) * sizeof(WCHAR); STARTUPINFOW sinfo; PROCESS_INFORMATION pinfo; @@ -1799,7 +1799,7 @@ static void get_localserver_pipe_name(WCHAR *pipefn, REFCLSID rclsid) { static const WCHAR wszPipeRef[] = {'\','\','.','\','p','i','p','e','\',0}; strcpyW(pipefn, wszPipeRef); - StringFromGUID2(rclsid, pipefn + sizeof(wszPipeRef)/sizeof(wszPipeRef[0]) - 1, CHARS_IN_GUID); + StringFromGUID2(rclsid, pipefn + ARRAY_SIZE(wszPipeRef) - 1, CHARS_IN_GUID); }
/* FIXME: should call to rpcss instead */ diff --git a/dlls/ole32/storage32.c b/dlls/ole32/storage32.c index 51f178be8e..886d9b95a5 100644 --- a/dlls/ole32/storage32.c +++ b/dlls/ole32/storage32.c @@ -5057,7 +5057,7 @@ static HRESULT StorageImpl_LockOne(StorageImpl *This, ULONG start, ULONG end)
if (SUCCEEDED(hr)) { - for (j=0; j<sizeof(This->locked_bytes)/sizeof(This->locked_bytes[0]); j++) + for (j = 0; j < ARRAY_SIZE(This->locked_bytes); j++) { if (This->locked_bytes[j] == 0) { @@ -5200,10 +5200,10 @@ static void StorageImpl_Destroy(StorageBaseImpl* iface) BlockChainStream_Destroy(This->rootBlockChain); BlockChainStream_Destroy(This->smallBlockDepotChain);
- for (i=0; i<BLOCKCHAIN_CACHE_SIZE; i++) + for (i = 0; i < BLOCKCHAIN_CACHE_SIZE; i++) BlockChainStream_Destroy(This->blockChainCache[i]);
- for (i=0; i<sizeof(This->locked_bytes)/sizeof(This->locked_bytes[0]); i++) + for (i = 0; i < ARRAY_SIZE(This->locked_bytes); i++) { ULARGE_INTEGER offset, cb; cb.QuadPart = 1; @@ -9369,8 +9369,7 @@ HRESULT WINAPI WriteFmtUserTypeStg( /* get the clipboard format name */ if( cf ) { - n = GetClipboardFormatNameW( cf, szwClipName, - sizeof(szwClipName)/sizeof(szwClipName[0]) ); + n = GetClipboardFormatNameW(cf, szwClipName, ARRAY_SIZE(szwClipName)); szwClipName[n]=0; }
diff --git a/dlls/ole32/usrmarshal.c b/dlls/ole32/usrmarshal.c index 8d36e13441..772bff5f5e 100644 --- a/dlls/ole32/usrmarshal.c +++ b/dlls/ole32/usrmarshal.c @@ -116,7 +116,7 @@ ULONG __RPC_USER CLIPFORMAT_UserSize(ULONG *pFlags, ULONG size, CLIPFORMAT *pCF) /* urg! this function is badly designed because it won't tell us how * much space is needed without doing a dummy run of storing the * name into a buffer */ - ret = GetClipboardFormatNameW(*pCF, format, sizeof(format)/sizeof(format[0])-1); + ret = GetClipboardFormatNameW(*pCF, format, ARRAY_SIZE(format)-1); if (!ret) RaiseException(DV_E_CLIPFORMAT, 0, 0, NULL); size += (ret + 1) * sizeof(WCHAR); @@ -161,7 +161,7 @@ unsigned char * __RPC_USER CLIPFORMAT_UserMarshal(ULONG *pFlags, unsigned char * *(DWORD *)pBuffer = *pCF; pBuffer += 4;
- len = GetClipboardFormatNameW(*pCF, format, sizeof(format)/sizeof(format[0])-1); + len = GetClipboardFormatNameW(*pCF, format, ARRAY_SIZE(format)-1); if (!len) RaiseException(DV_E_CLIPFORMAT, 0, 0, NULL); len += 1;