[WINESYNC] setupapi: Use the ARRAY_SIZE() macro.

Signed-off-by: Michael Stefaniuc <mstefani@winehq.org>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>

wine commit id d33f06746050984c622366ffbc19219ec1f5aa7d by Michael Stefaniuc <mstefani@winehq.org>

[WINESYNC] setupapi: For consistency use __x86_64__ instead of __x86_64.

Spotted by Ken Thomases.

Signed-off-by: Huw Davies <huw@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>

wine commit id a6d89db61566b5dcccd66cb1cb5a51dfa0cc0f0a by Huw Davies <huw@codeweavers.com>
This commit is contained in:
winesync 2023-09-25 17:11:19 +02:00 committed by Hermès Bélusca-Maïto
parent 8ebf8ef4fa
commit ea725d3792
No known key found for this signature in database
GPG key ID: 3B2539C65E7B93D0
5 changed files with 17 additions and 24 deletions

View file

@ -49,28 +49,23 @@ static void promptdisk_init(HWND hwnd, struct promptdisk_params *params)
WCHAR format[256];
WCHAR unknown[256];
DWORD_PTR args[2];
LoadStringW(SETUPAPI_hInstance, IDS_PROMPTDISK, format,
sizeof(format)/sizeof(format[0]));
LoadStringW(SETUPAPI_hInstance, IDS_PROMPTDISK, format, ARRAY_SIZE(format));
args[0] = (DWORD_PTR)params->FileSought;
if(params->DiskName)
args[1] = (DWORD_PTR)params->DiskName;
else
{
LoadStringW(SETUPAPI_hInstance, IDS_UNKNOWN, unknown,
sizeof(unknown)/sizeof(unknown[0]));
LoadStringW(SETUPAPI_hInstance, IDS_UNKNOWN, unknown, ARRAY_SIZE(unknown));
args[1] = (DWORD_PTR)unknown;
}
FormatMessageW(FORMAT_MESSAGE_FROM_STRING|FORMAT_MESSAGE_ARGUMENT_ARRAY,
format, 0, 0, message, sizeof(message)/sizeof(*message),
(__ms_va_list*)args);
format, 0, 0, message, ARRAY_SIZE(message), (__ms_va_list*)args);
SetDlgItemTextW(hwnd, IDC_FILENEEDED, message);
LoadStringW(SETUPAPI_hInstance, IDS_INFO, message,
sizeof(message)/sizeof(message[0]));
LoadStringW(SETUPAPI_hInstance, IDS_INFO, message, ARRAY_SIZE(message));
SetDlgItemTextW(hwnd, IDC_INFO, message);
LoadStringW(SETUPAPI_hInstance, IDS_COPYFROM, message,
sizeof(message)/sizeof(message[0]));
LoadStringW(SETUPAPI_hInstance, IDS_COPYFROM, message, ARRAY_SIZE(message));
SetDlgItemTextW(hwnd, IDC_COPYFROM, message);
}
if(params->DiskPromptStyle & IDF_NOBROWSE)

View file

