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

Some files were not shown because too many files have changed in this diff Show More