Added Mailing list - ARRAY_SIZE patchset

These patches are directly from the mailing list with second
sign-off if one was provided.
This commit is contained in:
Alistair Leslie-Hughes 2018-08-03 09:28:30 +10:00
parent a7ae3783c5
commit f23105a6d8
60 changed files with 5149 additions and 37 deletions

View File

@ -0,0 +1 @@
Depends: ml-array_size

View File

@ -1,4 +1,4 @@
From a7af0ee96959aab299e543e9d6938e2533780c47 Mon Sep 17 00:00:00 2001
From 45713db2d90bd8833415ad2af1920cc792767535 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Michael=20M=C3=BCller?= <michael@fds-team.de>
Date: Sat, 5 Aug 2017 04:02:16 +0200
Subject: [PATCH] kernel32: Implement CreateProcessInternalW.
@ -11,7 +11,7 @@ Subject: [PATCH] kernel32: Implement CreateProcessInternalW.
4 files changed, 17 insertions(+), 12 deletions(-)
diff --git a/dlls/kernel32/kernel32.spec b/dlls/kernel32/kernel32.spec
index e78c1ca..fde5f18 100644
index de6f007..a3607d1 100644
--- a/dlls/kernel32/kernel32.spec
+++ b/dlls/kernel32/kernel32.spec
@@ -315,7 +315,7 @@
@ -24,10 +24,10 @@ index e78c1ca..fde5f18 100644
@ stdcall CreateProcessW(wstr wstr ptr ptr long long ptr wstr ptr ptr)
@ stdcall CreateRemoteThread(long ptr long ptr long long ptr)
diff --git a/dlls/kernel32/process.c b/dlls/kernel32/process.c
index 2075dfd..f9606be 100644
index f568022..e270ca7 100644
--- a/dlls/kernel32/process.c
+++ b/dlls/kernel32/process.c
@@ -2436,12 +2436,13 @@ static LPWSTR get_file_name( LPCWSTR appname, LPWSTR cmdline, LPWSTR buffer,
@@ -2438,12 +2438,13 @@ static LPWSTR get_file_name( LPCWSTR appname, LPWSTR cmdline, LPWSTR buffer,
return ret;
}
@ -47,17 +47,17 @@ index 2075dfd..f9606be 100644
{
BOOL retv = FALSE;
HANDLE hFile = 0;
@@ -2454,6 +2455,9 @@ static BOOL create_process_impl( LPCWSTR app_name, LPWSTR cmd_line, LPSECURITY_A
@@ -2456,6 +2457,9 @@ static BOOL create_process_impl( LPCWSTR app_name, LPWSTR cmd_line, LPSECURITY_A
TRACE("app %s cmdline %s\n", debugstr_w(app_name), debugstr_w(cmd_line) );
+ if (token) FIXME("Creating a process with a token is not yet implemented\n");
+ if (new_token) FIXME("No support for returning created process token\n");
+
if (!(tidy_cmdline = get_file_name( app_name, cmd_line, name, sizeof(name)/sizeof(WCHAR),
if (!(tidy_cmdline = get_file_name( app_name, cmd_line, name, ARRAY_SIZE( name ),
&hFile, &binary_info )))
return FALSE;
@@ -2605,8 +2609,8 @@ BOOL WINAPI DECLSPEC_HOTPATCH CreateProcessA( LPCSTR app_name, LPSTR cmd_line, L
@@ -2607,8 +2611,8 @@ BOOL WINAPI DECLSPEC_HOTPATCH CreateProcessA( LPCSTR app_name, LPSTR cmd_line, L
FIXME("StartupInfo.lpReserved is used, please report (%s)\n",
debugstr_a(startup_info->lpReserved));
@ -68,7 +68,7 @@ index 2075dfd..f9606be 100644
done:
HeapFree( GetProcessHeap(), 0, app_nameW );
HeapFree( GetProcessHeap(), 0, cmd_lineW );
@@ -2625,8 +2629,8 @@ BOOL WINAPI DECLSPEC_HOTPATCH CreateProcessW( LPCWSTR app_name, LPWSTR cmd_line,
@@ -2627,8 +2631,8 @@ BOOL WINAPI DECLSPEC_HOTPATCH CreateProcessW( LPCWSTR app_name, LPWSTR cmd_line,
LPVOID env, LPCWSTR cur_dir, LPSTARTUPINFOW startup_info,
LPPROCESS_INFORMATION info )
{
@ -80,7 +80,7 @@ index 2075dfd..f9606be 100644
diff --git a/dlls/kernelbase/kernelbase.spec b/dlls/kernelbase/kernelbase.spec
index 8cac67f..e8fd7aa 100644
index fb7fafe..9d6c5f9 100644
--- a/dlls/kernelbase/kernelbase.spec
+++ b/dlls/kernelbase/kernelbase.spec
@@ -209,7 +209,7 @@
@ -93,7 +93,7 @@ index 8cac67f..e8fd7aa 100644
@ stdcall CreateRemoteThread(long ptr long ptr long long ptr) kernel32.CreateRemoteThread
@ stdcall CreateRemoteThreadEx(long ptr long ptr ptr long ptr ptr) kernel32.CreateRemoteThreadEx
diff --git a/include/winbase.h b/include/winbase.h
index 4ddc1d3..e21cf6e 100644
index 667df96..b77bced 100644
--- a/include/winbase.h
+++ b/include/winbase.h
@@ -1856,6 +1856,7 @@ WINBASEAPI BOOL WINAPI CreateProcessW(LPCWSTR,LPWSTR,LPSECURITY_ATTRIBUTE

View File

@ -1,4 +1,4 @@
From 23181e8cbe07ac0fd3b6effd04624122a6b0024f Mon Sep 17 00:00:00 2001
From b534f2d905c3ba205c9a4f895149e6be8425b31e Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Michael=20M=C3=BCller?= <michael@fds-team.de>
Date: Sun, 6 Aug 2017 02:08:05 +0200
Subject: [PATCH] server: Implement support for creating processes using a
@ -15,10 +15,10 @@ Subject: [PATCH] server: Implement support for creating processes using a
7 files changed, 59 insertions(+), 21 deletions(-)
diff --git a/dlls/kernel32/process.c b/dlls/kernel32/process.c
index f9606be..c0b89f9 100644
index e270ca7..633065b 100644
--- a/dlls/kernel32/process.c
+++ b/dlls/kernel32/process.c
@@ -2034,7 +2034,7 @@ static NTSTATUS create_struct_sd(PSECURITY_DESCRIPTOR nt_sd, struct security_des
@@ -2036,7 +2036,7 @@ static NTSTATUS create_struct_sd(PSECURITY_DESCRIPTOR nt_sd, struct security_des
* Create a new process. If hFile is a valid handle we have an exe
* file, otherwise it is a Winelib app.
*/
@ -27,7 +27,7 @@ index f9606be..c0b89f9 100644
LPCWSTR cur_dir, LPSECURITY_ATTRIBUTES psa, LPSECURITY_ATTRIBUTES tsa,
BOOL inherit, DWORD flags, LPSTARTUPINFOW startup,
LPPROCESS_INFORMATION info, LPCSTR unixdir,
@@ -2180,6 +2180,7 @@ static BOOL create_process( HANDLE hFile, LPCWSTR filename, LPWSTR cmd_line, LPW
@@ -2182,6 +2182,7 @@ static BOOL create_process( HANDLE hFile, LPCWSTR filename, LPWSTR cmd_line, LPW
req->info_size = startup_info_size;
req->env_size = (env_end - env) * sizeof(WCHAR);
req->process_sd_size = process_sd_size;
@ -35,7 +35,7 @@ index f9606be..c0b89f9 100644
wine_server_add_data( req, startup_info, startup_info_size );
wine_server_add_data( req, env, (env_end - env) * sizeof(WCHAR) );
@@ -2280,7 +2281,7 @@ error:
@@ -2282,7 +2283,7 @@ error:
*
* Create a new VDM process for a 16-bit or DOS application.
*/
@ -44,7 +44,7 @@ index f9606be..c0b89f9 100644
LPSECURITY_ATTRIBUTES psa, LPSECURITY_ATTRIBUTES tsa,
BOOL inherit, DWORD flags, LPSTARTUPINFOW startup,
LPPROCESS_INFORMATION info, LPCSTR unixdir,
@@ -2304,7 +2305,7 @@ static BOOL create_vdm_process( LPCWSTR filename, LPWSTR cmd_line, LPWSTR env, L
@@ -2306,7 +2307,7 @@ static BOOL create_vdm_process( LPCWSTR filename, LPWSTR cmd_line, LPWSTR env, L
return FALSE;
}
sprintfW(new_cmd_line, argsW, winevdmW, buffer, cmd_line);
@ -53,7 +53,7 @@ index f9606be..c0b89f9 100644
flags, startup, info, unixdir, binary_info, exec_only );
HeapFree( GetProcessHeap(), 0, new_cmd_line );
return ret;
@@ -2316,7 +2317,7 @@ static BOOL create_vdm_process( LPCWSTR filename, LPWSTR cmd_line, LPWSTR env, L
@@ -2318,7 +2319,7 @@ static BOOL create_vdm_process( LPCWSTR filename, LPWSTR cmd_line, LPWSTR env, L
*
* Create a new cmd shell process for a .BAT file.
*/
@ -62,7 +62,7 @@ index f9606be..c0b89f9 100644
LPSECURITY_ATTRIBUTES psa, LPSECURITY_ATTRIBUTES tsa,
BOOL inherit, DWORD flags, LPSTARTUPINFOW startup,
LPPROCESS_INFORMATION info )
@@ -2344,8 +2345,8 @@ static BOOL create_cmd_process( LPCWSTR filename, LPWSTR cmd_line, LPVOID env, L
@@ -2346,8 +2347,8 @@ static BOOL create_cmd_process( LPCWSTR filename, LPWSTR cmd_line, LPVOID env, L
strcatW( newcmdline, quotW );
strcatW( newcmdline, cmd_line );
strcatW( newcmdline, quotW );
@ -73,7 +73,7 @@ index f9606be..c0b89f9 100644
HeapFree( GetProcessHeap(), 0, newcmdline );
return ret;
}
@@ -2455,7 +2456,9 @@ BOOL WINAPI CreateProcessInternalW( HANDLE token, LPCWSTR app_name, LPWSTR cmd_l
@@ -2457,7 +2458,9 @@ BOOL WINAPI CreateProcessInternalW( HANDLE token, LPCWSTR app_name, LPWSTR cmd_l
TRACE("app %s cmdline %s\n", debugstr_w(app_name), debugstr_w(cmd_line) );
@ -83,8 +83,8 @@ index f9606be..c0b89f9 100644
+
if (new_token) FIXME("No support for returning created process token\n");
if (!(tidy_cmdline = get_file_name( app_name, cmd_line, name, sizeof(name)/sizeof(WCHAR),
@@ -2513,20 +2516,20 @@ BOOL WINAPI CreateProcessInternalW( HANDLE token, LPCWSTR app_name, LPWSTR cmd_l
if (!(tidy_cmdline = get_file_name( app_name, cmd_line, name, ARRAY_SIZE( name ),
@@ -2515,20 +2518,20 @@ BOOL WINAPI CreateProcessInternalW( HANDLE token, LPCWSTR app_name, LPWSTR cmd_l
debugstr_w(name), (binary_info.flags & BINARY_FLAG_64BIT) ? 64 : 32,
wine_dbgstr_longlong(binary_info.res_start), wine_dbgstr_longlong(binary_info.res_end),
binary_info.arch, (binary_info.flags & BINARY_FLAG_FAKEDLL) ? ", fakedll" : "" );
@ -108,7 +108,7 @@ index f9606be..c0b89f9 100644
inherit, flags, startup_info, info, unixdir, &binary_info, FALSE );
break;
case BINARY_UNKNOWN:
@@ -2538,7 +2541,7 @@ BOOL WINAPI CreateProcessInternalW( HANDLE token, LPCWSTR app_name, LPWSTR cmd_l
@@ -2540,7 +2543,7 @@ BOOL WINAPI CreateProcessInternalW( HANDLE token, LPCWSTR app_name, LPWSTR cmd_l
TRACE( "starting %s as DOS binary\n", debugstr_w(name) );
binary_info.type = BINARY_DOS;
binary_info.arch = IMAGE_FILE_MACHINE_I386;
@ -117,7 +117,7 @@ index f9606be..c0b89f9 100644
inherit, flags, startup_info, info, unixdir,
&binary_info, FALSE );
break;
@@ -2546,7 +2549,7 @@ BOOL WINAPI CreateProcessInternalW( HANDLE token, LPCWSTR app_name, LPWSTR cmd_l
@@ -2548,7 +2551,7 @@ BOOL WINAPI CreateProcessInternalW( HANDLE token, LPCWSTR app_name, LPWSTR cmd_l
if (!strcmpiW( p, batW ) || !strcmpiW( p, cmdW ) )
{
TRACE( "starting %s as batch binary\n", debugstr_w(name) );
@ -126,7 +126,7 @@ index f9606be..c0b89f9 100644
inherit, flags, startup_info, info );
break;
}
@@ -2666,12 +2669,12 @@ static void exec_process( LPCWSTR name )
@@ -2668,12 +2671,12 @@ static void exec_process( LPCWSTR name )
debugstr_w(name), (binary_info.flags & BINARY_FLAG_64BIT) ? 64 : 32,
wine_dbgstr_longlong(binary_info.res_start), wine_dbgstr_longlong(binary_info.res_end),
binary_info.arch );
@ -141,7 +141,7 @@ index f9606be..c0b89f9 100644
FALSE, 0, &startup_info, &info, NULL, &binary_info, TRUE );
break;
case BINARY_UNKNOWN:
@@ -2685,7 +2688,7 @@ static void exec_process( LPCWSTR name )
@@ -2687,7 +2690,7 @@ static void exec_process( LPCWSTR name )
case BINARY_WIN16:
case BINARY_DOS:
TRACE( "starting %s as Win16/DOS binary\n", debugstr_w(name) );
@ -248,7 +248,7 @@ index 78e88ec..313c36a 100644
extern struct thread *get_process_first_thread( struct process *process );
extern struct process *get_process_from_id( process_id_t id );
diff --git a/server/protocol.def b/server/protocol.def
index 5fb6e38..f0bc83b 100644
index b29df0a..95a120e 100644
--- a/server/protocol.def
+++ b/server/protocol.def
@@ -748,6 +748,7 @@ struct rawinput_device

View File

@ -1,4 +1,4 @@
From af37cc621e7a0c460240cc01049a10531f685e38 Mon Sep 17 00:00:00 2001
From 9d6b3e42916fbbd52a3fe9920c329dbe3d20330b Mon Sep 17 00:00:00 2001
From: Qian Hong <qhong@codeweavers.com>
Date: Sun, 26 Jul 2015 17:55:01 +0800
Subject: [PATCH] kernel32: Fallback to default comspec when %COMSPEC% is not
@ -10,10 +10,10 @@ Subject: [PATCH] kernel32: Fallback to default comspec when %COMSPEC% is not
2 files changed, 15 insertions(+), 1 deletion(-)
diff --git a/dlls/kernel32/process.c b/dlls/kernel32/process.c
index 91d242e..2075dfd 100644
index d9673d7..f568022 100644
--- a/dlls/kernel32/process.c
+++ b/dlls/kernel32/process.c
@@ -2323,6 +2323,7 @@ static BOOL create_cmd_process( LPCWSTR filename, LPWSTR cmd_line, LPVOID env, L
@@ -2325,6 +2325,7 @@ static BOOL create_cmd_process( LPCWSTR filename, LPWSTR cmd_line, LPVOID env, L
{
static const WCHAR comspecW[] = {'C','O','M','S','P','E','C',0};
@ -21,10 +21,10 @@ index 91d242e..2075dfd 100644
static const WCHAR slashscW[] = {' ','/','s','/','c',' ',0};
static const WCHAR quotW[] = {'"',0};
WCHAR comspec[MAX_PATH];
@@ -2330,7 +2331,10 @@ static BOOL create_cmd_process( LPCWSTR filename, LPWSTR cmd_line, LPVOID env, L
@@ -2332,7 +2333,10 @@ static BOOL create_cmd_process( LPCWSTR filename, LPWSTR cmd_line, LPVOID env, L
BOOL ret;
if (!GetEnvironmentVariableW( comspecW, comspec, sizeof(comspec)/sizeof(WCHAR) ))
if (!GetEnvironmentVariableW( comspecW, comspec, ARRAY_SIZE( comspec )))
- return FALSE;
+ {
+ GetSystemDirectoryW( comspec, (sizeof(comspec) - sizeof(cmdW))/sizeof(WCHAR) );
@ -34,10 +34,10 @@ index 91d242e..2075dfd 100644
(strlenW(comspec) + 7 + strlenW(cmd_line) + 2) * sizeof(WCHAR))))
return FALSE;
diff --git a/programs/cmd/wcmdmain.c b/programs/cmd/wcmdmain.c
index 827ddd2..9feac1a 100644
index 8fe2d57..3573885 100644
--- a/programs/cmd/wcmdmain.c
+++ b/programs/cmd/wcmdmain.c
@@ -2343,10 +2343,20 @@ int wmain (int argc, WCHAR *argvW[])
@@ -2348,10 +2348,20 @@ int wmain (int argc, WCHAR *argvW[])
static const WCHAR offW[] = {'O','F','F','\0'};
static const WCHAR promptW[] = {'P','R','O','M','P','T','\0'};
static const WCHAR defaultpromptW[] = {'$','P','$','G','\0'};

View File

@ -0,0 +1,141 @@
From 4944b0ed67011898a68fb244bdd947a15ef1c8ab Mon Sep 17 00:00:00 2001
From: Michael Stefaniuc <mstefani@winehq.org>
Date: Wed, 18 Jul 2018 18:37:52 +0200
Subject: [PATCH] windowscodecs: Use the ARRAY_SIZE() macro
Signed-off-by: Michael Stefaniuc <mstefani@winehq.org>
---
dlls/windowscodecs/bitmap.c | 2 +-
dlls/windowscodecs/bmpencode.c | 2 +-
dlls/windowscodecs/jpegformat.c | 2 +-
dlls/windowscodecs/metadataquery.c | 10 +++++-----
dlls/windowscodecs/pngformat.c | 4 ++--
dlls/windowscodecs/tiffformat.c | 2 +-
6 files changed, 11 insertions(+), 11 deletions(-)
diff --git a/dlls/windowscodecs/bitmap.c b/dlls/windowscodecs/bitmap.c
index f8414962f2..116fd3134a 100644
--- a/dlls/windowscodecs/bitmap.c
+++ b/dlls/windowscodecs/bitmap.c
@@ -555,7 +555,7 @@ static HRESULT WINAPI IMILBitmapImpl_GetPixelFormat(IMILBitmapSource *iface,
*format = 0;
- for (i = 0; i < sizeof(pixel_fmt_map)/sizeof(pixel_fmt_map[0]); i++)
+ for (i = 0; i < ARRAY_SIZE(pixel_fmt_map); i++)
{
if (IsEqualGUID(pixel_fmt_map[i].WIC_format, &This->pixelformat))
{
diff --git a/dlls/windowscodecs/bmpencode.c b/dlls/windowscodecs/bmpencode.c
index 97f30d7197..aa65675a98 100644
--- a/dlls/windowscodecs/bmpencode.c
+++ b/dlls/windowscodecs/bmpencode.c
@@ -529,7 +529,7 @@ static HRESULT WINAPI BmpEncoder_CreateNewFrame(IWICBitmapEncoder *iface,
if (ppIEncoderOptions)
{
- hr = CreatePropertyBag2(opts, sizeof(opts)/sizeof(opts[0]), ppIEncoderOptions);
+ hr = CreatePropertyBag2(opts, ARRAY_SIZE(opts), ppIEncoderOptions);
if (FAILED(hr)) return hr;
}
diff --git a/dlls/windowscodecs/jpegformat.c b/dlls/windowscodecs/jpegformat.c
index f05663f070..d24af6dc9e 100644
--- a/dlls/windowscodecs/jpegformat.c
+++ b/dlls/windowscodecs/jpegformat.c
@@ -1463,7 +1463,7 @@ static HRESULT WINAPI JpegEncoder_CreateNewFrame(IWICBitmapEncoder *iface,
if (ppIEncoderOptions)
{
- hr = CreatePropertyBag2(opts, sizeof(opts)/sizeof(opts[0]), ppIEncoderOptions);
+ hr = CreatePropertyBag2(opts, ARRAY_SIZE(opts), ppIEncoderOptions);
if (FAILED(hr))
{
LeaveCriticalSection(&This->lock);
diff --git a/dlls/windowscodecs/metadataquery.c b/dlls/windowscodecs/metadataquery.c
index e33884881b..2d7c918921 100644
--- a/dlls/windowscodecs/metadataquery.c
+++ b/dlls/windowscodecs/metadataquery.c
@@ -164,7 +164,7 @@ static VARTYPE map_type(struct string_t *str)
{
UINT i;
- for (i = 0; i < sizeof(str2vt)/sizeof(str2vt[0]); i++)
+ for (i = 0; i < ARRAY_SIZE(str2vt); i++)
{
if (str2vt[i].len == str->len)
{
@@ -743,7 +743,7 @@ HRESULT WINAPI WICMapGuidToShortName(REFGUID guid, UINT len, WCHAR *name, UINT *
if (!guid) return E_INVALIDARG;
- for (i = 0; i < sizeof(guid2name)/sizeof(guid2name[0]); i++)
+ for (i = 0; i < ARRAY_SIZE(guid2name); i++)
{
if (IsEqualGUID(guid, guid2name[i].guid))
{
@@ -774,7 +774,7 @@ HRESULT WINAPI WICMapShortNameToGuid(PCWSTR name, GUID *guid)
if (!name || !guid) return E_INVALIDARG;
- for (i = 0; i < sizeof(guid2name)/sizeof(guid2name[0]); i++)
+ for (i = 0; i < ARRAY_SIZE(guid2name); i++)
{
if (!lstrcmpiW(name, guid2name[i].name))
{
@@ -884,7 +884,7 @@ static const WCHAR *map_shortname_to_schema(const GUID *format, const WCHAR *nam
!IsEqualGUID(format, &GUID_MetadataFormatXMPStruct))
return NULL;
- for (i = 0; i < sizeof(name2schema)/sizeof(name2schema[0]); i++)
+ for (i = 0; i < ARRAY_SIZE(name2schema); i++)
{
if (!lstrcmpW(name2schema[i].name, name))
return name2schema[i].schema;
@@ -909,7 +909,7 @@ HRESULT WINAPI WICMapSchemaToName(REFGUID format, LPWSTR schema, UINT len, WCHAR
!IsEqualGUID(format, &GUID_MetadataFormatXMPStruct))
return WINCODEC_ERR_PROPERTYNOTFOUND;
- for (i = 0; i < sizeof(name2schema)/sizeof(name2schema[0]); i++)
+ for (i = 0; i < ARRAY_SIZE(name2schema); i++)
{
if (!lstrcmpW(name2schema[i].schema, schema))
{
diff --git a/dlls/windowscodecs/pngformat.c b/dlls/windowscodecs/pngformat.c
index fd0d197bb3..6b13112130 100644
--- a/dlls/windowscodecs/pngformat.c
+++ b/dlls/windowscodecs/pngformat.c
@@ -1441,7 +1441,7 @@ static HRESULT WINAPI PngFrameEncode_Initialize(IWICBitmapFrameEncode *iface,
if (pIEncoderOptions)
{
- hr = IPropertyBag2_Read(pIEncoderOptions, sizeof(opts)/sizeof(opts[0]), opts, NULL, opt_values, opt_hres);
+ hr = IPropertyBag2_Read(pIEncoderOptions, ARRAY_SIZE(opts), opts, NULL, opt_values, opt_hres);
if (FAILED(hr))
return hr;
@@ -2046,7 +2046,7 @@ static HRESULT WINAPI PngEncoder_CreateNewFrame(IWICBitmapEncoder *iface,
if (ppIEncoderOptions)
{
- hr = CreatePropertyBag2(opts, sizeof(opts)/sizeof(opts[0]), ppIEncoderOptions);
+ hr = CreatePropertyBag2(opts, ARRAY_SIZE(opts), ppIEncoderOptions);
if (FAILED(hr))
{
LeaveCriticalSection(&This->lock);
diff --git a/dlls/windowscodecs/tiffformat.c b/dlls/windowscodecs/tiffformat.c
index 2b2f84f859..966ab3eb4b 100644
--- a/dlls/windowscodecs/tiffformat.c
+++ b/dlls/windowscodecs/tiffformat.c
@@ -1956,7 +1956,7 @@ static HRESULT WINAPI TiffEncoder_CreateNewFrame(IWICBitmapEncoder *iface,
if (ppIEncoderOptions && SUCCEEDED(hr))
{
- hr = CreatePropertyBag2(opts, sizeof(opts)/sizeof(opts[0]), ppIEncoderOptions);
+ hr = CreatePropertyBag2(opts, ARRAY_SIZE(opts), ppIEncoderOptions);
if (SUCCEEDED(hr))
{
VARIANT v;
--
2.14.4

View File

@ -0,0 +1,147 @@
From a786168729fc3af234574a6f2a9baa7ea562a9ee Mon Sep 17 00:00:00 2001
From: Michael Stefaniuc <mstefani@winehq.org>
Date: Fri, 20 Jul 2018 14:20:24 +0200
Subject: [PATCH] localspl: Use the ARRAY_SIZE() macro
Signed-off-by: Michael Stefaniuc <mstefani@winehq.org>
---
dlls/localspl/localmon.c | 10 +++++-----
dlls/localspl/provider.c | 20 ++++++++++----------
2 files changed, 15 insertions(+), 15 deletions(-)
diff --git a/dlls/localspl/localmon.c b/dlls/localspl/localmon.c
index 4be1ad6101..8553aa2297 100644
--- a/dlls/localspl/localmon.c
+++ b/dlls/localspl/localmon.c
@@ -279,10 +279,10 @@ static DWORD get_type_from_name(LPCWSTR name)
{
HANDLE hfile;
- if (!strncmpW(name, portname_LPT, sizeof(portname_LPT) / sizeof(WCHAR) -1))
+ if (!strncmpW(name, portname_LPT, ARRAY_SIZE(portname_LPT) -1))
return PORT_IS_LPT;
- if (!strncmpW(name, portname_COM, sizeof(portname_COM) / sizeof(WCHAR) -1))
+ if (!strncmpW(name, portname_COM, ARRAY_SIZE(portname_COM) -1))
return PORT_IS_COM;
if (!strcmpW(name, portname_FILE))
@@ -294,10 +294,10 @@ static DWORD get_type_from_name(LPCWSTR name)
if (name[0] == '|')
return PORT_IS_PIPE;
- if (!strncmpW(name, portname_CUPS, sizeof(portname_CUPS) / sizeof(WCHAR) -1))
+ if (!strncmpW(name, portname_CUPS, ARRAY_SIZE(portname_CUPS) -1))
return PORT_IS_CUPS;
- if (!strncmpW(name, portname_LPR, sizeof(portname_LPR) / sizeof(WCHAR) -1))
+ if (!strncmpW(name, portname_LPR, ARRAY_SIZE(portname_LPR) -1))
return PORT_IS_LPR;
/* Must be a file or a directory. Does the file exist ? */
@@ -704,7 +704,7 @@ static DWORD WINAPI localmon_XcvDataPort(HANDLE hXcv, LPCWSTR pszDataName, PBYTE
{
ptr = ((xcv_t *)hXcv)->nameW;
}
- lstrcpynW(buffer, ptr, sizeof(buffer)/sizeof(WCHAR));
+ lstrcpynW(buffer, ptr, ARRAY_SIZE(buffer));
if (buffer[0]) buffer[lstrlenW(buffer)-1] = '\0'; /* remove the ':' */
res = SetDefaultCommConfigW(buffer, (LPCOMMCONFIG) pInputData, cbInputData);
TRACE("got %u with %u\n", res, GetLastError() );
diff --git a/dlls/localspl/provider.c b/dlls/localspl/provider.c
index 3538947281..c17d982fa7 100644
--- a/dlls/localspl/provider.c
+++ b/dlls/localspl/provider.c
@@ -275,7 +275,7 @@ static LONG copy_servername_from_name(LPCWSTR name, LPWSTR target)
target[serverlen] = '\0';
}
- len = sizeof(buffer) / sizeof(buffer[0]);
+ len = ARRAY_SIZE(buffer);
if (GetComputerNameW(buffer, &len)) {
if ((serverlen == len) && (strncmpiW(server, buffer, len) == 0)) {
/* The requested Servername is our computername */
@@ -693,7 +693,7 @@ static const printenv_t * validate_envW(LPCWSTR env)
TRACE("(%s)\n", debugstr_w(env));
if (env && env[0])
{
- for (i = 0; i < sizeof(all_printenv)/sizeof(all_printenv[0]); i++)
+ for (i = 0; i < ARRAY_SIZE(all_printenv); i++)
{
if (lstrcmpiW(env, all_printenv[i]->envname) == 0)
{
@@ -749,7 +749,7 @@ static DWORD get_local_monitors(DWORD level, LPBYTE pMonitors, DWORD cbBuf, LPDW
ptr = (LPWSTR) &pMonitors[len];
numentries = 0;
- len = sizeof(buffer)/sizeof(buffer[0]);
+ len = ARRAY_SIZE(buffer);
buffer[0] = '\0';
/* Windows creates the "Monitors"-Key on reboot / start "spooler" */
@@ -802,7 +802,7 @@ static DWORD get_local_monitors(DWORD level, LPBYTE pMonitors, DWORD cbBuf, LPDW
}
}
index++;
- len = sizeof(buffer)/sizeof(buffer[0]);
+ len = ARRAY_SIZE(buffer);
buffer[0] = '\0';
}
RegCloseKey(hroot);
@@ -838,7 +838,7 @@ static DWORD get_local_printprocessors(LPWSTR regpathW, LPBYTE pPPInfo, DWORD cb
ptr = (LPWSTR) &pPPInfo[len];
numentries = 0;
- len = sizeof(buffer)/sizeof(buffer[0]);
+ len = ARRAY_SIZE(buffer);
buffer[0] = '\0';
if (RegCreateKeyW(HKEY_LOCAL_MACHINE, regpathW, &hroot) == ERROR_SUCCESS) {
@@ -852,7 +852,7 @@ static DWORD get_local_printprocessors(LPWSTR regpathW, LPBYTE pPPInfo, DWORD cb
TRACE("%p: writing PRINTPROCESSOR_INFO_1W #%d\n", ppi, numentries);
ppi->pName = ptr;
lstrcpyW(ptr, winprintW); /* Name of the Print Processor */
- ptr += sizeof(winprintW) / sizeof(WCHAR);
+ ptr += ARRAY_SIZE(winprintW);
}
/* Scan all Printprocessor Keys */
@@ -888,7 +888,7 @@ static DWORD get_local_printprocessors(LPWSTR regpathW, LPBYTE pPPInfo, DWORD cb
}
}
index++;
- len = sizeof(buffer)/sizeof(buffer[0]);
+ len = ARRAY_SIZE(buffer);
buffer[0] = '\0';
}
RegCloseKey(hroot);
@@ -1196,7 +1196,7 @@ static HANDLE printer_alloc_handle(LPCWSTR name, LPPRINTER_DEFAULTSW pDefault)
printer = NULL;
}
if (printername) {
- len = sizeof(XcvMonitorW)/sizeof(WCHAR) - 1;
+ len = ARRAY_SIZE(XcvMonitorW) - 1;
if (strncmpW(printername, XcvMonitorW, len) == 0) {
/* OpenPrinter(",XcvMonitor ", ...) detected */
TRACE(",XcvMonitor: %s\n", debugstr_w(&printername[len]));
@@ -1210,7 +1210,7 @@ static HANDLE printer_alloc_handle(LPCWSTR name, LPPRINTER_DEFAULTSW pDefault)
}
else
{
- len = sizeof(XcvPortW)/sizeof(WCHAR) - 1;
+ len = ARRAY_SIZE(XcvPortW) - 1;
if (strncmpW( printername, XcvPortW, len) == 0) {
/* OpenPrinter(",XcvPort ", ...) detected */
TRACE(",XcvPort: %s\n", debugstr_w(&printername[len]));
@@ -1303,7 +1303,7 @@ static BOOL myAddPrinterDriverEx(DWORD level, LPBYTE pDriverInfo, DWORD dwFileCo
DRIVER_INFO, that the caller supplied */
ZeroMemory(&di, sizeof(di));
- if (pDriverInfo && (level < (sizeof(di_sizeof) / sizeof(di_sizeof[0])))) {
+ if (pDriverInfo && (level < ARRAY_SIZE(di_sizeof))) {
memcpy(&di, pDriverInfo, di_sizeof[level]);
}
--
2.14.4

View File

@ -0,0 +1,76 @@
From cc5f7e223678e31439d4194fd62d6448a06570f3 Mon Sep 17 00:00:00 2001
From: Michael Stefaniuc <mstefani@winehq.org>
Date: Fri, 20 Jul 2018 18:13:30 +0200
Subject: [PATCH] mmdevapi: Use the ARRAY_SIZE() macro
Signed-off-by: Michael Stefaniuc <mstefani@winehq.org>
---
dlls/mmdevapi/devenum.c | 10 +++++-----
dlls/mmdevapi/main.c | 2 +-
2 files changed, 6 insertions(+), 6 deletions(-)
diff --git a/dlls/mmdevapi/devenum.c b/dlls/mmdevapi/devenum.c
index b189e8e060..685ec27de6 100644
--- a/dlls/mmdevapi/devenum.c
+++ b/dlls/mmdevapi/devenum.c
@@ -338,7 +338,7 @@ static MMDevice *MMDevice_Create(WCHAR *name, GUID *id, EDataFlow flow, DWORD st
cur->state = state;
cur->devguid = *id;
- StringFromGUID2(&cur->devguid, guidstr, sizeof(guidstr)/sizeof(*guidstr));
+ StringFromGUID2(&cur->devguid, guidstr, ARRAY_SIZE(guidstr));
if (flow == eRender)
root = key_render;
@@ -429,7 +429,7 @@ static HRESULT load_devices_from_reg(void)
DWORD len;
PROPVARIANT pv = { VT_EMPTY };
- len = sizeof(guidvalue)/sizeof(guidvalue[0]);
+ len = ARRAY_SIZE(guidvalue);
ret = RegEnumKeyExW(cur, i++, guidvalue, &len, NULL, NULL, NULL, NULL);
if (ret == ERROR_NO_MORE_ITEMS)
{
@@ -1395,7 +1395,7 @@ static HRESULT WINAPI MMDevPropStore_GetCount(IPropertyStore *iface, DWORD *npro
return hr;
*nprops = 0;
do {
- DWORD len = sizeof(buffer)/sizeof(*buffer);
+ DWORD len = ARRAY_SIZE(buffer);
if (RegEnumValueW(propkey, i, buffer, &len, NULL, NULL, NULL, NULL) != ERROR_SUCCESS)
break;
i++;
@@ -1410,7 +1410,7 @@ static HRESULT WINAPI MMDevPropStore_GetAt(IPropertyStore *iface, DWORD prop, PR
{
MMDevPropStore *This = impl_from_IPropertyStore(iface);
WCHAR buffer[50];
- DWORD len = sizeof(buffer)/sizeof(*buffer);
+ DWORD len = ARRAY_SIZE(buffer);
HRESULT hr;
HKEY propkey;
@@ -1530,7 +1530,7 @@ static HRESULT WINAPI PB_Read(IPropertyBag *iface, LPCOLESTR name, VARIANT *var,
if (!lstrcmpW(name, dsguid))
{
WCHAR guidstr[39];
- StringFromGUID2(&This->devguid, guidstr,sizeof(guidstr)/sizeof(*guidstr));
+ StringFromGUID2(&This->devguid, guidstr,ARRAY_SIZE(guidstr));
var->n1.n2.vt = VT_BSTR;
var->n1.n2.n3.bstrVal = SysAllocString(guidstr);
return S_OK;
diff --git a/dlls/mmdevapi/main.c b/dlls/mmdevapi/main.c
index 2b0a6f946b..8886975c96 100644
--- a/dlls/mmdevapi/main.c
+++ b/dlls/mmdevapi/main.c
@@ -295,7 +295,7 @@ HRESULT WINAPI DllGetClassObject(REFCLSID rclsid, REFIID riid, LPVOID *ppv)
return E_NOINTERFACE;
}
- for (i = 0; i < sizeof(MMDEVAPI_CF)/sizeof(MMDEVAPI_CF[0]); ++i)
+ for (i = 0; i < ARRAY_SIZE(MMDEVAPI_CF); ++i)
{
if (IsEqualGUID(rclsid, MMDEVAPI_CF[i].rclsid)) {
IClassFactory_AddRef(&MMDEVAPI_CF[i].IClassFactory_iface);
--
2.14.4

View File

@ -0,0 +1,53 @@
From 5499bc6ae7bbc3b6924ec2a692ab0821d6c7113d Mon Sep 17 00:00:00 2001
From: Michael Stefaniuc <mstefani@winehq.org>
Date: Fri, 20 Jul 2018 18:16:59 +0200
Subject: [PATCH] mapi32: Use the ARRAY_SIZE() macro
Signed-off-by: Michael Stefaniuc <mstefani@winehq.org>
---
dlls/mapi32/sendmail.c | 8 ++++----
dlls/mapi32/util.c | 2 +-
2 files changed, 5 insertions(+), 5 deletions(-)
diff --git a/dlls/mapi32/sendmail.c b/dlls/mapi32/sendmail.c
index 9ebb220c03..407dd13041 100644
--- a/dlls/mapi32/sendmail.c
+++ b/dlls/mapi32/sendmail.c
@@ -542,8 +542,8 @@ ULONG WINAPI MAPISendMail( LHANDLE session, ULONG_PTR uiparam,
}
/* Display an error message since we apparently have no mail clients */
- LoadStringW(hInstMAPI32, IDS_NO_MAPI_CLIENT, error_msg, sizeof(error_msg) / sizeof(WCHAR));
- LoadStringW(hInstMAPI32, IDS_SEND_MAIL, msg_title, sizeof(msg_title) / sizeof(WCHAR));
+ LoadStringW(hInstMAPI32, IDS_NO_MAPI_CLIENT, error_msg, ARRAY_SIZE(error_msg));
+ LoadStringW(hInstMAPI32, IDS_SEND_MAIL, msg_title, ARRAY_SIZE(msg_title));
MessageBoxW((HWND) uiparam, error_msg, msg_title, MB_ICONEXCLAMATION);
@@ -701,8 +701,8 @@ ULONG WINAPI MAPISendMailW(LHANDLE session, ULONG_PTR uiparam,
}
/* Display an error message since we apparently have no mail clients */
- LoadStringW(hInstMAPI32, IDS_NO_MAPI_CLIENT, error_msg, sizeof(error_msg) / sizeof(WCHAR));
- LoadStringW(hInstMAPI32, IDS_SEND_MAIL, msg_title, sizeof(msg_title) / sizeof(WCHAR));
+ LoadStringW(hInstMAPI32, IDS_NO_MAPI_CLIENT, error_msg, ARRAY_SIZE(error_msg));
+ LoadStringW(hInstMAPI32, IDS_SEND_MAIL, msg_title, ARRAY_SIZE(msg_title));
MessageBoxW((HWND) uiparam, error_msg, msg_title, MB_ICONEXCLAMATION);
diff --git a/dlls/mapi32/util.c b/dlls/mapi32/util.c
index 13e4affc39..9c3b01944a 100644
--- a/dlls/mapi32/util.c
+++ b/dlls/mapi32/util.c
@@ -903,7 +903,7 @@ BOOL WINAPI FGetComponentPath(LPCSTR component, LPCSTR qualifier, LPSTR dll_path
char lcid_ver[20];
UINT i;
- for (i = 0; i < sizeof(fmt)/sizeof(fmt[0]); i++)
+ for (i = 0; i < ARRAY_SIZE(fmt); i++)
{
/* FIXME: what's the correct behaviour here? */
if (!qualifier || qualifier == lcid_ver)
--
2.14.4

View File

@ -0,0 +1,126 @@
From d66b0e6cc5066669c5e856d4627af51f7004fead Mon Sep 17 00:00:00 2001
From: Michael Stefaniuc <mstefani@winehq.org>
Date: Fri, 20 Jul 2018 18:21:27 +0200
Subject: [PATCH] krnl386.exe16: Use the ARRAY_SIZE() macro
Signed-off-by: Michael Stefaniuc <mstefani@winehq.org>
---
dlls/krnl386.exe16/int21.c | 6 +++---
dlls/krnl386.exe16/interrupts.c | 4 ++--
dlls/krnl386.exe16/relay.c | 4 ++--
dlls/krnl386.exe16/snoop.c | 4 ++--
dlls/krnl386.exe16/vxd.c | 6 +++---
5 files changed, 12 insertions(+), 12 deletions(-)
diff --git a/dlls/krnl386.exe16/int21.c b/dlls/krnl386.exe16/int21.c
index f32b1a767c..f5b257b6d7 100644
--- a/dlls/krnl386.exe16/int21.c
+++ b/dlls/krnl386.exe16/int21.c
@@ -814,8 +814,8 @@ static HANDLE INT21_CreateMagicDeviceHandle( LPCWSTR name )
return 0;
}
memcpy( nameW.Buffer, prefixW, sizeof(prefixW) );
- MultiByteToWideChar( CP_UNIXCP, 0, dir, -1, nameW.Buffer + sizeof(prefixW)/sizeof(WCHAR), len );
- len += sizeof(prefixW) / sizeof(WCHAR);
+ MultiByteToWideChar( CP_UNIXCP, 0, dir, -1, nameW.Buffer + ARRAY_SIZE(prefixW), len );
+ len += ARRAY_SIZE(prefixW);
nameW.Buffer[len-1] = '/';
strcpyW( nameW.Buffer + len, name );
@@ -3264,7 +3264,7 @@ static BOOL INT21_NetworkFunc (CONTEXT *context)
case 0x00: /* Get machine name. */
{
WCHAR dstW[MAX_COMPUTERNAME_LENGTH + 1];
- DWORD s = sizeof(dstW) / sizeof(WCHAR);
+ DWORD s = ARRAY_SIZE(dstW);
int len;
char *dst = CTX_SEG_OFF_TO_LIN (context,context->SegDs,context->Edx);
diff --git a/dlls/krnl386.exe16/interrupts.c b/dlls/krnl386.exe16/interrupts.c
index e1b01b7b3d..c4448c6d00 100644
--- a/dlls/krnl386.exe16/interrupts.c
+++ b/dlls/krnl386.exe16/interrupts.c
@@ -103,7 +103,7 @@ static void WINAPI DOSVM_DefaultHandler( CONTEXT *context )
*/
static INTPROC DOSVM_GetBuiltinHandler( BYTE intnum )
{
- if (intnum < sizeof(DOSVM_VectorsBuiltin)/sizeof(INTPROC)) {
+ if (intnum < ARRAY_SIZE(DOSVM_VectorsBuiltin)) {
INTPROC proc = DOSVM_VectorsBuiltin[intnum];
if (proc)
return proc;
@@ -274,7 +274,7 @@ BOOL DOSVM_EmulateInterruptPM( CONTEXT *context, BYTE intnum )
else if (wine_ldt_is_system(context->SegCs))
{
INTPROC proc;
- if (intnum >= sizeof(DOSVM_VectorsBuiltin)/sizeof(INTPROC)) return FALSE;
+ if (intnum >= ARRAY_SIZE(DOSVM_VectorsBuiltin)) return FALSE;
if (!(proc = DOSVM_VectorsBuiltin[intnum])) return FALSE;
proc( context );
}
diff --git a/dlls/krnl386.exe16/relay.c b/dlls/krnl386.exe16/relay.c
index f1fbc57a0f..264ba2c589 100644
--- a/dlls/krnl386.exe16/relay.c
+++ b/dlls/krnl386.exe16/relay.c
@@ -345,7 +345,7 @@ static int relay_call_from_16_no_debug( void *entry_point, unsigned char *args16
int args32[20];
/* look for the ret instruction */
- for (j = 0; j < sizeof(call->ret)/sizeof(call->ret[0]); j++)
+ for (j = 0; j < ARRAY_SIZE(call->ret); j++)
if (call->ret[j] == 0xca66 || call->ret[j] == 0xcb66) break;
if (call->ret[j] == 0xcb66) /* cdecl */
@@ -449,7 +449,7 @@ int relay_call_from_16( void *entry_point, unsigned char *args16, CONTEXT *conte
TRACE( "\1Call %s.%d: %s(", module, ordinal, func );
/* look for the ret instruction */
- for (j = 0; j < sizeof(call->ret)/sizeof(call->ret[0]); j++)
+ for (j = 0; j < ARRAY_SIZE(call->ret); j++)
if (call->ret[j] == 0xca66 || call->ret[j] == 0xcb66) break;
if (call->ret[j] == 0xcb66) /* cdecl */
diff --git a/dlls/krnl386.exe16/snoop.c b/dlls/krnl386.exe16/snoop.c
index 95a5154a4b..4496080dad 100644
--- a/dlls/krnl386.exe16/snoop.c
+++ b/dlls/krnl386.exe16/snoop.c
@@ -262,10 +262,10 @@ static void WINAPI SNOOP16_Entry(FARPROC proc, LPBYTE args, CONTEXT *context) {
return; /* oops */
}
while (*rets) {
- for (i=0;i<sizeof((*rets)->entry)/sizeof((*rets)->entry[0]);i++)
+ for (i=0;i<ARRAY_SIZE((*rets)->entry);i++)
if (!(*rets)->entry[i].origreturn)
break;
- if (i!=sizeof((*rets)->entry)/sizeof((*rets)->entry[0]))
+ if (i!=ARRAY_SIZE((*rets)->entry))
break;
rets = &((*rets)->next);
}
diff --git a/dlls/krnl386.exe16/vxd.c b/dlls/krnl386.exe16/vxd.c
index dc14600f5d..e103b96bb9 100644
--- a/dlls/krnl386.exe16/vxd.c
+++ b/dlls/krnl386.exe16/vxd.c
@@ -129,8 +129,8 @@ static HANDLE open_vxd_handle( LPCWSTR name )
return 0;
}
memcpy( nameW.Buffer, prefixW, sizeof(prefixW) );
- MultiByteToWideChar( CP_UNIXCP, 0, dir, -1, nameW.Buffer + sizeof(prefixW)/sizeof(WCHAR), len );
- len += sizeof(prefixW) / sizeof(WCHAR);
+ MultiByteToWideChar( CP_UNIXCP, 0, dir, -1, nameW.Buffer + ARRAY_SIZE(prefixW), len );
+ len += ARRAY_SIZE(prefixW);
nameW.Buffer[len-1] = '/';
strcpyW( nameW.Buffer + len, name );
@@ -201,7 +201,7 @@ HANDLE __wine_vxd_open( LPCWSTR filenameW, DWORD access, SECURITY_ATTRIBUTES *sa
/* normalize the filename */
- if (strlenW( filenameW ) >= sizeof(name)/sizeof(WCHAR) - 4 ||
+ if (strlenW( filenameW ) >= ARRAY_SIZE(name) - 4 ||
strchrW( filenameW, '/' ) || strchrW( filenameW, '\\' ))
{
SetLastError( ERROR_FILE_NOT_FOUND );
--
2.14.4

View File

@ -0,0 +1,101 @@
From a2c03d68887fc2bd2eb4cde9bb4ea7aa133af5ee Mon Sep 17 00:00:00 2001
From: Michael Stefaniuc <mstefani@winehq.org>
Date: Fri, 20 Jul 2018 18:24:53 +0200
Subject: [PATCH] inetcpl.cpl: Use the ARRAY_SIZE() macro
Signed-off-by: Michael Stefaniuc <mstefani@winehq.org>
---
dlls/inetcpl.cpl/connections.c | 9 ++++-----
dlls/inetcpl.cpl/general.c | 4 ++--
dlls/inetcpl.cpl/security.c | 10 +++++-----
3 files changed, 11 insertions(+), 12 deletions(-)
diff --git a/dlls/inetcpl.cpl/connections.c b/dlls/inetcpl.cpl/connections.c
index 707fb3c4f7..648cd3d002 100644
--- a/dlls/inetcpl.cpl/connections.c
+++ b/dlls/inetcpl.cpl/connections.c
@@ -273,13 +273,12 @@ static INT_PTR connections_on_notify(HWND hwnd, WPARAM wparam, LPARAM lparam)
}
TRACE("ProxyEnable set to %x\n", use_proxy);
- proxy_len = GetDlgItemTextW(hwnd, IDC_EDIT_PROXY_SERVER,
- proxy, sizeof(proxy)/sizeof(proxy[0]));
+ proxy_len = GetDlgItemTextW(hwnd, IDC_EDIT_PROXY_SERVER, proxy, ARRAY_SIZE(proxy));
if(proxy_len)
{
proxy[proxy_len++] = ':';
- port_len = GetDlgItemTextW(hwnd, IDC_EDIT_PROXY_PORT,
- proxy+proxy_len, sizeof(proxy)/sizeof(proxy[0])-proxy_len);
+ port_len = GetDlgItemTextW(hwnd, IDC_EDIT_PROXY_PORT, proxy+proxy_len,
+ ARRAY_SIZE(proxy)-proxy_len);
if(!port_len)
{
proxy[proxy_len++] = '8';
@@ -305,7 +304,7 @@ static INT_PTR connections_on_notify(HWND hwnd, WPARAM wparam, LPARAM lparam)
use_pac_script = IsDlgButtonChecked(hwnd, IDC_USE_PAC_SCRIPT);
pac_script_len = GetDlgItemTextW(hwnd, IDC_EDIT_PAC_SCRIPT,
- pac_script, sizeof(pac_script)/sizeof(pac_script[0]));
+ pac_script, ARRAY_SIZE(pac_script));
if(!pac_script_len) use_pac_script = FALSE;
if(use_pac_script)
{
diff --git a/dlls/inetcpl.cpl/general.c b/dlls/inetcpl.cpl/general.c
index e0f473caf7..b9fbf1eb0a 100644
--- a/dlls/inetcpl.cpl/general.c
+++ b/dlls/inetcpl.cpl/general.c
@@ -263,10 +263,10 @@ static INT_PTR general_on_notify(HWND hwnd, WPARAM wparam, LPARAM lparam)
if (psn->hdr.code == PSN_APPLY)
{
*buffer = 0;
- GetDlgItemTextW(hwnd, IDC_HOME_EDIT, buffer, sizeof(buffer)/sizeof(WCHAR));
+ GetDlgItemTextW(hwnd, IDC_HOME_EDIT, buffer, ARRAY_SIZE(buffer));
TRACE("EDITTEXT has %s\n", debugstr_w(buffer));
- res = parse_url_from_outside(buffer, parsed, sizeof(parsed)/sizeof(WCHAR));
+ res = parse_url_from_outside(buffer, parsed, ARRAY_SIZE(parsed));
TRACE("got %d with %s\n", res, debugstr_w(parsed));
if (res)
diff --git a/dlls/inetcpl.cpl/security.c b/dlls/inetcpl.cpl/security.c
index 543ada433d..e11caf1fc3 100644
--- a/dlls/inetcpl.cpl/security.c
+++ b/dlls/inetcpl.cpl/security.c
@@ -73,7 +73,7 @@ static DWORD url_templates[] = {URLTEMPLATE_CUSTOM,
static DWORD index_from_urltemplate(URLTEMPLATE value)
{
- DWORD index = sizeof(url_templates) / sizeof(url_templates[0]);
+ DWORD index = ARRAY_SIZE(url_templates);
while((index > 0) && (url_templates[index-1] != value))
index--;
@@ -105,12 +105,12 @@ static void update_security_level(secdlg_data *sd, DWORD lv_index, DWORD tb_inde
current_index = (tb_index > 0) ? tb_index : index_from_urltemplate(sd->levels[lv_index]);
name[0] = 0;
- LoadStringW(hcpl, IDS_SEC_LEVEL0 + current_index, name, sizeof(name)/sizeof(name[0]));
+ LoadStringW(hcpl, IDS_SEC_LEVEL0 + current_index, name, ARRAY_SIZE(name));
TRACE("new level #%d: %s\n", current_index, debugstr_w(name));
SetWindowTextW(GetDlgItem(sd->hsec, IDC_SEC_LEVEL), name);
name[0] = 0;
- LoadStringW(hcpl, IDS_SEC_LEVEL0_INFO + (current_index * 0x10), name, sizeof(name)/sizeof(name[0]));
+ LoadStringW(hcpl, IDS_SEC_LEVEL0_INFO + (current_index * 0x10), name, ARRAY_SIZE(name));
TRACE("new level info: %s\n", debugstr_w(name));
SetWindowTextW(GetDlgItem(sd->hsec, IDC_SEC_LEVEL_INFO), name);
@@ -134,8 +134,8 @@ static void update_zone_info(secdlg_data *sd, DWORD lv_index)
SetWindowTextW(GetDlgItem(sd->hsec, IDC_SEC_ZONE_INFO), za->szDescription);
- len = LoadStringW(hcpl, IDS_SEC_SETTINGS, name, sizeof(name)/sizeof(*name));
- lstrcpynW(&name[len], za->szDisplayName, sizeof(name)/sizeof(*name) - len - 1);
+ len = LoadStringW(hcpl, IDS_SEC_SETTINGS, name, ARRAY_SIZE(name));
+ lstrcpynW(&name[len], za->szDisplayName, ARRAY_SIZE(name) - len - 1);
TRACE("new title: %s\n", debugstr_w(name));
SetWindowTextW(GetDlgItem(sd->hsec, IDC_SEC_GROUP), name);
--
2.14.4

View File

@ -0,0 +1,68 @@
From 00e499b6eef608c2b3eceec3b51db412637cd803 Mon Sep 17 00:00:00 2001
From: Michael Stefaniuc <mstefani@winehq.org>
Date: Fri, 20 Jul 2018 20:15:42 +0200
Subject: [PATCH] hhctrl.ocx: Use the ARRAY_SIZE() macro
Signed-off-by: Michael Stefaniuc <mstefani@winehq.org>
---
dlls/hhctrl.ocx/chm.c | 12 ++++++------
dlls/hhctrl.ocx/help.c | 6 +++---
2 files changed, 9 insertions(+), 9 deletions(-)
diff --git a/dlls/hhctrl.ocx/chm.c b/dlls/hhctrl.ocx/chm.c
index 8cf2539d71..01403368b0 100644
--- a/dlls/hhctrl.ocx/chm.c
+++ b/dlls/hhctrl.ocx/chm.c
@@ -483,12 +483,12 @@ LPCWSTR skip_schema(LPCWSTR url)
static const WCHAR msits_schema[] = {'m','s','-','i','t','s',':'};
static const WCHAR mk_schema[] = {'m','k',':','@','M','S','I','T','S','t','o','r','e',':'};
- if(!strncmpiW(its_schema, url, sizeof(its_schema)/sizeof(WCHAR)))
- return url+sizeof(its_schema)/sizeof(WCHAR);
- if(!strncmpiW(msits_schema, url, sizeof(msits_schema)/sizeof(WCHAR)))
- return url+sizeof(msits_schema)/sizeof(WCHAR);
- if(!strncmpiW(mk_schema, url, sizeof(mk_schema)/sizeof(WCHAR)))
- return url+sizeof(mk_schema)/sizeof(WCHAR);
+ if(!strncmpiW(its_schema, url, ARRAY_SIZE(its_schema)))
+ return url + ARRAY_SIZE(its_schema);
+ if(!strncmpiW(msits_schema, url, ARRAY_SIZE(msits_schema)))
+ return url + ARRAY_SIZE(msits_schema);
+ if(!strncmpiW(mk_schema, url, ARRAY_SIZE(mk_schema)))
+ return url + ARRAY_SIZE(mk_schema);
return url;
}
diff --git a/dlls/hhctrl.ocx/help.c b/dlls/hhctrl.ocx/help.c
index c7a2a7a9e2..75b28f2f57 100644
--- a/dlls/hhctrl.ocx/help.c
+++ b/dlls/hhctrl.ocx/help.c
@@ -241,7 +241,7 @@ static BOOL AppendFullPathURL(LPCWSTR file, LPWSTR buf, LPCWSTR index)
TRACE("%s %p %s\n", debugstr_w(file), buf, debugstr_w(index));
- if(!GetFullPathNameW(file, sizeof(full_path)/sizeof(full_path[0]), full_path, NULL)) {
+ if (!GetFullPathNameW(file, ARRAY_SIZE(full_path), full_path, NULL)) {
WARN("GetFullPathName failed: %u\n", GetLastError());
return FALSE;
}
@@ -1830,7 +1830,7 @@ HHInfo *CreateHelpViewer(HHInfo *info, LPCWSTR filename, HWND caller)
/* Set the invalid tab ID (-1) as the default value for all
* of the tabs, this matches a failed TCM_INSERTITEM call.
*/
- for(i=0;i<sizeof(info->tabs)/sizeof(HHTab);i++)
+ for (i = 0; i < ARRAY_SIZE(info->tabs); i++)
info->tabs[i].id = -1;
OleInitialize(NULL);
@@ -1867,7 +1867,7 @@ HHInfo *CreateHelpViewer(HHInfo *info, LPCWSTR filename, HWND caller)
*/
static char find_html_symbol(const char *entity, int entity_len)
{
- int max = sizeof(html_encoded_symbols)/sizeof(html_encoded_symbols[0])-1;
+ int max = ARRAY_SIZE(html_encoded_symbols)-1;
int min = 0, dir;
while(min <= max)
--
2.14.4

View File

@ -0,0 +1,27 @@
From e8731fe8f894a10182df1f2f699a0f9f107062bb Mon Sep 17 00:00:00 2001
From: Michael Stefaniuc <mstefani@winehq.org>
Date: Fri, 20 Jul 2018 20:18:06 +0200
Subject: [PATCH] dpnet: Use the ARRAY_SIZE() macro
Signed-off-by: Henri Verbeet <hverbeet@codeweavers.com>
Signed-off-by: Michael Stefaniuc <mstefani@winehq.org>
---
dlls/dpnet/address.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/dlls/dpnet/address.c b/dlls/dpnet/address.c
index 4d55caa47e..0bfa2bca03 100644
--- a/dlls/dpnet/address.c
+++ b/dlls/dpnet/address.c
@@ -150,7 +150,7 @@ static const char *debugstr_SP(const GUID *id) {
if (!id) return "(null)";
- for (i = 0; i < sizeof(guids)/sizeof(guids[0]); i++) {
+ for (i = 0; i < ARRAY_SIZE(guids); i++) {
if (IsEqualGUID(id, guids[i].guid))
return guids[i].name;
}
--
2.14.4

View File

@ -0,0 +1,34 @@
From d4c354720d4534593b3a49ece07b40ea4be4b92d Mon Sep 17 00:00:00 2001
From: Michael Stefaniuc <mstefani@winehq.org>
Date: Fri, 20 Jul 2018 20:19:12 +0200
Subject: [PATCH] dx8vb: Use the ARRAY_SIZE() macro
Signed-off-by: Henri Verbeet <hverbeet@codeweavers.com>
Signed-off-by: Michael Stefaniuc <mstefani@winehq.org>
---
dlls/dx8vb/main.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/dlls/dx8vb/main.c b/dlls/dx8vb/main.c
index aa6b9436ce..a1ee7c918e 100644
--- a/dlls/dx8vb/main.c
+++ b/dlls/dx8vb/main.c
@@ -157,13 +157,13 @@ HRESULT WINAPI DllGetClassObject(REFCLSID rclsid, REFIID riid, void **ppv)
&& !IsEqualGUID( &IID_IUnknown, riid))
return E_NOINTERFACE;
- for (i = 0; i < sizeof(object_creation)/sizeof(object_creation[0]); i++)
+ for (i = 0; i < ARRAY_SIZE(object_creation); i++)
{
if (IsEqualGUID(object_creation[i].clsid, rclsid))
break;
}
- if (i == sizeof(object_creation)/sizeof(object_creation[0]))
+ if (i == ARRAY_SIZE(object_creation))
{
FIXME("%s: no class found.\n", debugstr_guid(rclsid));
return CLASS_E_CLASSNOTAVAILABLE;
--
2.14.4

View File

@ -0,0 +1,78 @@
From 7e95288b2d586f41e746cf930a1a75979591399a Mon Sep 17 00:00:00 2001
From: Michael Stefaniuc <mstefani@winehq.org>
Date: Fri, 20 Jul 2018 20:22:05 +0200
Subject: [PATCH] fusion: Use the ARRAY_SIZE() macro
Signed-off-by: Michael Stefaniuc <mstefani@winehq.org>
---
dlls/fusion/asmcache.c | 8 ++++----
dlls/fusion/fusion.c | 10 +++++-----
2 files changed, 9 insertions(+), 9 deletions(-)
diff --git a/dlls/fusion/asmcache.c b/dlls/fusion/asmcache.c
index 668aa8777e..deca5f4c37 100644
--- a/dlls/fusion/asmcache.c
+++ b/dlls/fusion/asmcache.c
@@ -117,14 +117,14 @@ static BOOL get_assembly_directory(LPWSTR dir, DWORD size, const char *version,
if (!strcmp(version, "v4.0.30319"))
{
strcpyW(dir + len, dotnet);
- len += sizeof(dotnet)/sizeof(WCHAR) -1;
+ len += ARRAY_SIZE(dotnet) - 1;
strcpyW(dir + len, gac + 1);
- len += sizeof(gac)/sizeof(WCHAR) - 2;
+ len += ARRAY_SIZE(gac) - 2;
}
else
{
strcpyW(dir + len, gac);
- len += sizeof(gac)/sizeof(WCHAR) - 1;
+ len += ARRAY_SIZE(gac) - 1;
}
switch (architecture)
{
@@ -433,7 +433,7 @@ static HRESULT WINAPI IAssemblyCacheImpl_InstallAssembly(IAssemblyCache *iface,
WCHAR asmdir[MAX_PATH], *p, **external_files = NULL, *dst_dir = NULL;
PEKIND architecture;
char *clr_version;
- DWORD i, count = 0, src_len, dst_len = sizeof(format_v40)/sizeof(format_v40[0]);
+ DWORD i, count = 0, src_len, dst_len = ARRAY_SIZE(format_v40);
HRESULT hr;
TRACE("(%p, %d, %s, %p)\n", iface, dwFlags,
diff --git a/dlls/fusion/fusion.c b/dlls/fusion/fusion.c
index b038b38092..a57d7e067c 100644
--- a/dlls/fusion/fusion.c
+++ b/dlls/fusion/fusion.c
@@ -144,9 +144,9 @@ HRESULT WINAPI GetCachePath(ASM_CACHE_FLAGS dwCacheFlags, LPWSTR pwzCachePath,
case ASM_CACHE_GAC:
{
strcpyW(path + len, assembly);
- len += sizeof(assembly)/sizeof(WCHAR) - 1;
+ len += ARRAY_SIZE(assembly) - 1;
strcpyW(path + len, gac);
- len += sizeof(gac)/sizeof(WCHAR) - 1;
+ len += ARRAY_SIZE(gac) - 1;
break;
}
case ASM_CACHE_DOWNLOAD:
@@ -156,13 +156,13 @@ HRESULT WINAPI GetCachePath(ASM_CACHE_FLAGS dwCacheFlags, LPWSTR pwzCachePath,
}
case ASM_CACHE_ROOT:
strcpyW(path + len, assembly);
- len += sizeof(assembly)/sizeof(WCHAR) - 1;
+ len += ARRAY_SIZE(assembly) - 1;
break;
case ASM_CACHE_ROOT_EX:
strcpyW(path + len, dotnet);
- len += sizeof(dotnet)/sizeof(WCHAR) - 1;
+ len += ARRAY_SIZE(dotnet) - 1;
strcpyW(path + len, assembly);
- len += sizeof(assembly)/sizeof(WCHAR) - 1;
+ len += ARRAY_SIZE(assembly) - 1;
break;
default:
return E_INVALIDARG;
--
2.14.4

View File

@ -0,0 +1,33 @@
From aca6266ebe1ead32e12dfb0c9aec035fec0c1363 Mon Sep 17 00:00:00 2001
From: Michael Stefaniuc <mstefani@winehq.org>
Date: Fri, 20 Jul 2018 20:28:08 +0200
Subject: [PATCH] evr: Use the ARRAY_SIZE() macro
Signed-off-by: Michael Stefaniuc <mstefani@winehq.org>
---
dlls/evr/main.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/dlls/evr/main.c b/dlls/evr/main.c
index ed5c9f4c79..313d518b76 100644
--- a/dlls/evr/main.c
+++ b/dlls/evr/main.c
@@ -154,13 +154,13 @@ HRESULT WINAPI DllGetClassObject(REFCLSID rclsid, REFIID riid, void **ppv)
&& !IsEqualGUID( &IID_IUnknown, riid))
return E_NOINTERFACE;
- for (i = 0; i < sizeof(object_creation)/sizeof(object_creation[0]); i++)
+ for (i = 0; i < ARRAY_SIZE(object_creation); i++)
{
if (IsEqualGUID(object_creation[i].clsid, rclsid))
break;
}
- if (i == sizeof(object_creation)/sizeof(object_creation[0]))
+ if (i == ARRAY_SIZE(object_creation))
{
FIXME("%s: no class found.\n", debugstr_guid(rclsid));
return CLASS_E_CLASSNOTAVAILABLE;
--
2.14.4

View File

@ -0,0 +1,36 @@
From ab5ec464cf9178ec1466bf6af36ba6584ceda982 Mon Sep 17 00:00:00 2001
From: Michael Stefaniuc <mstefani@winehq.org>
Date: Fri, 20 Jul 2018 20:31:59 +0200
Subject: [PATCH] d3d10: Use the ARRAY_SIZE() macro
Signed-off-by: Henri Verbeet <hverbeet@codeweavers.com>
Signed-off-by: Michael Stefaniuc <mstefani@winehq.org>
---
dlls/d3d10/effect.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/dlls/d3d10/effect.c b/dlls/d3d10/effect.c
index 10d8404559..cd6f4a3e1d 100644
--- a/dlls/d3d10/effect.c
+++ b/dlls/d3d10/effect.c
@@ -1139,7 +1139,7 @@ static const struct d3d10_effect_state_property_info *get_property_info(UINT id)
{
unsigned int i;
- for (i = 0; i < sizeof(property_info) / sizeof(*property_info); ++i)
+ for (i = 0; i < ARRAY_SIZE(property_info); ++i)
{
if (property_info[i].id == id)
return &property_info[i];
@@ -1152,7 +1152,7 @@ static const struct d3d10_effect_state_storage_info *get_storage_info(D3D_SHADER
{
unsigned int i;
- for (i = 0; i < sizeof(d3d10_effect_state_storage_info) / sizeof(*d3d10_effect_state_storage_info); ++i)
+ for (i = 0; i < ARRAY_SIZE(d3d10_effect_state_storage_info); ++i)
{
if (d3d10_effect_state_storage_info[i].id == id)
return &d3d10_effect_state_storage_info[i];
--
2.14.4

View File

@ -0,0 +1,36 @@
From 68a223a5b2faac1fae87a9e1125f923d62b06c80 Mon Sep 17 00:00:00 2001
From: Michael Stefaniuc <mstefani@winehq.org>
Date: Fri, 20 Jul 2018 20:33:14 +0200
Subject: [PATCH] d3d8: Use the ARRAY_SIZE() macro
Signed-off-by: Henri Verbeet <hverbeet@codeweavers.com>
Signed-off-by: Michael Stefaniuc <mstefani@winehq.org>
---
dlls/d3d8/device.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/dlls/d3d8/device.c b/dlls/d3d8/device.c
index c967a33d8c..364798f79b 100644
--- a/dlls/d3d8/device.c
+++ b/dlls/d3d8/device.c
@@ -2126,7 +2126,7 @@ static HRESULT WINAPI d3d8_device_GetTextureStageState(IDirect3DDevice8 *iface,
TRACE("iface %p, stage %u, state %#x, value %p.\n", iface, stage, Type, value);
- if (Type >= sizeof(tss_lookup) / sizeof(*tss_lookup))
+ if (Type >= ARRAY_SIZE(tss_lookup))
{
WARN("Invalid Type %#x passed.\n", Type);
return D3D_OK;
@@ -2152,7 +2152,7 @@ static HRESULT WINAPI d3d8_device_SetTextureStageState(IDirect3DDevice8 *iface,
TRACE("iface %p, stage %u, state %#x, value %#x.\n", iface, stage, type, value);
- if (type >= sizeof(tss_lookup) / sizeof(*tss_lookup))
+ if (type >= ARRAY_SIZE(tss_lookup))
{
WARN("Invalid type %#x passed.\n", type);
return D3D_OK;
--
2.14.4

View File

@ -0,0 +1,51 @@
From 87f229b2bc6347493ea602ac51ff7b0271c9cbb6 Mon Sep 17 00:00:00 2001
From: Michael Stefaniuc <mstefani@winehq.org>
Date: Fri, 20 Jul 2018 20:34:30 +0200
Subject: [PATCH] d3dcompiler: Use the ARRAY_SIZE() macro
Signed-off-by: Henri Verbeet <hverbeet@codeweavers.com>
Signed-off-by: Matteo Bruni <mbruni@codeweavers.com>
Signed-off-by: Michael Stefaniuc <mstefani@winehq.org>
---
dlls/d3dcompiler_43/compiler.c | 2 +-
dlls/d3dcompiler_43/utils.c | 4 ++--
2 files changed, 3 insertions(+), 3 deletions(-)
diff --git a/dlls/d3dcompiler_43/compiler.c b/dlls/d3dcompiler_43/compiler.c
index 36e793ed01..10c6d01878 100644
--- a/dlls/d3dcompiler_43/compiler.c
+++ b/dlls/d3dcompiler_43/compiler.c
@@ -570,7 +570,7 @@ static const struct target_info targets_info[] = {
static const struct target_info * get_target_info(const char *target)
{
LONG min = 0;
- LONG max = sizeof(targets_info) / sizeof(targets_info[0]) - 1;
+ LONG max = ARRAY_SIZE(targets_info) - 1;
LONG cur;
int res;
diff --git a/dlls/d3dcompiler_43/utils.c b/dlls/d3dcompiler_43/utils.c
index 79f3be8840..b0232f375d 100644
--- a/dlls/d3dcompiler_43/utils.c
+++ b/dlls/d3dcompiler_43/utils.c
@@ -1165,7 +1165,7 @@ static enum hlsl_base_type expr_common_base_type(enum hlsl_base_type t1, enum hl
};
int t1_idx = -1, t2_idx = -1, i;
- for (i = 0; i < sizeof(types) / sizeof(types[0]); ++i)
+ for (i = 0; i < ARRAY_SIZE(types); ++i)
{
/* Always convert away from HLSL_TYPE_HALF */
if (t1 == types[i])
@@ -1943,7 +1943,7 @@ static const char *debug_node_type(enum hlsl_ir_node_type type)
"HLSL_IR_SWIZZLE",
};
- if (type >= sizeof(names) / sizeof(names[0]))
+ if (type >= ARRAY_SIZE(names))
return "Unexpected node type";
return names[type];
}
--
2.14.4

View File

@ -0,0 +1,34 @@
From 647edc04f021e10ccb1e6417056c32d251856abf Mon Sep 17 00:00:00 2001
From: Michael Stefaniuc <mstefani@winehq.org>
Date: Fri, 20 Jul 2018 20:36:58 +0200
Subject: [PATCH] d3dxof: Use the ARRAY_SIZE() macro
Signed-off-by: Matteo Bruni <mbruni@codeweavers.com>
Signed-off-by: Michael Stefaniuc <mstefani@winehq.org>
---
dlls/d3dxof/main.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/dlls/d3dxof/main.c b/dlls/d3dxof/main.c
index 572f38831f..385609ace0 100644
--- a/dlls/d3dxof/main.c
+++ b/dlls/d3dxof/main.c
@@ -195,13 +195,13 @@ HRESULT WINAPI DllGetClassObject(REFCLSID rclsid, REFIID riid, LPVOID *ppv)
&& ! IsEqualGUID( &IID_IUnknown, riid) )
return E_NOINTERFACE;
- for (i=0; i < sizeof(object_creation)/sizeof(object_creation[0]); i++)
+ for (i = 0; i < ARRAY_SIZE(object_creation); i++)
{
if (IsEqualGUID(object_creation[i].clsid, rclsid))
break;
}
- if (i == sizeof(object_creation)/sizeof(object_creation[0]))
+ if (i == ARRAY_SIZE(object_creation))
{
FIXME("%s: no class found.\n", debugstr_guid(rclsid));
return CLASS_E_CLASSNOTAVAILABLE;
--
2.14.4

View File

@ -0,0 +1,44 @@
From febcd7051a70405d6a4a4882f9fc41314445ca0e Mon Sep 17 00:00:00 2001
From: Michael Stefaniuc <mstefani@winehq.org>
Date: Fri, 20 Jul 2018 20:39:05 +0200
Subject: [PATCH] dnsapi: Use the ARRAY_SIZE() macro
Signed-off-by: Michael Stefaniuc <mstefani@winehq.org>
---
dlls/dnsapi/query.c | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/dlls/dnsapi/query.c b/dlls/dnsapi/query.c
index 74b70967ae..19eecfded1 100644
--- a/dlls/dnsapi/query.c
+++ b/dlls/dnsapi/query.c
@@ -618,7 +618,7 @@ static DNS_STATUS dns_do_query( PCSTR name, WORD type, DWORD options, PDNS_RECOR
goto exit;
}
- for (i = 0; i < sizeof(sections)/sizeof(sections[0]); i++)
+ for (i = 0; i < ARRAY_SIZE(sections); i++)
{
for (num = 0; num < ns_msg_count( msg, sections[i] ); num++)
{
@@ -771,7 +771,7 @@ static DNS_STATUS dns_get_hostname_a( COMPUTER_NAME_FORMAT format,
PSTR buffer, PDWORD len )
{
char name[256];
- DWORD size = sizeof(name)/sizeof(name[0]);
+ DWORD size = ARRAY_SIZE(name);
if (!GetComputerNameExA( format, name, &size ))
return DNS_ERROR_NAME_DOES_NOT_EXIST;
@@ -790,7 +790,7 @@ static DNS_STATUS dns_get_hostname_w( COMPUTER_NAME_FORMAT format,
PWSTR buffer, PDWORD len )
{
WCHAR name[256];
- DWORD size = sizeof(name)/sizeof(name[0]);
+ DWORD size = ARRAY_SIZE(name);
if (!GetComputerNameExW( format, name, &size ))
return DNS_ERROR_NAME_DOES_NOT_EXIST;
--
2.14.4

View File

@ -0,0 +1,47 @@
From 86bb2d2b580b4f5c77fcdb75be9d68522bd9807d Mon Sep 17 00:00:00 2001
From: Michael Stefaniuc <mstefani@winehq.org>
Date: Mon, 23 Jul 2018 08:57:48 +0200
Subject: [PATCH] amstream: Use the ARRAY_SIZE() macro
Signed-off-by: Michael Stefaniuc <mstefani@winehq.org>
---
dlls/amstream/main.c | 4 ++--
dlls/amstream/tests/amstream.c | 2 +-
2 files changed, 3 insertions(+), 3 deletions(-)
diff --git a/dlls/amstream/main.c b/dlls/amstream/main.c
index 2cadf9c32f..65aafba3e6 100644
--- a/dlls/amstream/main.c
+++ b/dlls/amstream/main.c
@@ -174,13 +174,13 @@ HRESULT WINAPI DllGetClassObject(REFCLSID rclsid, REFIID riid, LPVOID *ppv)
&& ! IsEqualGUID( &IID_IUnknown, riid) )
return E_NOINTERFACE;
- for (i=0; i < sizeof(object_creation)/sizeof(object_creation[0]); i++)
+ for (i = 0; i < ARRAY_SIZE(object_creation); i++)
{
if (IsEqualGUID(object_creation[i].clsid, rclsid))
break;
}
- if (i == sizeof(object_creation)/sizeof(object_creation[0]))
+ if (i == ARRAY_SIZE(object_creation))
{
FIXME("%s: no class found.\n", debugstr_guid(rclsid));
return CLASS_E_CLASSNOTAVAILABLE;
diff --git a/dlls/amstream/tests/amstream.c b/dlls/amstream/tests/amstream.c
index 1a14572c8a..52e691fea4 100644
--- a/dlls/amstream/tests/amstream.c
+++ b/dlls/amstream/tests/amstream.c
@@ -479,7 +479,7 @@ static void test_media_streams(void)
ok(!lstrcmpW(info.achName, id), "Pin name is %s instead of %s\n", wine_dbgstr_w(info.achName), wine_dbgstr_w(id));
hr = IPin_EnumMediaTypes(pins[i], &enum_media_types);
ok(hr == S_OK, "IPin_EnumMediaTypes returned: %x\n", hr);
- hr = IEnumMediaTypes_Next(enum_media_types, sizeof(media_types) / sizeof(media_types[0]), media_types, &nb_media_types);
+ hr = IEnumMediaTypes_Next(enum_media_types, ARRAY_SIZE(media_types), media_types, &nb_media_types);
ok(SUCCEEDED(hr), "IEnumMediaTypes_Next returned: %x\n", hr);
ok(nb_media_types > 0, "nb_media_types should be >0\n");
IEnumMediaTypes_Release(enum_media_types);
--
2.14.4

View File

@ -0,0 +1,26 @@
From a12472814a32462fd5e1b23efe0bbae33b76ee1c Mon Sep 17 00:00:00 2001
From: Michael Stefaniuc <mstefani@winehq.org>
Date: Mon, 23 Jul 2018 08:58:41 +0200
Subject: [PATCH] browseui: Use the ARRAY_SIZE() macro
Signed-off-by: Michael Stefaniuc <mstefani@winehq.org>
---
dlls/browseui/progressdlg.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/dlls/browseui/progressdlg.c b/dlls/browseui/progressdlg.c
index 7cba7d6464..2355b0cfa0 100644
--- a/dlls/browseui/progressdlg.c
+++ b/dlls/browseui/progressdlg.c
@@ -114,7 +114,7 @@ static LPWSTR load_string(HINSTANCE hInstance, UINT uiResourceId)
WCHAR string[256];
LPWSTR ret;
- LoadStringW(hInstance, uiResourceId, string, sizeof(string)/sizeof(string[0]));
+ LoadStringW(hInstance, uiResourceId, string, ARRAY_SIZE(string));
ret = HeapAlloc(GetProcessHeap(), 0, (strlenW(string) + 1) * sizeof(WCHAR));
strcpyW(ret, string);
return ret;
--
2.14.4

View File

@ -0,0 +1,35 @@
From 908e14ff27dc82ade08cc05573b4963179d05791 Mon Sep 17 00:00:00 2001
From: Michael Stefaniuc <mstefani@winehq.org>
Date: Mon, 23 Jul 2018 09:01:38 +0200
Subject: [PATCH] gameux: Use the ARRAY_SIZE() macro
Signed-off-by: Michael Stefaniuc <mstefani@winehq.org>
---
dlls/gameux/gameexplorer.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/dlls/gameux/gameexplorer.c b/dlls/gameux/gameexplorer.c
index 63bf69d736..6495c78b38 100644
--- a/dlls/gameux/gameexplorer.c
+++ b/dlls/gameux/gameexplorer.c
@@ -150,7 +150,7 @@ HRESULT GAMEUX_buildGameRegistryPath(GAME_INSTALL_SCOPE installScope,
if(gameInstanceId)
{
if(SUCCEEDED(hr))
- hr = (StringFromGUID2(gameInstanceId, sInstanceId, sizeof(sInstanceId)/sizeof(sInstanceId[0])) ? S_OK : E_FAIL);
+ hr = (StringFromGUID2(gameInstanceId, sInstanceId, ARRAY_SIZE(sInstanceId)) ? S_OK : E_FAIL);
if(SUCCEEDED(hr))
{
@@ -219,7 +219,7 @@ static HRESULT GAMEUX_WriteRegistryRecord(struct GAMEUX_GAME_DATA *GameData)
hr = GAMEUX_buildGameRegistryPath(GameData->installScope, &GameData->guidInstanceId, &lpRegistryKey);
if(SUCCEEDED(hr))
- hr = (StringFromGUID2(&GameData->guidApplicationId, sGameApplicationId, sizeof(sGameApplicationId)/sizeof(sGameApplicationId[0])) ? S_OK : E_FAIL);
+ hr = (StringFromGUID2(&GameData->guidApplicationId, sGameApplicationId, ARRAY_SIZE(sGameApplicationId)) ? S_OK : E_FAIL);
if(SUCCEEDED(hr))
hr = HRESULT_FROM_WIN32(RegCreateKeyExW(HKEY_LOCAL_MACHINE, lpRegistryKey,
--
2.14.4

View File

@ -0,0 +1,104 @@
From 1e5920e18facb943edaf4bff76dd863550338cf1 Mon Sep 17 00:00:00 2001
From: Michael Stefaniuc <mstefani@winehq.org>
Date: Mon, 23 Jul 2018 09:10:49 +0200
Subject: [PATCH] inetcomm: Use the ARRAY_SIZE() macro
Signed-off-by: Michael Stefaniuc <mstefani@winehq.org>
---
dlls/inetcomm/mimeole.c | 7 +++----
dlls/inetcomm/protocol.c | 18 +++++++++---------
2 files changed, 12 insertions(+), 13 deletions(-)
diff --git a/dlls/inetcomm/mimeole.c b/dlls/inetcomm/mimeole.c
index 681ca820d4..cb9ebcc382 100644
--- a/dlls/inetcomm/mimeole.c
+++ b/dlls/inetcomm/mimeole.c
@@ -1581,9 +1581,8 @@ static HRESULT decode_base64(IStream *input, IStream **ret_stream)
while(1) {
/* skip invalid chars */
- while(ptr < end &&
- (*ptr >= sizeof(base64_decode_table)/sizeof(*base64_decode_table)
- || base64_decode_table[*ptr] == -1))
+ while(ptr < end && (*ptr >= ARRAY_SIZE(base64_decode_table)
+ || base64_decode_table[*ptr] == -1))
ptr++;
if(ptr == end)
break;
@@ -3715,7 +3714,7 @@ HRESULT WINAPI MimeOleObjectFromMoniker(BINDF bindf, IMoniker *moniker, IBindCtx
return E_OUTOFMEMORY;
memcpy(mhtml_url, mhtml_prefixW, sizeof(mhtml_prefixW));
- strcpyW(mhtml_url + sizeof(mhtml_prefixW)/sizeof(WCHAR), display_name);
+ strcpyW(mhtml_url + ARRAY_SIZE(mhtml_prefixW), display_name);
HeapFree(GetProcessHeap(), 0, display_name);
hres = CreateURLMoniker(NULL, mhtml_url, moniker_new);
diff --git a/dlls/inetcomm/protocol.c b/dlls/inetcomm/protocol.c
index 028463a269..c6a59fee7c 100644
--- a/dlls/inetcomm/protocol.c
+++ b/dlls/inetcomm/protocol.c
@@ -83,16 +83,16 @@ static HRESULT parse_mhtml_url(const WCHAR *url, mhtml_url_t *r)
{
const WCHAR *p;
- if(strncmpiW(url, mhtml_prefixW, sizeof(mhtml_prefixW)/sizeof(WCHAR)))
+ if(strncmpiW(url, mhtml_prefixW, ARRAY_SIZE(mhtml_prefixW)))
return E_FAIL;
- r->mhtml = url + sizeof(mhtml_prefixW)/sizeof(WCHAR);
+ r->mhtml = url + ARRAY_SIZE(mhtml_prefixW);
p = strchrW(r->mhtml, '!');
if(p) {
r->mhtml_len = p - r->mhtml;
/* FIXME: We handle '!' and '!x-usc:' in URLs as the same thing. Those should not be the same. */
- if(!strncmpW(p, mhtml_separatorW, sizeof(mhtml_separatorW)/sizeof(WCHAR)))
- p += sizeof(mhtml_separatorW)/sizeof(WCHAR);
+ if(!strncmpW(p, mhtml_separatorW, ARRAY_SIZE(mhtml_separatorW)))
+ p += ARRAY_SIZE(mhtml_separatorW);
else
p++;
}else {
@@ -657,7 +657,7 @@ static HRESULT WINAPI MimeHtmlProtocolInfo_CombineUrl(IInternetProtocolInfo *ifa
DWORD cchResult, DWORD* pcchResult, DWORD dwReserved)
{
MimeHtmlProtocol *This = impl_from_IInternetProtocolInfo(iface);
- size_t len = sizeof(mhtml_prefixW)/sizeof(WCHAR);
+ size_t len = ARRAY_SIZE(mhtml_prefixW);
mhtml_url_t url;
WCHAR *p;
HRESULT hres;
@@ -670,26 +670,26 @@ static HRESULT WINAPI MimeHtmlProtocolInfo_CombineUrl(IInternetProtocolInfo *ifa
if(FAILED(hres))
return hres;
- if(!strncmpiW(pwzRelativeUrl, mhtml_prefixW, sizeof(mhtml_prefixW)/sizeof(WCHAR))) {
+ if(!strncmpiW(pwzRelativeUrl, mhtml_prefixW, ARRAY_SIZE(mhtml_prefixW))) {
FIXME("Relative URL is mhtml protocol\n");
return INET_E_USE_DEFAULT_PROTOCOLHANDLER;
}
len += url.mhtml_len;
if(*pwzRelativeUrl)
- len += strlenW(pwzRelativeUrl) + sizeof(mhtml_separatorW)/sizeof(WCHAR);
+ len += strlenW(pwzRelativeUrl) + ARRAY_SIZE(mhtml_separatorW);
if(len >= cchResult) {
*pcchResult = 0;
return E_FAIL;
}
memcpy(pwzResult, mhtml_prefixW, sizeof(mhtml_prefixW));
- p = pwzResult + sizeof(mhtml_prefixW)/sizeof(WCHAR);
+ p = pwzResult + ARRAY_SIZE(mhtml_prefixW);
memcpy(p, url.mhtml, url.mhtml_len*sizeof(WCHAR));
p += url.mhtml_len;
if(*pwzRelativeUrl) {
memcpy(p, mhtml_separatorW, sizeof(mhtml_separatorW));
- p += sizeof(mhtml_separatorW)/sizeof(WCHAR);
+ p += ARRAY_SIZE(mhtml_separatorW);
strcpyW(p, pwzRelativeUrl);
}else {
*p = 0;
--
2.14.4

View File

@ -0,0 +1,67 @@
From 8b38172e836c44f5fd8ed98f7cb20702d0435d35 Mon Sep 17 00:00:00 2001
From: Michael Stefaniuc <mstefani@winehq.org>
Date: Mon, 23 Jul 2018 09:15:07 +0200
Subject: [PATCH] iphlpapi: Use the ARRAY_SIZE() macro
Signed-off-by: Michael Stefaniuc <mstefani@winehq.org>
---
dlls/iphlpapi/iphlpapi_main.c | 2 +-
dlls/iphlpapi/ipstats.c | 8 ++++----
2 files changed, 5 insertions(+), 5 deletions(-)
diff --git a/dlls/iphlpapi/iphlpapi_main.c b/dlls/iphlpapi/iphlpapi_main.c
index 7911e9d8cf..7de70c9ef4 100644
--- a/dlls/iphlpapi/iphlpapi_main.c
+++ b/dlls/iphlpapi/iphlpapi_main.c
@@ -1717,7 +1717,7 @@ DWORD WINAPI GetIfEntry(PMIB_IFROW pIfRow)
*/
DWORD WINAPI GetIfEntry2( MIB_IF_ROW2 *row2 )
{
- DWORD ret, len = sizeof(row2->Description)/sizeof(row2->Description[0]);
+ DWORD ret, len = ARRAY_SIZE(row2->Description);
char buf[MAX_ADAPTER_NAME], *name;
MIB_IFROW row;
diff --git a/dlls/iphlpapi/ipstats.c b/dlls/iphlpapi/ipstats.c
index 8f6720ea52..799d03d574 100644
--- a/dlls/iphlpapi/ipstats.c
+++ b/dlls/iphlpapi/ipstats.c
@@ -666,7 +666,7 @@ DWORD WINAPI GetIcmpStatisticsEx(PMIB_ICMP_EX stats, DWORD family)
continue;
}
- for (i = 0; i < sizeof(icmpinstatlist)/sizeof(icmpinstatlist[0]); i++)
+ for (i = 0; i < ARRAY_SIZE(icmpinstatlist); i++)
{
if (!strcasecmp(buf, icmpinstatlist[i].name))
{
@@ -688,7 +688,7 @@ DWORD WINAPI GetIcmpStatisticsEx(PMIB_ICMP_EX stats, DWORD family)
continue;
}
- for (i = 0; i < sizeof(icmpoutstatlist)/sizeof(icmpoutstatlist[0]); i++)
+ for (i = 0; i < ARRAY_SIZE(icmpoutstatlist); i++)
{
if (!strcasecmp(buf, icmpoutstatlist[i].name))
{
@@ -819,7 +819,7 @@ DWORD WINAPI GetIpStatisticsEx(PMIB_IPSTATS stats, DWORD family)
if ((ptr = strchr(value, '\n')))
*ptr='\0';
- for (i = 0; i < sizeof(ipstatlist)/sizeof(ipstatlist[0]); i++)
+ for (i = 0; i < ARRAY_SIZE(ipstatlist); i++)
if (!strcasecmp(buf, ipstatlist[i].name))
{
if (sscanf(value, "%d", &res)) *ipstatlist[i].elem = res;
@@ -1209,7 +1209,7 @@ DWORD WINAPI GetUdpStatisticsEx(PMIB_UDPSTATS stats, DWORD family)
if ((ptr = strchr(value, '\n')))
*ptr='\0';
- for (i = 0; i < sizeof(udpstatlist)/sizeof(udpstatlist[0]); i++)
+ for (i = 0; i < ARRAY_SIZE(udpstatlist); i++)
if (!strcasecmp(buf, udpstatlist[i].name))
{
if (sscanf(value, "%d", &res)) *udpstatlist[i].elem = res;
--
2.14.4

View File

@ -0,0 +1,26 @@
From 26098afa5665e6e3eb70d4560e2059ce97ae3a96 Mon Sep 17 00:00:00 2001
From: Michael Stefaniuc <mstefani@winehq.org>
Date: Mon, 23 Jul 2018 09:18:52 +0200
Subject: [PATCH] itss: Remove a superfluous variable initialization
Signed-off-by: Michael Stefaniuc <mstefani@winehq.org>
---
dlls/itss/moniker.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/dlls/itss/moniker.c b/dlls/itss/moniker.c
index 0509c9e1a5..3315b914d3 100644
--- a/dlls/itss/moniker.c
+++ b/dlls/itss/moniker.c
@@ -287,7 +287,7 @@ static HRESULT WINAPI ITS_IMonikerImpl_GetDisplayName(
ITS_IMonikerImpl *This = impl_from_IMoniker(iface);
static const WCHAR szFormat[] = {
'm','s','-','i','t','s',':','%','s',':',':','%','s',0 };
- DWORD len = sizeof szFormat / sizeof(WCHAR);
+ DWORD len;
LPWSTR str;
TRACE("%p %p %p %p\n", iface, pbc, pmkToLeft, ppszDisplayName);
--
2.14.4

View File

@ -0,0 +1,50 @@
From 54586555e7ea3b721741b0937f6a909f9a58baf2 Mon Sep 17 00:00:00 2001
From: Michael Stefaniuc <mstefani@winehq.org>
Date: Mon, 23 Jul 2018 09:21:21 +0200
Subject: [PATCH] itss: Use the ARRAY_SIZE() macro
Signed-off-by: Michael Stefaniuc <mstefani@winehq.org>
---
dlls/itss/moniker.c | 2 +-
dlls/itss/protocol.c | 12 ++++++------
2 files changed, 7 insertions(+), 7 deletions(-)
diff --git a/dlls/itss/moniker.c b/dlls/itss/moniker.c
index 3315b914d3..6c61f47482 100644
--- a/dlls/itss/moniker.c
+++ b/dlls/itss/moniker.c
@@ -435,7 +435,7 @@ static HRESULT WINAPI ITS_IParseDisplayNameImpl_ParseDisplayName(
{
static const WCHAR szPrefix[] = {
'@','M','S','I','T','S','t','o','r','e',':',0 };
- const DWORD prefix_len = (sizeof szPrefix/sizeof szPrefix[0])-1;
+ const DWORD prefix_len = ARRAY_SIZE(szPrefix)-1;
DWORD n;
ITS_IParseDisplayNameImpl *This = impl_from_IParseDisplayName(iface);
diff --git a/dlls/itss/protocol.c b/dlls/itss/protocol.c
index 1cdb365002..a7c40077cc 100644
--- a/dlls/itss/protocol.c
+++ b/dlls/itss/protocol.c
@@ -153,12 +153,12 @@ static LPCWSTR skip_schema(LPCWSTR url)
static const WCHAR msits_schema[] = {'m','s','-','i','t','s',':'};
static const WCHAR mk_schema[] = {'m','k',':','@','M','S','I','T','S','t','o','r','e',':'};
- if(!strncmpiW(its_schema, url, sizeof(its_schema)/sizeof(WCHAR)))
- return url+sizeof(its_schema)/sizeof(WCHAR);
- if(!strncmpiW(msits_schema, url, sizeof(msits_schema)/sizeof(WCHAR)))
- return url+sizeof(msits_schema)/sizeof(WCHAR);
- if(!strncmpiW(mk_schema, url, sizeof(mk_schema)/sizeof(WCHAR)))
- return url+sizeof(mk_schema)/sizeof(WCHAR);
+ if(!strncmpiW(its_schema, url, ARRAY_SIZE(its_schema)))
+ return url + ARRAY_SIZE(its_schema);
+ if(!strncmpiW(msits_schema, url, ARRAY_SIZE(msits_schema)))
+ return url + ARRAY_SIZE(msits_schema);
+ if(!strncmpiW(mk_schema, url, ARRAY_SIZE(mk_schema)))
+ return url + ARRAY_SIZE(mk_schema);
return NULL;
}
--
2.14.4

View File

@ -0,0 +1,44 @@
From 8bf0cb26484dcfd57220fde43e6ff5d91aa86b26 Mon Sep 17 00:00:00 2001
From: Michael Stefaniuc <mstefani@winehq.org>
Date: Mon, 23 Jul 2018 11:27:34 +0200
Subject: [PATCH] attrib: Use the ARRAY_SIZE() macro
Signed-off-by: Michael Stefaniuc <mstefani@winehq.org>
---
programs/attrib/attrib.c | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/programs/attrib/attrib.c b/programs/attrib/attrib.c
index a5742048bc..79a599aafd 100644
--- a/programs/attrib/attrib.c
+++ b/programs/attrib/attrib.c
@@ -36,7 +36,7 @@ static WCHAR *ATTRIB_LoadMessage(UINT id)
static WCHAR msg[MAXSTRING];
const WCHAR failedMsg[] = {'F', 'a', 'i', 'l', 'e', 'd', '!', 0};
- if (!LoadStringW(GetModuleHandleW(NULL), id, msg, sizeof(msg)/sizeof(WCHAR))) {
+ if (!LoadStringW(GetModuleHandleW(NULL), id, msg, ARRAY_SIZE(msg))) {
WINE_FIXME("LoadString failed with %d\n", GetLastError());
lstrcpyW(msg, failedMsg);
}
@@ -236,7 +236,7 @@ static BOOL ATTRIB_processdirectory(const WCHAR *rootdir, const WCHAR *filespec,
strcpyW(buffer, rootdir);
strcatW(buffer, fd.cFileName);
ATTRIB_wprintf(fmt, flags, buffer);
- for (count = 0; count < (sizeof(flags)/sizeof(WCHAR) - 1); count++) flags[count] = ' ';
+ for (count = 0; count < (ARRAY_SIZE(flags) - 1); count++) flags[count] = ' ';
found = TRUE;
}
} while (FindNextFileW(hff, &fd) != 0);
@@ -302,7 +302,7 @@ int wmain(int argc, WCHAR *argv[])
/* Name may be a relative or explicit path, so calculate curdir based on
current locations, stripping off the filename */
WINE_TRACE("Supplied name: '%s'\n", wine_dbgstr_w(originalname));
- GetFullPathNameW(originalname, sizeof(curdir)/sizeof(WCHAR), curdir, &namepart);
+ GetFullPathNameW(originalname, ARRAY_SIZE(curdir), curdir, &namepart);
WINE_TRACE("Result: '%s'\n", wine_dbgstr_w(curdir));
if (namepart) {
strcpyW(name, namepart);
--
2.14.4

View File

@ -0,0 +1,58 @@
From be9c79bb13ad9d354c458b5af5c4ea83edb2e29a Mon Sep 17 00:00:00 2001
From: Michael Stefaniuc <mstefani@winehq.org>
Date: Mon, 23 Jul 2018 11:53:50 +0200
Subject: [PATCH] clock: Use the ARRAY_SIZE() macro
Signed-off-by: Michael Stefaniuc <mstefani@winehq.org>
---
programs/clock/main.c | 4 ++--
programs/clock/winclock.c | 4 ++--
2 files changed, 4 insertions(+), 4 deletions(-)
diff --git a/programs/clock/main.c b/programs/clock/main.c
index 04bfe64424..3ad636be43 100644
--- a/programs/clock/main.c
+++ b/programs/clock/main.c
@@ -72,7 +72,7 @@ static VOID CLOCK_UpdateWindowCaption(VOID)
/* Set frame caption */
if (Globals.bDate) {
chars = GetDateFormatW(LOCALE_USER_DEFAULT, DATE_LONGDATE, NULL, NULL,
- szCaption, sizeof(szCaption)/sizeof(WCHAR));
+ szCaption, ARRAY_SIZE(szCaption));
if (chars) {
--chars;
szCaption[chars++] = ' ';
@@ -255,7 +255,7 @@ static int CLOCK_MenuCommand (WPARAM wParam)
}
/* show "about" box */
case IDM_ABOUT: {
- LoadStringW(Globals.hInstance, IDS_CLOCK, szApp, sizeof(szApp)/sizeof(WCHAR));
+ LoadStringW(Globals.hInstance, IDS_CLOCK, szApp, ARRAY_SIZE(szApp));
lstrcpyW(szAppRelease,szApp);
ShellAboutW(Globals.hMainWnd, szApp, szAppRelease, 0);
break;
diff --git a/programs/clock/winclock.c b/programs/clock/winclock.c
index 0b2def11ab..53c3821d95 100644
--- a/programs/clock/winclock.c
+++ b/programs/clock/winclock.c
@@ -187,7 +187,7 @@ HFONT SizeFont(HDC dc, int x, int y, BOOL bSeconds, const LOGFONTW* font)
int chars;
chars = GetTimeFormatW(LOCALE_USER_DEFAULT, bSeconds ? 0 : TIME_NOSECONDS, NULL,
- NULL, szTime, sizeof(szTime)/sizeof(WCHAR));
+ NULL, szTime, ARRAY_SIZE(szTime));
if (!chars)
return 0;
@@ -219,7 +219,7 @@ void DigitalClock(HDC dc, int x, int y, BOOL bSeconds, HFONT font)
int chars;
chars = GetTimeFormatW(LOCALE_USER_DEFAULT, bSeconds ? 0 : TIME_NOSECONDS, NULL,
- NULL, szTime, sizeof(szTime)/sizeof(WCHAR));
+ NULL, szTime, ARRAY_SIZE(szTime));
if (!chars)
return;
--chars;
--
2.14.4

View File

@ -0,0 +1,55 @@
From 6efa8387411c9db492b2f965e9daf976abe04d40 Mon Sep 17 00:00:00 2001
From: Michael Stefaniuc <mstefani@winehq.org>
Date: Mon, 23 Jul 2018 13:14:34 +0200
Subject: [PATCH] hostname: Use the ARRAY_SIZE() macro
Signed-off-by: Michael Stefaniuc <mstefani@winehq.org>
---
programs/hostname/hostname.c | 10 ++++------
1 file changed, 4 insertions(+), 6 deletions(-)
diff --git a/programs/hostname/hostname.c b/programs/hostname/hostname.c
index 8bf8676a97..3e1f2bdda3 100644
--- a/programs/hostname/hostname.c
+++ b/programs/hostname/hostname.c
@@ -90,8 +90,7 @@ static int hostname_message_printfW(int msg, ...)
WCHAR msg_buffer[8192];
int len;
- LoadStringW(GetModuleHandleW(NULL), msg, msg_buffer,
- sizeof(msg_buffer)/sizeof(WCHAR));
+ LoadStringW(GetModuleHandleW(NULL), msg, msg_buffer, ARRAY_SIZE(msg_buffer));
va_start(va_args, msg);
len = hostname_vprintfW(msg_buffer, va_args);
@@ -105,8 +104,7 @@ static int hostname_message(int msg)
static const WCHAR formatW[] = {'%','s',0};
WCHAR msg_buffer[8192];
- LoadStringW(GetModuleHandleW(NULL), msg, msg_buffer,
- sizeof(msg_buffer)/sizeof(WCHAR));
+ LoadStringW(GetModuleHandleW(NULL), msg, msg_buffer, ARRAY_SIZE(msg_buffer));
return hostname_printfW(formatW, msg_buffer);
}
@@ -119,7 +117,7 @@ static void display_computer_name(void)
WCHAR nameW[256];
gethostname(nameA, sizeof(nameA));
- MultiByteToWideChar(CP_UNIXCP, 0, nameA, sizeof(nameA), nameW, sizeof(nameW)/sizeof(WCHAR));
+ MultiByteToWideChar(CP_UNIXCP, 0, nameA, sizeof(nameA), nameW, ARRAY_SIZE(nameW));
hostname_printfW(fmtW, nameW);
}
@@ -132,7 +130,7 @@ int wmain(int argc, WCHAR *argv[])
unsigned int i;
- if (!strncmpW(argv[1], slashHelpW, sizeof(slashHelpW)/sizeof(WCHAR) - 1))
+ if (!strncmpW(argv[1], slashHelpW, ARRAY_SIZE(slashHelpW) - 1))
{
hostname_message(STRING_USAGE);
return 1;
--
2.14.4

View File

@ -0,0 +1,26 @@
From a11a1464b49a115d73c8b787ad2e55327f668c5e Mon Sep 17 00:00:00 2001
From: Michael Stefaniuc <mstefani@winehq.org>
Date: Mon, 23 Jul 2018 16:40:31 +0200
Subject: [PATCH] icinfo: Use the ARRAY_SIZE() macro
Signed-off-by: Michael Stefaniuc <mstefani@winehq.org>
---
programs/icinfo/icinfo.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/programs/icinfo/icinfo.c b/programs/icinfo/icinfo.c
index 601ec8c8b3..1059183361 100644
--- a/programs/icinfo/icinfo.c
+++ b/programs/icinfo/icinfo.c
@@ -33,7 +33,7 @@ static int mywprintf(const WCHAR *format, ...)
HANDLE hout = GetStdHandle(STD_OUTPUT_HANDLE);
va_start(parms, format);
- vsnprintfW(output_bufW, sizeof(output_bufW)/sizeof(output_bufW[0]), format, parms);
+ vsnprintfW(output_bufW, ARRAY_SIZE(output_bufW), format, parms);
va_end(parms);
/* Try to write as unicode whenever we think it's a console */
--
2.14.4

View File

@ -0,0 +1,63 @@
From a2a7e76379da5eaf1d521e95f9337661bb49ed84 Mon Sep 17 00:00:00 2001
From: Michael Stefaniuc <mstefani@winehq.org>
Date: Mon, 23 Jul 2018 17:01:22 +0200
Subject: [PATCH] net: Use the ARRAY_SIZE() macro
Signed-off-by: Michael Stefaniuc <mstefani@winehq.org>
---
programs/net/net.c | 11 +++++------
1 file changed, 5 insertions(+), 6 deletions(-)
diff --git a/programs/net/net.c b/programs/net/net.c
index d8123ebf97..8a4c3f1132 100644
--- a/programs/net/net.c
+++ b/programs/net/net.c
@@ -61,8 +61,7 @@ static int output_vprintf(const WCHAR* fmt, __ms_va_list va_args)
int len;
SetLastError(NO_ERROR);
- len = FormatMessageW(FORMAT_MESSAGE_FROM_STRING, fmt, 0, 0, str,
- sizeof(str)/sizeof(*str), &va_args);
+ len = FormatMessageW(FORMAT_MESSAGE_FROM_STRING, fmt, 0, 0, str, ARRAY_SIZE(str), &va_args);
if (len == 0 && GetLastError() != NO_ERROR)
WINE_FIXME("Could not format string: le=%u, fmt=%s\n", GetLastError(), wine_dbgstr_w(fmt));
else
@@ -85,7 +84,7 @@ static int WINAPIV output_string(int msg, ...)
WCHAR fmt[8192];
__ms_va_list arguments;
- LoadStringW(GetModuleHandleW(NULL), msg, fmt, sizeof(fmt)/sizeof(fmt[0]));
+ LoadStringW(GetModuleHandleW(NULL), msg, fmt, ARRAY_SIZE(fmt));
__ms_va_start(arguments, msg);
output_vprintf(fmt, arguments);
__ms_va_end(arguments);
@@ -119,7 +118,7 @@ static BOOL net_use(int argc, const WCHAR* argv[])
HMODULE hmod = GetModuleHandleW(NULL);
/* Load the status strings */
- for (i = 0; i < sizeof(status)/sizeof(*status); i++)
+ for (i = 0; i < ARRAY_SIZE(status); i++)
{
status[i] = HeapAlloc(GetProcessHeap(), 0, 1024 * sizeof(**status));
LoadStringW(hmod, STRING_OK+i, status[i], 1024);
@@ -147,7 +146,7 @@ static BOOL net_use(int argc, const WCHAR* argv[])
} while (rc == ERROR_MORE_DATA);
/* Release the status strings */
- for (i = 0; i < sizeof(status)/sizeof(*status); i++)
+ for (i = 0; i < ARRAY_SIZE(status); i++)
HeapFree(GetProcessHeap(), 0, status[i]);
return TRUE;
@@ -256,7 +255,7 @@ static BOOL net_service(int operation, const WCHAR* service_name)
return FALSE;
}
- buffer_size = sizeof(service_display_name)/sizeof(*service_display_name);
+ buffer_size = ARRAY_SIZE(service_display_name);
GetServiceDisplayNameW(SCManager, service_name, service_display_name, &buffer_size);
if (!service_display_name[0]) lstrcpyW(service_display_name, service_name);
--
2.14.4

View File

@ -0,0 +1,46 @@
From b9918474575b009cc132f5df5a7b29e839772d88 Mon Sep 17 00:00:00 2001
From: Michael Stefaniuc <mstefani@winehq.org>
Date: Mon, 23 Jul 2018 19:13:54 +0200
Subject: [PATCH] taskkill: Use the ARRAY_SIZE() macro
Signed-off-by: Michael Stefaniuc <mstefani@winehq.org>
---
programs/taskkill/taskkill.c | 8 +++-----
1 file changed, 3 insertions(+), 5 deletions(-)
diff --git a/programs/taskkill/taskkill.c b/programs/taskkill/taskkill.c
index 6e4e1eb55a..59ce98dc6d 100644
--- a/programs/taskkill/taskkill.c
+++ b/programs/taskkill/taskkill.c
@@ -47,7 +47,7 @@ static int taskkill_vprintfW(const WCHAR *msg, __ms_va_list va_args)
WCHAR msg_buffer[8192];
wlen = FormatMessageW(FORMAT_MESSAGE_FROM_STRING, msg, 0, 0, msg_buffer,
- sizeof(msg_buffer)/sizeof(*msg_buffer), &va_args);
+ ARRAY_SIZE(msg_buffer), &va_args);
ret = WriteConsoleW(GetStdHandle(STD_OUTPUT_HANDLE), msg_buffer, wlen, &count, NULL);
if (!ret)
@@ -92,8 +92,7 @@ static int WINAPIV taskkill_message_printfW(int msg, ...)
WCHAR msg_buffer[8192];
int len;
- LoadStringW(GetModuleHandleW(NULL), msg, msg_buffer,
- sizeof(msg_buffer)/sizeof(WCHAR));
+ LoadStringW(GetModuleHandleW(NULL), msg, msg_buffer, ARRAY_SIZE(msg_buffer));
__ms_va_start(va_args, msg);
len = taskkill_vprintfW(msg_buffer, va_args);
@@ -107,8 +106,7 @@ static int taskkill_message(int msg)
static const WCHAR formatW[] = {'%','1',0};
WCHAR msg_buffer[8192];
- LoadStringW(GetModuleHandleW(NULL), msg, msg_buffer,
- sizeof(msg_buffer)/sizeof(WCHAR));
+ LoadStringW(GetModuleHandleW(NULL), msg, msg_buffer, ARRAY_SIZE(msg_buffer));
return taskkill_printfW(formatW, msg_buffer);
}
--
2.14.4

View File

@ -0,0 +1,152 @@
From 081705a865b159a13be0afe8235f8cc7b62a635f Mon Sep 17 00:00:00 2001
From: Michael Stefaniuc <mstefani@winehq.org>
Date: Mon, 23 Jul 2018 19:18:13 +0200
Subject: [PATCH] ipconfig: Use the ARRAY_SIZE() macro
Signed-off-by: Michael Stefaniuc <mstefani@winehq.org>
---
programs/ipconfig/ipconfig.c | 40 ++++++++++++++++++----------------------
1 file changed, 18 insertions(+), 22 deletions(-)
diff --git a/programs/ipconfig/ipconfig.c b/programs/ipconfig/ipconfig.c
index 936dfa2ea8..4370a28a44 100644
--- a/programs/ipconfig/ipconfig.c
+++ b/programs/ipconfig/ipconfig.c
@@ -35,7 +35,7 @@ static int ipconfig_vprintfW(const WCHAR *msg, __ms_va_list va_args)
WCHAR msg_buffer[8192];
wlen = FormatMessageW(FORMAT_MESSAGE_FROM_STRING, msg, 0, 0, msg_buffer,
- sizeof(msg_buffer)/sizeof(*msg_buffer), &va_args);
+ ARRAY_SIZE(msg_buffer), &va_args);
ret = WriteConsoleW(GetStdHandle(STD_OUTPUT_HANDLE), msg_buffer, wlen, &count, NULL);
if (!ret)
@@ -80,8 +80,7 @@ static int WINAPIV ipconfig_message_printfW(int msg, ...)
WCHAR msg_buffer[8192];
int len;
- LoadStringW(GetModuleHandleW(NULL), msg, msg_buffer,
- sizeof(msg_buffer)/sizeof(WCHAR));
+ LoadStringW(GetModuleHandleW(NULL), msg, msg_buffer, ARRAY_SIZE(msg_buffer));
__ms_va_start(va_args, msg);
len = ipconfig_vprintfW(msg_buffer, va_args);
@@ -95,8 +94,7 @@ static int ipconfig_message(int msg)
static const WCHAR formatW[] = {'%','1',0};
WCHAR msg_buffer[8192];
- LoadStringW(GetModuleHandleW(NULL), msg, msg_buffer,
- sizeof(msg_buffer)/sizeof(WCHAR));
+ LoadStringW(GetModuleHandleW(NULL), msg, msg_buffer, ARRAY_SIZE(msg_buffer));
return ipconfig_printfW(formatW, msg_buffer);
}
@@ -118,8 +116,7 @@ static const WCHAR *iftype_to_string(DWORD type)
msg = STRING_UNKNOWN;
}
- LoadStringW(GetModuleHandleW(NULL), msg, msg_buffer,
- sizeof(msg_buffer)/sizeof(WCHAR));
+ LoadStringW(GetModuleHandleW(NULL), msg, msg_buffer, ARRAY_SIZE(msg_buffer));
return msg_buffer;
}
@@ -130,10 +127,10 @@ static void print_field(int msg, const WCHAR *value)
WCHAR field[] = {'.',' ','.',' ','.',' ','.',' ','.',' ','.',' ','.',' ','.',' ','.',
' ','.',' ','.',' ','.',' ','.',' ','.',' ','.',' ','.',' ','.',' ',0};
- WCHAR name_buffer[sizeof(field)/sizeof(WCHAR)];
+ WCHAR name_buffer[ARRAY_SIZE(field)];
- LoadStringW(GetModuleHandleW(NULL), msg, name_buffer, sizeof(name_buffer)/sizeof(WCHAR));
- memcpy(field, name_buffer, sizeof(WCHAR) * min(strlenW(name_buffer), sizeof(field)/sizeof(WCHAR) - 1));
+ LoadStringW(GetModuleHandleW(NULL), msg, name_buffer, ARRAY_SIZE(name_buffer));
+ memcpy(field, name_buffer, sizeof(WCHAR) * min(strlenW(name_buffer), ARRAY_SIZE(field) - 1));
ipconfig_printfW(formatW, field, value);
}
@@ -189,22 +186,22 @@ static void print_basic_information(void)
for (addr = p->FirstUnicastAddress; addr; addr = addr->Next)
{
if (addr->Address.lpSockaddr->sa_family == AF_INET &&
- socket_address_to_string(addr_buf, sizeof(addr_buf)/sizeof(WCHAR), &addr->Address))
+ socket_address_to_string(addr_buf, ARRAY_SIZE(addr_buf), &addr->Address))
print_field(STRING_IP_ADDRESS, addr_buf);
else if (addr->Address.lpSockaddr->sa_family == AF_INET6 &&
- socket_address_to_string(addr_buf, sizeof(addr_buf)/sizeof(WCHAR), &addr->Address))
+ socket_address_to_string(addr_buf, ARRAY_SIZE(addr_buf), &addr->Address))
print_field(STRING_IP6_ADDRESS, addr_buf);
/* FIXME: Output corresponding subnet mask. */
}
if (p->FirstGatewayAddress)
{
- if (socket_address_to_string(addr_buf, sizeof(addr_buf)/sizeof(WCHAR), &p->FirstGatewayAddress->Address))
+ if (socket_address_to_string(addr_buf, ARRAY_SIZE(addr_buf), &p->FirstGatewayAddress->Address))
print_field(STRING_DEFAULT_GATEWAY, addr_buf);
for (gateway = p->FirstGatewayAddress->Next; gateway; gateway = gateway->Next)
{
- if (socket_address_to_string(addr_buf, sizeof(addr_buf)/sizeof(WCHAR), &gateway->Address))
+ if (socket_address_to_string(addr_buf, ARRAY_SIZE(addr_buf), &gateway->Address))
print_value(addr_buf);
}
}
@@ -243,8 +240,7 @@ static const WCHAR *nodetype_to_string(DWORD type)
msg = STRING_UNKNOWN;
}
- LoadStringW(GetModuleHandleW(NULL), msg, msg_buffer,
- sizeof(msg_buffer)/sizeof(WCHAR));
+ LoadStringW(GetModuleHandleW(NULL), msg, msg_buffer, ARRAY_SIZE(msg_buffer));
return msg_buffer;
}
@@ -277,7 +273,7 @@ static const WCHAR *boolean_to_string(int value)
static WCHAR msg_buffer[15];
LoadStringW(GetModuleHandleW(NULL), value ? STRING_YES : STRING_NO,
- msg_buffer, sizeof(msg_buffer)/sizeof(WCHAR));
+ msg_buffer, ARRAY_SIZE(msg_buffer));
return msg_buffer;
}
@@ -301,7 +297,7 @@ static void print_full_information(void)
{
WCHAR hostnameW[MAX_HOSTNAME_LEN + 4];
- MultiByteToWideChar(CP_ACP, 0, info->HostName, -1, hostnameW, sizeof(hostnameW)/sizeof(hostnameW[0]));
+ MultiByteToWideChar(CP_ACP, 0, info->HostName, -1, hostnameW, ARRAY_SIZE(hostnameW));
print_field(STRING_HOSTNAME, hostnameW);
/* FIXME: Output primary DNS suffix. */
@@ -348,22 +344,22 @@ static void print_full_information(void)
for (addr = p->FirstUnicastAddress; addr; addr = addr->Next)
{
if (addr->Address.lpSockaddr->sa_family == AF_INET &&
- socket_address_to_string(addr_buf, sizeof(addr_buf)/sizeof(WCHAR), &addr->Address))
+ socket_address_to_string(addr_buf, ARRAY_SIZE(addr_buf), &addr->Address))
print_field(STRING_IP_ADDRESS, addr_buf);
else if (addr->Address.lpSockaddr->sa_family == AF_INET6 &&
- socket_address_to_string(addr_buf, sizeof(addr_buf)/sizeof(WCHAR), &addr->Address))
+ socket_address_to_string(addr_buf, ARRAY_SIZE(addr_buf), &addr->Address))
print_field(STRING_IP6_ADDRESS, addr_buf);
/* FIXME: Output corresponding subnet mask. */
}
if (p->FirstGatewayAddress)
{
- if (socket_address_to_string(addr_buf, sizeof(addr_buf)/sizeof(WCHAR), &p->FirstGatewayAddress->Address))
+ if (socket_address_to_string(addr_buf, ARRAY_SIZE(addr_buf), &p->FirstGatewayAddress->Address))
print_field(STRING_DEFAULT_GATEWAY, addr_buf);
for (gateway = p->FirstGatewayAddress->Next; gateway; gateway = gateway->Next)
{
- if (socket_address_to_string(addr_buf, sizeof(addr_buf)/sizeof(WCHAR), &gateway->Address))
+ if (socket_address_to_string(addr_buf, ARRAY_SIZE(addr_buf), &gateway->Address))
print_value(addr_buf);
}
}
--
2.14.4

View File

@ -0,0 +1,31 @@
From 3c68cac0e75c47c9bc0c3e0265d37d42668af0c7 Mon Sep 17 00:00:00 2001
From: Michael Stefaniuc <mstefani@winehq.org>
Date: Mon, 23 Jul 2018 19:19:29 +0200
Subject: [PATCH] msiexec: Use the ARRAY_SIZE() macro
Signed-off-by: Michael Stefaniuc <mstefani@winehq.org>
---
programs/msiexec/msiexec.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/programs/msiexec/msiexec.c b/programs/msiexec/msiexec.c
index 5a471a2184..47cef7e0fa 100644
--- a/programs/msiexec/msiexec.c
+++ b/programs/msiexec/msiexec.c
@@ -71,11 +71,11 @@ static void ShowUsage(int ExitCode)
/* MsiGetFileVersion need the full path */
*filename = 0;
- res = GetModuleFileNameW(hmsi, filename, sizeof(filename) / sizeof(filename[0]));
+ res = GetModuleFileNameW(hmsi, filename, ARRAY_SIZE(filename));
if (!res)
WINE_ERR("GetModuleFileName failed: %d\n", GetLastError());
- len = sizeof(msiexec_version) / sizeof(msiexec_version[0]);
+ len = ARRAY_SIZE(msiexec_version);
*msiexec_version = 0;
res = MsiGetFileVersionW(filename, msiexec_version, &len, NULL, NULL);
if (res)
--
2.14.4

View File

@ -0,0 +1,505 @@
From 18a03a7294b0cfb4155cd128eb0c45fb07352b1b Mon Sep 17 00:00:00 2001
From: Michael Stefaniuc <mstefani@winehq.org>
Date: Mon, 23 Jul 2018 19:38:53 +0200
Subject: [PATCH] taskmgr: Use the ARRAY_SIZE() macro
Signed-off-by: Michael Stefaniuc <mstefani@winehq.org>
---
programs/taskmgr/about.c | 2 +-
programs/taskmgr/affinity.c | 16 +++++++--------
programs/taskmgr/applpage.c | 14 ++++++-------
programs/taskmgr/column.c | 50 ++++++++++++++++++++++-----------------------
programs/taskmgr/dbgchnl.c | 8 ++++----
programs/taskmgr/debug.c | 16 +++++++--------
programs/taskmgr/endproc.c | 14 ++++++-------
programs/taskmgr/perfdata.c | 2 +-
programs/taskmgr/perfpage.c | 4 ++--
programs/taskmgr/priority.c | 10 ++++-----
programs/taskmgr/procpage.c | 4 ++--
programs/taskmgr/taskmgr.c | 32 ++++++++++++++---------------
programs/taskmgr/trayicon.c | 6 +++---
13 files changed, 88 insertions(+), 90 deletions(-)
diff --git a/programs/taskmgr/about.c b/programs/taskmgr/about.c
index c625139645..1eff50f003 100644
--- a/programs/taskmgr/about.c
+++ b/programs/taskmgr/about.c
@@ -36,7 +36,7 @@ void OnAbout(void)
WCHAR copy[] = {'B','r','i','a','n',' ',
'P','a','l','m','e','r',' ',
'<','b','r','i','a','n','p','@','r','e','a','c','t','o','s','.','o','r','g','>',0};
- LoadStringW( hInst, IDC_TASKMGR, appname, sizeof(appname)/sizeof(WCHAR) );
+ LoadStringW( hInst, IDC_TASKMGR, appname, ARRAY_SIZE( appname ));
ShellAboutW( hMainWnd, appname, copy,
LoadImageA( hInst, (LPSTR)IDI_TASKMANAGER, IMAGE_ICON, 48, 48, LR_SHARED ));
}
diff --git a/programs/taskmgr/affinity.c b/programs/taskmgr/affinity.c
index c195a2d7ce..4e33f50d4f 100644
--- a/programs/taskmgr/affinity.c
+++ b/programs/taskmgr/affinity.c
@@ -51,9 +51,9 @@ AffinityDialogWndProc(HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam)
* the number of CPUs present in the system
*/
if (!GetProcessAffinityMask(hProcessAffinityHandle, &dwProcessAffinityMask, &dwSystemAffinityMask)) {
- GetLastErrorText(wstrErrorText, sizeof(wstrErrorText)/sizeof(WCHAR));
+ GetLastErrorText(wstrErrorText, ARRAY_SIZE(wstrErrorText));
EndDialog(hDlg, 0);
- LoadStringW(hInst, IDS_AFFINITY_UNABLE2ACCESS, wszUnable2Access, sizeof(wszUnable2Access)/sizeof(WCHAR));
+ LoadStringW(hInst, IDS_AFFINITY_UNABLE2ACCESS, wszUnable2Access, ARRAY_SIZE(wszUnable2Access));
MessageBoxW(hMainWnd, wstrErrorText, wszUnable2Access, MB_OK|MB_ICONSTOP);
}
@@ -291,8 +291,8 @@ AffinityDialogWndProc(HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam)
if (!dwProcessAffinityMask) {
WCHAR wszErrorMsg[255];
WCHAR wszErrorTitle[255];
- LoadStringW(hInst, IDS_AFFINITY_ERROR_MESSAGE, wszErrorMsg, sizeof(wszErrorMsg)/sizeof(WCHAR));
- LoadStringW(hInst, IDS_AFFINITY_ERROR_TITLE, wszErrorTitle, sizeof(wszErrorTitle)/sizeof(WCHAR));
+ LoadStringW(hInst, IDS_AFFINITY_ERROR_MESSAGE, wszErrorMsg, ARRAY_SIZE(wszErrorMsg));
+ LoadStringW(hInst, IDS_AFFINITY_ERROR_TITLE, wszErrorTitle, ARRAY_SIZE(wszErrorTitle));
MessageBoxW(hDlg, wszErrorMsg, wszErrorTitle, MB_OK|MB_ICONSTOP);
return TRUE;
}
@@ -301,9 +301,9 @@ AffinityDialogWndProc(HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam)
* Try to set the process affinity
*/
if (!SetProcessAffinityMask(hProcessAffinityHandle, dwProcessAffinityMask)) {
- GetLastErrorText(wstrErrorText, sizeof(wstrErrorText)/sizeof(WCHAR));
+ GetLastErrorText(wstrErrorText, ARRAY_SIZE(wstrErrorText));
EndDialog(hDlg, LOWORD(wParam));
- LoadStringW(hInst, IDS_AFFINITY_UNABLE2ACCESS, wszUnable2Access, sizeof(wszUnable2Access)/sizeof(WCHAR));
+ LoadStringW(hInst, IDS_AFFINITY_UNABLE2ACCESS, wszUnable2Access, ARRAY_SIZE(wszUnable2Access));
MessageBoxW(hMainWnd, wstrErrorText, wszUnable2Access, MB_OK|MB_ICONSTOP);
}
@@ -341,8 +341,8 @@ void ProcessPage_OnSetAffinity(void)
return;
hProcessAffinityHandle = OpenProcess(PROCESS_QUERY_INFORMATION|PROCESS_SET_INFORMATION, FALSE, dwProcessId);
if (!hProcessAffinityHandle) {
- GetLastErrorText(wstrErrorText, sizeof(wstrErrorText)/sizeof(WCHAR));
- LoadStringW(hInst, IDS_AFFINITY_UNABLE2ACCESS, wszUnable2Access, sizeof(wszUnable2Access)/sizeof(WCHAR));
+ GetLastErrorText(wstrErrorText, ARRAY_SIZE(wstrErrorText));
+ LoadStringW(hInst, IDS_AFFINITY_UNABLE2ACCESS, wszUnable2Access, ARRAY_SIZE(wszUnable2Access));
MessageBoxW(hMainWnd, wstrErrorText, wszUnable2Access, MB_OK|MB_ICONSTOP);
return;
}
diff --git a/programs/taskmgr/applpage.c b/programs/taskmgr/applpage.c
index e2874b5943..ae881b530c 100644
--- a/programs/taskmgr/applpage.c
+++ b/programs/taskmgr/applpage.c
@@ -249,10 +249,8 @@ static BOOL CALLBACK EnumWindowsProc(HWND hWnd, LPARAM lParam)
return TRUE;
/* Check and see if this is a top-level app window */
- if (!GetWindowTextW(hWnd, wszText, sizeof(wszText)/sizeof(WCHAR)) ||
- !IsWindowVisible(hWnd) ||
- (GetParent(hWnd) != NULL) ||
- (GetWindow(hWnd, GW_OWNER) != NULL) ||
+ if (!GetWindowTextW(hWnd, wszText, ARRAY_SIZE(wszText)) || !IsWindowVisible(hWnd) ||
+ (GetParent(hWnd) != NULL) || (GetWindow(hWnd, GW_OWNER) != NULL) ||
(GetWindowLongW(hWnd, GWL_EXSTYLE) & WS_EX_TOOLWINDOW))
{
return TRUE; /* Skip this window */
@@ -415,8 +413,8 @@ static void ApplicationPageOnNotify(WPARAM wParam, LPARAM lParam)
WCHAR wszNotResponding[255];
WCHAR wszRunning[255];
- LoadStringW(hInst, IDS_APPLICATION_NOT_RESPONDING, wszNotResponding, sizeof(wszNotResponding)/sizeof(WCHAR));
- LoadStringW(hInst, IDS_APPLICATION_RUNNING, wszRunning, sizeof(wszRunning)/sizeof(WCHAR));
+ LoadStringW(hInst, IDS_APPLICATION_NOT_RESPONDING, wszNotResponding, ARRAY_SIZE(wszNotResponding));
+ LoadStringW(hInst, IDS_APPLICATION_RUNNING, wszRunning, ARRAY_SIZE(wszRunning));
pnmh = (LPNMHDR) lParam;
pnmdi = (LV_DISPINFOW*) lParam;
@@ -842,8 +840,8 @@ ApplicationPageWndProc(HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam)
WCHAR wszTask[255];
WCHAR wszStatus[255];
- LoadStringW(hInst, IDS_APPLICATION_TASK, wszTask, sizeof(wszTask)/sizeof(WCHAR));
- LoadStringW(hInst, IDS_APPLICATION_STATUS, wszStatus, sizeof(wszStatus)/sizeof(WCHAR));
+ LoadStringW(hInst, IDS_APPLICATION_TASK, wszTask, ARRAY_SIZE(wszTask));
+ LoadStringW(hInst, IDS_APPLICATION_STATUS, wszStatus, ARRAY_SIZE(wszStatus));
switch (message) {
case WM_INITDIALOG:
diff --git a/programs/taskmgr/column.c b/programs/taskmgr/column.c
index 35ba2a0b94..27c5926b5b 100644
--- a/programs/taskmgr/column.c
+++ b/programs/taskmgr/column.c
@@ -63,31 +63,31 @@ static WCHAR wszIOOtherBytes[255];
static void load_column_headers(void)
{
- LoadStringW(hInst, IDS_IMAGENAME, wszImageName, sizeof(wszImageName)/sizeof(WCHAR));
- LoadStringW(hInst, IDS_PID, wszPID, sizeof(wszPID)/sizeof(WCHAR));
- LoadStringW(hInst, IDS_USERNAME, wszUserName, sizeof(wszUserName)/sizeof(WCHAR));
- LoadStringW(hInst, IDS_SESSIONID, wszSessionID, sizeof(wszSessionID)/sizeof(WCHAR));
- LoadStringW(hInst, IDS_CPUUSAGE, wszCPU, sizeof(wszCPU)/sizeof(WCHAR));
- LoadStringW(hInst, IDS_CPUTIME, wszCPUTime, sizeof(wszCPUTime)/sizeof(WCHAR));
- LoadStringW(hInst, IDS_MEMORYUSAGE, wszMemUsage, sizeof(wszMemUsage)/sizeof(WCHAR));
- LoadStringW(hInst, IDS_PEAKMEMORYUSAGE, wszPeakMemUsage, sizeof(wszPeakMemUsage)/sizeof(WCHAR));
- LoadStringW(hInst, IDS_MEMORYUSAGEDELTA, wszMemDelta, sizeof(wszMemDelta)/sizeof(WCHAR));
- LoadStringW(hInst, IDS_PAGEFAULTS, wszPageFaults, sizeof(wszPageFaults)/sizeof(WCHAR));
- LoadStringW(hInst, IDS_PAGEFAULTSDELTA, wszPFDelta, sizeof(wszPFDelta)/sizeof(WCHAR));
- LoadStringW(hInst, IDS_VIRTUALMEMORYSIZE, wszVMSize, sizeof(wszVMSize)/sizeof(WCHAR));
- LoadStringW(hInst, IDS_PAGEDPOOL, wszPagedPool, sizeof(wszPagedPool)/sizeof(WCHAR));
- LoadStringW(hInst, IDS_NONPAGEDPOOL, wszNPPool, sizeof(wszNPPool)/sizeof(WCHAR));
- LoadStringW(hInst, IDS_BASEPRIORITY, wszBasePri, sizeof(wszBasePri)/sizeof(WCHAR));
- LoadStringW(hInst, IDS_HANDLECOUNT, wszHandles, sizeof(wszHandles)/sizeof(WCHAR));
- LoadStringW(hInst, IDS_THREADCOUNT, wszThreads, sizeof(wszThreads)/sizeof(WCHAR));
- LoadStringW(hInst, IDS_USEROBJECTS, wszUSERObjects, sizeof(wszUSERObjects)/sizeof(WCHAR));
- LoadStringW(hInst, IDS_GDIOBJECTS, wszGDIObjects, sizeof(wszGDIObjects)/sizeof(WCHAR));
- LoadStringW(hInst, IDS_IOREADS, wszIOReads, sizeof(wszIOReads)/sizeof(WCHAR));
- LoadStringW(hInst, IDS_IOWRITES, wszIOWrites, sizeof(wszIOWrites)/sizeof(WCHAR));
- LoadStringW(hInst, IDS_IOOTHER, wszIOOther, sizeof(wszIOOther)/sizeof(WCHAR));
- LoadStringW(hInst, IDS_IOREADBYTES, wszIOReadBytes, sizeof(wszIOReadBytes)/sizeof(WCHAR));
- LoadStringW(hInst, IDS_IOWRITEBYTES, wszIOWriteBytes, sizeof(wszIOWriteBytes)/sizeof(WCHAR));
- LoadStringW(hInst, IDS_IOOTHERBYTES, wszIOOtherBytes, sizeof(wszIOOtherBytes)/sizeof(WCHAR));
+ LoadStringW(hInst, IDS_IMAGENAME, wszImageName, ARRAY_SIZE(wszImageName));
+ LoadStringW(hInst, IDS_PID, wszPID, ARRAY_SIZE(wszPID));
+ LoadStringW(hInst, IDS_USERNAME, wszUserName, ARRAY_SIZE(wszUserName));
+ LoadStringW(hInst, IDS_SESSIONID, wszSessionID, ARRAY_SIZE(wszSessionID));
+ LoadStringW(hInst, IDS_CPUUSAGE, wszCPU, ARRAY_SIZE(wszCPU));
+ LoadStringW(hInst, IDS_CPUTIME, wszCPUTime, ARRAY_SIZE(wszCPUTime));
+ LoadStringW(hInst, IDS_MEMORYUSAGE, wszMemUsage, ARRAY_SIZE(wszMemUsage));
+ LoadStringW(hInst, IDS_PEAKMEMORYUSAGE, wszPeakMemUsage, ARRAY_SIZE(wszPeakMemUsage));
+ LoadStringW(hInst, IDS_MEMORYUSAGEDELTA, wszMemDelta, ARRAY_SIZE(wszMemDelta));
+ LoadStringW(hInst, IDS_PAGEFAULTS, wszPageFaults, ARRAY_SIZE(wszPageFaults));
+ LoadStringW(hInst, IDS_PAGEFAULTSDELTA, wszPFDelta, ARRAY_SIZE(wszPFDelta));
+ LoadStringW(hInst, IDS_VIRTUALMEMORYSIZE, wszVMSize, ARRAY_SIZE(wszVMSize));
+ LoadStringW(hInst, IDS_PAGEDPOOL, wszPagedPool, ARRAY_SIZE(wszPagedPool));
+ LoadStringW(hInst, IDS_NONPAGEDPOOL, wszNPPool, ARRAY_SIZE(wszNPPool));
+ LoadStringW(hInst, IDS_BASEPRIORITY, wszBasePri, ARRAY_SIZE(wszBasePri));
+ LoadStringW(hInst, IDS_HANDLECOUNT, wszHandles, ARRAY_SIZE(wszHandles));
+ LoadStringW(hInst, IDS_THREADCOUNT, wszThreads, ARRAY_SIZE(wszThreads));
+ LoadStringW(hInst, IDS_USEROBJECTS, wszUSERObjects, ARRAY_SIZE(wszUSERObjects));
+ LoadStringW(hInst, IDS_GDIOBJECTS, wszGDIObjects, ARRAY_SIZE(wszGDIObjects));
+ LoadStringW(hInst, IDS_IOREADS, wszIOReads, ARRAY_SIZE(wszIOReads));
+ LoadStringW(hInst, IDS_IOWRITES, wszIOWrites, ARRAY_SIZE(wszIOWrites));
+ LoadStringW(hInst, IDS_IOOTHER, wszIOOther, ARRAY_SIZE(wszIOOther));
+ LoadStringW(hInst, IDS_IOREADBYTES, wszIOReadBytes, ARRAY_SIZE(wszIOReadBytes));
+ LoadStringW(hInst, IDS_IOWRITEBYTES, wszIOWriteBytes, ARRAY_SIZE(wszIOWriteBytes));
+ LoadStringW(hInst, IDS_IOOTHERBYTES, wszIOOtherBytes, ARRAY_SIZE(wszIOOtherBytes));
}
static int InsertColumn(int nCol, LPCWSTR lpszColumnHeading, int nFormat, int nWidth, int nSubItem)
diff --git a/programs/taskmgr/dbgchnl.c b/programs/taskmgr/dbgchnl.c
index 6e2dea0e14..7200eb476c 100644
--- a/programs/taskmgr/dbgchnl.c
+++ b/programs/taskmgr/dbgchnl.c
@@ -113,7 +113,7 @@ static int list_channel_CB(HANDLE hProcess, void* addr, struct __wine_debug_
int index;
HWND hChannelLV = user;
- MultiByteToWideChar(CP_ACP, 0, channel->name, sizeof(channel->name), nameW, sizeof(nameW)/sizeof(WCHAR));
+ MultiByteToWideChar(CP_ACP, 0, channel->name, sizeof(channel->name), nameW, ARRAY_SIZE(nameW));
lvitem.mask = LVIF_TEXT;
lvitem.pszText = nameW;
@@ -231,7 +231,7 @@ static void DebugChannels_OnCreate(HWND hwndDlg)
LVCOLUMNW lvc;
WCHAR debug_channelW[255];
- LoadStringW(hInst, IDS_DEBUG_CHANNEL, debug_channelW, sizeof(debug_channelW)/sizeof(WCHAR));
+ LoadStringW(hInst, IDS_DEBUG_CHANNEL, debug_channelW, ARRAY_SIZE(debug_channelW));
lvc.mask = LVCF_FMT | LVCF_TEXT | LVCF_WIDTH;
lvc.fmt = LVCFMT_LEFT;
@@ -293,8 +293,8 @@ static void DebugChannels_OnNotify(HWND hDlg, LPARAM lParam)
unsigned bitmask = 1 << (lhti.iSubItem - 1);
struct cce_user user;
- ListView_GetItemTextA(hChannelLV, lhti.iItem, 0, name, sizeof(name) / sizeof(name[0]));
- ListView_GetItemTextW(hChannelLV, lhti.iItem, lhti.iSubItem, val, sizeof(val) / sizeof(val[0]));
+ ListView_GetItemTextA(hChannelLV, lhti.iItem, 0, name, ARRAY_SIZE(name));
+ ListView_GetItemTextW(hChannelLV, lhti.iItem, lhti.iSubItem, val, ARRAY_SIZE(val));
user.name = name;
user.value = (val[0] == 'x') ? 0 : bitmask;
user.mask = bitmask;
diff --git a/programs/taskmgr/debug.c b/programs/taskmgr/debug.c
index 10fa912feb..ceb27d11f9 100644
--- a/programs/taskmgr/debug.c
+++ b/programs/taskmgr/debug.c
@@ -57,9 +57,9 @@ void ProcessPage_OnDebug(void)
'A','e','D','e','b','u','g',0};
static const WCHAR wszDebugger[] = {'D','e','b','u','g','g','e','r',0};
- LoadStringW(hInst, IDS_WARNING_TITLE, wszWarnTitle, sizeof(wszWarnTitle)/sizeof(WCHAR));
- LoadStringW(hInst, IDS_DEBUG_UNABLE2DEBUG, wszUnable2Debug, sizeof(wszUnable2Debug)/sizeof(WCHAR));
- LoadStringW(hInst, IDS_DEBUG_MESSAGE, wszWarnMsg, sizeof(wszWarnMsg)/sizeof(WCHAR));
+ LoadStringW(hInst, IDS_WARNING_TITLE, wszWarnTitle, ARRAY_SIZE(wszWarnTitle));
+ LoadStringW(hInst, IDS_DEBUG_UNABLE2DEBUG, wszUnable2Debug, ARRAY_SIZE(wszUnable2Debug));
+ LoadStringW(hInst, IDS_DEBUG_MESSAGE, wszWarnMsg, ARRAY_SIZE(wszWarnMsg));
Count = SendMessageW(hProcessPageListCtrl, LVM_GETITEMCOUNT, 0, 0);
for (Index=0; Index<Count; Index++)
@@ -82,14 +82,14 @@ void ProcessPage_OnDebug(void)
if (MessageBoxW(hMainWnd, wszWarnMsg, wszWarnTitle, MB_YESNO|MB_ICONWARNING) != IDYES)
{
- GetLastErrorText(wstrErrorText, sizeof(wstrErrorText)/sizeof(WCHAR));
+ GetLastErrorText(wstrErrorText, ARRAY_SIZE(wstrErrorText));
MessageBoxW(hMainWnd, wstrErrorText, wszUnable2Debug, MB_OK|MB_ICONSTOP);
return;
}
if (RegOpenKeyExW(HKEY_LOCAL_MACHINE, wszSubKey, 0, KEY_READ, &hKey) != ERROR_SUCCESS)
{
- GetLastErrorText(wstrErrorText, sizeof(wstrErrorText)/sizeof(WCHAR));
+ GetLastErrorText(wstrErrorText, ARRAY_SIZE(wstrErrorText));
MessageBoxW(hMainWnd, wstrErrorText, wszUnable2Debug, MB_OK|MB_ICONSTOP);
return;
}
@@ -97,7 +97,7 @@ void ProcessPage_OnDebug(void)
dwDebuggerSize = 260;
if (RegQueryValueExW(hKey, wszDebugger, NULL, NULL, (LPBYTE)wstrDebugger, &dwDebuggerSize) != ERROR_SUCCESS)
{
- GetLastErrorText(wstrErrorText, sizeof(wstrErrorText)/sizeof(WCHAR));
+ GetLastErrorText(wstrErrorText, ARRAY_SIZE(wstrErrorText));
MessageBoxW(hMainWnd, wstrErrorText, wszUnable2Debug, MB_OK|MB_ICONSTOP);
RegCloseKey(hKey);
return;
@@ -108,7 +108,7 @@ void ProcessPage_OnDebug(void)
hDebugEvent = CreateEventW(NULL, FALSE, FALSE, NULL);
if (!hDebugEvent)
{
- GetLastErrorText(wstrErrorText, sizeof(wstrErrorText)/sizeof(WCHAR));
+ GetLastErrorText(wstrErrorText, ARRAY_SIZE(wstrErrorText));
MessageBoxW(hMainWnd, wstrErrorText, wszUnable2Debug, MB_OK|MB_ICONSTOP);
return;
}
@@ -120,7 +120,7 @@ void ProcessPage_OnDebug(void)
si.cb = sizeof(STARTUPINFOW);
if (!CreateProcessW(NULL, wstrDebugPath, NULL, NULL, FALSE, 0, NULL, NULL, &si, &pi))
{
- GetLastErrorText(wstrErrorText, sizeof(wstrErrorText)/sizeof(WCHAR));
+ GetLastErrorText(wstrErrorText, ARRAY_SIZE(wstrErrorText));
MessageBoxW(hMainWnd, wstrErrorText, wszUnable2Debug, MB_OK|MB_ICONSTOP);
}
diff --git a/programs/taskmgr/endproc.c b/programs/taskmgr/endproc.c
index 89c2d7bf80..7ed5ff08c6 100644
--- a/programs/taskmgr/endproc.c
+++ b/programs/taskmgr/endproc.c
@@ -38,9 +38,9 @@ static WCHAR wszUnable2Terminate[255];
static void load_message_strings(void)
{
- LoadStringW(hInst, IDS_TERMINATE_MESSAGE, wszWarnMsg, sizeof(wszWarnMsg)/sizeof(WCHAR));
- LoadStringW(hInst, IDS_TERMINATE_UNABLE2TERMINATE, wszUnable2Terminate, sizeof(wszUnable2Terminate)/sizeof(WCHAR));
- LoadStringW(hInst, IDS_WARNING_TITLE, wszWarnTitle, sizeof(wszWarnTitle)/sizeof(WCHAR));
+ LoadStringW(hInst, IDS_TERMINATE_MESSAGE, wszWarnMsg, ARRAY_SIZE(wszWarnMsg));
+ LoadStringW(hInst, IDS_TERMINATE_UNABLE2TERMINATE, wszUnable2Terminate, ARRAY_SIZE(wszUnable2Terminate));
+ LoadStringW(hInst, IDS_WARNING_TITLE, wszWarnTitle, ARRAY_SIZE(wszWarnTitle));
}
void ProcessPage_OnEndProcess(void)
@@ -79,14 +79,14 @@ void ProcessPage_OnEndProcess(void)
if (!hProcess)
{
- GetLastErrorText(wstrErrorText, sizeof(wstrErrorText)/sizeof(WCHAR));
+ GetLastErrorText(wstrErrorText, ARRAY_SIZE(wstrErrorText));
MessageBoxW(hMainWnd, wstrErrorText,wszUnable2Terminate, MB_OK|MB_ICONSTOP);
return;
}
if (!TerminateProcess(hProcess, 0))
{
- GetLastErrorText(wstrErrorText, sizeof(wstrErrorText)/sizeof(WCHAR));
+ GetLastErrorText(wstrErrorText, ARRAY_SIZE(wstrErrorText));
MessageBoxW(hMainWnd, wstrErrorText,wszUnable2Terminate, MB_OK|MB_ICONSTOP);
}
@@ -129,14 +129,14 @@ void ProcessPage_OnEndProcessTree(void)
if (!hProcess)
{
- GetLastErrorText(wstrErrorText, sizeof(wstrErrorText)/sizeof(WCHAR));
+ GetLastErrorText(wstrErrorText, ARRAY_SIZE(wstrErrorText));
MessageBoxW(hMainWnd, wstrErrorText,wszUnable2Terminate, MB_OK|MB_ICONSTOP);
return;
}
if (!TerminateProcess(hProcess, 0))
{
- GetLastErrorText(wstrErrorText, sizeof(wstrErrorText)/sizeof(WCHAR));
+ GetLastErrorText(wstrErrorText, ARRAY_SIZE(wstrErrorText));
MessageBoxW(hMainWnd, wstrErrorText,wszUnable2Terminate, MB_OK|MB_ICONSTOP);
}
diff --git a/programs/taskmgr/perfdata.c b/programs/taskmgr/perfdata.c
index aa19914d61..f86d52159f 100644
--- a/programs/taskmgr/perfdata.c
+++ b/programs/taskmgr/perfdata.c
@@ -248,7 +248,7 @@ void PerfDataRefresh(void)
else
{
WCHAR idleW[255];
- LoadStringW(hInst, IDS_SYSTEM_IDLE_PROCESS, idleW, sizeof(idleW)/sizeof(WCHAR));
+ LoadStringW(hInst, IDS_SYSTEM_IDLE_PROCESS, idleW, ARRAY_SIZE(idleW));
lstrcpyW(pPerfData[Idx].ImageName, idleW );
}
diff --git a/programs/taskmgr/perfpage.c b/programs/taskmgr/perfpage.c
index 3969ce41a2..63fb009eda 100644
--- a/programs/taskmgr/perfpage.c
+++ b/programs/taskmgr/perfpage.c
@@ -141,7 +141,7 @@ static DWORD WINAPI PerformancePageRefreshThread(void *lpParameter)
static const WCHAR wszFormatDigit[] = {'%','u',0};
WCHAR wszMemUsage[255];
- LoadStringW(hInst, IDS_STATUS_BAR_MEMORY_USAGE, wszMemUsage, sizeof(wszMemUsage)/sizeof(WCHAR));
+ LoadStringW(hInst, IDS_STATUS_BAR_MEMORY_USAGE, wszMemUsage, ARRAY_SIZE(wszMemUsage));
/* Create the event */
hPerformancePageEvent = CreateEventW(NULL, TRUE, TRUE, NULL);
@@ -190,7 +190,7 @@ static DWORD WINAPI PerformancePageRefreshThread(void *lpParameter)
args[1] = CommitChargeLimit;
FormatMessageW(FORMAT_MESSAGE_FROM_STRING|FORMAT_MESSAGE_ARGUMENT_ARRAY,
wszMemUsage, 0, 0, Text,
- sizeof(Text)/sizeof(*Text), (__ms_va_list*)args);
+ ARRAY_SIZE(Text), (__ms_va_list*)args);
SendMessageW(hStatusWnd, SB_SETTEXTW, 2, (LPARAM)Text);
/*
diff --git a/programs/taskmgr/priority.c b/programs/taskmgr/priority.c
index 577a1aee14..90323db0c4 100644
--- a/programs/taskmgr/priority.c
+++ b/programs/taskmgr/priority.c
@@ -44,9 +44,9 @@ static void DoSetPriority(DWORD priority)
WCHAR wszWarnTitle[255];
WCHAR wszUnable2Change[255];
- LoadStringW(hInst, IDS_PRIORITY_CHANGE_MESSAGE, wszWarnMsg, sizeof(wszWarnMsg)/sizeof(WCHAR));
- LoadStringW(hInst, IDS_WARNING_TITLE, wszWarnTitle, sizeof(wszWarnTitle)/sizeof(WCHAR));
- LoadStringW(hInst, IDS_PRIORITY_UNABLE2CHANGE, wszUnable2Change, sizeof(wszUnable2Change)/sizeof(WCHAR));
+ LoadStringW(hInst, IDS_PRIORITY_CHANGE_MESSAGE, wszWarnMsg, ARRAY_SIZE(wszWarnMsg));
+ LoadStringW(hInst, IDS_WARNING_TITLE, wszWarnTitle, ARRAY_SIZE(wszWarnTitle));
+ LoadStringW(hInst, IDS_PRIORITY_UNABLE2CHANGE, wszUnable2Change, ARRAY_SIZE(wszUnable2Change));
Count = SendMessageW(hProcessPageListCtrl, LVM_GETITEMCOUNT, 0, 0);
for (Index=0; Index<Count; Index++)
@@ -74,14 +74,14 @@ static void DoSetPriority(DWORD priority)
if (!hProcess)
{
- GetLastErrorText(wstrErrorText, sizeof(wstrErrorText)/sizeof(WCHAR));
+ GetLastErrorText(wstrErrorText, ARRAY_SIZE(wstrErrorText));
MessageBoxW(hMainWnd, wstrErrorText, wszUnable2Change, MB_OK|MB_ICONSTOP);
return;
}
if (!SetPriorityClass(hProcess, priority))
{
- GetLastErrorText(wstrErrorText, sizeof(wstrErrorText)/sizeof(WCHAR));
+ GetLastErrorText(wstrErrorText, ARRAY_SIZE(wstrErrorText));
MessageBoxW(hMainWnd, wstrErrorText, wszUnable2Change, MB_OK|MB_ICONSTOP);
}
diff --git a/programs/taskmgr/procpage.c b/programs/taskmgr/procpage.c
index beccd86e5f..5ea2e6b044 100644
--- a/programs/taskmgr/procpage.c
+++ b/programs/taskmgr/procpage.c
@@ -384,8 +384,8 @@ static DWORD WINAPI ProcessPageRefreshThread(void *lpParameter)
WCHAR wszCPU_Usage[255];
WCHAR wszProcesses[255];
- LoadStringW(hInst, IDS_STATUS_BAR_CPU_USAGE, wszCPU_Usage, sizeof(wszCPU_Usage)/sizeof(WCHAR));
- LoadStringW(hInst, IDS_STATUS_BAR_PROCESSES, wszProcesses, sizeof(wszProcesses)/sizeof(WCHAR));
+ LoadStringW(hInst, IDS_STATUS_BAR_CPU_USAGE, wszCPU_Usage, ARRAY_SIZE(wszCPU_Usage));
+ LoadStringW(hInst, IDS_STATUS_BAR_PROCESSES, wszProcesses, ARRAY_SIZE(wszProcesses));
/* Create the event */
hProcessPageEvent = CreateEventW(NULL, TRUE, TRUE, NULL);
diff --git a/programs/taskmgr/taskmgr.c b/programs/taskmgr/taskmgr.c
index b280f7975d..1983d4d443 100644
--- a/programs/taskmgr/taskmgr.c
+++ b/programs/taskmgr/taskmgr.c
@@ -122,9 +122,9 @@ static BOOL OnCreate(HWND hWnd)
static WCHAR wszProcesses[255];
static WCHAR wszPerformance[255];
- LoadStringW(hInst, IDS_APPLICATIONS, wszApplications, sizeof(wszApplications)/sizeof(WCHAR));
- LoadStringW(hInst, IDS_PROCESSES, wszProcesses, sizeof(wszProcesses)/sizeof(WCHAR));
- LoadStringW(hInst, IDS_PERFORMANCE, wszPerformance, sizeof(wszPerformance)/sizeof(WCHAR));
+ LoadStringW(hInst, IDS_APPLICATIONS, wszApplications, ARRAY_SIZE(wszApplications));
+ LoadStringW(hInst, IDS_PROCESSES, wszProcesses, ARRAY_SIZE(wszProcesses));
+ LoadStringW(hInst, IDS_PERFORMANCE, wszPerformance, ARRAY_SIZE(wszPerformance));
SendMessageW(hMainWnd, WM_SETICON, ICON_BIG, (LPARAM)LoadIconW(hInst, MAKEINTRESOURCEW(IDI_TASKMANAGER)));
SendMessageW(hMainWnd, WM_SETICON, ICON_SMALL,
@@ -501,8 +501,8 @@ static void TaskManager_OnExitMenuLoop(HWND hWnd)
WCHAR wszCPU_Usage[255];
WCHAR wszProcesses[255];
- LoadStringW(hInst, IDS_STATUS_BAR_CPU_USAGE, wszCPU_Usage, sizeof(wszCPU_Usage)/sizeof(WCHAR));
- LoadStringW(hInst, IDS_STATUS_BAR_PROCESSES, wszProcesses, sizeof(wszProcesses)/sizeof(WCHAR));
+ LoadStringW(hInst, IDS_STATUS_BAR_CPU_USAGE, wszCPU_Usage, ARRAY_SIZE(wszCPU_Usage));
+ LoadStringW(hInst, IDS_STATUS_BAR_PROCESSES, wszProcesses, ARRAY_SIZE(wszProcesses));
bInMenuLoop = FALSE;
/* Update the status bar pane sizes */
@@ -522,7 +522,7 @@ static void TaskManager_OnMenuSelect(HWND hWnd, UINT nItemID, UINT nFlags, HMENU
{
WCHAR wstr[256] = {0};
- LoadStringW(hInst, nItemID, wstr, sizeof(wstr)/sizeof(WCHAR));
+ LoadStringW(hInst, nItemID, wstr, ARRAY_SIZE(wstr));
SendMessageW(hStatusWnd, SB_SETTEXTW, 0, (LPARAM)wstr);
}
@@ -610,16 +610,16 @@ static void TaskManager_OnTabWndSelChange(void)
WCHAR wszCPUHistory[255];
WCHAR wszShowKernelTimes[255];
- LoadStringW(hInst, IDS_VIEW_LARGE, wszLargeIcons, sizeof(wszLargeIcons)/sizeof(WCHAR));
- LoadStringW(hInst, IDS_VIEW_SMALL, wszSmallIcons, sizeof(wszSmallIcons)/sizeof(WCHAR));
- LoadStringW(hInst, IDS_VIEW_DETAILS, wszDetails, sizeof(wszDetails)/sizeof(WCHAR));
- LoadStringW(hInst, IDS_WINDOWS, wszWindows, sizeof(wszWindows)/sizeof(WCHAR));
- LoadStringW(hInst, IDS_VIEW_SELECTCOLUMNS, wszSelectColumns, sizeof(wszSelectColumns)/sizeof(WCHAR));
- LoadStringW(hInst, IDS_OPTIONS_SHOW16BITTASKS, wszShow16bTasks, sizeof(wszShow16bTasks)/sizeof(WCHAR));
- LoadStringW(hInst, IDS_VIEW_CPUHISTORY_ONEGRAPHALL, wszOneGraphAllCPU, sizeof(wszOneGraphAllCPU)/sizeof(WCHAR));
- LoadStringW(hInst, IDS_VIEW_CPUHISTORY_ONEGRAPHPERCPU, wszOneGraphPerCPU, sizeof(wszOneGraphPerCPU)/sizeof(WCHAR));
- LoadStringW(hInst, IDS_VIEW_CPUHISTORY, wszCPUHistory, sizeof(wszCPUHistory)/sizeof(WCHAR));
- LoadStringW(hInst, IDS_VIEW_SHOWKERNELTIMES, wszShowKernelTimes, sizeof(wszShowKernelTimes)/sizeof(WCHAR));
+ LoadStringW(hInst, IDS_VIEW_LARGE, wszLargeIcons, ARRAY_SIZE(wszLargeIcons));
+ LoadStringW(hInst, IDS_VIEW_SMALL, wszSmallIcons, ARRAY_SIZE(wszSmallIcons));
+ LoadStringW(hInst, IDS_VIEW_DETAILS, wszDetails, ARRAY_SIZE(wszDetails));
+ LoadStringW(hInst, IDS_WINDOWS, wszWindows, ARRAY_SIZE(wszWindows));
+ LoadStringW(hInst, IDS_VIEW_SELECTCOLUMNS, wszSelectColumns, ARRAY_SIZE(wszSelectColumns));
+ LoadStringW(hInst, IDS_OPTIONS_SHOW16BITTASKS, wszShow16bTasks, ARRAY_SIZE(wszShow16bTasks));
+ LoadStringW(hInst, IDS_VIEW_CPUHISTORY_ONEGRAPHALL, wszOneGraphAllCPU, ARRAY_SIZE(wszOneGraphAllCPU));
+ LoadStringW(hInst, IDS_VIEW_CPUHISTORY_ONEGRAPHPERCPU, wszOneGraphPerCPU, ARRAY_SIZE(wszOneGraphPerCPU));
+ LoadStringW(hInst, IDS_VIEW_CPUHISTORY, wszCPUHistory, ARRAY_SIZE(wszCPUHistory));
+ LoadStringW(hInst, IDS_VIEW_SHOWKERNELTIMES, wszShowKernelTimes, ARRAY_SIZE(wszShowKernelTimes));
hMenu = GetMenu(hMainWnd);
hViewMenu = GetSubMenu(hMenu, 2);
diff --git a/programs/taskmgr/trayicon.c b/programs/taskmgr/trayicon.c
index af98474c24..b814e8c7c0 100644
--- a/programs/taskmgr/trayicon.c
+++ b/programs/taskmgr/trayicon.c
@@ -140,7 +140,7 @@ BOOL TrayIcon_ShellAddTrayIcon(void)
BOOL bRetVal;
WCHAR wszCPU_Usage[255];
- LoadStringW(hInst, IDS_STATUS_BAR_CPU_USAGE, wszCPU_Usage, sizeof(wszCPU_Usage)/sizeof(WCHAR));
+ LoadStringW(hInst, IDS_STATUS_BAR_CPU_USAGE, wszCPU_Usage, ARRAY_SIZE(wszCPU_Usage));
memset(&nid, 0, sizeof(NOTIFYICONDATAW));
@@ -187,8 +187,8 @@ BOOL TrayIcon_ShellUpdateTrayIcon(void)
BOOL bRetVal;
WCHAR wszCPU_Usage[255];
- LoadStringW(hInst, IDS_STATUS_BAR_CPU_USAGE, wszCPU_Usage, sizeof(wszCPU_Usage)/sizeof(WCHAR));
-
+ LoadStringW(hInst, IDS_STATUS_BAR_CPU_USAGE, wszCPU_Usage, ARRAY_SIZE(wszCPU_Usage));
+
memset(&nid, 0, sizeof(NOTIFYICONDATAW));
hIcon = TrayIcon_GetProcessorUsageIcon();
--
2.14.4

View File

@ -0,0 +1,37 @@
From 1c97d42e6271b8f81a3561d2480a4877014d5fd3 Mon Sep 17 00:00:00 2001
From: Michael Stefaniuc <mstefani@winehq.org>
Date: Tue, 24 Jul 2018 15:35:50 +0200
Subject: [PATCH] uninstaller: Use the ARRAY_SIZE() macro
Signed-off-by: Michael Stefaniuc <mstefani@winehq.org>
---
programs/uninstaller/main.c | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/programs/uninstaller/main.c b/programs/uninstaller/main.c
index 736593e27d..142d3d16f7 100644
--- a/programs/uninstaller/main.c
+++ b/programs/uninstaller/main.c
@@ -102,7 +102,7 @@ static void WINAPIV output_message(unsigned int id, ...)
WCHAR fmt[1024];
__ms_va_list va_args;
- if (!LoadStringW(GetModuleHandleW(NULL), id, fmt, sizeof(fmt)/sizeof(fmt[0])))
+ if (!LoadStringW(GetModuleHandleW(NULL), id, fmt, ARRAY_SIZE(fmt)))
{
WINE_FIXME("LoadString failed with %d\n", GetLastError());
return;
@@ -342,8 +342,8 @@ static void UninstallProgram(void)
WCHAR sUninstallFailed[MAX_STRING_LEN];
HINSTANCE hInst = GetModuleHandleW(0);
- LoadStringW(hInst, IDS_APPNAME, sAppName, sizeof(sAppName)/sizeof(WCHAR));
- LoadStringW(hInst, IDS_UNINSTALLFAILED, sUninstallFailed, sizeof(sUninstallFailed)/sizeof(WCHAR));
+ LoadStringW(hInst, IDS_APPNAME, sAppName, ARRAY_SIZE(sAppName));
+ LoadStringW(hInst, IDS_UNINSTALLFAILED, sUninstallFailed, ARRAY_SIZE(sUninstallFailed));
wsprintfW(errormsg, sUninstallFailed, entries[i].command);
if(MessageBoxW(0, errormsg, sAppName, MB_YESNO | MB_ICONQUESTION)==IDYES)
{
--
2.14.4

View File

@ -0,0 +1,53 @@
From efcc9e39250c4a511faf265b81da85e41a466b1d Mon Sep 17 00:00:00 2001
From: Michael Stefaniuc <mstefani@winehq.org>
Date: Tue, 24 Jul 2018 16:51:27 +0200
Subject: [PATCH] wineboot: Use the ARRAY_SIZE() macro
Signed-off-by: Michael Stefaniuc <mstefani@winehq.org>
---
programs/wineboot/wineboot.c | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)
diff --git a/programs/wineboot/wineboot.c b/programs/wineboot/wineboot.c
index 2a65b9e8b3..17ef9cbcca 100644
--- a/programs/wineboot/wineboot.c
+++ b/programs/wineboot/wineboot.c
@@ -401,7 +401,7 @@ static void create_volatile_environment_registry_key(void)
set_reg_value( hkey, HomeDriveW, path );
}
- size = sizeof(path)/sizeof(path[0]);
+ size = ARRAY_SIZE(path);
if (GetUserNameW( path, &size )) set_reg_value( hkey, UserNameW, path );
set_reg_value( hkey, HomeShareW, EmptyW );
@@ -410,7 +410,7 @@ static void create_volatile_environment_registry_key(void)
if (SUCCEEDED(hr))
set_reg_value( hkey, LocalAppDataW, path );
- size = (sizeof(computername)/sizeof(WCHAR)) - 2;
+ size = ARRAY_SIZE(computername) - 2;
if (GetComputerNameW(&computername[2], &size))
{
set_reg_value( hkey, UserDomainW, &computername[2] );
@@ -433,7 +433,7 @@ static BOOL wininit(void)
static const WCHAR wininitbakW[] = {'w','i','n','i','n','i','t','.','b','a','k',0};
WCHAR initial_buffer[1024];
WCHAR *str, *buffer = initial_buffer;
- DWORD size = sizeof(initial_buffer)/sizeof(WCHAR);
+ DWORD size = ARRAY_SIZE(initial_buffer);
DWORD res;
for (;;)
@@ -948,7 +948,7 @@ static HANDLE start_rundll32( const char *inf_path, BOOL wow64 )
static const WCHAR wowinstall[] = {' ','W','o','w','6','4','I','n','s','t','a','l','l',0};
static const WCHAR inf[] = {' ','1','2','8',' ','\\','\\','?','\\','u','n','i','x',0 };
- WCHAR app[MAX_PATH + sizeof(rundll)/sizeof(WCHAR)];
+ WCHAR app[MAX_PATH + ARRAY_SIZE(rundll)];
STARTUPINFOW si;
PROCESS_INFORMATION pi;
WCHAR *buffer;
--
2.14.4

View File

@ -0,0 +1,73 @@
From 3574168c07cb94f4bb391cac1bda6b3ea63afc4a Mon Sep 17 00:00:00 2001
From: Michael Stefaniuc <mstefani@winehq.org>
Date: Tue, 24 Jul 2018 17:28:23 +0200
Subject: [PATCH] wordpad: Use the ARRAY_SIZE() macro
Signed-off-by: Michael Stefaniuc <mstefani@winehq.org>
---
programs/wordpad/wordpad.c | 14 +++++++-------
1 file changed, 7 insertions(+), 7 deletions(-)
diff --git a/programs/wordpad/wordpad.c b/programs/wordpad/wordpad.c
index 904867f617..1ced34c7ff 100644
--- a/programs/wordpad/wordpad.c
+++ b/programs/wordpad/wordpad.c
@@ -250,7 +250,7 @@ static void set_caption(LPCWSTR wszNewFileName)
memcpy(wszCaption, wszNewFileName, lstrlenW(wszNewFileName)*sizeof(WCHAR));
length += lstrlenW(wszNewFileName);
memcpy(wszCaption + length, wszSeparator, sizeof(wszSeparator));
- length += sizeof(wszSeparator) / sizeof(WCHAR);
+ length += ARRAY_SIZE(wszSeparator);
memcpy(wszCaption + length, wszAppTitle, sizeof(wszAppTitle));
SetWindowTextW(hMainWnd, wszCaption);
@@ -398,7 +398,7 @@ static void populate_size_list(HWND hSizeListWnd)
GetDeviceCaps(hdc, LOGPIXELSY)));
} else
{
- for(i = 0; i < sizeof(choices)/sizeof(choices[0]); i++)
+ for(i = 0; i < ARRAY_SIZE(choices); i++)
add_size(hSizeListWnd, choices[i]);
}
@@ -1124,7 +1124,7 @@ static void dialog_viewproperties(void)
psp[0].lParam = reg_formatindex(SF_TEXT);
psp[0].pfnCallback = NULL;
psp[0].pszTitle = MAKEINTRESOURCEW(STRING_VIEWPROPS_TEXT);
- for(i = 1; i < sizeof(psp)/sizeof(psp[0]); i++)
+ for(i = 1; i < ARRAY_SIZE(psp); i++)
{
psp[i].dwSize = psp[0].dwSize;
psp[i].dwFlags = psp[0].dwFlags;
@@ -1141,7 +1141,7 @@ static void dialog_viewproperties(void)
psh.hwndParent = hMainWnd;
psh.hInstance = hInstance;
psh.pszCaption = MAKEINTRESOURCEW(STRING_VIEWPROPS_TITLE);
- psh.nPages = sizeof(psp)/sizeof(psp[0]);
+ psh.nPages = ARRAY_SIZE(psp);
U3(psh).ppsp = ppsp;
U(psh).pszIcon = MAKEINTRESOURCEW(IDI_WORDPAD);
@@ -1235,7 +1235,7 @@ static LRESULT handle_findmsg(LPFINDREPLACEW pFr)
if (pFr->lpstrFindWhat != custom_data->findBuffer)
{
lstrcpynW(custom_data->findBuffer, pFr->lpstrFindWhat,
- sizeof(custom_data->findBuffer) / sizeof(WCHAR));
+ ARRAY_SIZE(custom_data->findBuffer));
pFr->lpstrFindWhat = custom_data->findBuffer;
}
@@ -1885,8 +1885,8 @@ static LRESULT OnCreate( HWND hWnd )
font = (HFONT)SendMessageW(hFontListWnd, WM_GETFONT, 0, 0);
hdc = GetDC(hFontListWnd);
font = SelectObject(hdc, font);
- GetTextExtentPointW(hdc, font_text, sizeof(font_text) / sizeof(font_text[0]) - 1, &name_sz);
- GetTextExtentPointW(hdc, size_text, sizeof(size_text) / sizeof(size_text[0]) - 1, &size_sz);
+ GetTextExtentPointW(hdc, font_text, ARRAY_SIZE(font_text) - 1, &name_sz);
+ GetTextExtentPointW(hdc, size_text, ARRAY_SIZE(size_text) - 1, &size_sz);
font = SelectObject(hdc, font);
ReleaseDC(hFontListWnd, hdc);
rbb.hwndChild = hFontListWnd;
--
2.14.4

View File

@ -0,0 +1,49 @@
From d3b1d2f5c710ffbb778ae739b3068eb982d0b901 Mon Sep 17 00:00:00 2001
From: Michael Stefaniuc <mstefani@winehq.org>
Date: Tue, 24 Jul 2018 18:43:24 +0200
Subject: [PATCH] winetest: Use the ARRAY_SIZE() macro
Signed-off-by: Michael Stefaniuc <mstefani@winehq.org>
---
programs/winetest/gui.c | 2 +-
programs/winetest/main.c | 4 ++--
2 files changed, 3 insertions(+), 3 deletions(-)
diff --git a/programs/winetest/gui.c b/programs/winetest/gui.c
index 2948d7e1ad..bda00f3707 100644
--- a/programs/winetest/gui.c
+++ b/programs/winetest/gui.c
@@ -547,7 +547,7 @@ report (enum report_type t, ...)
}
va_start (ap, t);
- if (t < sizeof text_funcs / sizeof text_funcs[0]) ret = funcs[t](ap);
+ if (t < ARRAY_SIZE(text_funcs)) ret = funcs[t](ap);
else report (R_WARNING, "unimplemented report type: %d", t);
va_end (ap);
return ret;
diff --git a/programs/winetest/main.c b/programs/winetest/main.c
index b3c3c1c850..56044095f3 100644
--- a/programs/winetest/main.c
+++ b/programs/winetest/main.c
@@ -461,7 +461,7 @@ static void print_language(void)
if (pGetSystemPreferredUILanguages && !running_under_wine())
{
WCHAR langW[32];
- ULONG num, size = sizeof(langW)/sizeof(langW[0]);
+ ULONG num, size = ARRAY_SIZE(langW);
if (pGetSystemPreferredUILanguages(MUI_LANGUAGE_ID, &num, langW, &size))
{
char lang[32], *p = lang;
@@ -1263,7 +1263,7 @@ int main( int argc, char *argv[] )
exit (0);
}
else if ((argv[i][0] != '-' && argv[i][0] != '/') || argv[i][2]) {
- if (nb_filters == sizeof(filters)/sizeof(filters[0]))
+ if (nb_filters == ARRAY_SIZE(filters))
{
report (R_ERROR, "Too many test filters specified");
exit (2);
--
2.14.4

View File

@ -0,0 +1,44 @@
From 34a20bf87deab524a00c1be9d60a6f78306359b4 Mon Sep 17 00:00:00 2001
From: Michael Stefaniuc <mstefani@winehq.org>
Date: Tue, 24 Jul 2018 18:56:16 +0200
Subject: [PATCH] mountmgr.sys: Use the ARRAY_SIZE() macro
Signed-off-by: Michael Stefaniuc <mstefani@winehq.org>
---
dlls/mountmgr.sys/device.c | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/dlls/mountmgr.sys/device.c b/dlls/mountmgr.sys/device.c
index 1437bfc853..f96b05e4da 100644
--- a/dlls/mountmgr.sys/device.c
+++ b/dlls/mountmgr.sys/device.c
@@ -658,7 +658,7 @@ static void create_drive_devices(void)
if (!RegQueryValueExW( drives_key, driveW, NULL, &type, (BYTE *)buffer, &size ) &&
type == REG_SZ)
{
- for (j = 0; j < sizeof(drive_types)/sizeof(drive_types[0]); j++)
+ for (j = 0; j < ARRAY_SIZE(drive_types); j++)
if (drive_types[j][0] && !strcmpiW( buffer, drive_types[j] ))
{
drive_type = j;
@@ -1123,7 +1123,7 @@ static void create_port_devices( DRIVER_OBJECT *driver )
p[1] = 'o';
p[2] = 'm';
search_paths = serial_search_paths;
- num_search_paths = sizeof(serial_search_paths)/sizeof(serial_search_paths[0]);
+ num_search_paths = ARRAY_SIZE(serial_search_paths);
windows_ports_key_name = serialcomm_keyW;
}
else
@@ -1132,7 +1132,7 @@ static void create_port_devices( DRIVER_OBJECT *driver )
p[1] = 'p';
p[2] = 't';
search_paths = parallel_search_paths;
- num_search_paths = sizeof(parallel_search_paths)/sizeof(parallel_search_paths[0]);
+ num_search_paths = ARRAY_SIZE(parallel_search_paths);
windows_ports_key_name = parallel_ports_keyW;
}
p += 3;
--
2.14.4

View File

@ -0,0 +1,38 @@
From b8b021f3724c4a5705cde344a806ab30218670f7 Mon Sep 17 00:00:00 2001
From: Michael Stefaniuc <mstefani@winehq.org>
Date: Wed, 25 Jul 2018 09:06:44 +0200
Subject: [PATCH] mpr: Use the ARRAY_SIZE() macro
Signed-off-by: Michael Stefaniuc <mstefani@winehq.org>
---
dlls/mpr/wnet.c | 7 +++----
1 file changed, 3 insertions(+), 4 deletions(-)
diff --git a/dlls/mpr/wnet.c b/dlls/mpr/wnet.c
index 78759ecb15..ad4f1ddb65 100644
--- a/dlls/mpr/wnet.c
+++ b/dlls/mpr/wnet.c
@@ -130,9 +130,8 @@ static void _tryLoadProvider(PCWSTR provider)
HKEY hKey;
TRACE("%s\n", debugstr_w(provider));
- snprintfW(serviceName, sizeof(serviceName) / sizeof(WCHAR), serviceFmt,
- servicePrefix, provider);
- serviceName[sizeof(serviceName) / sizeof(WCHAR) - 1] = '\0';
+ snprintfW(serviceName, ARRAY_SIZE(serviceName), serviceFmt, servicePrefix, provider);
+ serviceName[ARRAY_SIZE(serviceName) - 1] = '\0';
if (RegOpenKeyExW(HKEY_LOCAL_MACHINE, serviceName, 0, KEY_READ, &hKey) ==
ERROR_SUCCESS)
{
@@ -2127,7 +2126,7 @@ DWORD WINAPI WNetGetConnectionA( LPCSTR lpLocalName,
if (wideLocalName)
{
WCHAR wideRemoteStatic[MAX_PATH];
- DWORD wideRemoteSize = sizeof(wideRemoteStatic) / sizeof(WCHAR);
+ DWORD wideRemoteSize = ARRAY_SIZE(wideRemoteStatic);
MultiByteToWideChar(CP_ACP, 0, lpLocalName, -1, wideLocalName, len);
--
2.14.4

View File

@ -0,0 +1,172 @@
From 23b2b3e7e76161f3780551a9de77f8ccc5815e33 Mon Sep 17 00:00:00 2001
From: Michael Stefaniuc <mstefani@winehq.org>
Date: Wed, 25 Jul 2018 09:21:17 +0200
Subject: [PATCH] msacm32: Use the ARRAY_SIZE() macro
Signed-off-by: Michael Stefaniuc <mstefani@winehq.org>
---
dlls/msacm32/filter.c | 4 ++--
dlls/msacm32/format.c | 18 +++++++++---------
dlls/msacm32/internal.c | 14 +++++++-------
dlls/msacm32/pcmconverter.c | 15 +++++++--------
dlls/msacm32/tests/msacm.c | 2 +-
5 files changed, 26 insertions(+), 27 deletions(-)
diff --git a/dlls/msacm32/filter.c b/dlls/msacm32/filter.c
index 53db82777d..8d5abced9d 100644
--- a/dlls/msacm32/filter.c
+++ b/dlls/msacm32/filter.c
@@ -361,8 +361,8 @@ MMRESULT WINAPI acmFilterTagDetailsW(HACMDRIVER had, PACMFILTERTAGDETAILSW paftd
if (mmr == MMSYSERR_NOERROR &&
paftd->dwFilterTag == WAVE_FORMAT_PCM && paftd->szFilterTag[0] == 0)
- MultiByteToWideChar( CP_ACP, 0, "PCM", -1, paftd->szFilterTag,
- sizeof(paftd->szFilterTag)/sizeof(WCHAR) );
+ MultiByteToWideChar(CP_ACP, 0, "PCM", -1, paftd->szFilterTag,
+ ARRAY_SIZE(paftd->szFilterTag));
return mmr;
}
diff --git a/dlls/msacm32/format.c b/dlls/msacm32/format.c
index b3d2900393..fcc0d9b1c6 100644
--- a/dlls/msacm32/format.c
+++ b/dlls/msacm32/format.c
@@ -503,9 +503,9 @@ MMRESULT WINAPI acmFormatDetailsW(HACMDRIVER had, PACMFORMATDETAILSW pafd, DWORD
wsprintfW(pafd->szFormat + lstrlenW(pafd->szFormat), fmt2,
pafd->pwfx->wBitsPerSample);
}
- MultiByteToWideChar( CP_ACP, 0, (pafd->pwfx->nChannels == 1) ? "; Mono" : "; Stereo", -1,
- pafd->szFormat + strlenW(pafd->szFormat),
- sizeof(pafd->szFormat)/sizeof(WCHAR) - strlenW(pafd->szFormat) );
+ MultiByteToWideChar(CP_ACP, 0, (pafd->pwfx->nChannels == 1) ? "; Mono" : "; Stereo", -1,
+ pafd->szFormat + strlenW(pafd->szFormat),
+ ARRAY_SIZE(pafd->szFormat) - strlenW(pafd->szFormat));
}
TRACE("=> %d\n", mmr);
@@ -929,8 +929,8 @@ MMRESULT WINAPI acmFormatTagDetailsW(HACMDRIVER had, PACMFORMATTAGDETAILSW paftd
if (mmr == MMSYSERR_NOERROR &&
paftd->dwFormatTag == WAVE_FORMAT_PCM && paftd->szFormatTag[0] == 0)
- MultiByteToWideChar( CP_ACP, 0, "PCM", -1, paftd->szFormatTag,
- sizeof(paftd->szFormatTag)/sizeof(WCHAR) );
+ MultiByteToWideChar(CP_ACP, 0, "PCM", -1, paftd->szFormatTag,
+ ARRAY_SIZE(paftd->szFormatTag));
return mmr;
}
@@ -1036,8 +1036,8 @@ MMRESULT WINAPI acmFormatTagEnumW(HACMDRIVER had, PACMFORMATTAGDETAILSW paftd,
(LPARAM)paftd, ACM_FORMATTAGDETAILSF_INDEX) == MMSYSERR_NOERROR) {
if (paftd->dwFormatTag == WAVE_FORMAT_PCM) {
if (paftd->szFormatTag[0] == 0)
- MultiByteToWideChar( CP_ACP, 0, "PCM", -1, paftd->szFormatTag,
- sizeof(paftd->szFormatTag)/sizeof(WCHAR) );
+ MultiByteToWideChar(CP_ACP, 0, "PCM", -1, paftd->szFormatTag,
+ ARRAY_SIZE(paftd->szFormatTag));
/* (WS) I'm preserving this PCM hack since it seems to be
* correct. Please notice this block was borrowed from
* below.
@@ -1062,8 +1062,8 @@ MMRESULT WINAPI acmFormatTagEnumW(HACMDRIVER had, PACMFORMATTAGDETAILSW paftd,
(LPARAM)paftd, ACM_FORMATTAGDETAILSF_INDEX) == MMSYSERR_NOERROR) {
if (paftd->dwFormatTag == WAVE_FORMAT_PCM) {
if (paftd->szFormatTag[0] == 0)
- MultiByteToWideChar( CP_ACP, 0, "PCM", -1, paftd->szFormatTag,
- sizeof(paftd->szFormatTag)/sizeof(WCHAR) );
+ MultiByteToWideChar(CP_ACP, 0, "PCM", -1, paftd->szFormatTag,
+ ARRAY_SIZE(paftd->szFormatTag));
/* FIXME (EPP): I'm not sure this is the correct
* algorithm (should make more sense to apply the same
* for all already loaded formats, but this will do
diff --git a/dlls/msacm32/internal.c b/dlls/msacm32/internal.c
index 7bafcaad5e..aad071e8ad 100644
--- a/dlls/msacm32/internal.c
+++ b/dlls/msacm32/internal.c
@@ -72,7 +72,7 @@ PWINE_ACMDRIVERID MSACM_RegisterDriverFromRegistry(LPCWSTR pszRegEntry)
/* The requested registry entry must have the format msacm.XXXXX in order to
be recognized in any future sessions of msacm
*/
- if (0 == strncmpiW(pszRegEntry, msacmW, sizeof(msacmW)/sizeof(WCHAR))) {
+ if (0 == strncmpiW(pszRegEntry, msacmW, ARRAY_SIZE(msacmW))) {
lRet = RegOpenKeyExW(HKEY_LOCAL_MACHINE, drvkey, 0, KEY_QUERY_VALUE, &hKey);
if (lRet != ERROR_SUCCESS) {
WARN("unable to open registry key - 0x%08x\n", lRet);
@@ -373,31 +373,31 @@ void MSACM_RegisterAllDrivers(void)
if (lRet == ERROR_SUCCESS) {
RegQueryInfoKeyW( hKey, 0, 0, 0, &cnt, 0, 0, 0, 0, 0, 0, 0);
for (i = 0; i < cnt; i++) {
- bufLen = sizeof(buf) / sizeof(buf[0]);
+ bufLen = ARRAY_SIZE(buf);
lRet = RegEnumKeyExW(hKey, i, buf, &bufLen, 0, 0, 0, &lastWrite);
if (lRet != ERROR_SUCCESS) continue;
- if (strncmpiW(buf, msacmW, sizeof(msacmW)/sizeof(msacmW[0]))) continue;
+ if (strncmpiW(buf, msacmW, ARRAY_SIZE(msacmW))) continue;
if (!(name = strchrW(buf, '='))) continue;
*name = 0;
MSACM_RegisterDriver(buf, name + 1, 0);
}
i = 0;
- cnt = sizeof(valname) / sizeof(*valname);
+ cnt = ARRAY_SIZE(valname);
bufLen = sizeof(buf);
while(RegEnumValueW(hKey, i, valname, &cnt, 0,
&type, (BYTE*)buf, &bufLen) == ERROR_SUCCESS){
- if(!strncmpiW(valname, msacmW, sizeof(msacmW) / sizeof(*msacmW)))
+ if (!strncmpiW(valname, msacmW, ARRAY_SIZE(msacmW)))
MSACM_RegisterDriver(valname, buf, 0);
++i;
}
RegCloseKey( hKey );
}
- if (GetPrivateProfileSectionW(drv32, buf, sizeof(buf)/sizeof(buf[0]), sys))
+ if (GetPrivateProfileSectionW(drv32, buf, ARRAY_SIZE(buf), sys))
{
for(s = buf; *s; s += strlenW(s) + 1)
{
- if (strncmpiW(s, msacmW, sizeof(msacmW)/sizeof(msacmW[0]))) continue;
+ if (strncmpiW(s, msacmW, ARRAY_SIZE(msacmW))) continue;
if (!(name = strchrW(s, '='))) continue;
*name = 0;
MSACM_RegisterDriver(s, name + 1, 0);
diff --git a/dlls/msacm32/pcmconverter.c b/dlls/msacm32/pcmconverter.c
index f26f125fcd..dc10f11e7a 100644
--- a/dlls/msacm32/pcmconverter.c
+++ b/dlls/msacm32/pcmconverter.c
@@ -984,14 +984,13 @@ static LRESULT PCM_DriverDetails(PACMDRIVERDETAILSW add)
add->cFormatTags = 1;
add->cFilterTags = 0;
add->hicon = NULL;
- MultiByteToWideChar( CP_ACP, 0, "MS-PCM", -1,
- add->szShortName, sizeof(add->szShortName)/sizeof(WCHAR) );
- MultiByteToWideChar( CP_ACP, 0, "Wine PCM converter", -1,
- add->szLongName, sizeof(add->szLongName)/sizeof(WCHAR) );
- MultiByteToWideChar( CP_ACP, 0, "Brought to you by the Wine team...", -1,
- add->szCopyright, sizeof(add->szCopyright)/sizeof(WCHAR) );
- MultiByteToWideChar( CP_ACP, 0, "Refer to LICENSE file", -1,
- add->szLicensing, sizeof(add->szLicensing)/sizeof(WCHAR) );
+ MultiByteToWideChar(CP_ACP, 0, "MS-PCM", -1, add->szShortName, ARRAY_SIZE(add->szShortName));
+ MultiByteToWideChar(CP_ACP, 0, "Wine PCM converter", -1,
+ add->szLongName, ARRAY_SIZE(add->szLongName));
+ MultiByteToWideChar(CP_ACP, 0, "Brought to you by the Wine team...", -1,
+ add->szCopyright, ARRAY_SIZE(add->szCopyright));
+ MultiByteToWideChar(CP_ACP, 0, "Refer to LICENSE file", -1,
+ add->szLicensing, ARRAY_SIZE(add->szLicensing) );
add->szFeatures[0] = 0;
return MMSYSERR_NOERROR;
diff --git a/dlls/msacm32/tests/msacm.c b/dlls/msacm32/tests/msacm.c
index 959ec7f0c0..180639fa54 100644
--- a/dlls/msacm32/tests/msacm.c
+++ b/dlls/msacm32/tests/msacm.c
@@ -1106,7 +1106,7 @@ static void test_convert(void)
MMRESULT mmr;
unsigned i;
- for (i = 0; i < sizeof(expected_output)/sizeof(struct stream_output); i++)
+ for (i = 0; i < ARRAY_SIZE(expected_output); i++)
{
mmr = acmStreamOpen(&has, NULL, (WAVEFORMATEX *)&expected_output[i].src, (WAVEFORMATEX *)&expected_output[i].dst, NULL, 0, 0, 0);
ok(mmr == MMSYSERR_NOERROR, "#%d: open failed: 0x%x\n", i, mmr);
--
2.14.4

View File

@ -0,0 +1,39 @@
From a14a92dc9859ab9ae40b81a103f5efa528c4efc6 Mon Sep 17 00:00:00 2001
From: Michael Stefaniuc <mstefani@winehq.org>
Date: Wed, 25 Jul 2018 18:37:36 +0200
Subject: [PATCH] msrle32: Use the ARRAY_SIZE() macro
Signed-off-by: Michael Stefaniuc <mstefani@winehq.org>
---
dlls/msrle32/msrle32.c | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)
diff --git a/dlls/msrle32/msrle32.c b/dlls/msrle32/msrle32.c
index 66880408d4..5bcfa86f97 100644
--- a/dlls/msrle32/msrle32.c
+++ b/dlls/msrle32/msrle32.c
@@ -1183,8 +1183,8 @@ static LRESULT GetInfo(const CodecInfo *pi, ICINFO *icinfo, DWORD dwSize)
icinfo->dwVersion = ICVERSION;
icinfo->dwVersionICM = ICVERSION;
- LoadStringW(MSRLE32_hModule, IDS_NAME, icinfo->szName, sizeof(icinfo->szName)/sizeof(WCHAR));
- LoadStringW(MSRLE32_hModule, IDS_DESCRIPTION, icinfo->szDescription, sizeof(icinfo->szDescription)/sizeof(WCHAR));
+ LoadStringW(MSRLE32_hModule, IDS_NAME, icinfo->szName, ARRAY_SIZE(icinfo->szName));
+ LoadStringW(MSRLE32_hModule, IDS_DESCRIPTION, icinfo->szDescription, ARRAY_SIZE(icinfo->szDescription));
return sizeof(ICINFO);
}
@@ -1206,8 +1206,8 @@ static LRESULT About(CodecInfo *pi, HWND hWnd)
/* pre-condition */
assert(MSRLE32_hModule != 0);
- LoadStringW(MSRLE32_hModule, IDS_NAME, szTitle, sizeof(szTitle)/sizeof(szTitle[0]));
- LoadStringW(MSRLE32_hModule, IDS_ABOUT, szAbout, sizeof(szAbout)/sizeof(szAbout[0]));
+ LoadStringW(MSRLE32_hModule, IDS_NAME, szTitle, ARRAY_SIZE(szTitle));
+ LoadStringW(MSRLE32_hModule, IDS_ABOUT, szAbout, ARRAY_SIZE(szAbout));
MessageBoxW(hWnd, szAbout, szTitle, MB_OK|MB_ICONINFORMATION);
--
2.14.4

View File

@ -0,0 +1,291 @@
From eb0325daf599408d5d606bade6fd47ac7c78d3cb Mon Sep 17 00:00:00 2001
From: Michael Stefaniuc <mstefani@winehq.org>
Date: Wed, 25 Jul 2018 18:44:28 +0200
Subject: [PATCH] msvcrt: Use the ARRAY_SIZE() macro
Signed-off-by: Michael Stefaniuc <mstefani@winehq.org>
---
dlls/msvcrt/console.c | 2 +-
dlls/msvcrt/ctype.c | 2 +-
dlls/msvcrt/errno.c | 2 +-
dlls/msvcrt/except.c | 3 +--
dlls/msvcrt/exit.c | 3 +--
dlls/msvcrt/file.c | 20 ++++++++++----------
dlls/msvcrt/locale.c | 12 ++++++------
dlls/msvcrt/printf.h | 4 ++--
dlls/msvcrt/process.c | 2 +-
dlls/msvcrt/scheduler.c | 8 ++++----
dlls/msvcrt/wcs.c | 2 +-
11 files changed, 29 insertions(+), 31 deletions(-)
diff --git a/dlls/msvcrt/console.c b/dlls/msvcrt/console.c
index 75e95ebcfc..3a2301ef18 100644
--- a/dlls/msvcrt/console.c
+++ b/dlls/msvcrt/console.c
@@ -124,7 +124,7 @@ static BOOL handle_enhanced_keys(INPUT_RECORD *ir, unsigned char *ch1, unsigned
{
int i;
- for (i = 0; i < sizeof(enh_map) / sizeof(enh_map[0]); i++)
+ for (i = 0; i < ARRAY_SIZE(enh_map); i++)
{
if (ir->Event.KeyEvent.wVirtualScanCode == enh_map[i].vk)
{
diff --git a/dlls/msvcrt/ctype.c b/dlls/msvcrt/ctype.c
index 2c39a56686..758411a7a4 100644
--- a/dlls/msvcrt/ctype.c
+++ b/dlls/msvcrt/ctype.c
@@ -493,7 +493,7 @@ unsigned short __cdecl wctype(const char *property)
};
unsigned int i;
- for(i=0; i<sizeof(properties)/sizeof(properties[0]); i++)
+ for(i=0; i<ARRAY_SIZE(properties); i++)
if(!strcmp(property, properties[i].name))
return properties[i].mask;
diff --git a/dlls/msvcrt/errno.c b/dlls/msvcrt/errno.c
index c5fbae21a8..a80ac61f11 100644
--- a/dlls/msvcrt/errno.c
+++ b/dlls/msvcrt/errno.c
@@ -123,7 +123,7 @@ char *MSVCRT__sys_errlist[] =
str_generic_error
};
-unsigned int MSVCRT__sys_nerr = sizeof(MSVCRT__sys_errlist)/sizeof(MSVCRT__sys_errlist[0]) - 1;
+unsigned int MSVCRT__sys_nerr = ARRAY_SIZE(MSVCRT__sys_errlist) - 1;
static MSVCRT_invalid_parameter_handler invalid_parameter_handler = NULL;
diff --git a/dlls/msvcrt/except.c b/dlls/msvcrt/except.c
index 8fccd8ed5d..da0ac9219e 100644
--- a/dlls/msvcrt/except.c
+++ b/dlls/msvcrt/except.c
@@ -136,8 +136,7 @@ static LONG msvcrt_exception_filter(struct _EXCEPTION_POINTERS *except)
int float_signal = MSVCRT__FPE_INVALID;
sighandlers[MSVCRT_SIGFPE] = MSVCRT_SIG_DFL;
- for (i = 0; i < sizeof(float_exception_map) /
- sizeof(float_exception_map[0]); i++)
+ for (i = 0; i < ARRAY_SIZE(float_exception_map); i++)
{
if (float_exception_map[i].status ==
except->ExceptionRecord->ExceptionCode)
diff --git a/dlls/msvcrt/exit.c b/dlls/msvcrt/exit.c
index b84c50adbc..51bc6f07e1 100644
--- a/dlls/msvcrt/exit.c
+++ b/dlls/msvcrt/exit.c
@@ -209,8 +209,7 @@ static void DoMessageBoxW(const MSVCRT_wchar_t *lead, const MSVCRT_wchar_t *mess
MSVCRT_wchar_t text[2048];
INT ret;
- MSVCRT__snwprintf(text, sizeof(text)/sizeof(text[0]), message_format,
- lead, MSVCRT__wpgmptr, message);
+ MSVCRT__snwprintf(text, ARRAY_SIZE(text), message_format, lead, MSVCRT__wpgmptr, message);
msgbox.cbSize = sizeof(msgbox);
msgbox.hwndOwner = GetActiveWindow();
diff --git a/dlls/msvcrt/file.c b/dlls/msvcrt/file.c
index 2c05f25c6a..224e6eae0c 100644
--- a/dlls/msvcrt/file.c
+++ b/dlls/msvcrt/file.c
@@ -1223,7 +1223,7 @@ void msvcrt_free_io(void)
MSVCRT__flushall();
MSVCRT__fcloseall();
- for(i=0; i<sizeof(MSVCRT___pioinfo)/sizeof(MSVCRT___pioinfo[0]); i++)
+ for(i=0; i<ARRAY_SIZE(MSVCRT___pioinfo); i++)
{
if(!MSVCRT___pioinfo[i])
continue;
@@ -1246,7 +1246,7 @@ void msvcrt_free_io(void)
}
}
- for(i=0; i<sizeof(MSVCRT_fstream)/sizeof(MSVCRT_fstream[0]); i++)
+ for(i=0; i<ARRAY_SIZE(MSVCRT_fstream); i++)
MSVCRT_free(MSVCRT_fstream[i]);
}
@@ -1606,29 +1606,29 @@ static int msvcrt_get_flags(const MSVCRT_wchar_t* mode, int *open_flags, int* st
mode++;
while(*mode == ' ') mode++;
- if(!MSVCRT_CHECK_PMT(!strncmpW(ccs, mode, sizeof(ccs)/sizeof(ccs[0]))))
+ if(!MSVCRT_CHECK_PMT(!strncmpW(ccs, mode, ARRAY_SIZE(ccs))))
return -1;
- mode += sizeof(ccs)/sizeof(ccs[0]);
+ mode += ARRAY_SIZE(ccs);
while(*mode == ' ') mode++;
if(!MSVCRT_CHECK_PMT(*mode == '='))
return -1;
mode++;
while(*mode == ' ') mode++;
- if(!strncmpiW(utf8, mode, sizeof(utf8)/sizeof(utf8[0])))
+ if(!strncmpiW(utf8, mode, ARRAY_SIZE(utf8)))
{
*open_flags |= MSVCRT__O_U8TEXT;
- mode += sizeof(utf8)/sizeof(utf8[0]);
+ mode += ARRAY_SIZE(utf8);
}
- else if(!strncmpiW(utf16le, mode, sizeof(utf16le)/sizeof(utf16le[0])))
+ else if(!strncmpiW(utf16le, mode, ARRAY_SIZE(utf16le)))
{
*open_flags |= MSVCRT__O_U16TEXT;
- mode += sizeof(utf16le)/sizeof(utf16le[0]);
+ mode += ARRAY_SIZE(utf16le);
}
- else if(!strncmpiW(unicode, mode, sizeof(unicode)/sizeof(unicode[0])))
+ else if(!strncmpiW(unicode, mode, ARRAY_SIZE(unicode)))
{
*open_flags |= MSVCRT__O_WTEXT;
- mode += sizeof(unicode)/sizeof(unicode[0]);
+ mode += ARRAY_SIZE(unicode);
}
else
{
diff --git a/dlls/msvcrt/locale.c b/dlls/msvcrt/locale.c
index 8c9bece774..1e56395dbb 100644
--- a/dlls/msvcrt/locale.c
+++ b/dlls/msvcrt/locale.c
@@ -94,7 +94,7 @@ static const char * const _country_synonyms[] =
static void remap_synonym(char *name)
{
unsigned int i;
- for (i = 0; i < sizeof(_country_synonyms)/sizeof(char*); i += 2 )
+ for (i = 0; i < ARRAY_SIZE(_country_synonyms); i += 2)
{
if (!strcasecmp(_country_synonyms[i],name))
{
@@ -595,7 +595,7 @@ void* CDECL _Gettnames(void)
TRACE("\n");
- for(i=0; i<sizeof(cur->str.str)/sizeof(cur->str.str[0]); i++)
+ for(i=0; i<ARRAY_SIZE(cur->str.str); i++)
size += strlen(cur->str.str[i])+1;
ret = MSVCRT_malloc(size);
@@ -604,7 +604,7 @@ void* CDECL _Gettnames(void)
memcpy(ret, cur, size);
size = 0;
- for(i=0; i<sizeof(cur->str.str)/sizeof(cur->str.str[0]); i++) {
+ for(i=0; i<ARRAY_SIZE(cur->str.str); i++) {
ret->str.str[i] = &ret->data[size];
size += strlen(&ret->data[size])+1;
}
@@ -1605,7 +1605,7 @@ static MSVCRT_pthreadlocinfo create_locinfo(int category,
size = sizeof(MSVCRT___lc_time_data);
lcid_tmp = lcid[MSVCRT_LC_TIME] ? lcid[MSVCRT_LC_TIME] : MAKELCID(LANG_ENGLISH, SORT_DEFAULT);
- for(i=0; i<sizeof(time_data)/sizeof(time_data[0]); i++) {
+ for(i=0; i<ARRAY_SIZE(time_data); i++) {
if(time_data[i]==LOCALE_SSHORTDATE && !lcid[MSVCRT_LC_TIME]) {
size += sizeof(cloc_short_date) + sizeof(cloc_short_dateW);
}else if(time_data[i]==LOCALE_SLONGDATE && !lcid[MSVCRT_LC_TIME]) {
@@ -1637,7 +1637,7 @@ static MSVCRT_pthreadlocinfo create_locinfo(int category,
}
ret = 0;
- for(i=0; i<sizeof(time_data)/sizeof(time_data[0]); i++) {
+ for(i=0; i<ARRAY_SIZE(time_data); i++) {
locinfo->lc_time_curr->str.str[i] = &locinfo->lc_time_curr->data[ret];
if(time_data[i]==LOCALE_SSHORTDATE && !lcid[MSVCRT_LC_TIME]) {
memcpy(&locinfo->lc_time_curr->data[ret], cloc_short_date, sizeof(cloc_short_date));
@@ -1653,7 +1653,7 @@ static MSVCRT_pthreadlocinfo create_locinfo(int category,
&locinfo->lc_time_curr->data[ret], size-ret);
}
}
- for(i=0; i<sizeof(time_data)/sizeof(time_data[0]); i++) {
+ for(i=0; i<ARRAY_SIZE(time_data); i++) {
locinfo->lc_time_curr->wstr.wstr[i] = (MSVCRT_wchar_t*)&locinfo->lc_time_curr->data[ret];
if(time_data[i]==LOCALE_SSHORTDATE && !lcid[MSVCRT_LC_TIME]) {
memcpy(&locinfo->lc_time_curr->data[ret], cloc_short_dateW, sizeof(cloc_short_dateW));
diff --git a/dlls/msvcrt/printf.h b/dlls/msvcrt/printf.h
index ee8120e149..077dafa550 100644
--- a/dlls/msvcrt/printf.h
+++ b/dlls/msvcrt/printf.h
@@ -518,7 +518,7 @@ int FUNC_NAME(pf_printf)(FUNC_NAME(puts_clbk) pf_puts, void *puts_ctx, const API
flags.PadZero = '0';
i = flags.Precision;
flags.Precision = 2*sizeof(void*);
- FUNC_NAME(pf_integer_conv)(buf, sizeof(buf)/sizeof(APICHAR), &flags,
+ FUNC_NAME(pf_integer_conv)(buf, ARRAY_SIZE(buf), &flags,
(ULONG_PTR)pf_args(args_ctx, pos, VT_PTR, valist).get_ptr);
flags.PadZero = 0;
flags.Precision = i;
@@ -549,7 +549,7 @@ int FUNC_NAME(pf_printf)(FUNC_NAME(puts_clbk) pf_puts, void *puts_ctx, const API
flags.Precision = flags.FieldLength - 2;
max_len = (flags.FieldLength>flags.Precision ? flags.FieldLength : flags.Precision) + 10;
- if(max_len > sizeof(buf)/sizeof(APICHAR))
+ if(max_len > ARRAY_SIZE(buf))
tmp = HeapAlloc(GetProcessHeap(), 0, max_len);
if(!tmp)
return -1;
diff --git a/dlls/msvcrt/process.c b/dlls/msvcrt/process.c
index fac3bd4d20..9a192e7e9b 100644
--- a/dlls/msvcrt/process.c
+++ b/dlls/msvcrt/process.c
@@ -345,7 +345,7 @@ static MSVCRT_wchar_t *msvcrt_get_comspec(void)
MSVCRT_wchar_t *ret;
unsigned int len;
- if (!(len = GetEnvironmentVariableW(comspec, NULL, 0))) len = sizeof(cmd)/sizeof(MSVCRT_wchar_t);
+ if (!(len = GetEnvironmentVariableW(comspec, NULL, 0))) len = ARRAY_SIZE(cmd);
if ((ret = HeapAlloc(GetProcessHeap(), 0, len * sizeof(MSVCRT_wchar_t))))
{
if (!GetEnvironmentVariableW(comspec, ret, len)) strcpyW(ret, cmd);
diff --git a/dlls/msvcrt/scheduler.c b/dlls/msvcrt/scheduler.c
index c6c0fa7e38..55ab1c549e 100644
--- a/dlls/msvcrt/scheduler.c
+++ b/dlls/msvcrt/scheduler.c
@@ -344,7 +344,7 @@ static void ExternalContextBase_dtor(ExternalContextBase *this)
int i;
/* TODO: move the allocator cache to scheduler so it can be reused */
- for(i=0; i<sizeof(this->allocator_cache)/sizeof(this->allocator_cache[0]); i++) {
+ for(i=0; i<ARRAY_SIZE(this->allocator_cache); i++) {
for(cur = this->allocator_cache[i]; cur; cur=next) {
next = cur->free.next;
MSVCRT_operator_delete(cur);
@@ -413,10 +413,10 @@ void * CDECL Concurrency_Alloc(MSVCRT_size_t size)
int i;
C_ASSERT(sizeof(union allocator_cache_entry) <= 1 << 4);
- for(i=0; i<sizeof(context->allocator_cache)/sizeof(context->allocator_cache[0]); i++)
+ for(i=0; i<ARRAY_SIZE(context->allocator_cache); i++)
if (1 << (i+4) >= size) break;
- if(i==sizeof(context->allocator_cache)/sizeof(context->allocator_cache[0])) {
+ if(i==ARRAY_SIZE(context->allocator_cache)) {
p = MSVCRT_operator_new(size);
p->alloc.bucket = -1;
}else if (context->allocator_cache[i]) {
@@ -446,7 +446,7 @@ void CDECL Concurrency_Free(void* mem)
if (context->context.vtable != &MSVCRT_ExternalContextBase_vtable) {
MSVCRT_operator_delete(p);
}else {
- if(bucket >= 0 && bucket < sizeof(context->allocator_cache)/sizeof(context->allocator_cache[0]) &&
+ if(bucket >= 0 && bucket < ARRAY_SIZE(context->allocator_cache) &&
(!context->allocator_cache[bucket] || context->allocator_cache[bucket]->free.depth < 20)) {
p->free.next = context->allocator_cache[bucket];
p->free.depth = p->free.next ? p->free.next->free.depth+1 : 0;
diff --git a/dlls/msvcrt/wcs.c b/dlls/msvcrt/wcs.c
index 098e0d5ba8..ed73fc6163 100644
--- a/dlls/msvcrt/wcs.c
+++ b/dlls/msvcrt/wcs.c
@@ -2109,7 +2109,7 @@ static int wctoint(WCHAR c, int base)
0xd66, 0xe50, 0xed0, 0xf20, 0x1040, 0x17e0, 0x1810, 0xff10
};
int i;
- for (i = 0; i < sizeof(zeros)/sizeof(zeros[0]) && c >= zeros[i]; ++i) {
+ for (i = 0; i < ARRAY_SIZE(zeros) && c >= zeros[i]; ++i) {
if (zeros[i] <= c && c <= zeros[i] + 9) {
v = c - zeros[i];
break;
--
2.14.4

View File

@ -0,0 +1,35 @@
From 5675688cff4eb773a4b531423f72267823caec3b Mon Sep 17 00:00:00 2001
From: Michael Stefaniuc <mstefani@winehq.org>
Date: Wed, 25 Jul 2018 19:17:44 +0200
Subject: [PATCH] scrobj: Use the ARRAY_SIZE() macro
Signed-off-by: Michael Stefaniuc <mstefani@winehq.org>
---
dlls/scrobj/scrobj.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/dlls/scrobj/scrobj.c b/dlls/scrobj/scrobj.c
index 3e6535a607..989a648370 100644
--- a/dlls/scrobj/scrobj.c
+++ b/dlls/scrobj/scrobj.c
@@ -102,7 +102,7 @@ static void release_typelib(void)
if (!typelib)
return;
- for (i = 0; i < sizeof(typeinfos)/sizeof(*typeinfos); i++)
+ for (i = 0; i < ARRAY_SIZE(typeinfos); i++)
if (typeinfos[i])
ITypeInfo_Release(typeinfos[i]);
@@ -369,7 +369,7 @@ static HRESULT WINAPI scriptlet_typelib_get_GUID(IGenScriptletTLib *iface, BSTR
if (FAILED(hr))
return hr;
- hr = StringFromGUID2(&guid, guidW, sizeof(guidW)/sizeof(guidW[0]));
+ hr = StringFromGUID2(&guid, guidW, ARRAY_SIZE(guidW));
if (FAILED(hr))
return hr;
--
2.14.4

View File

@ -0,0 +1,68 @@
From c4428ddee47ee8f189552442261adf72fbe9c1c8 Mon Sep 17 00:00:00 2001
From: Michael Stefaniuc <mstefani@winehq.org>
Date: Wed, 25 Jul 2018 19:23:08 +0200
Subject: [PATCH] storage.dll16: Use the ARRAY_SIZE() macro
Signed-off-by: Michael Stefaniuc <mstefani@winehq.org>
---
dlls/storage.dll16/storage.c | 16 ++++++++--------
1 file changed, 8 insertions(+), 8 deletions(-)
diff --git a/dlls/storage.dll16/storage.c b/dlls/storage.dll16/storage.c
index 865411f9cb..23e88b42d1 100644
--- a/dlls/storage.dll16/storage.c
+++ b/dlls/storage.dll16/storage.c
@@ -776,8 +776,8 @@ STORAGE_init_storage(stream_access16 *str) {
/* block 1 is the root directory entry */
memset(block,0x00,sizeof(block));
stde = (struct storage_pps_entry*)block;
- MultiByteToWideChar( CP_ACP, 0, "RootEntry", -1, stde->pps_rawname,
- sizeof(stde->pps_rawname)/sizeof(WCHAR));
+ MultiByteToWideChar(CP_ACP, 0, "RootEntry", -1, stde->pps_rawname,
+ ARRAY_SIZE(stde->pps_rawname));
stde->pps_sizeofname = (strlenW(stde->pps_rawname)+1) * sizeof(WCHAR);
stde->pps_type = 5;
stde->pps_dir = -1;
@@ -1750,8 +1750,8 @@ HRESULT CDECL IStorage16_fnCreateStorage(IStorage16 *iface, LPCOLESTR16 pwcsName
assert(ret);
nPPSEntries = STORAGE_get_pps_entry(&lpstg->str,ppsent,&(lpstg->stde));
assert(nPPSEntries == 1);
- MultiByteToWideChar( CP_ACP, 0, pwcsName, -1, lpstg->stde.pps_rawname,
- sizeof(lpstg->stde.pps_rawname)/sizeof(WCHAR));
+ MultiByteToWideChar(CP_ACP, 0, pwcsName, -1, lpstg->stde.pps_rawname,
+ ARRAY_SIZE(lpstg->stde.pps_rawname));
lpstg->stde.pps_sizeofname = (strlenW(lpstg->stde.pps_rawname)+1)*sizeof(WCHAR);
lpstg->stde.pps_next = -1;
lpstg->stde.pps_prev = -1;
@@ -1813,8 +1813,8 @@ HRESULT CDECL IStorage16_fnCreateStream(IStorage16 *iface, LPCOLESTR16 pwcsName,
assert(ret);
nPPSEntries = STORAGE_get_pps_entry(&lpstr->str,ppsent,&(lpstr->stde));
assert(nPPSEntries == 1);
- MultiByteToWideChar( CP_ACP, 0, pwcsName, -1, lpstr->stde.pps_rawname,
- sizeof(lpstr->stde.pps_rawname)/sizeof(WCHAR));
+ MultiByteToWideChar(CP_ACP, 0, pwcsName, -1, lpstr->stde.pps_rawname,
+ ARRAY_SIZE(lpstr->stde.pps_rawname));
lpstr->stde.pps_sizeofname = (strlenW(lpstr->stde.pps_rawname)+1) * sizeof(WCHAR);
lpstr->stde.pps_next = -1;
lpstr->stde.pps_prev = -1;
@@ -1855,7 +1855,7 @@ HRESULT CDECL IStorage16_fnOpenStorage(IStorage16 *iface, LPCOLESTR16 pwcsName,
lpstg->str.lockbytes = This->str.lockbytes;
_ilockbytes16_addref(This->str.lockbytes);
}
- MultiByteToWideChar( CP_ACP, 0, pwcsName, -1, name, sizeof(name)/sizeof(WCHAR));
+ MultiByteToWideChar(CP_ACP, 0, pwcsName, -1, name, ARRAY_SIZE(name));
newpps = STORAGE_look_for_named_pps(&lpstg->str,This->stde.pps_dir,name);
if (newpps==-1) {
IStorage16_fnRelease(&lpstg->IStorage16_iface);
@@ -1897,7 +1897,7 @@ HRESULT CDECL IStorage16_fnOpenStream(IStorage16 *iface, LPCOLESTR16 pwcsName, v
lpstr->str.lockbytes = This->str.lockbytes;
_ilockbytes16_addref(This->str.lockbytes);
}
- MultiByteToWideChar( CP_ACP, 0, pwcsName, -1, name, sizeof(name)/sizeof(WCHAR));
+ MultiByteToWideChar(CP_ACP, 0, pwcsName, -1, name, ARRAY_SIZE(name));
newpps = STORAGE_look_for_named_pps(&lpstr->str,This->stde.pps_dir,name);
if (newpps==-1) {
IStream16_fnRelease(&lpstr->IStream16_iface);
--
2.14.4

View File

@ -0,0 +1,40 @@
From 897ed8f10acb62fca27c4ecb04b06bb9e29449e9 Mon Sep 17 00:00:00 2001
From: Michael Stefaniuc <mstefani@winehq.org>
Date: Wed, 25 Jul 2018 19:35:09 +0200
Subject: [PATCH] urlmon: Use the ARRAY_SIZE() macro
Signed-off-by: Michael Stefaniuc <mstefani@winehq.org>
---
dlls/urlmon/urlmon_main.c | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)
diff --git a/dlls/urlmon/urlmon_main.c b/dlls/urlmon/urlmon_main.c
index 5968a6ce55..06f0698efa 100644
--- a/dlls/urlmon/urlmon_main.c
+++ b/dlls/urlmon/urlmon_main.c
@@ -409,7 +409,7 @@ static void init_session(void)
{
unsigned int i;
- for(i=0; i < sizeof(object_creation)/sizeof(object_creation[0]); i++) {
+ for(i = 0; i < ARRAY_SIZE(object_creation); i++) {
if(object_creation[i].protocol)
register_namespace(object_creation[i].cf, object_creation[i].clsid,
object_creation[i].protocol, TRUE);
@@ -438,10 +438,10 @@ HRESULT WINAPI DllGetClassObject(REFCLSID rclsid, REFIID riid, LPVOID *ppv)
{
unsigned int i;
HRESULT hr;
-
+
TRACE("(%s,%s,%p)\n", debugstr_guid(rclsid), debugstr_guid(riid), ppv);
-
- for (i=0; i < sizeof(object_creation)/sizeof(object_creation[0]); i++)
+
+ for (i = 0; i < ARRAY_SIZE(object_creation); i++)
{
if (IsEqualGUID(object_creation[i].clsid, rclsid))
return IClassFactory_QueryInterface(object_creation[i].cf, riid, ppv);
--
2.14.4

View File

@ -0,0 +1,26 @@
From dbdf14d77be88f1e380b9e5d0638d5f55137e8ca Mon Sep 17 00:00:00 2001
From: Michael Stefaniuc <mstefani@winehq.org>
Date: Wed, 25 Jul 2018 19:13:30 +0200
Subject: [PATCH] msvideo.dll16: Use the ARRAY_SIZE() macro
Signed-off-by: Michael Stefaniuc <mstefani@winehq.org>
---
dlls/msvideo.dll16/msvideo16.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/dlls/msvideo.dll16/msvideo16.c b/dlls/msvideo.dll16/msvideo16.c
index d390020ecc..bc239a8ab3 100644
--- a/dlls/msvideo.dll16/msvideo16.c
+++ b/dlls/msvideo.dll16/msvideo16.c
@@ -889,7 +889,7 @@ DWORD WINAPI VideoCapDriverDescAndVer16(WORD nr, LPSTR buf1, WORD buf1len,
RegQueryInfoKeyA( hKey, 0, 0, 0, &cnt, 0, 0, 0, 0, 0, 0, 0);
for (i = 0; i < cnt; i++)
{
- bufLen = sizeof(buf) / sizeof(buf[0]);
+ bufLen = ARRAY_SIZE(buf);
lRet = RegEnumKeyExA(hKey, i, buf, &bufLen, 0, 0, 0, &lastWrite);
if (lRet != ERROR_SUCCESS) continue;
if (strncasecmp(buf, "vid", 3)) continue;
--
2.14.4

View File

@ -0,0 +1,138 @@
From bb748f41222a923e002ebbf2ffc0c904ba139db2 Mon Sep 17 00:00:00 2001
From: Michael Stefaniuc <mstefani@winehq.org>
Date: Wed, 25 Jul 2018 18:35:21 +0200
Subject: [PATCH] mscoree: Use the ARRAY_SIZE() macro
Signed-off-by: Vincent Povirk <vincent@codeweavers.com>
Signed-off-by: Michael Stefaniuc <mstefani@winehq.org>
---
dlls/mscoree/config.c | 18 +++++++-----------
dlls/mscoree/corruntimehost.c | 6 +++---
dlls/mscoree/mscoree_main.c | 4 ++--
3 files changed, 12 insertions(+), 16 deletions(-)
diff --git a/dlls/mscoree/config.c b/dlls/mscoree/config.c
index 48f12f4d53..a5c0666904 100644
--- a/dlls/mscoree/config.c
+++ b/dlls/mscoree/config.c
@@ -417,7 +417,7 @@ static HRESULT WINAPI ConfigFileHandler_startElement(ISAXContentHandler *iface,
TRACE("%s %s %s\n", debugstr_wn(pNamespaceUri,nNamespaceUri),
debugstr_wn(pLocalName,nLocalName), debugstr_wn(pQName,nQName));
- if (This->statenum == sizeof(This->states) / sizeof(This->states[0]) - 1)
+ if (This->statenum == ARRAY_SIZE(This->states) - 1)
{
ERR("file has too much nesting\n");
return E_FAIL;
@@ -426,8 +426,7 @@ static HRESULT WINAPI ConfigFileHandler_startElement(ISAXContentHandler *iface,
switch (This->states[This->statenum])
{
case STATE_ROOT:
- if (nLocalName == sizeof(configuration)/sizeof(WCHAR)-1 &&
- lstrcmpW(pLocalName, configuration) == 0)
+ if (nLocalName == ARRAY_SIZE(configuration) - 1 && lstrcmpW(pLocalName, configuration) == 0)
{
This->states[++This->statenum] = STATE_CONFIGURATION;
break;
@@ -435,15 +434,13 @@ static HRESULT WINAPI ConfigFileHandler_startElement(ISAXContentHandler *iface,
else
goto unknown;
case STATE_CONFIGURATION:
- if (nLocalName == sizeof(startup)/sizeof(WCHAR)-1 &&
- lstrcmpW(pLocalName, startup) == 0)
+ if (nLocalName == ARRAY_SIZE(startup) - 1 && lstrcmpW(pLocalName, startup) == 0)
{
hr = parse_startup(This, pAttr);
This->states[++This->statenum] = STATE_STARTUP;
break;
}
- else if (nLocalName == sizeof(runtime)/sizeof(WCHAR)-1 &&
- lstrcmpW(pLocalName, runtime) == 0)
+ else if (nLocalName == ARRAY_SIZE(runtime) - 1 && lstrcmpW(pLocalName, runtime) == 0)
{
This->states[++This->statenum] = STATE_RUNTIME;
break;
@@ -451,7 +448,7 @@ static HRESULT WINAPI ConfigFileHandler_startElement(ISAXContentHandler *iface,
else
goto unknown;
case STATE_RUNTIME:
- if (nLocalName == sizeof(assemblyBinding)/sizeof(WCHAR)-1 &&
+ if (nLocalName == ARRAY_SIZE(assemblyBinding) - 1 &&
lstrcmpW(pLocalName, assemblyBinding) == 0)
{
This->states[++This->statenum] = STATE_ASSEMBLY_BINDING;
@@ -460,8 +457,7 @@ static HRESULT WINAPI ConfigFileHandler_startElement(ISAXContentHandler *iface,
else
goto unknown;
case STATE_ASSEMBLY_BINDING:
- if (nLocalName == sizeof(probing)/sizeof(WCHAR)-1 &&
- lstrcmpW(pLocalName, probing) == 0)
+ if (nLocalName == ARRAY_SIZE(probing) - 1 && lstrcmpW(pLocalName, probing) == 0)
{
hr = parse_probing(This, pAttr);
This->states[++This->statenum] = STATE_PROBING;
@@ -470,7 +466,7 @@ static HRESULT WINAPI ConfigFileHandler_startElement(ISAXContentHandler *iface,
else
goto unknown;
case STATE_STARTUP:
- if (nLocalName == sizeof(supportedRuntime)/sizeof(WCHAR)-1 &&
+ if (nLocalName == ARRAY_SIZE(supportedRuntime) - 1 &&
lstrcmpW(pLocalName, supportedRuntime) == 0)
{
hr = parse_supported_runtime(This, pAttr);
diff --git a/dlls/mscoree/corruntimehost.c b/dlls/mscoree/corruntimehost.c
index 0c933cac29..5c4e7f1d6e 100644
--- a/dlls/mscoree/corruntimehost.c
+++ b/dlls/mscoree/corruntimehost.c
@@ -138,7 +138,7 @@ static HRESULT RuntimeHost_GetDefaultDomain(RuntimeHost *This, const WCHAR *conf
if (!config_path)
{
- DWORD len = sizeof(config_dir)/sizeof(*config_dir);
+ DWORD len = ARRAY_SIZE(config_dir);
static const WCHAR machine_configW[] = {'\\','C','O','N','F','I','G','\\','m','a','c','h','i','n','e','.','c','o','n','f','i','g',0};
@@ -159,7 +159,7 @@ static HRESULT RuntimeHost_GetDefaultDomain(RuntimeHost *This, const WCHAR *conf
goto end;
}
- GetModuleFileNameW(NULL, base_dir, sizeof(base_dir) / sizeof(*base_dir));
+ GetModuleFileNameW(NULL, base_dir, ARRAY_SIZE(base_dir));
base_dirA = WtoA(base_dir);
if (!base_dirA)
{
@@ -1674,7 +1674,7 @@ HRESULT create_monodata(REFIID riid, LPVOID *ppObj )
if (res != ERROR_SUCCESS || numKeys == 0)
goto cleanup;
numKeys--;
- keyLength = sizeof(subkeyName) / sizeof(WCHAR);
+ keyLength = ARRAY_SIZE(subkeyName);
res = RegEnumKeyExW(key, numKeys, subkeyName, &keyLength, 0, 0, 0, 0);
if (res != ERROR_SUCCESS)
goto cleanup;
diff --git a/dlls/mscoree/mscoree_main.c b/dlls/mscoree/mscoree_main.c
index eda380a1ca..5612ff6b89 100644
--- a/dlls/mscoree/mscoree_main.c
+++ b/dlls/mscoree/mscoree_main.c
@@ -751,7 +751,7 @@ static BOOL install_wine_mono(void)
}
}
- len = GetSystemDirectoryW(app, MAX_PATH-sizeof(controlW)/sizeof(WCHAR));
+ len = GetSystemDirectoryW(app, MAX_PATH - ARRAY_SIZE(controlW));
memcpy(app+len, controlW, sizeof(controlW));
args = HeapAlloc(GetProcessHeap(), 0, (len*sizeof(WCHAR) + sizeof(controlW) + sizeof(argsW)));
@@ -759,7 +759,7 @@ static BOOL install_wine_mono(void)
return FALSE;
memcpy(args, app, len*sizeof(WCHAR) + sizeof(controlW));
- memcpy(args + len + sizeof(controlW)/sizeof(WCHAR)-1, argsW, sizeof(argsW));
+ memcpy(args + len + ARRAY_SIZE(controlW) - 1, argsW, sizeof(argsW));
TRACE("starting %s\n", debugstr_w(args));
--
2.14.4

View File

@ -0,0 +1,433 @@
From dc0c77b7ac781b47159fba8c2e043bcfb226912b Mon Sep 17 00:00:00 2001
From: Michael Stefaniuc <mstefani@winehq.org>
Date: Sat, 28 Jul 2018 00:04:52 +0200
Subject: [PATCH] dxdiagn: Use the ARRAY_SIZE() macro
Signed-off-by: Michael Stefaniuc <mstefani@winehq.org>
---
dlls/dxdiagn/provider.c | 92 +++++++++++++++++-----------------
include/wine/server_protocol.h | 21 +++++++-
server/request.h | 8 +++
server/trace.c | 15 ++++++
4 files changed, 90 insertions(+), 46 deletions(-)
diff --git a/dlls/dxdiagn/provider.c b/dlls/dxdiagn/provider.c
index 1fdab5e2db..ec30574b84 100644
--- a/dlls/dxdiagn/provider.c
+++ b/dlls/dxdiagn/provider.c
@@ -494,7 +494,7 @@ static BOOL is_netmeeting_running(void)
for (i = 0; i < list_count; i++)
{
- if (get_process_name_from_pid(pid_list[i], process_name, sizeof(process_name)/sizeof(WCHAR)) &&
+ if (get_process_name_from_pid(pid_list[i], process_name, ARRAY_SIZE(process_name)) &&
!lstrcmpW(conf_exe, process_name))
{
HeapFree(GetProcessHeap(), 0, pid_list);
@@ -518,21 +518,23 @@ static HRESULT fill_language_information(IDxDiagContainerImpl_Container *node)
HRESULT hr;
/* szLanguagesLocalized */
- GetLocaleInfoW(LOCALE_SYSTEM_DEFAULT, LOCALE_SNATIVELANGNAME, system_lang, sizeof(system_lang)/sizeof(WCHAR));
- LoadStringW(dxdiagn_instance, IDS_REGIONAL_SETTING, regional_setting, sizeof(regional_setting)/sizeof(WCHAR));
- GetLocaleInfoW(LOCALE_USER_DEFAULT, LOCALE_SNATIVELANGNAME, user_lang, sizeof(user_lang)/sizeof(WCHAR));
+ GetLocaleInfoW(LOCALE_SYSTEM_DEFAULT, LOCALE_SNATIVELANGNAME, system_lang, ARRAY_SIZE(system_lang));
+ LoadStringW(dxdiagn_instance, IDS_REGIONAL_SETTING, regional_setting, ARRAY_SIZE(regional_setting));
+ GetLocaleInfoW(LOCALE_USER_DEFAULT, LOCALE_SNATIVELANGNAME, user_lang, ARRAY_SIZE(user_lang));
- snprintfW(language_str, sizeof(language_str)/sizeof(WCHAR), languages_fmtW, system_lang, regional_setting, user_lang);
+ snprintfW(language_str, ARRAY_SIZE(language_str), languages_fmtW, system_lang, regional_setting,
+ user_lang);
hr = add_bstr_property(node, szLanguagesLocalized, language_str);
if (FAILED(hr))
return hr;
/* szLanguagesEnglish */
- GetLocaleInfoW(LOCALE_SYSTEM_DEFAULT, LOCALE_SENGLANGUAGE, system_lang, sizeof(system_lang)/sizeof(WCHAR));
- GetLocaleInfoW(LOCALE_USER_DEFAULT, LOCALE_SENGLANGUAGE, user_lang, sizeof(user_lang)/sizeof(WCHAR));
+ GetLocaleInfoW(LOCALE_SYSTEM_DEFAULT, LOCALE_SENGLANGUAGE, system_lang, ARRAY_SIZE(system_lang));
+ GetLocaleInfoW(LOCALE_USER_DEFAULT, LOCALE_SENGLANGUAGE, user_lang, ARRAY_SIZE(user_lang));
- snprintfW(language_str, sizeof(language_str)/sizeof(WCHAR), languages_fmtW, system_lang, regional_setting_engW, user_lang);
+ snprintfW(language_str, ARRAY_SIZE(language_str), languages_fmtW, system_lang,
+ regional_setting_engW, user_lang);
hr = add_bstr_property(node, szLanguagesEnglish, language_str);
if (FAILED(hr))
@@ -555,21 +557,21 @@ static HRESULT fill_datetime_information(IDxDiagContainerImpl_Container *node)
GetLocalTime(&curtime);
- GetTimeFormatW(LOCALE_NEUTRAL, 0, &curtime, time_fmtW, time_str, sizeof(time_str)/sizeof(WCHAR));
+ GetTimeFormatW(LOCALE_NEUTRAL, 0, &curtime, time_fmtW, time_str, ARRAY_SIZE(time_str));
/* szTimeLocalized */
- GetDateFormatW(LOCALE_USER_DEFAULT, DATE_LONGDATE, &curtime, NULL, date_str, sizeof(date_str)/sizeof(WCHAR));
+ GetDateFormatW(LOCALE_USER_DEFAULT, DATE_LONGDATE, &curtime, NULL, date_str, ARRAY_SIZE(date_str));
- snprintfW(datetime_str, sizeof(datetime_str)/sizeof(WCHAR), datetime_fmtW, date_str, time_str);
+ snprintfW(datetime_str, ARRAY_SIZE(datetime_str), datetime_fmtW, date_str, time_str);
hr = add_bstr_property(node, szTimeLocalized, datetime_str);
if (FAILED(hr))
return hr;
/* szTimeEnglish */
- GetDateFormatW(LOCALE_NEUTRAL, 0, &curtime, date_fmtW, date_str, sizeof(date_str)/sizeof(WCHAR));
+ GetDateFormatW(LOCALE_NEUTRAL, 0, &curtime, date_fmtW, date_str, ARRAY_SIZE(date_str));
- snprintfW(datetime_str, sizeof(datetime_str)/sizeof(WCHAR), datetime_fmtW, date_str, time_str);
+ snprintfW(datetime_str, ARRAY_SIZE(datetime_str), datetime_fmtW, date_str, time_str);
hr = add_bstr_property(node, szTimeEnglish, datetime_str);
if (FAILED(hr))
@@ -596,7 +598,7 @@ static HRESULT fill_os_string_information(IDxDiagContainerImpl_Container *node,
/* FIXME: OS detection should be performed, and localized OS strings
* should contain translated versions of the "build" phrase. */
- for (i = 0; i < sizeof(prop_list)/sizeof(prop_list[0]); i++)
+ for (i = 0; i < ARRAY_SIZE(prop_list); i++)
{
hr = add_bstr_property(node, prop_list[i], winxpW);
if (FAILED(hr))
@@ -798,25 +800,26 @@ static HRESULT build_systeminfo_tree(IDxDiagContainerImpl_Container *node)
return hr;
/* FIXME: Roundoff should not be done with truncated division. */
- snprintfW(print_buf, sizeof(print_buf)/sizeof(WCHAR), physmem_fmtW, (DWORD)(msex.ullTotalPhys / (1024 * 1024)));
+ snprintfW(print_buf, ARRAY_SIZE(print_buf), physmem_fmtW,
+ (DWORD)(msex.ullTotalPhys / (1024 * 1024)));
hr = add_bstr_property(node, szPhysicalMemoryEnglish, print_buf);
if (FAILED(hr))
return hr;
usedpage_mb = (DWORD)((msex.ullTotalPageFile - msex.ullAvailPageFile) / (1024 * 1024));
availpage_mb = (DWORD)(msex.ullAvailPageFile / (1024 * 1024));
- LoadStringW(dxdiagn_instance, IDS_PAGE_FILE_FORMAT, localized_pagefile_fmt, sizeof(localized_pagefile_fmt)/sizeof(WCHAR));
+ LoadStringW(dxdiagn_instance, IDS_PAGE_FILE_FORMAT, localized_pagefile_fmt,
+ ARRAY_SIZE(localized_pagefile_fmt));
args[0] = usedpage_mb;
args[1] = availpage_mb;
- FormatMessageW(FORMAT_MESSAGE_FROM_STRING|FORMAT_MESSAGE_ARGUMENT_ARRAY,
- localized_pagefile_fmt, 0, 0, print_buf,
- sizeof(print_buf)/sizeof(*print_buf), (__ms_va_list*)args);
+ FormatMessageW(FORMAT_MESSAGE_FROM_STRING|FORMAT_MESSAGE_ARGUMENT_ARRAY, localized_pagefile_fmt,
+ 0, 0, print_buf, ARRAY_SIZE(print_buf), (__ms_va_list*)args);
hr = add_bstr_property(node, szPageFileLocalized, print_buf);
if (FAILED(hr))
return hr;
- snprintfW(print_buf, sizeof(print_buf)/sizeof(WCHAR), pagefile_fmtW, usedpage_mb, availpage_mb);
+ snprintfW(print_buf, ARRAY_SIZE(print_buf), pagefile_fmtW, usedpage_mb, availpage_mb);
hr = add_bstr_property(node, szPageFileEnglish, print_buf);
if (FAILED(hr))
@@ -828,7 +831,7 @@ static HRESULT build_systeminfo_tree(IDxDiagContainerImpl_Container *node)
if (FAILED(hr))
return hr;
- count = sizeof(computer_name)/sizeof(WCHAR);
+ count = ARRAY_SIZE(computer_name);
if (!GetComputerNameW(computer_name, &count))
return E_FAIL;
@@ -984,7 +987,7 @@ static HRESULT fill_display_information_d3d(IDxDiagContainerImpl_Container *node
DWORD available_mem = 0;
BOOL hardware_accel;
- snprintfW(buffer, sizeof(buffer)/sizeof(WCHAR), adapterid_fmtW, index);
+ snprintfW(buffer, ARRAY_SIZE(buffer), adapterid_fmtW, index);
display_adapter = allocate_information_node(buffer);
if (!display_adapter)
{
@@ -1001,9 +1004,11 @@ static HRESULT fill_display_information_d3d(IDxDiagContainerImpl_Container *node
WCHAR descriptionW[sizeof(adapter_info.Description)];
WCHAR devicenameW[sizeof(adapter_info.DeviceName)];
- MultiByteToWideChar(CP_ACP, 0, adapter_info.Driver, -1, driverW, sizeof(driverW)/sizeof(WCHAR));
- MultiByteToWideChar(CP_ACP, 0, adapter_info.Description, -1, descriptionW, sizeof(descriptionW)/sizeof(WCHAR));
- MultiByteToWideChar(CP_ACP, 0, adapter_info.DeviceName, -1, devicenameW, sizeof(devicenameW)/sizeof(WCHAR));
+ MultiByteToWideChar(CP_ACP, 0, adapter_info.Driver, -1, driverW, ARRAY_SIZE(driverW));
+ MultiByteToWideChar(CP_ACP, 0, adapter_info.Description, -1, descriptionW,
+ ARRAY_SIZE(descriptionW));
+ MultiByteToWideChar(CP_ACP, 0, adapter_info.DeviceName, -1, devicenameW,
+ ARRAY_SIZE(devicenameW));
hr = add_bstr_property(display_adapter, szDriverName, driverW);
if (FAILED(hr))
@@ -1017,7 +1022,7 @@ static HRESULT fill_display_information_d3d(IDxDiagContainerImpl_Container *node
if (FAILED(hr))
goto cleanup;
- snprintfW(buffer, sizeof(buffer)/sizeof(WCHAR), driverversion_fmtW,
+ snprintfW(buffer, ARRAY_SIZE(buffer), driverversion_fmtW,
HIWORD(adapter_info.DriverVersion.u.HighPart), LOWORD(adapter_info.DriverVersion.u.HighPart),
HIWORD(adapter_info.DriverVersion.u.LowPart), LOWORD(adapter_info.DriverVersion.u.LowPart));
@@ -1025,22 +1030,22 @@ static HRESULT fill_display_information_d3d(IDxDiagContainerImpl_Container *node
if (FAILED(hr))
goto cleanup;
- snprintfW(buffer, sizeof(buffer)/sizeof(WCHAR), id_fmtW, adapter_info.VendorId);
+ snprintfW(buffer, ARRAY_SIZE(buffer), id_fmtW, adapter_info.VendorId);
hr = add_bstr_property(display_adapter, szVendorId, buffer);
if (FAILED(hr))
goto cleanup;
- snprintfW(buffer, sizeof(buffer)/sizeof(WCHAR), id_fmtW, adapter_info.DeviceId);
+ snprintfW(buffer, ARRAY_SIZE(buffer), id_fmtW, adapter_info.DeviceId);
hr = add_bstr_property(display_adapter, szDeviceId, buffer);
if (FAILED(hr))
goto cleanup;
- snprintfW(buffer, sizeof(buffer)/sizeof(WCHAR), subsysid_fmtW, adapter_info.SubSysId);
+ snprintfW(buffer, ARRAY_SIZE(buffer), subsysid_fmtW, adapter_info.SubSysId);
hr = add_bstr_property(display_adapter, szSubSysId, buffer);
if (FAILED(hr))
goto cleanup;
- snprintfW(buffer, sizeof(buffer)/sizeof(WCHAR), id_fmtW, adapter_info.Revision);
+ snprintfW(buffer, ARRAY_SIZE(buffer), id_fmtW, adapter_info.Revision);
hr = add_bstr_property(display_adapter, szRevisionId, buffer);
if (FAILED(hr))
goto cleanup;
@@ -1074,7 +1079,7 @@ static HRESULT fill_display_information_d3d(IDxDiagContainerImpl_Container *node
if (FAILED(hr))
goto cleanup;
- snprintfW(buffer, sizeof(buffer)/sizeof(WCHAR), mode_fmtW, adapter_mode.Width, adapter_mode.Height,
+ snprintfW(buffer, ARRAY_SIZE(buffer), mode_fmtW, adapter_mode.Width, adapter_mode.Height,
depth_for_pixelformat(adapter_mode.Format), adapter_mode.RefreshRate);
hr = add_bstr_property(display_adapter, szDisplayModeLocalized, buffer);
@@ -1109,7 +1114,7 @@ static HRESULT fill_display_information_d3d(IDxDiagContainerImpl_Container *node
if (!get_texture_memory(&adapter_info.DeviceIdentifier, &available_mem))
WARN("get_texture_memory helper failed\n");
- snprintfW(buffer, sizeof(buffer)/sizeof(buffer[0]), mem_fmt, available_mem / 1000000.0f);
+ snprintfW(buffer, ARRAY_SIZE(buffer), mem_fmt, available_mem / 1000000.0f);
hr = add_bstr_property(display_adapter, szDisplayMemoryLocalized, buffer);
if (FAILED(hr))
@@ -1288,7 +1293,7 @@ static HRESULT fill_display_information_fallback(IDxDiagContainerImpl_Container
{
static const WCHAR mem_fmt[] = {'%','.','1','f',' ','M','B',0};
- snprintfW(buffer, sizeof(buffer)/sizeof(buffer[0]), mem_fmt, tmp / 1000000.0f);
+ snprintfW(buffer, ARRAY_SIZE(buffer), mem_fmt, tmp / 1000000.0f);
hr = add_bstr_property(display_adapter, szDisplayMemoryLocalized, buffer);
if (FAILED(hr))
@@ -1329,7 +1334,7 @@ static HRESULT fill_display_information_fallback(IDxDiagContainerImpl_Container
if (FAILED(hr))
goto cleanup;
- for (tmp = 0; tmp < sizeof(empty_properties)/sizeof(empty_properties[0]); tmp++)
+ for (tmp = 0; tmp < ARRAY_SIZE(empty_properties); tmp++)
{
hr = add_bstr_property(display_adapter, empty_properties[tmp], szEmpty);
if (FAILED(hr))
@@ -1465,12 +1470,9 @@ static HRESULT fill_file_description(IDxDiagContainerImpl_Container *node, const
if (boolret)
{
- snprintfW(szVersion_v, sizeof(szVersion_v)/sizeof(szVersion_v[0]),
- szVersionFormat,
- HIWORD(pFileInfo->dwFileVersionMS),
- LOWORD(pFileInfo->dwFileVersionMS),
- HIWORD(pFileInfo->dwFileVersionLS),
- LOWORD(pFileInfo->dwFileVersionLS));
+ snprintfW(szVersion_v, ARRAY_SIZE(szVersion_v), szVersionFormat,
+ HIWORD(pFileInfo->dwFileVersionMS), LOWORD(pFileInfo->dwFileVersionMS),
+ HIWORD(pFileInfo->dwFileVersionLS), LOWORD(pFileInfo->dwFileVersionLS));
TRACE("Found version as (%s)\n", debugstr_w(szVersion_v));
@@ -1542,14 +1544,14 @@ static HRESULT build_directxfiles_tree(IDxDiagContainerImpl_Container *node)
GetSystemDirectoryW(szFilePath, MAX_PATH);
- for (i = 0; i < sizeof(dlls) / sizeof(dlls[0]); i++)
+ for (i = 0; i < ARRAY_SIZE(dlls); i++)
{
static const WCHAR szFormat[] = {'%','d',0};
WCHAR szFileID[5];
IDxDiagContainerImpl_Container *file_container;
- snprintfW(szFileID, sizeof(szFileID)/sizeof(szFileID[0]), szFormat, i);
+ snprintfW(szFileID, ARRAY_SIZE(szFileID), szFormat, i);
file_container = allocate_information_node(szFileID);
if (!file_container)
@@ -1624,7 +1626,7 @@ static HRESULT fill_filter_data_information(IDxDiagContainerImpl_Container *subc
goto cleanup;
pRF = ((REGFILTER2**)ppRF)[0];
- snprintfW(bufferW, sizeof(bufferW)/sizeof(bufferW[0]), szVersionFormat, pRF->dwVersion);
+ snprintfW(bufferW, ARRAY_SIZE(bufferW), szVersionFormat, pRF->dwVersion);
hr = add_bstr_property(subcont, szVersionW, bufferW);
if (FAILED(hr))
goto cleanup;
@@ -1796,7 +1798,7 @@ static HRESULT build_directshowfilters_tree(IDxDiagContainerImpl_Container *node
WCHAR bufferW[10];
IDxDiagContainerImpl_Container *subcont;
- snprintfW(bufferW, sizeof(bufferW)/sizeof(bufferW[0]), szIdFormat, i);
+ snprintfW(bufferW, ARRAY_SIZE(bufferW), szIdFormat, i);
subcont = allocate_information_node(bufferW);
if (!subcont)
{
@@ -1893,7 +1895,7 @@ static HRESULT build_information_tree(IDxDiagContainerImpl_Container **pinfo_roo
if (!info_root)
return E_OUTOFMEMORY;
- for (index = 0; index < sizeof(root_children)/sizeof(root_children[0]); index++)
+ for (index = 0; index < ARRAY_SIZE(root_children); index++)
{
IDxDiagContainerImpl_Container *node;
HRESULT hr;
diff --git a/include/wine/server_protocol.h b/include/wine/server_protocol.h
index 511ad5c628..b776d8dc6d 100644
--- a/include/wine/server_protocol.h
+++ b/include/wine/server_protocol.h
@@ -1839,6 +1839,22 @@ struct open_console_reply
+struct attach_console_request
+{
+ struct request_header __header;
+ process_id_t pid;
+};
+struct attach_console_reply
+{
+ struct reply_header __header;
+ obj_handle_t std_in;
+ obj_handle_t std_out;
+ obj_handle_t std_err;
+ char __pad_20[4];
+};
+
+
+
struct get_console_wait_event_request
{
struct request_header __header;
@@ -5697,6 +5713,7 @@ enum request
REQ_free_console,
REQ_get_console_renderer_events,
REQ_open_console,
+ REQ_attach_console,
REQ_get_console_wait_event,
REQ_get_console_mode,
REQ_set_console_mode,
@@ -5993,6 +6010,7 @@ union generic_request
struct free_console_request free_console_request;
struct get_console_renderer_events_request get_console_renderer_events_request;
struct open_console_request open_console_request;
+ struct attach_console_request attach_console_request;
struct get_console_wait_event_request get_console_wait_event_request;
struct get_console_mode_request get_console_mode_request;
struct set_console_mode_request set_console_mode_request;
@@ -6287,6 +6305,7 @@ union generic_reply
struct free_console_reply free_console_reply;
struct get_console_renderer_events_reply get_console_renderer_events_reply;
struct open_console_reply open_console_reply;
+ struct attach_console_reply attach_console_reply;
struct get_console_wait_event_reply get_console_wait_event_reply;
struct get_console_mode_reply get_console_mode_reply;
struct set_console_mode_reply set_console_mode_reply;
@@ -6514,6 +6533,6 @@ union generic_reply
struct terminate_job_reply terminate_job_reply;
};
-#define SERVER_PROTOCOL_VERSION 555
+#define SERVER_PROTOCOL_VERSION 560
#endif /* __WINE_WINE_SERVER_PROTOCOL_H */
diff --git a/server/request.h b/server/request.h
index 10fd850ec1..d3028f0b1d 100644
--- a/server/request.h
+++ b/server/request.h
@@ -176,6 +176,7 @@ DECL_HANDLER(alloc_console);
DECL_HANDLER(free_console);
DECL_HANDLER(get_console_renderer_events);
DECL_HANDLER(open_console);
+DECL_HANDLER(attach_console);
DECL_HANDLER(get_console_wait_event);
DECL_HANDLER(get_console_mode);
DECL_HANDLER(set_console_mode);
@@ -471,6 +472,7 @@ static const req_handler req_handlers[REQ_NB_REQUESTS] =
(req_handler)req_free_console,
(req_handler)req_get_console_renderer_events,
(req_handler)req_open_console,
+ (req_handler)req_attach_console,
(req_handler)req_get_console_wait_event,
(req_handler)req_get_console_mode,
(req_handler)req_set_console_mode,
@@ -1120,6 +1122,12 @@ C_ASSERT( FIELD_OFFSET(struct open_console_request, share) == 24 );
C_ASSERT( sizeof(struct open_console_request) == 32 );
C_ASSERT( FIELD_OFFSET(struct open_console_reply, handle) == 8 );
C_ASSERT( sizeof(struct open_console_reply) == 16 );
+C_ASSERT( FIELD_OFFSET(struct attach_console_request, pid) == 12 );
+C_ASSERT( sizeof(struct attach_console_request) == 16 );
+C_ASSERT( FIELD_OFFSET(struct attach_console_reply, std_in) == 8 );
+C_ASSERT( FIELD_OFFSET(struct attach_console_reply, std_out) == 12 );
+C_ASSERT( FIELD_OFFSET(struct attach_console_reply, std_err) == 16 );
+C_ASSERT( sizeof(struct attach_console_reply) == 24 );
C_ASSERT( sizeof(struct get_console_wait_event_request) == 16 );
C_ASSERT( FIELD_OFFSET(struct get_console_wait_event_reply, handle) == 8 );
C_ASSERT( sizeof(struct get_console_wait_event_reply) == 16 );
diff --git a/server/trace.c b/server/trace.c
index e6ed964e16..17d25bbf79 100644
--- a/server/trace.c
+++ b/server/trace.c
@@ -1989,6 +1989,18 @@ static void dump_open_console_reply( const struct open_console_reply *req )
fprintf( stderr, " handle=%04x", req->handle );
}
+static void dump_attach_console_request( const struct attach_console_request *req )
+{
+ fprintf( stderr, " pid=%04x", req->pid );
+}
+
+static void dump_attach_console_reply( const struct attach_console_reply *req )
+{
+ fprintf( stderr, " std_in=%04x", req->std_in );
+ fprintf( stderr, ", std_out=%04x", req->std_out );
+ fprintf( stderr, ", std_err=%04x", req->std_err );
+}
+
static void dump_get_console_wait_event_request( const struct get_console_wait_event_request *req )
{
}
@@ -4595,6 +4607,7 @@ static const dump_func req_dumpers[REQ_NB_REQUESTS] = {
(dump_func)dump_free_console_request,
(dump_func)dump_get_console_renderer_events_request,
(dump_func)dump_open_console_request,
+ (dump_func)dump_attach_console_request,
(dump_func)dump_get_console_wait_event_request,
(dump_func)dump_get_console_mode_request,
(dump_func)dump_set_console_mode_request,
@@ -4887,6 +4900,7 @@ static const dump_func reply_dumpers[REQ_NB_REQUESTS] = {
NULL,
(dump_func)dump_get_console_renderer_events_reply,
(dump_func)dump_open_console_reply,
+ (dump_func)dump_attach_console_reply,
(dump_func)dump_get_console_wait_event_reply,
(dump_func)dump_get_console_mode_reply,
NULL,
@@ -5179,6 +5193,7 @@ static const char * const req_names[REQ_NB_REQUESTS] = {
"free_console",
"get_console_renderer_events",
"open_console",
+ "attach_console",
"get_console_wait_event",
"get_console_mode",
"set_console_mode",
--
2.18.0

View File

@ -0,0 +1,52 @@
From 100f6ad44eacdb2265652b56c048a68efbbff7c0 Mon Sep 17 00:00:00 2001
From: Michael Stefaniuc <mstefani@winehq.org>
Date: Mon, 30 Jul 2018 21:18:07 +0200
Subject: [PATCH] localui: Use the ARRAY_SIZE() macro
Signed-off-by: Michael Stefaniuc <mstefani@winehq.org>
---
dlls/localui/localui.c | 10 +++++-----
1 file changed, 5 insertions(+), 5 deletions(-)
diff --git a/dlls/localui/localui.c b/dlls/localui/localui.c
index 9fb975c..77c8bf0 100644
--- a/dlls/localui/localui.c
+++ b/dlls/localui/localui.c
@@ -375,7 +375,7 @@ static INT_PTR CALLBACK dlgproc_lptconfig(HWND hwnd, UINT msg, WPARAM wparam, LP
status = FALSE;
res = GetDlgItemInt(hwnd, LPTCONFIG_EDIT, (BOOL *) &status, FALSE);
/* length is in WCHAR, including the '\0' */
- GetDlgItemTextW(hwnd, LPTCONFIG_EDIT, bufferW, sizeof(bufferW) / sizeof(bufferW[0]));
+ GetDlgItemTextW(hwnd, LPTCONFIG_EDIT, bufferW, ARRAY_SIZE(bufferW));
TRACE("got %s and %u (translated: %u)\n", debugstr_w(bufferW), res, status);
/* native localui.dll use the same limits */
@@ -416,10 +416,10 @@ static DWORD get_type_from_name(LPCWSTR name)
{
HANDLE hfile;
- if (!strncmpiW(name, portname_LPT, sizeof(portname_LPT) / sizeof(WCHAR) -1))
+ if (!strncmpiW(name, portname_LPT, ARRAY_SIZE(portname_LPT) -1))
return PORT_IS_LPT;
- if (!strncmpiW(name, portname_COM, sizeof(portname_COM) / sizeof(WCHAR) -1))
+ if (!strncmpiW(name, portname_COM, ARRAY_SIZE(portname_COM) -1))
return PORT_IS_COM;
if (!strcmpiW(name, portname_FILE))
@@ -431,10 +431,10 @@ static DWORD get_type_from_name(LPCWSTR name)
if (name[0] == '|')
return PORT_IS_PIPE;
- if (!strncmpW(name, portname_CUPS, sizeof(portname_CUPS) / sizeof(WCHAR) -1))
+ if (!strncmpW(name, portname_CUPS, ARRAY_SIZE(portname_CUPS) -1))
return PORT_IS_CUPS;
- if (!strncmpW(name, portname_LPR, sizeof(portname_LPR) / sizeof(WCHAR) -1))
+ if (!strncmpW(name, portname_LPR, ARRAY_SIZE(portname_LPR) -1))
return PORT_IS_LPR;
/* Must be a file or a directory. Does the file exist ? */
--
1.9.1

View File

@ -0,0 +1,35 @@
From ed22fdf12f19983647bfd60230dc1325998f95fd Mon Sep 17 00:00:00 2001
From: Michael Stefaniuc <mstefani@winehq.org>
Date: Mon, 30 Jul 2018 21:18:08 +0200
Subject: [PATCH] inetmib1: Use the ARRAY_SIZE() macro
Signed-off-by: Michael Stefaniuc <mstefani@winehq.org>
---
dlls/inetmib1/main.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/dlls/inetmib1/main.c b/dlls/inetmib1/main.c
index c0719c1..2f7b9ca 100644
--- a/dlls/inetmib1/main.c
+++ b/dlls/inetmib1/main.c
@@ -1321,7 +1321,7 @@ BOOL WINAPI SnmpExtensionInit(DWORD dwUptimeReference,
pFirstSupportedRegion);
minSupportedIDLength = UINT_MAX;
- for (i = 0; i < sizeof(supportedIDs) / sizeof(supportedIDs[0]); i++)
+ for (i = 0; i < ARRAY_SIZE(supportedIDs); i++)
{
if (supportedIDs[i].init)
supportedIDs[i].init();
@@ -1337,7 +1337,7 @@ static void cleanup(void)
{
UINT i;
- for (i = 0; i < sizeof(supportedIDs) / sizeof(supportedIDs[0]); i++)
+ for (i = 0; i < ARRAY_SIZE(supportedIDs); i++)
if (supportedIDs[i].cleanup)
supportedIDs[i].cleanup();
}
--
1.9.1

View File

@ -0,0 +1,778 @@
From 92a6c434182962704a0cc20bb675655063d2d894 Mon Sep 17 00:00:00 2001
From: Michael Stefaniuc <mstefani@winehq.org>
Date: Mon, 30 Jul 2018 21:18:09 +0200
Subject: [PATCH] kernel32: Use the ARRAY_SIZE() macro
Signed-off-by: Michael Stefaniuc <mstefani@winehq.org>
---
dlls/kernel32/computername.c | 4 +--
dlls/kernel32/console.c | 4 +--
dlls/kernel32/file.c | 2 +-
dlls/kernel32/lcformat.c | 54 ++++++++++++++++++------------------
dlls/kernel32/locale.c | 66 +++++++++++++++++++++-----------------------
dlls/kernel32/module.c | 3 +-
dlls/kernel32/path.c | 2 +-
dlls/kernel32/process.c | 26 ++++++++---------
dlls/kernel32/profile.c | 7 ++---
dlls/kernel32/sync.c | 8 ++----
dlls/kernel32/term.c | 2 +-
dlls/kernel32/volume.c | 12 ++++----
12 files changed, 91 insertions(+), 99 deletions(-)
diff --git a/dlls/kernel32/computername.c b/dlls/kernel32/computername.c
index 1b5f4aa..720d4ba 100644
--- a/dlls/kernel32/computername.c
+++ b/dlls/kernel32/computername.c
@@ -538,9 +538,9 @@ static WCHAR netbios_char ( WCHAR wc )
static const WCHAR special[] = {'!','@','#','$','%','^','&','\'',')','(','-','_','{','}','~'};
static const WCHAR deflt = '_';
unsigned int i;
-
+
if ( isalnumW ( wc ) ) return wc;
- for ( i = 0; i < sizeof (special) / sizeof (WCHAR); i++ )
+ for ( i = 0; i < ARRAY_SIZE( special ); i++ )
if ( wc == special[i] ) return wc;
return deflt;
}
diff --git a/dlls/kernel32/console.c b/dlls/kernel32/console.c
index 51061de..8b98a50 100644
--- a/dlls/kernel32/console.c
+++ b/dlls/kernel32/console.c
@@ -1156,7 +1156,7 @@ static enum read_console_input_return bare_console_fetch_input(HANDLE handle, in
break;
case -1:
/* we haven't found the string into key-db, push full input string into server */
- idxw = MultiByteToWideChar(CP_UNIXCP, 0, input, idx, inputw, sizeof(inputw) / sizeof(inputw[0]));
+ idxw = MultiByteToWideChar(CP_UNIXCP, 0, input, idx, inputw, ARRAY_SIZE(inputw));
/* we cannot translate yet... likely we need more chars (wait max 1/2s for next char) */
if (idxw == 0)
@@ -1831,7 +1831,7 @@ BOOL WINAPI SetConsoleInputExeNameW(LPCWSTR name)
}
RtlEnterCriticalSection(&CONSOLE_CritSect);
- if (strlenW(name) < sizeof(input_exe)/sizeof(WCHAR)) strcpyW(input_exe, name);
+ if (strlenW(name) < ARRAY_SIZE(input_exe)) strcpyW(input_exe, name);
RtlLeaveCriticalSection(&CONSOLE_CritSect);
return TRUE;
diff --git a/dlls/kernel32/file.c b/dlls/kernel32/file.c
index 1e5b9fe..0c30fb7 100644
--- a/dlls/kernel32/file.c
+++ b/dlls/kernel32/file.c
@@ -1513,7 +1513,7 @@ HANDLE WINAPI CreateFileW( LPCWSTR filename, DWORD access, DWORD sharing,
static const WCHAR conW[] = {'C','O','N'};
if (LOWORD(dosdev) == sizeof(conW) &&
- !memicmpW( filename + HIWORD(dosdev)/sizeof(WCHAR), conW, sizeof(conW)/sizeof(WCHAR)))
+ !memicmpW( filename + HIWORD(dosdev)/sizeof(WCHAR), conW, ARRAY_SIZE( conW )))
{
switch (access & (GENERIC_READ|GENERIC_WRITE))
{
diff --git a/dlls/kernel32/lcformat.c b/dlls/kernel32/lcformat.c
index aeb48c6..b1dd32d 100644
--- a/dlls/kernel32/lcformat.c
+++ b/dlls/kernel32/lcformat.c
@@ -104,7 +104,7 @@ static DWORD NLS_GetLocaleNumber(LCID lcid, DWORD dwFlags)
DWORD dwVal = 0;
szBuff[0] = '\0';
- GetLocaleInfoW(lcid, dwFlags, szBuff, sizeof(szBuff) / sizeof(WCHAR));
+ GetLocaleInfoW(lcid, dwFlags, szBuff, ARRAY_SIZE(szBuff));
if (szBuff[0] && szBuff[1] == ';' && szBuff[2] != '0')
dwVal = (szBuff[0] - '0') * 10 + (szBuff[2] - '0');
@@ -129,7 +129,7 @@ static WCHAR* NLS_GetLocaleString(LCID lcid, DWORD dwFlags)
DWORD dwLen;
szBuff[0] = '\0';
- GetLocaleInfoW(lcid, dwFlags, szBuff, sizeof(szBuff) / sizeof(WCHAR));
+ GetLocaleInfoW(lcid, dwFlags, szBuff, ARRAY_SIZE(szBuff));
dwLen = strlenW(szBuff) + 1;
str = HeapAlloc(GetProcessHeap(), 0, dwLen * sizeof(WCHAR));
if (str)
@@ -258,7 +258,7 @@ static const NLS_FORMAT_NODE *NLS_GetFormats(LCID lcid, DWORD dwFlags)
GET_LOCALE_STRING(new_node->cyfmt.lpCurrencySymbol, LOCALE_SCURRENCY);
/* Date/Time Format info, negative character, etc */
- for (i = 0; i < sizeof(NLS_LocaleIndices)/sizeof(NLS_LocaleIndices[0]); i++)
+ for (i = 0; i < ARRAY_SIZE(NLS_LocaleIndices); i++)
{
GET_LOCALE_STRING(new_node->lppszStrings[i], NLS_LocaleIndices[i]);
}
@@ -302,7 +302,7 @@ static const NLS_FORMAT_NODE *NLS_GetFormats(LCID lcid, DWORD dwFlags)
/* We raced and lost: The node was already added by another thread.
* node points to the currently cached node, so free new_node.
*/
- for (i = 0; i < sizeof(NLS_LocaleIndices)/sizeof(NLS_LocaleIndices[0]); i++)
+ for (i = 0; i < ARRAY_SIZE(NLS_LocaleIndices); i++)
HeapFree(GetProcessHeap(), 0, new_node->lppszStrings[i]);
HeapFree(GetProcessHeap(), 0, new_node->fmt.lpDecimalSep);
HeapFree(GetProcessHeap(), 0, new_node->fmt.lpThousandSep);
@@ -677,7 +677,7 @@ static INT NLS_GetDateTimeFormatW(LCID lcid, DWORD dwFlags,
{
static const WCHAR fmtW[] = {'%','.','*','d',0};
/* We have a numeric value to add */
- snprintfW(buff, sizeof(buff)/sizeof(WCHAR), fmtW, count, dwVal);
+ snprintfW(buff, ARRAY_SIZE(buff), fmtW, count, dwVal);
}
dwLen = szAdd ? strlenW(szAdd) : 0;
@@ -773,10 +773,10 @@ static INT NLS_GetDateTimeFormatA(LCID lcid, DWORD dwFlags,
}
if (lpFormat)
- MultiByteToWideChar(cp, 0, lpFormat, -1, szFormat, sizeof(szFormat)/sizeof(WCHAR));
+ MultiByteToWideChar(cp, 0, lpFormat, -1, szFormat, ARRAY_SIZE(szFormat));
- if (cchOut > (int)(sizeof(szOut)/sizeof(WCHAR)))
- cchOut = sizeof(szOut)/sizeof(WCHAR);
+ if (cchOut > (int) ARRAY_SIZE(szOut))
+ cchOut = ARRAY_SIZE(szOut);
szOut[0] = '\0';
@@ -1063,21 +1063,21 @@ INT WINAPI GetNumberFormatA(LCID lcid, DWORD dwFlags,
pfmt = &fmt;
if (lpFormat->lpDecimalSep)
{
- MultiByteToWideChar(cp, 0, lpFormat->lpDecimalSep, -1, szDec, sizeof(szDec)/sizeof(WCHAR));
+ MultiByteToWideChar(cp, 0, lpFormat->lpDecimalSep, -1, szDec, ARRAY_SIZE(szDec));
fmt.lpDecimalSep = szDec;
}
if (lpFormat->lpThousandSep)
{
- MultiByteToWideChar(cp, 0, lpFormat->lpThousandSep, -1, szGrp, sizeof(szGrp)/sizeof(WCHAR));
+ MultiByteToWideChar(cp, 0, lpFormat->lpThousandSep, -1, szGrp, ARRAY_SIZE(szGrp));
fmt.lpThousandSep = szGrp;
}
}
if (lpszValue)
- MultiByteToWideChar(cp, 0, lpszValue, -1, szIn, sizeof(szIn)/sizeof(WCHAR));
+ MultiByteToWideChar(cp, 0, lpszValue, -1, szIn, ARRAY_SIZE(szIn));
- if (cchOut > (int)(sizeof(szOut)/sizeof(WCHAR)))
- cchOut = sizeof(szOut)/sizeof(WCHAR);
+ if (cchOut > (int) ARRAY_SIZE(szOut))
+ cchOut = ARRAY_SIZE(szOut);
szOut[0] = '\0';
@@ -1112,7 +1112,7 @@ INT WINAPI GetNumberFormatW(LCID lcid, DWORD dwFlags,
LPCWSTR lpszValue, const NUMBERFMTW *lpFormat,
LPWSTR lpNumberStr, int cchOut)
{
- WCHAR szBuff[128], *szOut = szBuff + sizeof(szBuff) / sizeof(WCHAR) - 1;
+ WCHAR szBuff[128], *szOut = szBuff + ARRAY_SIZE(szBuff) - 1;
WCHAR szNegBuff[8];
const WCHAR *lpszNeg = NULL, *lpszNegStart, *szSrc;
DWORD dwState = 0, dwDecimals = 0, dwGroupCount = 0, dwCurrentGroupCount = 0;
@@ -1140,7 +1140,7 @@ INT WINAPI GetNumberFormatW(LCID lcid, DWORD dwFlags,
else
{
GetLocaleInfoW(lcid, LOCALE_SNEGATIVESIGN|(dwFlags & LOCALE_NOUSEROVERRIDE),
- szNegBuff, sizeof(szNegBuff)/sizeof(WCHAR));
+ szNegBuff, ARRAY_SIZE(szNegBuff));
lpszNegStart = lpszNeg = szNegBuff;
}
lpszNeg = lpszNeg + strlenW(lpszNeg) - 1;
@@ -1427,26 +1427,26 @@ INT WINAPI GetCurrencyFormatA(LCID lcid, DWORD dwFlags,
pfmt = &fmt;
if (lpFormat->lpDecimalSep)
{
- MultiByteToWideChar(cp, 0, lpFormat->lpDecimalSep, -1, szDec, sizeof(szDec)/sizeof(WCHAR));
+ MultiByteToWideChar(cp, 0, lpFormat->lpDecimalSep, -1, szDec, ARRAY_SIZE(szDec));
fmt.lpDecimalSep = szDec;
}
if (lpFormat->lpThousandSep)
{
- MultiByteToWideChar(cp, 0, lpFormat->lpThousandSep, -1, szGrp, sizeof(szGrp)/sizeof(WCHAR));
+ MultiByteToWideChar(cp, 0, lpFormat->lpThousandSep, -1, szGrp, ARRAY_SIZE(szGrp));
fmt.lpThousandSep = szGrp;
}
if (lpFormat->lpCurrencySymbol)
{
- MultiByteToWideChar(cp, 0, lpFormat->lpCurrencySymbol, -1, szCy, sizeof(szCy)/sizeof(WCHAR));
+ MultiByteToWideChar(cp, 0, lpFormat->lpCurrencySymbol, -1, szCy, ARRAY_SIZE(szCy));
fmt.lpCurrencySymbol = szCy;
}
}
if (lpszValue)
- MultiByteToWideChar(cp, 0, lpszValue, -1, szIn, sizeof(szIn)/sizeof(WCHAR));
+ MultiByteToWideChar(cp, 0, lpszValue, -1, szIn, ARRAY_SIZE(szIn));
- if (cchOut > (int)(sizeof(szOut)/sizeof(WCHAR)))
- cchOut = sizeof(szOut)/sizeof(WCHAR);
+ if (cchOut > (int) ARRAY_SIZE(szOut))
+ cchOut = ARRAY_SIZE(szOut);
szOut[0] = '\0';
@@ -1502,7 +1502,7 @@ INT WINAPI GetCurrencyFormatW(LCID lcid, DWORD dwFlags,
CF_CY_LEFT|CF_CY_SPACE, /* $ 1.1 */
CF_CY_RIGHT|CF_CY_SPACE, /* 1.1 $ */
};
- WCHAR szBuff[128], *szOut = szBuff + sizeof(szBuff) / sizeof(WCHAR) - 1;
+ WCHAR szBuff[128], *szOut = szBuff + ARRAY_SIZE(szBuff) - 1;
WCHAR szNegBuff[8];
const WCHAR *lpszNeg = NULL, *lpszNegStart, *szSrc, *lpszCy, *lpszCyStart;
DWORD dwState = 0, dwDecimals = 0, dwGroupCount = 0, dwCurrentGroupCount = 0, dwFmt;
@@ -1533,7 +1533,7 @@ INT WINAPI GetCurrencyFormatW(LCID lcid, DWORD dwFlags,
else
{
GetLocaleInfoW(lcid, LOCALE_SNEGATIVESIGN|(dwFlags & LOCALE_NOUSEROVERRIDE),
- szNegBuff, sizeof(szNegBuff)/sizeof(WCHAR));
+ szNegBuff, ARRAY_SIZE(szNegBuff));
lpszNegStart = lpszNeg = szNegBuff;
}
dwFlags &= (LOCALE_NOUSEROVERRIDE|LOCALE_USE_CP_ACP);
@@ -1841,9 +1841,9 @@ static BOOL NLS_EnumDateFormats(const struct enumdateformats_context *ctxt)
lctype |= ctxt->flags & LOCALE_USE_CP_ACP;
if (ctxt->unicode)
- ret = GetLocaleInfoW(ctxt->lcid, lctype, bufW, sizeof(bufW)/sizeof(bufW[0]));
+ ret = GetLocaleInfoW(ctxt->lcid, lctype, bufW, ARRAY_SIZE(bufW));
else
- ret = GetLocaleInfoA(ctxt->lcid, lctype, bufA, sizeof(bufA)/sizeof(bufA[0]));
+ ret = GetLocaleInfoA(ctxt->lcid, lctype, bufA, ARRAY_SIZE(bufA));
if (ret)
{
@@ -1994,9 +1994,9 @@ static BOOL NLS_EnumTimeFormats(struct enumtimeformats_context *ctxt)
lctype |= ctxt->flags & LOCALE_USE_CP_ACP;
if (ctxt->unicode)
- ret = GetLocaleInfoW(ctxt->lcid, lctype, bufW, sizeof(bufW)/sizeof(bufW[0]));
+ ret = GetLocaleInfoW(ctxt->lcid, lctype, bufW, ARRAY_SIZE(bufW));
else
- ret = GetLocaleInfoA(ctxt->lcid, lctype, bufA, sizeof(bufA)/sizeof(bufA[0]));
+ ret = GetLocaleInfoA(ctxt->lcid, lctype, bufA, ARRAY_SIZE(bufA));
if (ret)
{
diff --git a/dlls/kernel32/locale.c b/dlls/kernel32/locale.c
index 2e0cf83..0f37027 100644
--- a/dlls/kernel32/locale.c
+++ b/dlls/kernel32/locale.c
@@ -355,8 +355,7 @@ static UINT find_charset( const WCHAR *name )
if (isalnum((unsigned char)name[i])) charset_name[j++] = name[i];
charset_name[j] = 0;
- entry = bsearch( charset_name, charset_names,
- sizeof(charset_names)/sizeof(charset_names[0]),
+ entry = bsearch( charset_name, charset_names, ARRAY_SIZE( charset_names ),
sizeof(charset_names[0]), charset_cmp );
if (entry) return entry->codepage;
return 0;
@@ -395,8 +394,7 @@ static BOOL CALLBACK find_locale_id_callback( HMODULE hModule, LPCWSTR type,
/* first check exact name */
if (data->win_name[0] &&
- GetLocaleInfoW( lcid, LOCALE_SNAME | LOCALE_NOUSEROVERRIDE,
- buffer, sizeof(buffer)/sizeof(WCHAR) ))
+ GetLocaleInfoW( lcid, LOCALE_SNAME | LOCALE_NOUSEROVERRIDE, buffer, ARRAY_SIZE( buffer )))
{
if (!strcmpiW( data->win_name, buffer ))
{
@@ -406,7 +404,7 @@ static BOOL CALLBACK find_locale_id_callback( HMODULE hModule, LPCWSTR type,
}
if (!GetLocaleInfoW( lcid, LOCALE_SISO639LANGNAME | LOCALE_NOUSEROVERRIDE,
- buffer, sizeof(buffer)/sizeof(WCHAR) ))
+ buffer, ARRAY_SIZE( buffer )))
return TRUE;
if (strcmpiW( buffer, data->lang )) return TRUE;
matches++; /* language name matched */
@@ -414,7 +412,7 @@ static BOOL CALLBACK find_locale_id_callback( HMODULE hModule, LPCWSTR type,
if (data->script)
{
if (GetLocaleInfoW( lcid, LOCALE_SSCRIPTS | LOCALE_NOUSEROVERRIDE,
- buffer, sizeof(buffer)/sizeof(WCHAR) ))
+ buffer, ARRAY_SIZE( buffer )))
{
const WCHAR *p = buffer;
unsigned int len = strlenW( data->script );
@@ -432,7 +430,7 @@ static BOOL CALLBACK find_locale_id_callback( HMODULE hModule, LPCWSTR type,
if (data->country)
{
if (GetLocaleInfoW( lcid, LOCALE_SISO3166CTRYNAME|LOCALE_NOUSEROVERRIDE,
- buffer, sizeof(buffer)/sizeof(WCHAR) ))
+ buffer, ARRAY_SIZE( buffer )))
{
if (strcmpiW( buffer, data->country )) goto done;
matches++; /* country name matched */
@@ -490,7 +488,7 @@ static void parse_locale_name( const WCHAR *str, struct locale_name *name )
name->matches = 0;
name->codepage = 0;
name->win_name[0] = 0;
- lstrcpynW( name->lang, str, sizeof(name->lang)/sizeof(WCHAR) );
+ lstrcpynW( name->lang, str, ARRAY_SIZE( name->lang ));
if (!*name->lang)
{
@@ -816,8 +814,7 @@ static BOOL locale_update_registry( HKEY hkey, const WCHAR *name, LCID lcid,
for (i = 0; i < nb_values; i++)
{
- GetLocaleInfoW( lcid, values[i] | LOCALE_NOUSEROVERRIDE, bufferW,
- sizeof(bufferW)/sizeof(WCHAR) );
+ GetLocaleInfoW( lcid, values[i] | LOCALE_NOUSEROVERRIDE, bufferW, ARRAY_SIZE( bufferW ));
SetLocaleInfoW( lcid, values[i], bufferW );
}
return TRUE;
@@ -905,19 +902,19 @@ void LOCALE_InitRegistry(void)
return; /* don't do anything if we can't create the registry key */
locale_update_registry( hkey, localeW, lcid_LC_MESSAGES, lc_messages_values,
- sizeof(lc_messages_values)/sizeof(lc_messages_values[0]) );
+ ARRAY_SIZE( lc_messages_values ));
locale_update_registry( hkey, lc_monetaryW, lcid_LC_MONETARY, lc_monetary_values,
- sizeof(lc_monetary_values)/sizeof(lc_monetary_values[0]) );
+ ARRAY_SIZE( lc_monetary_values ));
locale_update_registry( hkey, lc_numericW, lcid_LC_NUMERIC, lc_numeric_values,
- sizeof(lc_numeric_values)/sizeof(lc_numeric_values[0]) );
+ ARRAY_SIZE( lc_numeric_values ));
locale_update_registry( hkey, lc_timeW, lcid_LC_TIME, lc_time_values,
- sizeof(lc_time_values)/sizeof(lc_time_values[0]) );
+ ARRAY_SIZE( lc_time_values ));
locale_update_registry( hkey, lc_measurementW, lcid_LC_MEASUREMENT, lc_measurement_values,
- sizeof(lc_measurement_values)/sizeof(lc_measurement_values[0]) );
+ ARRAY_SIZE( lc_measurement_values ));
locale_update_registry( hkey, lc_telephoneW, lcid_LC_TELEPHONE, lc_telephone_values,
- sizeof(lc_telephone_values)/sizeof(lc_telephone_values[0]) );
+ ARRAY_SIZE( lc_telephone_values ));
locale_update_registry( hkey, lc_paperW, lcid_LC_PAPER, lc_paper_values,
- sizeof(lc_paper_values)/sizeof(lc_paper_values[0]) );
+ ARRAY_SIZE( lc_paper_values ));
if (locale_update_registry( hkey, lc_ctypeW, lcid_LC_CTYPE, NULL, 0 ))
{
@@ -943,10 +940,10 @@ void LOCALE_InitRegistry(void)
nameW.Length = len * sizeof(WCHAR);
if (!NtCreateKey( &nls_key, KEY_ALL_ACCESS, &attr, 0, NULL, 0, NULL ))
{
- for (i = 0; i < sizeof(update_cp_values)/sizeof(update_cp_values[0]); i++)
+ for (i = 0; i < ARRAY_SIZE( update_cp_values ); i++)
{
count = GetLocaleInfoW( lcid, update_cp_values[i].value | LOCALE_NOUSEROVERRIDE,
- bufferW, sizeof(bufferW)/sizeof(WCHAR) );
+ bufferW, ARRAY_SIZE( bufferW ));
RtlInitUnicodeString( &nameW, update_cp_values[i].name );
NtSetValueKey( nls_key, &nameW, 0, REG_SZ, bufferW, count * sizeof(WCHAR) );
}
@@ -1112,7 +1109,7 @@ static UINT setup_unix_locales(void)
if ((locale = get_locale( LC_CTYPE, "LC_CTYPE" )))
{
- strcpynAtoW( ctype_buff, locale, sizeof(ctype_buff)/sizeof(WCHAR) );
+ strcpynAtoW( ctype_buff, locale, ARRAY_SIZE( ctype_buff ));
parse_locale_name( ctype_buff, &locale_name );
lcid_LC_CTYPE = locale_name.lcid;
unix_cp = locale_name.codepage;
@@ -1126,7 +1123,7 @@ static UINT setup_unix_locales(void)
#define GET_UNIX_LOCALE(cat) do \
if ((locale = get_locale( cat, #cat ))) \
{ \
- strcpynAtoW( buffer, locale, sizeof(buffer)/sizeof(WCHAR) ); \
+ strcpynAtoW( buffer, locale, ARRAY_SIZE(buffer) ); \
if (!strcmpW( buffer, ctype_buff )) lcid_##cat = lcid_LC_CTYPE; \
else { \
parse_locale_name( buffer, &locale_name ); \
@@ -1444,7 +1441,7 @@ INT WINAPI LCIDToLocaleName( LCID lcid, LPWSTR name, INT count, DWORD flags )
static struct registry_value *get_locale_registry_value( DWORD lctype )
{
int i;
- for (i=0; i < sizeof(registry_values)/sizeof(registry_values[0]); i++)
+ for (i = 0; i < ARRAY_SIZE( registry_values ); i++)
if (registry_values[i].lctype == lctype)
return &registry_values[i];
return NULL;
@@ -1698,7 +1695,7 @@ INT WINAPI GetLocaleInfoW( LCID lcid, LCTYPE lctype, LPWSTR buffer, INT len )
if (lcflags & LOCALE_RETURN_NUMBER)
{
WCHAR tmp[16];
- ret = get_registry_locale_info( value, tmp, sizeof(tmp)/sizeof(WCHAR) );
+ ret = get_registry_locale_info( value, tmp, ARRAY_SIZE( tmp ));
if (ret > 0)
{
WCHAR *end;
@@ -2219,7 +2216,7 @@ BOOL WINAPI GetCPInfoExW( UINT codepage, DWORD dwFlags, LPCPINFOEXW cpinfo )
cpinfo->CodePage = table->info.codepage;
cpinfo->UnicodeDefaultChar = table->info.def_unicode_char;
MultiByteToWideChar( CP_ACP, 0, table->info.name, -1, cpinfo->CodePageName,
- sizeof(cpinfo->CodePageName)/sizeof(WCHAR));
+ ARRAY_SIZE( cpinfo->CodePageName ));
break;
}
}
@@ -2269,7 +2266,7 @@ BOOL WINAPI EnumSystemCodePagesW( CODEPAGE_ENUMPROCW lpfnCodePageEnum, DWORD fla
for (;;)
{
if (!(table = wine_cp_enum_table( index++ ))) break;
- p = buffer + sizeof(buffer)/sizeof(WCHAR);
+ p = buffer + ARRAY_SIZE( buffer );
*--p = 0;
page = table->info.codepage;
do
@@ -2989,7 +2986,7 @@ static BOOL CALLBACK enum_locale_ex_proc( HMODULE module, LPCWSTR type,
unsigned int flags;
GetLocaleInfoW( MAKELCID( lang, SORT_DEFAULT ), LOCALE_SNAME | LOCALE_NOUSEROVERRIDE,
- buffer, sizeof(buffer) / sizeof(WCHAR) );
+ buffer, ARRAY_SIZE( buffer ));
if (!GetLocaleInfoW( MAKELCID( lang, SORT_DEFAULT ),
LOCALE_INEUTRAL | LOCALE_NOUSEROVERRIDE | LOCALE_RETURN_NUMBER,
(LPWSTR)&neutral, sizeof(neutral) / sizeof(WCHAR) ))
@@ -3254,7 +3251,7 @@ static INT compose_katakana( LPCWSTR src, INT srclen, LPWSTR dst )
default:
{
int shift = *src - 0xff61;
- if (shift < 0 || shift >= sizeof(katakana_map)/sizeof(katakana_map[0]) )
+ if (shift < 0 || shift >= ARRAY_SIZE( katakana_map ))
return 0;
else
*dst = katakana_map[shift] | 0x3000;
@@ -3362,7 +3359,7 @@ static INT decompose_katakana( WCHAR c, LPWSTR dst, INT dstlen )
INT len = 0, shift = c - 0x3099;
BYTE k;
- if (shift < 0 || shift >= sizeof(katakana_map)/sizeof(katakana_map[0]))
+ if (shift < 0 || shift >= ARRAY_SIZE( katakana_map ))
return 0;
k = katakana_map[shift];
@@ -4382,7 +4379,7 @@ static BOOL NLS_EnumSystemLanguageGroups(ENUMLANGUAGEGROUP_CALLBACKS *lpProcs)
{
WCHAR szGrpName[48];
- if (!NLS_GetLanguageGroupName( lgrpid, szGrpName, sizeof(szGrpName) / sizeof(WCHAR) ))
+ if (!NLS_GetLanguageGroupName( lgrpid, szGrpName, ARRAY_SIZE( szGrpName )))
szGrpName[0] = '\0';
if (lpProcs->procW)
@@ -4390,7 +4387,7 @@ static BOOL NLS_EnumSystemLanguageGroups(ENUMLANGUAGEGROUP_CALLBACKS *lpProcs)
lpProcs->lParam );
else
{
- char szNumberA[sizeof(szNumber)/sizeof(WCHAR)];
+ char szNumberA[ARRAY_SIZE( szNumber )];
char szGrpNameA[48];
/* FIXME: MSDN doesn't say which code page the W->A translation uses,
@@ -4584,7 +4581,7 @@ static BOOL NLS_EnumLanguageGroupLocales(ENUMLANGUAGEGROUPLOCALE_CALLBACKS *lpPr
bContinue = lpProcs->procW( lgrpid, lcid, szNumber, lpProcs->lParam );
else
{
- char szNumberA[sizeof(szNumber)/sizeof(WCHAR)];
+ char szNumberA[ARRAY_SIZE( szNumber )];
WideCharToMultiByte(CP_ACP, 0, szNumber, -1, szNumberA, sizeof(szNumberA), 0, 0);
@@ -5174,7 +5171,7 @@ static const struct geoinfo_t *get_geoinfo_dataptr(GEOID geoid)
int min, max;
min = 0;
- max = sizeof(geoinfodata)/sizeof(struct geoinfo_t)-1;
+ max = ARRAY_SIZE(geoinfodata)-1;
while (min <= max) {
const struct geoinfo_t *ptr;
@@ -5324,7 +5321,7 @@ BOOL WINAPI EnumSystemGeoID(GEOCLASS geoclass, GEOID parent, GEO_ENUMPROC enumpr
return FALSE;
}
- for (i = 0; i < sizeof(geoinfodata)/sizeof(struct geoinfo_t); i++) {
+ for (i = 0; i < ARRAY_SIZE(geoinfodata); i++) {
const struct geoinfo_t *ptr = &geoinfodata[i];
if (geoclass == GEOCLASS_NATION && (ptr->kind == LOCATION_REGION))
@@ -5682,8 +5679,7 @@ INT WINAPI IdnToNameprepUnicode(DWORD dwFlags, LPCWSTR lpUnicodeCharStr, INT cch
}
}
- norm_len = FoldStringW(MAP_FOLDCZONE, map_str, map_len,
- norm_str, sizeof(norm_str)/sizeof(WCHAR)-1);
+ norm_len = FoldStringW(MAP_FOLDCZONE, map_str, map_len, norm_str, ARRAY_SIZE(norm_str)-1);
if(map_str != buf)
HeapFree(GetProcessHeap(), 0, map_str);
if(!norm_len) {
diff --git a/dlls/kernel32/module.c b/dlls/kernel32/module.c
index 3ab70e8..1188298 100644
--- a/dlls/kernel32/module.c
+++ b/dlls/kernel32/module.c
@@ -1142,8 +1142,7 @@ static BOOL load_library_as_datafile( LPCWSTR name, HMODULE *hmod, DWORD flags )
if (flags & LOAD_LIBRARY_AS_IMAGE_RESOURCE) protect |= SEC_IMAGE;
- if (SearchPathW( NULL, name, dotDLL, sizeof(filenameW) / sizeof(filenameW[0]),
- filenameW, NULL ))
+ if (SearchPathW( NULL, name, dotDLL, ARRAY_SIZE( filenameW ), filenameW, NULL ))
{
hFile = CreateFileW( filenameW, GENERIC_READ, sharing, NULL, OPEN_EXISTING, 0, 0 );
}
diff --git a/dlls/kernel32/path.c b/dlls/kernel32/path.c
index a389743..489f59e 100644
--- a/dlls/kernel32/path.c
+++ b/dlls/kernel32/path.c
@@ -893,7 +893,7 @@ static NTSTATUS find_actctx_dllpath(const WCHAR *libname, WCHAR **path)
strcpyW( p, DIR_Windows );
p += strlenW(p);
memcpy( p, winsxsW, sizeof(winsxsW) );
- p += sizeof(winsxsW) / sizeof(WCHAR);
+ p += ARRAY_SIZE( winsxsW );
memcpy( p, info->lpAssemblyDirectoryName, info->ulAssemblyDirectoryNameLength );
p += info->ulAssemblyDirectoryNameLength / sizeof(WCHAR);
*p++ = '\\';
diff --git a/dlls/kernel32/process.c b/dlls/kernel32/process.c
index 4e6ba11..5aa245c 100644
--- a/dlls/kernel32/process.c
+++ b/dlls/kernel32/process.c
@@ -377,7 +377,7 @@ static void set_registry_variables( HANDLE hkey, ULONG type )
}
/* PATH is magic */
if (env_name.Length == sizeof(pathW) &&
- !memicmpW( env_name.Buffer, pathW, sizeof(pathW)/sizeof(WCHAR) ) &&
+ !memicmpW( env_name.Buffer, pathW, ARRAY_SIZE( pathW )) &&
!RtlQueryEnvironmentVariable_U( NULL, &env_name, &tmp ))
{
RtlAppendUnicodeToString( &tmp, sep );
@@ -528,7 +528,7 @@ static void set_additional_environment(void)
DWORD len;
/* ComputerName */
- len = sizeof(buf) / sizeof(WCHAR);
+ len = ARRAY_SIZE( buf );
if (GetComputerNameW( buf, &len ))
SetEnvironmentVariableW( computernameW, buf );
@@ -606,7 +606,7 @@ static void set_wow64_environment(void)
/* set the PROCESSOR_ARCHITECTURE variable */
- if (GetEnvironmentVariableW( arch6432W, arch, sizeof(arch)/sizeof(WCHAR) ))
+ if (GetEnvironmentVariableW( arch6432W, arch, ARRAY_SIZE( arch )))
{
if (is_win64)
{
@@ -614,7 +614,7 @@ static void set_wow64_environment(void)
SetEnvironmentVariableW( arch6432W, NULL );
}
}
- else if (GetEnvironmentVariableW( archW, arch, sizeof(arch)/sizeof(WCHAR) ))
+ else if (GetEnvironmentVariableW( archW, arch, ARRAY_SIZE( arch )))
{
if (is_wow64)
{
@@ -1002,7 +1002,7 @@ static void start_wineboot( HANDLE handles[2] )
PROCESS_INFORMATION pi;
void *redir;
WCHAR app[MAX_PATH];
- WCHAR cmdline[MAX_PATH + (sizeof(wineboot) + sizeof(args)) / sizeof(WCHAR)];
+ WCHAR cmdline[MAX_PATH + ARRAY_SIZE( wineboot ) + ARRAY_SIZE( args )];
memset( &si, 0, sizeof(si) );
si.cb = sizeof(si);
@@ -1011,7 +1011,7 @@ static void start_wineboot( HANDLE handles[2] )
si.hStdOutput = 0;
si.hStdError = GetStdHandle( STD_ERROR_HANDLE );
- GetSystemDirectoryW( app, MAX_PATH - sizeof(wineboot)/sizeof(WCHAR) );
+ GetSystemDirectoryW( app, MAX_PATH - ARRAY_SIZE( wineboot ));
lstrcatW( app, wineboot );
Wow64DisableWow64FsRedirection( &redir );
@@ -1291,7 +1291,7 @@ void CDECL __wine_kernel_init(void)
}
args[0] = (DWORD_PTR)main_exe_name;
FormatMessageW( FORMAT_MESSAGE_FROM_SYSTEM | FORMAT_MESSAGE_ARGUMENT_ARRAY,
- NULL, error, 0, msgW, sizeof(msgW)/sizeof(WCHAR), (__ms_va_list *)args );
+ NULL, error, 0, msgW, ARRAY_SIZE( msgW ), (__ms_va_list *)args );
WideCharToMultiByte( CP_UNIXCP, 0, msgW, -1, msg, sizeof(msg), NULL, NULL );
MESSAGE( "wine: %s", msg );
ExitProcess( error );
@@ -1440,7 +1440,7 @@ static char **build_envp( const WCHAR *envW )
for (p = env; *p; p += strlen(p) + 1)
if (is_special_env_var( p )) length += 4; /* prefix it with "WINE" */
- for (i = 0; i < sizeof(unix_vars)/sizeof(unix_vars[0]); i++)
+ for (i = 0; i < ARRAY_SIZE( unix_vars ); i++)
{
if (!(p = getenv(unix_vars[i]))) continue;
length += strlen(unix_vars[i]) + strlen(p) + 2;
@@ -1453,7 +1453,7 @@ static char **build_envp( const WCHAR *envW )
char *dst = (char *)(envp + count);
/* some variables must not be modified, so we get them directly from the unix env */
- for (i = 0; i < sizeof(unix_vars)/sizeof(unix_vars[0]); i++)
+ for (i = 0; i < ARRAY_SIZE( unix_vars ); i++)
{
if (!(p = getenv(unix_vars[i]))) continue;
*envptr++ = strcpy( dst, unix_vars[i] );
@@ -2048,7 +2048,7 @@ static BOOL create_process( HANDLE hFile, LPCWSTR filename, LPWSTR cmd_line, LPW
while (*env_end)
{
static const WCHAR WINEDEBUG[] = {'W','I','N','E','D','E','B','U','G','=',0};
- if (!winedebug && !strncmpW( env_end, WINEDEBUG, sizeof(WINEDEBUG)/sizeof(WCHAR) - 1 ))
+ if (!winedebug && !strncmpW( env_end, WINEDEBUG, ARRAY_SIZE( WINEDEBUG ) - 1 ))
{
DWORD len = WideCharToMultiByte( CP_UNIXCP, 0, env_end, -1, NULL, 0, NULL, NULL );
if ((winedebug = HeapAlloc( GetProcessHeap(), 0, len )))
@@ -2219,7 +2219,7 @@ static BOOL create_cmd_process( LPCWSTR filename, LPWSTR cmd_line, LPVOID env, L
WCHAR *newcmdline;
BOOL ret;
- if (!GetEnvironmentVariableW( comspecW, comspec, sizeof(comspec)/sizeof(WCHAR) ))
+ if (!GetEnvironmentVariableW( comspecW, comspec, ARRAY_SIZE( comspec )))
return FALSE;
if (!(newcmdline = HeapAlloc( GetProcessHeap(), 0,
(strlenW(comspec) + 7 + strlenW(cmd_line) + 2) * sizeof(WCHAR))))
@@ -2340,7 +2340,7 @@ static BOOL create_process_impl( LPCWSTR app_name, LPWSTR cmd_line, LPSECURITY_A
TRACE("app %s cmdline %s\n", debugstr_w(app_name), debugstr_w(cmd_line) );
- if (!(tidy_cmdline = get_file_name( app_name, cmd_line, name, sizeof(name)/sizeof(WCHAR),
+ if (!(tidy_cmdline = get_file_name( app_name, cmd_line, name, ARRAY_SIZE( name ),
&hFile, &binary_info )))
return FALSE;
if (hFile == INVALID_HANDLE_VALUE) goto done;
@@ -3624,7 +3624,7 @@ BOOL WINAPI QueryFullProcessImageNameW(HANDLE hProcess, DWORD dwFlags, LPWSTR lp
drive[0] = result->Buffer[0];
drive[1] = ':';
drive[2] = 0;
- if (!QueryDosDeviceW(drive, device, sizeof(device)/sizeof(*device)))
+ if (!QueryDosDeviceW(drive, device, ARRAY_SIZE(device)))
{
status = STATUS_NO_SUCH_DEVICE;
goto cleanup;
diff --git a/dlls/kernel32/profile.c b/dlls/kernel32/profile.c
index 0974aaf..65a8f28 100644
--- a/dlls/kernel32/profile.c
+++ b/dlls/kernel32/profile.c
@@ -772,7 +772,7 @@ static BOOL PROFILE_Open( LPCWSTR filename, BOOL write_access )
else
{
LPWSTR dummy;
- GetFullPathNameW(filename, sizeof(buffer)/sizeof(buffer[0]), buffer, &dummy);
+ GetFullPathNameW(filename, ARRAY_SIZE(buffer), buffer, &dummy);
}
TRACE("path: %s\n", debugstr_w(buffer));
@@ -1238,9 +1238,8 @@ UINT WINAPI GetPrivateProfileIntW( LPCWSTR section, LPCWSTR entry,
UNICODE_STRING bufferW;
ULONG result;
- if (GetPrivateProfileStringW( section, entry, emptystringW,
- buffer, sizeof(buffer)/sizeof(WCHAR),
- filename ) == 0)
+ if (GetPrivateProfileStringW( section, entry, emptystringW, buffer, ARRAY_SIZE( buffer ),
+ filename ) == 0)
return def_val;
/* FIXME: if entry can be found but it's empty, then Win16 is
diff --git a/dlls/kernel32/sync.c b/dlls/kernel32/sync.c
index 343998e..6c7249c 100644
--- a/dlls/kernel32/sync.c
+++ b/dlls/kernel32/sync.c
@@ -1594,7 +1594,7 @@ BOOL WINAPI WaitNamedPipeW (LPCWSTR name, DWORD nTimeOut)
if (nt_name.Length >= MAX_PATH * sizeof(WCHAR) ||
nt_name.Length < sizeof(leadin) ||
- strncmpiW( nt_name.Buffer, leadin, sizeof(leadin)/sizeof(WCHAR)) != 0)
+ strncmpiW( nt_name.Buffer, leadin, ARRAY_SIZE( leadin )) != 0)
{
RtlFreeUnicodeString( &nt_name );
SetLastError( ERROR_PATH_NOT_FOUND );
@@ -1630,8 +1630,7 @@ BOOL WINAPI WaitNamedPipeW (LPCWSTR name, DWORD nTimeOut)
else
pipe_wait->Timeout.QuadPart = (ULONGLONG)nTimeOut * -10000;
pipe_wait->NameLength = nt_name.Length - sizeof(leadin);
- memcpy(pipe_wait->Name, nt_name.Buffer + sizeof(leadin)/sizeof(WCHAR),
- pipe_wait->NameLength);
+ memcpy( pipe_wait->Name, nt_name.Buffer + ARRAY_SIZE( leadin ), pipe_wait->NameLength );
RtlFreeUnicodeString( &nt_name );
status = NtFsControlFile( pipe_dev, NULL, NULL, NULL, &iosb, FSCTL_PIPE_WAIT,
@@ -2084,8 +2083,7 @@ BOOL WINAPI CreatePipe( PHANDLE hReadPipe, PHANDLE hWritePipe,
'\\','W','i','n','3','2','.','P','i','p','e','s','.','%','0','8','l',
'u','.','%','0','8','u','\0' };
- snprintfW(name, sizeof(name) / sizeof(name[0]), nameFmt,
- GetCurrentProcessId(), ++index);
+ snprintfW(name, ARRAY_SIZE(name), nameFmt, GetCurrentProcessId(), ++index);
RtlInitUnicodeString(&nt_name, name);
status = NtCreateNamedPipeFile(&hr, GENERIC_READ | SYNCHRONIZE, &attr, &iosb,
FILE_SHARE_WRITE, FILE_OVERWRITE_IF,
diff --git a/dlls/kernel32/term.c b/dlls/kernel32/term.c
index 171476a..b8877d4 100644
--- a/dlls/kernel32/term.c
+++ b/dlls/kernel32/term.c
@@ -373,7 +373,7 @@ static BOOL TERM_BuildKeyDB(void)
struct dbkey_descr descr;
char tmp[64];
- for (i = 0; i < sizeof(TERM_dbkey_init) / sizeof(TERM_dbkey_init[0]); i++)
+ for (i = 0; i < ARRAY_SIZE(TERM_dbkey_init); i++)
{
if (!TERM_AddKeyDescr(tigetstr((char *)TERM_dbkey_init[i].string_normal), &TERM_dbkey_init[i].descr))
return FALSE;
diff --git a/dlls/kernel32/volume.c b/dlls/kernel32/volume.c
index 3a4edf8..1208436 100644
--- a/dlls/kernel32/volume.c
+++ b/dlls/kernel32/volume.c
@@ -420,7 +420,7 @@ static BOOL UDF_Find_PVD( HANDLE handle, BYTE pvd[] )
DWORD offset;
INT locations[] = { 256, -1, -257, 512 };
- for(i=0; i<sizeof(locations)/sizeof(locations[0]); i++)
+ for(i=0; i<ARRAY_SIZE(locations); i++)
{
if (!VOLUME_ReadCDBlock(handle, pvd, locations[i]*BLOCK_SIZE))
return FALSE;
@@ -982,7 +982,7 @@ BOOL WINAPI GetVolumeNameForVolumeMountPointA( LPCSTR path, LPSTR volume, DWORD
{
BOOL ret;
WCHAR volumeW[50], *pathW = NULL;
- DWORD len = min( sizeof(volumeW) / sizeof(WCHAR), size );
+ DWORD len = min(ARRAY_SIZE(volumeW), size );
TRACE("(%s, %p, %x)\n", debugstr_a(path), volume, size);
@@ -1105,7 +1105,7 @@ BOOL WINAPI GetVolumeNameForVolumeMountPointW( LPCWSTR path, LPWSTR volume, DWOR
debugstr_wn((WCHAR*)((char *)output + o1->DeviceNameOffset),
o1->DeviceNameLength/sizeof(WCHAR)));
- if (!strncmpW( p, volumeW, sizeof(volumeW)/sizeof(WCHAR) ))
+ if (!strncmpW( p, volumeW, ARRAY_SIZE( volumeW )))
{
/* is there space in the return variable ?? */
if ((o1->SymbolicLinkNameLength/sizeof(WCHAR))+2 > size)
@@ -1763,7 +1763,7 @@ BOOL WINAPI GetVolumePathNameW(LPCWSTR filename, LPWSTR volumepathname, DWORD bu
goto cleanup;
}
}
- else if (GetCurrentDirectoryW( sizeof(cwdW)/sizeof(cwdW[0]), cwdW ))
+ else if (GetCurrentDirectoryW(ARRAY_SIZE(cwdW), cwdW ))
{
/* if the path is completely bogus then revert to the drive of the working directory */
fallbackpathW[0] = cwdW[0];
@@ -1942,12 +1942,12 @@ BOOL WINAPI GetVolumePathNamesForVolumeNameW(LPCWSTR volumename, LPWSTR volumepa
linkname = (const WCHAR *)((const char *)link + link->MountPoints[j].SymbolicLinkNameOffset);
if (link->MountPoints[j].SymbolicLinkNameLength == sizeof(dosdevicesW) + 2 * sizeof(WCHAR) &&
- !memicmpW( linkname, dosdevicesW, sizeof(dosdevicesW) / sizeof(WCHAR) ))
+ !memicmpW( linkname, dosdevicesW, ARRAY_SIZE( dosdevicesW )))
{
len += 4;
if (volumepathname && len < buflen)
{
- path[0] = linkname[sizeof(dosdevicesW) / sizeof(WCHAR)];
+ path[0] = linkname[ARRAY_SIZE( dosdevicesW )];
path[1] = ':';
path[2] = '\\';
path[3] = 0;
--
1.9.1

View File

@ -0,0 +1,26 @@
From 3508dde97fce11ef0b8ad570b1305aacec34db2e Mon Sep 17 00:00:00 2001
From: Michael Stefaniuc <mstefani@winehq.org>
Date: Mon, 30 Jul 2018 21:18:10 +0200
Subject: [PATCH] mciwave: Use the ARRAY_SIZE() macro
Signed-off-by: Michael Stefaniuc <mstefani@winehq.org>
---
dlls/mciwave/mciwave.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/dlls/mciwave/mciwave.c b/dlls/mciwave/mciwave.c
index fd4d6f6..0fa9b20 100644
--- a/dlls/mciwave/mciwave.c
+++ b/dlls/mciwave/mciwave.c
@@ -427,7 +427,7 @@ static DWORD create_tmp_file(HMMIO* hFile, LPWSTR* pszTmpFileName)
szPrefix[2] = 'I';
szPrefix[3] = '\0';
- if (!GetTempPathW(sizeof(szTmpPath)/sizeof(szTmpPath[0]), szTmpPath)) {
+ if (!GetTempPathW(ARRAY_SIZE(szTmpPath), szTmpPath)) {
WARN("can't retrieve temp path!\n");
*pszTmpFileName = NULL;
return MCIERR_FILE_NOT_FOUND;
--
1.9.1

View File

@ -0,0 +1,26 @@
From dbea486286c0794f4a0f145b7c6b44d075ab7170 Mon Sep 17 00:00:00 2001
From: Michael Stefaniuc <mstefani@winehq.org>
Date: Mon, 30 Jul 2018 21:18:11 +0200
Subject: [PATCH] midimap: Use the ARRAY_SIZE() macro
Signed-off-by: Michael Stefaniuc <mstefani@winehq.org>
---
dlls/midimap/midimap.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/dlls/midimap/midimap.c b/dlls/midimap/midimap.c
index 1b35da7..290300a 100644
--- a/dlls/midimap/midimap.c
+++ b/dlls/midimap/midimap.c
@@ -172,7 +172,7 @@ static BOOL MIDIMAP_LoadSettingsScheme(MIDIMAPDATA* mom, const WCHAR* scheme)
return FALSE;
}
- for (idx = 0; !RegEnumKeyW(hKey, idx, buffer, sizeof(buffer)/sizeof(buffer[0])); idx++)
+ for (idx = 0; !RegEnumKeyW(hKey, idx, buffer, ARRAY_SIZE(buffer)); idx++)
{
if (RegOpenKeyW(hKey, buffer, &hPortKey)) continue;
--
1.9.1

View File

@ -0,0 +1,26 @@
From e8135dad94110944af7a599dc1310bcbd96eb548 Mon Sep 17 00:00:00 2001
From: Michael Stefaniuc <mstefani@winehq.org>
Date: Mon, 30 Jul 2018 21:18:12 +0200
Subject: [PATCH] mscms: Use the ARRAY_SIZE() macro
Signed-off-by: Michael Stefaniuc <mstefani@winehq.org>
---
dlls/mscms/profile.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/dlls/mscms/profile.c b/dlls/mscms/profile.c
index f0c4087..cb4908c 100644
--- a/dlls/mscms/profile.c
+++ b/dlls/mscms/profile.c
@@ -295,7 +295,7 @@ BOOL WINAPI GetColorDirectoryW( PCWSTR machine, PWSTR buffer, PDWORD size )
if (machine || !size) return FALSE;
- GetSystemDirectoryW( colordir, sizeof(colordir) / sizeof(WCHAR) );
+ GetSystemDirectoryW( colordir, ARRAY_SIZE( colordir ));
lstrcatW( colordir, colorsubdir );
len = lstrlenW( colordir ) * sizeof(WCHAR);
--
1.9.1

View File

@ -0,0 +1,26 @@
From d6b9f1cef89956e4cc7ddd3e01d843cf9da2f770 Mon Sep 17 00:00:00 2001
From: Michael Stefaniuc <mstefani@winehq.org>
Date: Mon, 30 Jul 2018 21:18:13 +0200
Subject: [PATCH] msctf: Use the ARRAY_SIZE() macro
Signed-off-by: Michael Stefaniuc <mstefani@winehq.org>
---
dlls/msctf/documentmgr.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/dlls/msctf/documentmgr.c b/dlls/msctf/documentmgr.c
index cf4c601..9fa6b0f 100644
--- a/dlls/msctf/documentmgr.c
+++ b/dlls/msctf/documentmgr.c
@@ -188,7 +188,7 @@ static HRESULT WINAPI DocumentMgr_Pop(ITfDocumentMgr *iface, DWORD dwFlags)
{
int i;
- for (i = 0; i < sizeof(This->contextStack)/sizeof(This->contextStack[0]); i++)
+ for (i = 0; i < ARRAY_SIZE(This->contextStack); i++)
if (This->contextStack[i])
{
ITfThreadMgrEventSink_OnPopContext(This->ThreadMgrSink, This->contextStack[i]);
--
1.9.1

View File

@ -0,0 +1,26 @@
From 0c5f59d4379c6ae8ce9ea64c525c8957a5665d57 Mon Sep 17 00:00:00 2001
From: Michael Stefaniuc <mstefani@winehq.org>
Date: Mon, 30 Jul 2018 21:18:14 +0200
Subject: [PATCH] msscript.ocx: Use the ARRAY_SIZE() macro
Signed-off-by: Michael Stefaniuc <mstefani@winehq.org>
---
dlls/msscript.ocx/msscript.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/dlls/msscript.ocx/msscript.c b/dlls/msscript.ocx/msscript.c
index 746c2d3..ae5edb7 100644
--- a/dlls/msscript.ocx/msscript.c
+++ b/dlls/msscript.ocx/msscript.c
@@ -169,7 +169,7 @@ static void release_typelib(void)
if(!typelib)
return;
- for(i=0; i < sizeof(typeinfos)/sizeof(*typeinfos); i++)
+ for(i = 0; i < ARRAY_SIZE(typeinfos); i++)
if(typeinfos[i])
ITypeInfo_Release(typeinfos[i]);
--
1.9.1

View File

@ -189,6 +189,7 @@ patch_enable_all ()
enable_libs_Debug_Channel="$1"
enable_libs_Unicode_Collation="$1"
enable_loader_OSX_Preloader="$1"
enable_ml_array_size="$1"
enable_mmsystem_dll16_MIDIHDR_Refcount="$1"
enable_mountmgr_DosDevices="$1"
enable_mscoree_CorValidateImage="$1"
@ -747,6 +748,9 @@ patch_enable ()
loader-OSX_Preloader)
enable_loader_OSX_Preloader="$2"
;;
ml-array_size)
enable_ml_array_size="$2"
;;
mmsystem.dll16-MIDIHDR_Refcount)
enable_mmsystem_dll16_MIDIHDR_Refcount="$2"
;;
@ -2317,6 +2321,13 @@ if test "$enable_advapi32_LsaLookupSids" -eq 1; then
enable_server_Misc_ACL=1
fi
if test "$enable_Compiler_Warnings" -eq 1; then
if test "$enable_ml_array_size" -gt 1; then
abort "Patchset ml-array_size disabled, but Compiler_Warnings depends on that."
fi
enable_ml_array_size=1
fi
# If autoupdate is enabled then create a tempfile to keep track of all patches
if test "$enable_patchlist" -eq 1; then
@ -2333,8 +2344,158 @@ if test "$enable_patchlist" -eq 1; then
fi
# Patchset ml-array_size
# |
# | Modified files:
# | * dlls/amstream/main.c, dlls/amstream/tests/amstream.c, dlls/browseui/progressdlg.c, dlls/d3d10/effect.c,
# | dlls/d3d8/device.c, dlls/d3dcompiler_43/compiler.c, dlls/d3dcompiler_43/utils.c, dlls/d3dxof/main.c,
# | dlls/dnsapi/query.c, dlls/dpnet/address.c, dlls/dx8vb/main.c, dlls/dxdiagn/provider.c, dlls/evr/main.c,
# | dlls/fusion/asmcache.c, dlls/fusion/fusion.c, dlls/gameux/gameexplorer.c, dlls/hhctrl.ocx/chm.c, dlls/hhctrl.ocx/help.c,
# | dlls/inetcomm/mimeole.c, dlls/inetcomm/protocol.c, dlls/inetcpl.cpl/connections.c, dlls/inetcpl.cpl/general.c,
# | dlls/inetcpl.cpl/security.c, dlls/inetmib1/main.c, dlls/iphlpapi/iphlpapi_main.c, dlls/iphlpapi/ipstats.c,
# | dlls/itss/moniker.c, dlls/itss/protocol.c, dlls/kernel32/computername.c, dlls/kernel32/console.c, dlls/kernel32/file.c,
# | dlls/kernel32/lcformat.c, dlls/kernel32/locale.c, dlls/kernel32/module.c, dlls/kernel32/path.c, dlls/kernel32/process.c,
# | dlls/kernel32/profile.c, dlls/kernel32/sync.c, dlls/kernel32/term.c, dlls/kernel32/volume.c, dlls/krnl386.exe16/int21.c,
# | dlls/krnl386.exe16/interrupts.c, dlls/krnl386.exe16/relay.c, dlls/krnl386.exe16/snoop.c, dlls/krnl386.exe16/vxd.c,
# | dlls/localspl/localmon.c, dlls/localspl/provider.c, dlls/localui/localui.c, dlls/mapi32/sendmail.c, dlls/mapi32/util.c,
# | dlls/mciwave/mciwave.c, dlls/midimap/midimap.c, dlls/mmdevapi/devenum.c, dlls/mmdevapi/main.c,
# | dlls/mountmgr.sys/device.c, dlls/mpr/wnet.c, dlls/msacm32/filter.c, dlls/msacm32/format.c, dlls/msacm32/internal.c,
# | dlls/msacm32/pcmconverter.c, dlls/msacm32/tests/msacm.c, dlls/mscms/profile.c, dlls/mscoree/config.c,
# | dlls/mscoree/corruntimehost.c, dlls/mscoree/mscoree_main.c, dlls/msctf/documentmgr.c, dlls/msrle32/msrle32.c,
# | dlls/msscript.ocx/msscript.c, dlls/msvcrt/console.c, dlls/msvcrt/ctype.c, dlls/msvcrt/errno.c, dlls/msvcrt/except.c,
# | dlls/msvcrt/exit.c, dlls/msvcrt/file.c, dlls/msvcrt/locale.c, dlls/msvcrt/printf.h, dlls/msvcrt/process.c,
# | dlls/msvcrt/scheduler.c, dlls/msvcrt/wcs.c, dlls/msvideo.dll16/msvideo16.c, dlls/scrobj/scrobj.c,
# | dlls/storage.dll16/storage.c, dlls/urlmon/urlmon_main.c, dlls/windowscodecs/bitmap.c, dlls/windowscodecs/bmpencode.c,
# | dlls/windowscodecs/jpegformat.c, dlls/windowscodecs/metadataquery.c, dlls/windowscodecs/pngformat.c,
# | dlls/windowscodecs/tiffformat.c, include/wine/server_protocol.h, programs/attrib/attrib.c, programs/clock/main.c,
# | programs/clock/winclock.c, programs/hostname/hostname.c, programs/icinfo/icinfo.c, programs/ipconfig/ipconfig.c,
# | programs/msiexec/msiexec.c, programs/net/net.c, programs/taskkill/taskkill.c, programs/taskmgr/about.c,
# | programs/taskmgr/affinity.c, programs/taskmgr/applpage.c, programs/taskmgr/column.c, programs/taskmgr/dbgchnl.c,
# | programs/taskmgr/debug.c, programs/taskmgr/endproc.c, programs/taskmgr/perfdata.c, programs/taskmgr/perfpage.c,
# | programs/taskmgr/priority.c, programs/taskmgr/procpage.c, programs/taskmgr/taskmgr.c, programs/taskmgr/trayicon.c,
# | programs/uninstaller/main.c, programs/wineboot/wineboot.c, programs/winetest/gui.c, programs/winetest/main.c,
# | programs/wordpad/wordpad.c, server/request.h, server/trace.c
# |
if test "$enable_ml_array_size" -eq 1; then
patch_apply ml-array_size/0001-windowscodecs-Use-the-ARRAY_SIZE-macro.patch
patch_apply ml-array_size/0003-localspl-Use-the-ARRAY_SIZE-macro.patch
patch_apply ml-array_size/0004-mmdevapi-Use-the-ARRAY_SIZE-macro.patch
patch_apply ml-array_size/0005-mapi32-Use-the-ARRAY_SIZE-macro.patch
patch_apply ml-array_size/0006-krnl386.exe16-Use-the-ARRAY_SIZE-macro.patch
patch_apply ml-array_size/0007-inetcpl.cpl-Use-the-ARRAY_SIZE-macro.patch
patch_apply ml-array_size/0008-hhctrl.ocx-Use-the-ARRAY_SIZE-macro.patch
patch_apply ml-array_size/0009-dpnet-Use-the-ARRAY_SIZE-macro.patch
patch_apply ml-array_size/0010-dx8vb-Use-the-ARRAY_SIZE-macro.patch
patch_apply ml-array_size/0011-fusion-Use-the-ARRAY_SIZE-macro.patch
patch_apply ml-array_size/0012-evr-Use-the-ARRAY_SIZE-macro.patch
patch_apply ml-array_size/0013-d3d10-Use-the-ARRAY_SIZE-macro.patch
patch_apply ml-array_size/0014-d3d8-Use-the-ARRAY_SIZE-macro.patch
patch_apply ml-array_size/0015-d3dcompiler-Use-the-ARRAY_SIZE-macro.patch
patch_apply ml-array_size/0016-d3dxof-Use-the-ARRAY_SIZE-macro.patch
patch_apply ml-array_size/0017-dnsapi-Use-the-ARRAY_SIZE-macro.patch
patch_apply ml-array_size/0019-amstream-Use-the-ARRAY_SIZE-macro.patch
patch_apply ml-array_size/0020-browseui-Use-the-ARRAY_SIZE-macro.patch
patch_apply ml-array_size/0021-gameux-Use-the-ARRAY_SIZE-macro.patch
patch_apply ml-array_size/0022-inetcomm-Use-the-ARRAY_SIZE-macro.patch
patch_apply ml-array_size/0023-iphlpapi-Use-the-ARRAY_SIZE-macro.patch
patch_apply ml-array_size/0024-itss-Remove-a-superfluous-variable-initialization.patch
patch_apply ml-array_size/0025-itss-Use-the-ARRAY_SIZE-macro.patch
patch_apply ml-array_size/0026-attrib-Use-the-ARRAY_SIZE-macro.patch
patch_apply ml-array_size/0027-clock-Use-the-ARRAY_SIZE-macro.patch
patch_apply ml-array_size/0028-hostname-Use-the-ARRAY_SIZE-macro.patch
patch_apply ml-array_size/0029-icinfo-Use-the-ARRAY_SIZE-macro.patch
patch_apply ml-array_size/0030-net-Use-the-ARRAY_SIZE-macro.patch
patch_apply ml-array_size/0031-taskkill-Use-the-ARRAY_SIZE-macro.patch
patch_apply ml-array_size/0032-ipconfig-Use-the-ARRAY_SIZE-macro.patch
patch_apply ml-array_size/0033-msiexec-Use-the-ARRAY_SIZE-macro.patch
patch_apply ml-array_size/0034-taskmgr-Use-the-ARRAY_SIZE-macro.patch
patch_apply ml-array_size/0035-uninstaller-Use-the-ARRAY_SIZE-macro.patch
patch_apply ml-array_size/0036-wineboot-Use-the-ARRAY_SIZE-macro.patch
patch_apply ml-array_size/0037-wordpad-Use-the-ARRAY_SIZE-macro.patch
patch_apply ml-array_size/0038-winetest-Use-the-ARRAY_SIZE-macro.patch
patch_apply ml-array_size/0039-mountmgr.sys-Use-the-ARRAY_SIZE-macro.patch
patch_apply ml-array_size/0040-mpr-Use-the-ARRAY_SIZE-macro.patch
patch_apply ml-array_size/0041-msacm32-Use-the-ARRAY_SIZE-macro.patch
patch_apply ml-array_size/0042-msrle32-Use-the-ARRAY_SIZE-macro.patch
patch_apply ml-array_size/0043-msvcrt-Use-the-ARRAY_SIZE-macro.patch
patch_apply ml-array_size/0044-scrobj-Use-the-ARRAY_SIZE-macro.patch
patch_apply ml-array_size/0045-storage.dll16-Use-the-ARRAY_SIZE-macro.patch
patch_apply ml-array_size/0046-urlmon-Use-the-ARRAY_SIZE-macro.patch
patch_apply ml-array_size/0047-msvideo.dll16-Use-the-ARRAY_SIZE-macro.patch
patch_apply ml-array_size/0048-mscoree-Use-the-ARRAY_SIZE-macro.patch
patch_apply ml-array_size/0049-dxdiagn-Use-the-ARRAY_SIZE-macro.patch
patch_apply ml-array_size/0050-localui-Use-the-ARRAY_SIZE-macro.patch
patch_apply ml-array_size/0051-inetmib1-Use-the-ARRAY_SIZE-macro.patch
patch_apply ml-array_size/0052-kernel32-Use-the-ARRAY_SIZE-macro.patch
patch_apply ml-array_size/0053-mciwave-Use-the-ARRAY_SIZE-macro.patch
patch_apply ml-array_size/0054-midimap-Use-the-ARRAY_SIZE-macro.patch
patch_apply ml-array_size/0055-mscms-Use-the-ARRAY_SIZE-macro.patch
patch_apply ml-array_size/0056-msctf-Use-the-ARRAY_SIZE-macro.patch
patch_apply ml-array_size/0057-msscript.ocx-Use-the-ARRAY_SIZE-macro.patch
(
printf '%s\n' '+ { "Michael Stefaniuc", "windowscodecs: Use the ARRAY_SIZE() macro.", 1 },';
printf '%s\n' '+ { "Michael Stefaniuc", "localspl: Use the ARRAY_SIZE() macro.", 1 },';
printf '%s\n' '+ { "Michael Stefaniuc", "mmdevapi: Use the ARRAY_SIZE() macro.", 1 },';
printf '%s\n' '+ { "Michael Stefaniuc", "mapi32: Use the ARRAY_SIZE() macro.", 1 },';
printf '%s\n' '+ { "Michael Stefaniuc", "krnl386.exe16: Use the ARRAY_SIZE() macro.", 1 },';
printf '%s\n' '+ { "Michael Stefaniuc", "inetcpl.cpl: Use the ARRAY_SIZE() macro.", 1 },';
printf '%s\n' '+ { "Michael Stefaniuc", "hhctrl.ocx: Use the ARRAY_SIZE() macro.", 1 },';
printf '%s\n' '+ { "Michael Stefaniuc", "dpnet: Use the ARRAY_SIZE() macro.", 1 },';
printf '%s\n' '+ { "Michael Stefaniuc", "dx8vb: Use the ARRAY_SIZE() macro.", 1 },';
printf '%s\n' '+ { "Michael Stefaniuc", "fusion: Use the ARRAY_SIZE() macro.", 1 },';
printf '%s\n' '+ { "Michael Stefaniuc", "evr: Use the ARRAY_SIZE() macro.", 1 },';
printf '%s\n' '+ { "Michael Stefaniuc", "d3d10: Use the ARRAY_SIZE() macro.", 1 },';
printf '%s\n' '+ { "Michael Stefaniuc", "d3d8: Use the ARRAY_SIZE() macro.", 1 },';
printf '%s\n' '+ { "Michael Stefaniuc", "d3dcompiler: Use the ARRAY_SIZE() macro.", 1 },';
printf '%s\n' '+ { "Michael Stefaniuc", "d3dxof: Use the ARRAY_SIZE() macro.", 1 },';
printf '%s\n' '+ { "Michael Stefaniuc", "dnsapi: Use the ARRAY_SIZE() macro.", 1 },';
printf '%s\n' '+ { "Michael Stefaniuc", "amstream: Use the ARRAY_SIZE() macro.", 1 },';
printf '%s\n' '+ { "Michael Stefaniuc", "browseui: Use the ARRAY_SIZE() macro.", 1 },';
printf '%s\n' '+ { "Michael Stefaniuc", "gameux: Use the ARRAY_SIZE() macro.", 1 },';
printf '%s\n' '+ { "Michael Stefaniuc", "inetcomm: Use the ARRAY_SIZE() macro.", 1 },';
printf '%s\n' '+ { "Michael Stefaniuc", "iphlpapi: Use the ARRAY_SIZE() macro.", 1 },';
printf '%s\n' '+ { "Michael Stefaniuc", "itss: Remove a superfluous variable initialization.", 1 },';
printf '%s\n' '+ { "Michael Stefaniuc", "itss: Use the ARRAY_SIZE() macro.", 1 },';
printf '%s\n' '+ { "Michael Stefaniuc", "attrib: Use the ARRAY_SIZE() macro.", 1 },';
printf '%s\n' '+ { "Michael Stefaniuc", "clock: Use the ARRAY_SIZE() macro.", 1 },';
printf '%s\n' '+ { "Michael Stefaniuc", "hostname: Use the ARRAY_SIZE() macro.", 1 },';
printf '%s\n' '+ { "Michael Stefaniuc", "icinfo: Use the ARRAY_SIZE() macro.", 1 },';
printf '%s\n' '+ { "Michael Stefaniuc", "net: Use the ARRAY_SIZE() macro.", 1 },';
printf '%s\n' '+ { "Michael Stefaniuc", "taskkill: Use the ARRAY_SIZE() macro.", 1 },';
printf '%s\n' '+ { "Michael Stefaniuc", "ipconfig: Use the ARRAY_SIZE() macro.", 1 },';
printf '%s\n' '+ { "Michael Stefaniuc", "msiexec: Use the ARRAY_SIZE() macro.", 1 },';
printf '%s\n' '+ { "Michael Stefaniuc", "taskmgr: Use the ARRAY_SIZE() macro.", 1 },';
printf '%s\n' '+ { "Michael Stefaniuc", "uninstaller: Use the ARRAY_SIZE() macro.", 1 },';
printf '%s\n' '+ { "Michael Stefaniuc", "wineboot: Use the ARRAY_SIZE() macro.", 1 },';
printf '%s\n' '+ { "Michael Stefaniuc", "wordpad: Use the ARRAY_SIZE() macro.", 1 },';
printf '%s\n' '+ { "Michael Stefaniuc", "winetest: Use the ARRAY_SIZE() macro.", 1 },';
printf '%s\n' '+ { "Michael Stefaniuc", "mountmgr.sys: Use the ARRAY_SIZE() macro.", 1 },';
printf '%s\n' '+ { "Michael Stefaniuc", "mpr: Use the ARRAY_SIZE() macro.", 1 },';
printf '%s\n' '+ { "Michael Stefaniuc", "msacm32: Use the ARRAY_SIZE() macro.", 1 },';
printf '%s\n' '+ { "Michael Stefaniuc", "msrle32: Use the ARRAY_SIZE() macro.", 1 },';
printf '%s\n' '+ { "Michael Stefaniuc", "msvcrt: Use the ARRAY_SIZE() macro.", 1 },';
printf '%s\n' '+ { "Michael Stefaniuc", "scrobj: Use the ARRAY_SIZE() macro.", 1 },';
printf '%s\n' '+ { "Michael Stefaniuc", "storage.dll16: Use the ARRAY_SIZE() macro.", 1 },';
printf '%s\n' '+ { "Michael Stefaniuc", "urlmon: Use the ARRAY_SIZE() macro.", 1 },';
printf '%s\n' '+ { "Michael Stefaniuc", "msvideo.dll16: Use the ARRAY_SIZE() macro.", 1 },';
printf '%s\n' '+ { "Michael Stefaniuc", "mscoree: Use the ARRAY_SIZE() macro.", 1 },';
printf '%s\n' '+ { "Michael Stefaniuc", "dxdiagn: Use the ARRAY_SIZE() macro.", 1 },';
printf '%s\n' '+ { "Michael Stefaniuc", "localui: Use the ARRAY_SIZE() macro.", 1 },';
printf '%s\n' '+ { "Michael Stefaniuc", "inetmib1: Use the ARRAY_SIZE() macro.", 1 },';
printf '%s\n' '+ { "Michael Stefaniuc", "kernel32: Use the ARRAY_SIZE() macro.", 1 },';
printf '%s\n' '+ { "Michael Stefaniuc", "mciwave: Use the ARRAY_SIZE() macro.", 1 },';
printf '%s\n' '+ { "Michael Stefaniuc", "midimap: Use the ARRAY_SIZE() macro.", 1 },';
printf '%s\n' '+ { "Michael Stefaniuc", "mscms: Use the ARRAY_SIZE() macro.", 1 },';
printf '%s\n' '+ { "Michael Stefaniuc", "msctf: Use the ARRAY_SIZE() macro.", 1 },';
printf '%s\n' '+ { "Michael Stefaniuc", "msscript.ocx: Use the ARRAY_SIZE() macro.", 1 },';
) >> "$patchlist"
fi
# Patchset Compiler_Warnings
# |
# | This patchset has the following (direct or indirect) dependencies:
# | * ml-array_size
# |
# | Modified files:
# | * dlls/amstream/mediastreamfilter.c, dlls/d2d1/brush.c, dlls/d2d1/geometry.c, dlls/d3d11/view.c, dlls/d3d8/texture.c,
# | dlls/d3d9/tests/visual.c, dlls/d3d9/texture.c, dlls/ddraw/viewport.c, dlls/dwrite/font.c, dlls/dwrite/layout.c,
@ -5536,7 +5697,7 @@ fi
# Patchset ntoskrnl-Stubs
# |
# | This patchset has the following (direct or indirect) dependencies:
# | * Compiler_Warnings
# | * ml-array_size, Compiler_Warnings
# |
# | Modified files:
# | * dlls/ntoskrnl.exe/ntoskrnl.c, dlls/ntoskrnl.exe/ntoskrnl.exe.spec, dlls/ntoskrnl.exe/tests/driver.c, include/ddk/wdm.h,
@ -7748,7 +7909,7 @@ fi
# Patchset winedevice-Default_Drivers
# |
# | This patchset has the following (direct or indirect) dependencies:
# | * dxva2-Video_Decoder, Compiler_Warnings, ntoskrnl-Stubs
# | * dxva2-Video_Decoder, ml-array_size, Compiler_Warnings, ntoskrnl-Stubs
# |
# | Modified files:
# | * configure.ac, dlls/dxgkrnl.sys/Makefile.in, dlls/dxgkrnl.sys/dxgkrnl.sys.spec, dlls/dxgkrnl.sys/main.c,
@ -8030,8 +8191,7 @@ fi
# | * [#45554] - Correct compile error with gcc 4.5
# |
# | Modified files:
# | * dlls/ntdll/loader.c, dlls/ntdll/tests/info.c, dlls/winex11.drv/vulkan.c, include/wine/server_protocol.h,
# | server/request.h, server/trace.c
# | * dlls/winex11.drv/vulkan.c
# |
if test "$enable_winex11_compile_vulkan" -eq 1; then
patch_apply winex11-compile-vulkan/0001-winex11.drv-Correct-bBuild-fail-with-GCC-4.5.patch