@ -208,7 +208,7 @@ static int add_section( struct inf_file *file, const WCHAR *name )
if (!(section = HeapAlloc( GetProcessHeap(), 0, sizeof(*section) ))) return -1;
section->name = name;
section->nb_lines = 0;
section->alloc_lines = sizeof(section->lines)/sizeof(section->lines[0]);
section->alloc_lines = ARRAY_SIZE( section->lines );
file->sections[file->nb_sections] = section;
return file->nb_sections++;
}
@ -461,7 +461,7 @@ static unsigned int PARSER_string_substA( const struct inf_file *file, const WCH
WCHAR buffW[MAX_STRING_LEN+1];
DWORD ret;
unsigned int len = PARSER_string_substW( file, text, buffW, sizeof(buffW)/sizeof(WCHAR) );
unsigned int len = PARSER_string_substW( file, text, buffW, ARRAY_SIZE( buffW ));
if (!buffer) RtlUnicodeToMultiByteSize( &ret, buffW, len * sizeof(WCHAR) );
else
{
@ -485,7 +485,7 @@ static WCHAR *push_string( struct inf_file *file, const WCHAR *string )
/* push the current state on the parser stack */
static inline void push_state( struct parser *parser, enum parser_state state )
{
ASSERT( parser->stack_pos < sizeof(parser->stack)/sizeof(parser->stack[0]) );
ASSERT( parser->stack_pos < ARRAY_SIZE( parser->stack ));
parser->stack[parser->stack_pos++] = state;
}
@ -1356,8 +1356,7 @@ BOOL WINAPI SetupOpenAppendInfFileW( PCWSTR name, HINF parent_hinf, UINT *error
int idx = 1;
if (!SetupFindFirstLineW( parent_hinf, Version, LayoutFile, &context )) return FALSE;
while (SetupGetStringFieldW( &context, idx++, filename,
sizeof(filename)/sizeof(WCHAR), NULL ))
while (SetupGetStringFieldW( &context, idx++, filename, ARRAY_SIZE( filename ), NULL ))
{
child_hinf = SetupOpenInfFileW( filename, NULL, INF_STYLE_WIN4, error );
if (child_hinf == INVALID_HANDLE_VALUE) return FALSE;

View file

@ -27,7 +27,7 @@ static const WCHAR source_disks_names_platform[] =
{'S','o','u','r','c','e','D','i','s','k','s','N','a','m','e','s','.','x','8','6',0};
static const WCHAR source_disks_files_platform[] =
{'S','o','u','r','c','e','D','i','s','k','s','F','i','l','e','s','.','x','8','6',0};
#elif defined(__x86_64)
#elif defined(__x86_64__)
static const WCHAR source_disks_names_platform[] =
{'S','o','u','r','c','e','D','i','s','k','s','N','a','m','e','s','.','a','m','d','6','4',0};
static const WCHAR source_disks_files_platform[] =
@ -714,8 +714,7 @@ BOOL WINAPI SetupQueryInfOriginalFileInformationW(
if (!SetupGetLineTextW(NULL, hinf, wszVersion, wszCatalogFile,
OriginalFileInfo->OriginalCatalogName,
sizeof(OriginalFileInfo->OriginalCatalogName)/sizeof(OriginalFileInfo->OriginalCatalogName[0]),
NULL))
ARRAY_SIZE(OriginalFileInfo->OriginalCatalogName), NULL))
{
OriginalFileInfo->OriginalCatalogName[0] = '\0';
}

View file

@ -842,9 +842,9 @@ BOOL WINAPI SetupQueueCopySectionW( HSPFILEQ queue, PCWSTR src_root, HINF hinf,
if (!(params.TargetDirectory = dest_dir = get_destination_dir( hinf, section ))) goto done;
do
{
if (!SetupGetStringFieldW( &context, 1, dest, sizeof(dest)/sizeof(WCHAR), NULL ))
if (!SetupGetStringFieldW( &context, 1, dest, ARRAY_SIZE( dest ), NULL ))
goto end;
if (!SetupGetStringFieldW( &context, 2, src, sizeof(src)/sizeof(WCHAR), NULL )) *src = 0;
if (!SetupGetStringFieldW( &context, 2, src, ARRAY_SIZE( src ), NULL )) *src = 0;
if (!SetupGetIntField( &context, 4, &flags )) flags = 0; /* FIXME */
params.SourceFilename = *src ? src : NULL;
@ -898,7 +898,7 @@ BOOL WINAPI SetupQueueDeleteSectionW( HSPFILEQ queue, HINF hinf, HINF hlist, PCW
if (!(dest_dir = get_destination_dir( hinf, section ))) return FALSE;
do
{
if (!SetupGetStringFieldW( &context, 1, buffer, sizeof(buffer)/sizeof(WCHAR), NULL ))
if (!SetupGetStringFieldW( &context, 1, buffer, ARRAY_SIZE( buffer ), NULL ))
goto done;
if (!SetupGetIntField( &context, 4, &flags )) flags = 0;
if (!SetupQueueDeleteW( queue, dest_dir, buffer )) goto done;
@ -946,9 +946,9 @@ BOOL WINAPI SetupQueueRenameSectionW( HSPFILEQ queue, HINF hinf, HINF hlist, PCW
if (!(dest_dir = get_destination_dir( hinf, section ))) return FALSE;
do
{
if (!SetupGetStringFieldW( &context, 1, dst, sizeof(dst)/sizeof(WCHAR), NULL ))
if (!SetupGetStringFieldW( &context, 1, dst, ARRAY_SIZE( dst ), NULL ))
goto done;
if (!SetupGetStringFieldW( &context, 2, src, sizeof(src)/sizeof(WCHAR), NULL ))
if (!SetupGetStringFieldW( &context, 2, src, ARRAY_SIZE( src ), NULL ))
goto done;
if (!SetupQueueRenameW( queue, dest_dir, src, NULL, dst )) goto done;
} while (SetupFindNextLine( &context, &context ));

View file

@ -7,4 +7,4 @@ files:
dlls/setupapi/setupcab.c: dll/win32/setupapi/setupcab.c
dlls/setupapi/stringtable.c: dll/win32/setupapi/stringtable_wine.c
tags:
wine: wine-2.2
wine: a6d89db61566b5dcccd66cb1cb5a51dfa0cc0f0a