mirror of
git://source.winehq.org/git/wine.git
synced 2024-10-14 09:30:56 +00:00
wbemprox: Prefer the standard ARRAY_SIZE macro.
Signed-off-by: Michael Stefaniuc <mstefani@winehq.org> Signed-off-by: Hans Leidekker <hans@codeweavers.com> Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
parent
ad576b6965
commit
904820a523
|
@ -1250,7 +1250,7 @@ static UINT16 systemenclosure_chassistypes[] =
|
||||||
};
|
};
|
||||||
static const struct array systemenclosure_chassistypes_array =
|
static const struct array systemenclosure_chassistypes_array =
|
||||||
{
|
{
|
||||||
SIZEOF(systemenclosure_chassistypes),
|
ARRAY_SIZE(systemenclosure_chassistypes),
|
||||||
&systemenclosure_chassistypes
|
&systemenclosure_chassistypes
|
||||||
};
|
};
|
||||||
static const struct record_systemenclosure data_systemenclosure[] =
|
static const struct record_systemenclosure data_systemenclosure[] =
|
||||||
|
@ -3522,38 +3522,38 @@ done:
|
||||||
|
|
||||||
static struct table builtin_classes[] =
|
static struct table builtin_classes[] =
|
||||||
{
|
{
|
||||||
{ class_baseboardW, SIZEOF(col_baseboard), col_baseboard, SIZEOF(data_baseboard), 0, (BYTE *)data_baseboard },
|
{ class_baseboardW, ARRAY_SIZE(col_baseboard), col_baseboard, ARRAY_SIZE(data_baseboard), 0, (BYTE *)data_baseboard },
|
||||||
{ class_biosW, SIZEOF(col_bios), col_bios, SIZEOF(data_bios), 0, (BYTE *)data_bios },
|
{ class_biosW, ARRAY_SIZE(col_bios), col_bios, ARRAY_SIZE(data_bios), 0, (BYTE *)data_bios },
|
||||||
{ class_cdromdriveW, SIZEOF(col_cdromdrive), col_cdromdrive, 0, 0, NULL, fill_cdromdrive },
|
{ class_cdromdriveW, ARRAY_SIZE(col_cdromdrive), col_cdromdrive, 0, 0, NULL, fill_cdromdrive },
|
||||||
{ class_compsysW, SIZEOF(col_compsys), col_compsys, 0, 0, NULL, fill_compsys },
|
{ class_compsysW, ARRAY_SIZE(col_compsys), col_compsys, 0, 0, NULL, fill_compsys },
|
||||||
{ class_compsysproductW, SIZEOF(col_compsysproduct), col_compsysproduct, 0, 0, NULL, fill_compsysproduct },
|
{ class_compsysproductW, ARRAY_SIZE(col_compsysproduct), col_compsysproduct, 0, 0, NULL, fill_compsysproduct },
|
||||||
{ class_datafileW, SIZEOF(col_datafile), col_datafile, 0, 0, NULL, fill_datafile },
|
{ class_datafileW, ARRAY_SIZE(col_datafile), col_datafile, 0, 0, NULL, fill_datafile },
|
||||||
{ class_desktopmonitorW, SIZEOF(col_desktopmonitor), col_desktopmonitor, 0, 0, NULL, fill_desktopmonitor },
|
{ class_desktopmonitorW, ARRAY_SIZE(col_desktopmonitor), col_desktopmonitor, 0, 0, NULL, fill_desktopmonitor },
|
||||||
{ class_directoryW, SIZEOF(col_directory), col_directory, 0, 0, NULL, fill_directory },
|
{ class_directoryW, ARRAY_SIZE(col_directory), col_directory, 0, 0, NULL, fill_directory },
|
||||||
{ class_diskdriveW, SIZEOF(col_diskdrive), col_diskdrive, 0, 0, NULL, fill_diskdrive },
|
{ class_diskdriveW, ARRAY_SIZE(col_diskdrive), col_diskdrive, 0, 0, NULL, fill_diskdrive },
|
||||||
{ class_diskpartitionW, SIZEOF(col_diskpartition), col_diskpartition, 0, 0, NULL, fill_diskpartition },
|
{ class_diskpartitionW, ARRAY_SIZE(col_diskpartition), col_diskpartition, 0, 0, NULL, fill_diskpartition },
|
||||||
{ class_ip4routetableW, SIZEOF(col_ip4routetable), col_ip4routetable, 0, 0, NULL, fill_ip4routetable },
|
{ class_ip4routetableW, ARRAY_SIZE(col_ip4routetable), col_ip4routetable, 0, 0, NULL, fill_ip4routetable },
|
||||||
{ class_logicaldiskW, SIZEOF(col_logicaldisk), col_logicaldisk, 0, 0, NULL, fill_logicaldisk },
|
{ class_logicaldiskW, ARRAY_SIZE(col_logicaldisk), col_logicaldisk, 0, 0, NULL, fill_logicaldisk },
|
||||||
{ class_logicaldisk2W, SIZEOF(col_logicaldisk), col_logicaldisk, 0, 0, NULL, fill_logicaldisk },
|
{ class_logicaldisk2W, ARRAY_SIZE(col_logicaldisk), col_logicaldisk, 0, 0, NULL, fill_logicaldisk },
|
||||||
{ class_networkadapterW, SIZEOF(col_networkadapter), col_networkadapter, 0, 0, NULL, fill_networkadapter },
|
{ class_networkadapterW, ARRAY_SIZE(col_networkadapter), col_networkadapter, 0, 0, NULL, fill_networkadapter },
|
||||||
{ class_networkadapterconfigW, SIZEOF(col_networkadapterconfig), col_networkadapterconfig, 0, 0, NULL, fill_networkadapterconfig },
|
{ class_networkadapterconfigW, ARRAY_SIZE(col_networkadapterconfig), col_networkadapterconfig, 0, 0, NULL, fill_networkadapterconfig },
|
||||||
{ class_osW, SIZEOF(col_os), col_os, 0, 0, NULL, fill_os },
|
{ class_osW, ARRAY_SIZE(col_os), col_os, 0, 0, NULL, fill_os },
|
||||||
{ class_paramsW, SIZEOF(col_param), col_param, SIZEOF(data_param), 0, (BYTE *)data_param },
|
{ class_paramsW, ARRAY_SIZE(col_param), col_param, ARRAY_SIZE(data_param), 0, (BYTE *)data_param },
|
||||||
{ class_physicalmediaW, SIZEOF(col_physicalmedia), col_physicalmedia, SIZEOF(data_physicalmedia), 0, (BYTE *)data_physicalmedia },
|
{ class_physicalmediaW, ARRAY_SIZE(col_physicalmedia), col_physicalmedia, ARRAY_SIZE(data_physicalmedia), 0, (BYTE *)data_physicalmedia },
|
||||||
{ class_physicalmemoryW, SIZEOF(col_physicalmemory), col_physicalmemory, 0, 0, NULL, fill_physicalmemory },
|
{ class_physicalmemoryW, ARRAY_SIZE(col_physicalmemory), col_physicalmemory, 0, 0, NULL, fill_physicalmemory },
|
||||||
{ class_pnpentityW, SIZEOF(col_pnpentity), col_pnpentity, 0, 0, NULL, fill_pnpentity },
|
{ class_pnpentityW, ARRAY_SIZE(col_pnpentity), col_pnpentity, 0, 0, NULL, fill_pnpentity },
|
||||||
{ class_printerW, SIZEOF(col_printer), col_printer, 0, 0, NULL, fill_printer },
|
{ class_printerW, ARRAY_SIZE(col_printer), col_printer, 0, 0, NULL, fill_printer },
|
||||||
{ class_processW, SIZEOF(col_process), col_process, 0, 0, NULL, fill_process },
|
{ class_processW, ARRAY_SIZE(col_process), col_process, 0, 0, NULL, fill_process },
|
||||||
{ class_processorW, SIZEOF(col_processor), col_processor, 0, 0, NULL, fill_processor },
|
{ class_processorW, ARRAY_SIZE(col_processor), col_processor, 0, 0, NULL, fill_processor },
|
||||||
{ class_processor2W, SIZEOF(col_processor), col_processor, 0, 0, NULL, fill_processor },
|
{ class_processor2W, ARRAY_SIZE(col_processor), col_processor, 0, 0, NULL, fill_processor },
|
||||||
{ class_qualifiersW, SIZEOF(col_qualifier), col_qualifier, SIZEOF(data_qualifier), 0, (BYTE *)data_qualifier },
|
{ class_qualifiersW, ARRAY_SIZE(col_qualifier), col_qualifier, ARRAY_SIZE(data_qualifier), 0, (BYTE *)data_qualifier },
|
||||||
{ class_serviceW, SIZEOF(col_service), col_service, 0, 0, NULL, fill_service },
|
{ class_serviceW, ARRAY_SIZE(col_service), col_service, 0, 0, NULL, fill_service },
|
||||||
{ class_sidW, SIZEOF(col_sid), col_sid, 0, 0, NULL, fill_sid },
|
{ class_sidW, ARRAY_SIZE(col_sid), col_sid, 0, 0, NULL, fill_sid },
|
||||||
{ class_sounddeviceW, SIZEOF(col_sounddevice), col_sounddevice, SIZEOF(data_sounddevice), 0, (BYTE *)data_sounddevice },
|
{ class_sounddeviceW, ARRAY_SIZE(col_sounddevice), col_sounddevice, ARRAY_SIZE(data_sounddevice), 0, (BYTE *)data_sounddevice },
|
||||||
{ class_stdregprovW, SIZEOF(col_stdregprov), col_stdregprov, SIZEOF(data_stdregprov), 0, (BYTE *)data_stdregprov },
|
{ class_stdregprovW, ARRAY_SIZE(col_stdregprov), col_stdregprov, ARRAY_SIZE(data_stdregprov), 0, (BYTE *)data_stdregprov },
|
||||||
{ class_systemsecurityW, SIZEOF(col_systemsecurity), col_systemsecurity, SIZEOF(data_systemsecurity), 0, (BYTE *)data_systemsecurity },
|
{ class_systemsecurityW, ARRAY_SIZE(col_systemsecurity), col_systemsecurity, ARRAY_SIZE(data_systemsecurity), 0, (BYTE *)data_systemsecurity },
|
||||||
{ class_systemenclosureW, SIZEOF(col_systemenclosure), col_systemenclosure, SIZEOF(data_systemenclosure), 0, (BYTE *)data_systemenclosure },
|
{ class_systemenclosureW, ARRAY_SIZE(col_systemenclosure), col_systemenclosure, ARRAY_SIZE(data_systemenclosure), 0, (BYTE *)data_systemenclosure },
|
||||||
{ class_videocontrollerW, SIZEOF(col_videocontroller), col_videocontroller, 0, 0, NULL, fill_videocontroller }
|
{ class_videocontrollerW, ARRAY_SIZE(col_videocontroller), col_videocontroller, 0, 0, NULL, fill_videocontroller }
|
||||||
};
|
};
|
||||||
|
|
||||||
void init_table_list( void )
|
void init_table_list( void )
|
||||||
|
@ -3561,6 +3561,6 @@ void init_table_list( void )
|
||||||
static struct list tables = LIST_INIT( tables );
|
static struct list tables = LIST_INIT( tables );
|
||||||
UINT i;
|
UINT i;
|
||||||
|
|
||||||
for (i = 0; i < SIZEOF(builtin_classes); i++) list_add_tail( &tables, &builtin_classes[i].entry );
|
for (i = 0; i < ARRAY_SIZE(builtin_classes); i++) list_add_tail( &tables, &builtin_classes[i].entry );
|
||||||
table_list = &tables;
|
table_list = &tables;
|
||||||
}
|
}
|
||||||
|
|
|
@ -807,7 +807,7 @@ static WCHAR *build_signature_table_name( const WCHAR *class, const WCHAR *metho
|
||||||
static const WCHAR fmtW[] = {'_','_','%','s','_','%','s','_','%','s',0};
|
static const WCHAR fmtW[] = {'_','_','%','s','_','%','s','_','%','s',0};
|
||||||
static const WCHAR outW[] = {'O','U','T',0};
|
static const WCHAR outW[] = {'O','U','T',0};
|
||||||
static const WCHAR inW[] = {'I','N',0};
|
static const WCHAR inW[] = {'I','N',0};
|
||||||
UINT len = SIZEOF(fmtW) + SIZEOF(outW) + strlenW( class ) + strlenW( method );
|
UINT len = ARRAY_SIZE(fmtW) + ARRAY_SIZE(outW) + strlenW( class ) + strlenW( method );
|
||||||
WCHAR *ret;
|
WCHAR *ret;
|
||||||
|
|
||||||
if (!(ret = heap_alloc( len * sizeof(WCHAR) ))) return NULL;
|
if (!(ret = heap_alloc( len * sizeof(WCHAR) ))) return NULL;
|
||||||
|
@ -826,7 +826,7 @@ HRESULT create_signature( const WCHAR *class, const WCHAR *method, enum param_di
|
||||||
'D','i','r','e','c','t','i','o','n','%','s',0};
|
'D','i','r','e','c','t','i','o','n','%','s',0};
|
||||||
static const WCHAR geW[] = {'>','=','0',0};
|
static const WCHAR geW[] = {'>','=','0',0};
|
||||||
static const WCHAR leW[] = {'<','=','0',0};
|
static const WCHAR leW[] = {'<','=','0',0};
|
||||||
UINT len = SIZEOF(selectW) + SIZEOF(geW);
|
UINT len = ARRAY_SIZE(selectW) + ARRAY_SIZE(geW);
|
||||||
IEnumWbemClassObject *iter;
|
IEnumWbemClassObject *iter;
|
||||||
WCHAR *query, *name;
|
WCHAR *query, *name;
|
||||||
HRESULT hr;
|
HRESULT hr;
|
||||||
|
|
|
@ -109,8 +109,8 @@ static HRESULT create_qualifier_enum( const WCHAR *class, const WCHAR *member, c
|
||||||
|
|
||||||
if (!member) member = noneW;
|
if (!member) member = noneW;
|
||||||
len = strlenW( class ) + strlenW( member );
|
len = strlenW( class ) + strlenW( member );
|
||||||
if (name) len += strlenW( name ) + SIZEOF(fmtW);
|
if (name) len += strlenW( name ) + ARRAY_SIZE(fmtW);
|
||||||
else len += SIZEOF(fmt2W);
|
else len += ARRAY_SIZE(fmt2W);
|
||||||
|
|
||||||
if (!(query = heap_alloc( len * sizeof(WCHAR) ))) return E_OUTOFMEMORY;
|
if (!(query = heap_alloc( len * sizeof(WCHAR) ))) return E_OUTOFMEMORY;
|
||||||
if (name) sprintfW( query, fmtW, class, member, name );
|
if (name) sprintfW( query, fmtW, class, member, name );
|
||||||
|
|
|
@ -420,13 +420,13 @@ static WCHAR *query_from_path( const struct path *path )
|
||||||
|
|
||||||
if (path->filter)
|
if (path->filter)
|
||||||
{
|
{
|
||||||
len = path->class_len + path->filter_len + SIZEOF(selectW);
|
len = path->class_len + path->filter_len + ARRAY_SIZE(selectW);
|
||||||
if (!(query = heap_alloc( len * sizeof(WCHAR) ))) return NULL;
|
if (!(query = heap_alloc( len * sizeof(WCHAR) ))) return NULL;
|
||||||
sprintfW( query, selectW, path->class, path->filter );
|
sprintfW( query, selectW, path->class, path->filter );
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
len = path->class_len + SIZEOF(select_allW);
|
len = path->class_len + ARRAY_SIZE(select_allW);
|
||||||
if (!(query = heap_alloc( len * sizeof(WCHAR) ))) return NULL;
|
if (!(query = heap_alloc( len * sizeof(WCHAR) ))) return NULL;
|
||||||
strcpyW( query, select_allW );
|
strcpyW( query, select_allW );
|
||||||
strcatW( query, path->class );
|
strcatW( query, path->class );
|
||||||
|
|
|
@ -24,8 +24,6 @@
|
||||||
IClientSecurity client_security DECLSPEC_HIDDEN;
|
IClientSecurity client_security DECLSPEC_HIDDEN;
|
||||||
struct list *table_list DECLSPEC_HIDDEN;
|
struct list *table_list DECLSPEC_HIDDEN;
|
||||||
|
|
||||||
#define SIZEOF(array) (sizeof(array)/sizeof((array)[0]))
|
|
||||||
|
|
||||||
enum param_direction
|
enum param_direction
|
||||||
{
|
{
|
||||||
PARAM_OUT = -1,
|
PARAM_OUT = -1,
|
||||||
|
|
|
@ -559,18 +559,18 @@ static const WCHAR whereW[] = {'W','H','E','R','E'};
|
||||||
|
|
||||||
static const struct keyword keyword_table[] =
|
static const struct keyword keyword_table[] =
|
||||||
{
|
{
|
||||||
{ andW, SIZEOF(andW), TK_AND },
|
{ andW, ARRAY_SIZE(andW), TK_AND },
|
||||||
{ byW, SIZEOF(byW), TK_BY },
|
{ byW, ARRAY_SIZE(byW), TK_BY },
|
||||||
{ falseW, SIZEOF(falseW), TK_FALSE },
|
{ falseW, ARRAY_SIZE(falseW), TK_FALSE },
|
||||||
{ fromW, SIZEOF(fromW), TK_FROM },
|
{ fromW, ARRAY_SIZE(fromW), TK_FROM },
|
||||||
{ isW, SIZEOF(isW), TK_IS },
|
{ isW, ARRAY_SIZE(isW), TK_IS },
|
||||||
{ likeW, SIZEOF(likeW), TK_LIKE },
|
{ likeW, ARRAY_SIZE(likeW), TK_LIKE },
|
||||||
{ notW, SIZEOF(notW), TK_NOT },
|
{ notW, ARRAY_SIZE(notW), TK_NOT },
|
||||||
{ nullW, SIZEOF(nullW), TK_NULL },
|
{ nullW, ARRAY_SIZE(nullW), TK_NULL },
|
||||||
{ orW, SIZEOF(orW), TK_OR },
|
{ orW, ARRAY_SIZE(orW), TK_OR },
|
||||||
{ selectW, SIZEOF(selectW), TK_SELECT },
|
{ selectW, ARRAY_SIZE(selectW), TK_SELECT },
|
||||||
{ trueW, SIZEOF(trueW), TK_TRUE },
|
{ trueW, ARRAY_SIZE(trueW), TK_TRUE },
|
||||||
{ whereW, SIZEOF(whereW), TK_WHERE }
|
{ whereW, ARRAY_SIZE(whereW), TK_WHERE }
|
||||||
};
|
};
|
||||||
|
|
||||||
static int cmp_keyword( const void *arg1, const void *arg2 )
|
static int cmp_keyword( const void *arg1, const void *arg2 )
|
||||||
|
@ -594,7 +594,7 @@ static int keyword_type( const WCHAR *str, unsigned int len )
|
||||||
key.name = str;
|
key.name = str;
|
||||||
key.len = len;
|
key.len = len;
|
||||||
key.type = 0;
|
key.type = 0;
|
||||||
ret = bsearch( &key, keyword_table, SIZEOF(keyword_table), sizeof(struct keyword), cmp_keyword );
|
ret = bsearch( &key, keyword_table, ARRAY_SIZE(keyword_table), sizeof(struct keyword), cmp_keyword );
|
||||||
if (ret) return ret->type;
|
if (ret) return ret->type;
|
||||||
return TK_ID;
|
return TK_ID;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue