Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
W
wine-cw
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
wine
wine-cw
Commits
10f23ddb
Commit
10f23ddb
authored
Aug 02, 2018
by
Michael Stefaniuc
Committed by
Alexandre Julliard
Aug 14, 2018
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
ntdll: Use the ARRAY_SIZE() macro.
Signed-off-by:
Michael Stefaniuc
<
mstefani@winehq.org
>
Signed-off-by:
Alexandre Julliard
<
julliard@winehq.org
>
parent
d509b157
Hide whitespace changes
Inline
Side-by-side
Showing
16 changed files
with
33 additions
and
34 deletions
+33
-34
actctx.c
dlls/ntdll/actctx.c
+2
-2
cdrom.c
dlls/ntdll/cdrom.c
+1
-1
debugtools.c
dlls/ntdll/debugtools.c
+1
-1
directory.c
dlls/ntdll/directory.c
+8
-8
file.c
dlls/ntdll/file.c
+1
-1
heap.c
dlls/ntdll/heap.c
+1
-1
loader.c
dlls/ntdll/loader.c
+4
-4
path.c
dlls/ntdll/path.c
+6
-6
relay.c
dlls/ntdll/relay.c
+2
-2
signal_arm.c
dlls/ntdll/signal_arm.c
+1
-1
signal_arm64.c
dlls/ntdll/signal_arm64.c
+1
-1
signal_i386.c
dlls/ntdll/signal_i386.c
+1
-1
signal_powerpc.c
dlls/ntdll/signal_powerpc.c
+1
-1
signal_x86_64.c
dlls/ntdll/signal_x86_64.c
+1
-1
time.c
dlls/ntdll/time.c
+1
-2
virtual.c
dlls/ntdll/virtual.c
+1
-1
No files found.
dlls/ntdll/actctx.c
View file @
10f23ddb
...
...
@@ -1556,7 +1556,7 @@ static OLEMISC get_olemisc_value(const WCHAR *str, int len)
int
min
,
max
;
min
=
0
;
max
=
sizeof
(
olemisc_values
)
/
sizeof
(
struct
olemisc_entry
)
-
1
;
max
=
ARRAY_SIZE
(
olemisc_values
)
-
1
;
while
(
min
<=
max
)
{
...
...
@@ -3131,7 +3131,7 @@ static WCHAR *lookup_manifest_file( HANDLE dir, struct assembly_identity *ai )
tmp
=
strchrW
(
tmp
,
'_'
)
+
1
;
tmp
=
strchrW
(
tmp
,
'_'
)
+
1
;
if
(
dir_info
->
FileNameLength
-
(
tmp
-
dir_info
->
FileName
)
*
sizeof
(
WCHAR
)
==
sizeof
(
wine_trailerW
)
&&
!
memicmpW
(
tmp
,
wine_trailerW
,
sizeof
(
wine_trailerW
)
/
sizeof
(
WCHAR
)
))
!
memicmpW
(
tmp
,
wine_trailerW
,
ARRAY_SIZE
(
wine_trailerW
)
))
{
/* prefer a non-Wine manifest if we already have one */
/* we'll still load the builtin dll if specified through DllOverrides */
...
...
dlls/ntdll/cdrom.c
View file @
10f23ddb
...
...
@@ -208,7 +208,7 @@ static const char *iocodex(DWORD code)
{
unsigned
int
i
;
static
char
buffer
[
25
];
for
(
i
=
0
;
i
<
sizeof
(
iocodextable
)
/
sizeof
(
struct
iocodexs
);
i
++
)
for
(
i
=
0
;
i
<
ARRAY_SIZE
(
iocodextable
);
i
++
)
if
(
code
==
iocodextable
[
i
].
code
)
return
iocodextable
[
i
].
codex
;
sprintf
(
buffer
,
"IOCTL_CODE_%x"
,
(
int
)
code
);
...
...
dlls/ntdll/debugtools.c
View file @
10f23ddb
...
...
@@ -175,7 +175,7 @@ static int NTDLL_dbg_vlog( enum __wine_debug_class cls, struct __wine_debug_chan
ret
+=
wine_dbg_printf
(
"%04x:"
,
GetCurrentThreadId
()
);
if
(
*
format
==
'\1'
)
/* special magic to avoid standard prefix */
format
++
;
else
if
(
cls
<
sizeof
(
classes
)
/
sizeof
(
classes
[
0
]
))
else
if
(
cls
<
ARRAY_SIZE
(
classes
))
ret
+=
wine_dbg_printf
(
"%s:%s:%s "
,
classes
[
cls
],
channel
->
name
,
function
);
}
if
(
format
)
...
...
dlls/ntdll/directory.c
View file @
10f23ddb
...
...
@@ -1008,7 +1008,7 @@ struct vol_caps
static
struct
fs_cache
*
look_up_fs_cache
(
dev_t
dev
)
{
int
i
;
for
(
i
=
0
;
i
<
sizeof
(
fs_cache
)
/
sizeof
(
fs_cache
[
0
]
);
i
++
)
for
(
i
=
0
;
i
<
ARRAY_SIZE
(
fs_cache
);
i
++
)
if
(
fs_cache
[
i
].
dev
==
dev
)
return
fs_cache
+
i
;
return
NULL
;
...
...
@@ -1033,7 +1033,7 @@ static void add_fs_cache( dev_t dev, fsid_t fsid, BOOLEAN case_sensitive )
}
/* Add a new entry */
for
(
i
=
0
;
i
<
sizeof
(
fs_cache
)
/
sizeof
(
fs_cache
[
0
]
);
i
++
)
for
(
i
=
0
;
i
<
ARRAY_SIZE
(
fs_cache
);
i
++
)
if
(
fs_cache
[
i
].
dev
==
0
)
{
/* This entry is empty, use it */
...
...
@@ -1455,8 +1455,8 @@ static BOOL append_entry( struct dir_data *data, const char *long_name,
if
(
short_name
)
{
short_len
=
ntdll_umbstowcs
(
0
,
short_name
,
strlen
(
short_name
),
short_nameW
,
sizeof
(
short_nameW
)
/
sizeof
(
WCHAR
)
-
1
);
if
(
short_len
==
-
1
)
short_len
=
sizeof
(
short_nameW
)
/
sizeof
(
WCHAR
)
-
1
;
short_nameW
,
ARRAY_SIZE
(
short_nameW
)
-
1
);
if
(
short_len
==
-
1
)
short_len
=
ARRAY_SIZE
(
short_nameW
)
-
1
;
for
(
i
=
0
;
i
<
short_len
;
i
++
)
short_nameW
[
i
]
=
toupperW
(
short_nameW
[
i
]
);
}
else
/* generate a short name if necessary */
...
...
@@ -2291,7 +2291,7 @@ static void init_redirects(void)
{
windir
.
dev
=
st
.
st_dev
;
windir
.
ino
=
st
.
st_ino
;
nb_redirects
=
sizeof
(
redirects
)
/
sizeof
(
redirects
[
0
]
);
nb_redirects
=
ARRAY_SIZE
(
redirects
);
for
(
i
=
0
;
i
<
nb_redirects
;
i
++
)
{
if
(
!
redirects
[
i
].
dos_target
)
continue
;
...
...
@@ -2473,11 +2473,11 @@ static inline int get_dos_prefix_len( const UNICODE_STRING *name )
if
(
name
->
Length
>=
sizeof
(
nt_prefixW
)
&&
!
memcmp
(
name
->
Buffer
,
nt_prefixW
,
sizeof
(
nt_prefixW
)
))
return
sizeof
(
nt_prefixW
)
/
sizeof
(
WCHAR
);
return
ARRAY_SIZE
(
nt_prefixW
);
if
(
name
->
Length
>=
sizeof
(
dosdev_prefixW
)
&&
!
memicmpW
(
name
->
Buffer
,
dosdev_prefixW
,
sizeof
(
dosdev_prefixW
)
/
sizeof
(
WCHAR
)
))
return
sizeof
(
dosdev_prefixW
)
/
sizeof
(
WCHAR
);
!
memicmpW
(
name
->
Buffer
,
dosdev_prefixW
,
ARRAY_SIZE
(
dosdev_prefixW
)
))
return
ARRAY_SIZE
(
dosdev_prefixW
);
return
0
;
}
...
...
dlls/ntdll/file.c
View file @
10f23ddb
...
...
@@ -3256,7 +3256,7 @@ NTSTATUS WINAPI NtQueryVolumeInformationFile( HANDLE handle, PIO_STATUS_BLOCK io
}
break
;
case
FileFsAttributeInformation
:
if
(
length
<
offsetof
(
FILE_FS_ATTRIBUTE_INFORMATION
,
FileSystemName
[
sizeof
(
ntfsW
)
/
sizeof
(
WCHAR
)]
))
if
(
length
<
offsetof
(
FILE_FS_ATTRIBUTE_INFORMATION
,
FileSystemName
[
ARRAY_SIZE
(
ntfsW
)]
))
io
->
u
.
Status
=
STATUS_BUFFER_TOO_SMALL
;
else
{
...
...
dlls/ntdll/heap.c
View file @
10f23ddb
...
...
@@ -124,7 +124,7 @@ static const SIZE_T HEAP_freeListSizes[] =
{
0x200
,
0x400
,
0x1000
,
~
0UL
};
#define HEAP_NB_FREE_LISTS (
sizeof(HEAP_freeListSizes) / sizeof(HEAP_freeListSizes[0]
) + HEAP_NB_SMALL_FREE_LISTS)
#define HEAP_NB_FREE_LISTS (
ARRAY_SIZE( HEAP_freeListSizes
) + HEAP_NB_SMALL_FREE_LISTS)
typedef
union
{
...
...
dlls/ntdll/loader.c
View file @
10f23ddb
...
...
@@ -1878,7 +1878,7 @@ static NTSTATUS perform_relocations( void *module, SIZE_T len )
if
(
!
relocs
->
Size
)
return
STATUS_SUCCESS
;
if
(
!
relocs
->
VirtualAddress
)
return
STATUS_CONFLICTING_ADDRESSES
;
if
(
nt
->
FileHeader
.
NumberOfSections
>
sizeof
(
protect_old
)
/
sizeof
(
protect_old
[
0
]
))
if
(
nt
->
FileHeader
.
NumberOfSections
>
ARRAY_SIZE
(
protect_old
))
return
STATUS_INVALID_IMAGE_FORMAT
;
sec
=
(
const
IMAGE_SECTION_HEADER
*
)((
const
char
*
)
&
nt
->
OptionalHeader
+
...
...
@@ -2275,7 +2275,7 @@ static NTSTATUS find_actctx_dll( LPCWSTR libname, LPWSTR *fullname )
strcpyW
(
p
,
user_shared_data
->
NtSystemRoot
);
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
++
=
'\\'
;
...
...
@@ -2840,7 +2840,7 @@ NTSTATUS WINAPI LdrQueryImageFileExecutionOptions( const UNICODE_STRING *key, LP
'C'
,
'u'
,
'r'
,
'r'
,
'e'
,
'n'
,
't'
,
'V'
,
'e'
,
'r'
,
's'
,
'i'
,
'o'
,
'n'
,
'\\'
,
'I'
,
'm'
,
'a'
,
'g'
,
'e'
,
' '
,
'F'
,
'i'
,
'l'
,
'e'
,
' '
,
'E'
,
'x'
,
'e'
,
'c'
,
'u'
,
't'
,
'i'
,
'o'
,
'n'
,
' '
,
'O'
,
'p'
,
't'
,
'i'
,
'o'
,
'n'
,
's'
,
'\\'
};
WCHAR
path
[
MAX_PATH
+
sizeof
(
optionsW
)
/
sizeof
(
WCHAR
)];
WCHAR
path
[
MAX_PATH
+
ARRAY_SIZE
(
optionsW
)];
OBJECT_ATTRIBUTES
attr
;
UNICODE_STRING
name_str
;
HANDLE
hkey
;
...
...
@@ -2862,7 +2862,7 @@ NTSTATUS WINAPI LdrQueryImageFileExecutionOptions( const UNICODE_STRING *key, LP
name_str
.
Length
=
sizeof
(
optionsW
)
+
len
;
name_str
.
MaximumLength
=
name_str
.
Length
;
memcpy
(
path
,
optionsW
,
sizeof
(
optionsW
)
);
memcpy
(
path
+
sizeof
(
optionsW
)
/
sizeof
(
WCHAR
),
p
,
len
);
memcpy
(
path
+
ARRAY_SIZE
(
optionsW
),
p
,
len
);
if
((
status
=
NtOpenKey
(
&
hkey
,
KEY_QUERY_VALUE
,
&
attr
)))
return
status
;
if
(
type
==
REG_DWORD
)
...
...
dlls/ntdll/path.c
View file @
10f23ddb
...
...
@@ -1116,12 +1116,12 @@ NTSTATUS CDECL wine_unix_to_nt_file_name( const ANSI_STRING *name, UNICODE_STRIN
goto
done
;
}
memcpy
(
nt
->
Buffer
,
unix_prefixW
,
sizeof
(
unix_prefixW
)
);
ntdll_umbstowcs
(
0
,
path
,
lenA
,
nt
->
Buffer
+
sizeof
(
unix_prefixW
)
/
sizeof
(
WCHAR
),
lenW
);
lenW
+=
sizeof
(
unix_prefixW
)
/
sizeof
(
WCHAR
);
ntdll_umbstowcs
(
0
,
path
,
lenA
,
nt
->
Buffer
+
ARRAY_SIZE
(
unix_prefixW
),
lenW
);
lenW
+=
ARRAY_SIZE
(
unix_prefixW
);
nt
->
Buffer
[
lenW
]
=
0
;
nt
->
Length
=
lenW
*
sizeof
(
WCHAR
);
nt
->
MaximumLength
=
nt
->
Length
+
sizeof
(
WCHAR
);
for
(
p
=
nt
->
Buffer
+
sizeof
(
unix_prefixW
)
/
sizeof
(
WCHAR
);
*
p
;
p
++
)
if
(
*
p
==
'/'
)
*
p
=
'\\'
;
for
(
p
=
nt
->
Buffer
+
ARRAY_SIZE
(
unix_prefixW
);
*
p
;
p
++
)
if
(
*
p
==
'/'
)
*
p
=
'\\'
;
status
=
STATUS_SUCCESS
;
}
goto
done
;
...
...
@@ -1138,12 +1138,12 @@ NTSTATUS CDECL wine_unix_to_nt_file_name( const ANSI_STRING *name, UNICODE_STRIN
memcpy
(
nt
->
Buffer
,
prefixW
,
sizeof
(
prefixW
)
);
nt
->
Buffer
[
4
]
+=
drive
;
ntdll_umbstowcs
(
0
,
path
,
lenA
,
nt
->
Buffer
+
sizeof
(
prefixW
)
/
sizeof
(
WCHAR
),
lenW
);
lenW
+=
sizeof
(
prefixW
)
/
sizeof
(
WCHAR
);
ntdll_umbstowcs
(
0
,
path
,
lenA
,
nt
->
Buffer
+
ARRAY_SIZE
(
prefixW
),
lenW
);
lenW
+=
ARRAY_SIZE
(
prefixW
);
nt
->
Buffer
[
lenW
]
=
0
;
nt
->
Length
=
lenW
*
sizeof
(
WCHAR
);
nt
->
MaximumLength
=
nt
->
Length
+
sizeof
(
WCHAR
);
for
(
p
=
nt
->
Buffer
+
sizeof
(
prefixW
)
/
sizeof
(
WCHAR
);
*
p
;
p
++
)
if
(
*
p
==
'/'
)
*
p
=
'\\'
;
for
(
p
=
nt
->
Buffer
+
ARRAY_SIZE
(
prefixW
);
*
p
;
p
++
)
if
(
*
p
==
'/'
)
*
p
=
'\\'
;
done:
RtlFreeHeap
(
GetProcessHeap
(),
0
,
cwd
);
...
...
dlls/ntdll/relay.c
View file @
10f23ddb
...
...
@@ -1197,10 +1197,10 @@ void WINAPI DECLSPEC_HIDDEN __regs_SNOOP_Entry( void **stack )
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
);
}
...
...
dlls/ntdll/signal_arm.c
View file @
10f23ddb
...
...
@@ -940,7 +940,7 @@ static void usr1_handler( int signal, siginfo_t *siginfo, void *sigcontext )
*/
int
CDECL
__wine_set_signal_handler
(
unsigned
int
sig
,
wine_signal_handler
wsh
)
{
if
(
sig
>=
sizeof
(
handlers
)
/
sizeof
(
handlers
[
0
]
))
return
-
1
;
if
(
sig
>=
ARRAY_SIZE
(
handlers
))
return
-
1
;
if
(
handlers
[
sig
]
!=
NULL
)
return
-
2
;
handlers
[
sig
]
=
wsh
;
return
0
;
...
...
dlls/ntdll/signal_arm64.c
View file @
10f23ddb
...
...
@@ -838,7 +838,7 @@ static void usr1_handler( int signal, siginfo_t *siginfo, void *sigcontext )
*/
int
CDECL
__wine_set_signal_handler
(
unsigned
int
sig
,
wine_signal_handler
wsh
)
{
if
(
sig
>=
sizeof
(
handlers
)
/
sizeof
(
handlers
[
0
]
))
return
-
1
;
if
(
sig
>=
ARRAY_SIZE
(
handlers
))
return
-
1
;
if
(
handlers
[
sig
]
!=
NULL
)
return
-
2
;
handlers
[
sig
]
=
wsh
;
return
0
;
...
...
dlls/ntdll/signal_i386.c
View file @
10f23ddb
...
...
@@ -2221,7 +2221,7 @@ static void usr1_handler( int signal, siginfo_t *siginfo, void *sigcontext )
*/
int
CDECL
__wine_set_signal_handler
(
unsigned
int
sig
,
wine_signal_handler
wsh
)
{
if
(
sig
>=
sizeof
(
handlers
)
/
sizeof
(
handlers
[
0
]
))
return
-
1
;
if
(
sig
>=
ARRAY_SIZE
(
handlers
))
return
-
1
;
if
(
handlers
[
sig
]
!=
NULL
)
return
-
2
;
handlers
[
sig
]
=
wsh
;
return
0
;
...
...
dlls/ntdll/signal_powerpc.c
View file @
10f23ddb
...
...
@@ -1006,7 +1006,7 @@ static void usr1_handler( int signal, siginfo_t *siginfo, void *sigcontext )
*/
int
CDECL
__wine_set_signal_handler
(
unsigned
int
sig
,
wine_signal_handler
wsh
)
{
if
(
sig
>=
sizeof
(
handlers
)
/
sizeof
(
handlers
[
0
]
))
return
-
1
;
if
(
sig
>=
ARRAY_SIZE
(
handlers
))
return
-
1
;
if
(
handlers
[
sig
]
!=
NULL
)
return
-
2
;
handlers
[
sig
]
=
wsh
;
return
0
;
...
...
dlls/ntdll/signal_x86_64.c
View file @
10f23ddb
...
...
@@ -3247,7 +3247,7 @@ static void usr1_handler( int signal, siginfo_t *siginfo, void *ucontext )
*/
int
CDECL
__wine_set_signal_handler
(
unsigned
int
sig
,
wine_signal_handler
wsh
)
{
if
(
sig
>=
sizeof
(
handlers
)
/
sizeof
(
handlers
[
0
]
))
return
-
1
;
if
(
sig
>=
ARRAY_SIZE
(
handlers
))
return
-
1
;
if
(
handlers
[
sig
]
!=
NULL
)
return
-
2
;
handlers
[
sig
]
=
wsh
;
return
0
;
...
...
dlls/ntdll/time.c
View file @
10f23ddb
...
...
@@ -605,8 +605,7 @@ static BOOL match_tz_name(const char* tz_name,
return
TRUE
;
strcpyW
(
key
.
key_name
,
reg_tzi
->
TimeZoneKeyName
);
match
=
bsearch
(
&
key
,
mapping
,
sizeof
(
mapping
)
/
sizeof
(
mapping
[
0
]),
sizeof
(
mapping
[
0
]),
compare_tz_key
);
match
=
bsearch
(
&
key
,
mapping
,
ARRAY_SIZE
(
mapping
),
sizeof
(
mapping
[
0
]),
compare_tz_key
);
if
(
!
match
)
return
TRUE
;
...
...
dlls/ntdll/virtual.c
View file @
10f23ddb
...
...
@@ -1416,7 +1416,7 @@ static NTSTATUS map_image( HANDLE hmapping, ACCESS_MASK access, int fd, SIZE_T m
memset
(
ptr
+
header_size
,
0
,
header_end
-
(
ptr
+
header_size
)
);
if
((
char
*
)(
nt
+
1
)
>
header_end
)
goto
error
;
header_start
=
(
char
*
)
&
nt
->
OptionalHeader
+
nt
->
FileHeader
.
SizeOfOptionalHeader
;
if
(
nt
->
FileHeader
.
NumberOfSections
>
sizeof
(
sections
)
/
sizeof
(
*
sections
))
goto
error
;
if
(
nt
->
FileHeader
.
NumberOfSections
>
ARRAY_SIZE
(
sections
))
goto
error
;
if
(
header_start
+
sizeof
(
*
sections
)
*
nt
->
FileHeader
.
NumberOfSections
>
header_end
)
goto
error
;
/* Some applications (e.g. the Steam version of Borderlands) map over the top of the section headers,
* copying the headers into local memory is necessary to properly load such applications. */
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment