diff --git a/dll/win32/setupapi/dialog.c b/dll/win32/setupapi/dialog.c index 87757410d6c..42d2841fd50 100644 --- a/dll/win32/setupapi/dialog.c +++ b/dll/win32/setupapi/dialog.c @@ -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) diff --git a/dll/win32/setupapi/parser.c b/dll/win32/setupapi/parser.c index e558edaed1a..c38d62c1f5c 100644 --- a/dll/win32/setupapi/parser.c +++ b/dll/win32/setupapi/parser.c @@ -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; diff --git a/dll/win32/setupapi/query.c b/dll/win32/setupapi/query.c index ec96050096c..f1a867552c6 100644 --- a/dll/win32/setupapi/query.c +++ b/dll/win32/setupapi/query.c @@ -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'; } diff --git a/dll/win32/setupapi/queue.c b/dll/win32/setupapi/queue.c index ff4ce158e7f..80c50becc9e 100644 --- a/dll/win32/setupapi/queue.c +++ b/dll/win32/setupapi/queue.c @@ -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 )); diff --git a/sdk/tools/winesync/setupapi.cfg b/sdk/tools/winesync/setupapi.cfg index fa1e07e7938..98aeb2c43df 100644 --- a/sdk/tools/winesync/setupapi.cfg +++ b/sdk/tools/winesync/setupapi.cfg @@ -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