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
9e365e4e
Commit
9e365e4e
authored
Oct 22, 2018
by
Michael Stefaniuc
Committed by
Alexandre Julliard
Oct 23, 2018
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
server: Use the ARRAY_SIZE() macro.
Signed-off-by:
Michael Stefaniuc
<
mstefani@winehq.org
>
Signed-off-by:
Alexandre Julliard
<
julliard@winehq.org
>
parent
e9d844f2
Hide whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
25 additions
and
26 deletions
+25
-26
clipboard.c
server/clipboard.c
+1
-1
directory.c
server/directory.c
+1
-1
fd.c
server/fd.c
+5
-5
mapping.c
server/mapping.c
+1
-1
queue.c
server/queue.c
+2
-2
registry.c
server/registry.c
+9
-9
token.c
server/token.c
+5
-6
trace.c
server/trace.c
+1
-1
No files found.
server/clipboard.c
View file @
9e365e4e
...
@@ -214,7 +214,7 @@ static int synthesize_formats( struct clipboard *clipboard )
...
@@ -214,7 +214,7 @@ static int synthesize_formats( struct clipboard *clipboard )
else
free
(
data
);
else
free
(
data
);
}
}
for
(
i
=
0
;
i
<
sizeof
(
formats
)
/
sizeof
(
formats
[
0
]
);
i
++
)
for
(
i
=
0
;
i
<
ARRAY_SIZE
(
formats
);
i
++
)
{
{
if
(
HAS_FORMAT
(
map
,
formats
[
i
][
0
]
))
continue
;
if
(
HAS_FORMAT
(
map
,
formats
[
i
][
0
]
))
continue
;
if
(
HAS_FORMAT
(
map
,
formats
[
i
][
1
]
))
from
=
formats
[
i
][
1
];
if
(
HAS_FORMAT
(
map
,
formats
[
i
][
1
]
))
from
=
formats
[
i
][
1
];
...
...
server/directory.c
View file @
9e365e4e
...
@@ -421,7 +421,7 @@ void init_directories(void)
...
@@ -421,7 +421,7 @@ void init_directories(void)
make_object_static
(
link_mailslot
);
make_object_static
(
link_mailslot
);
/* events */
/* events */
for
(
i
=
0
;
i
<
sizeof
(
kernel_events
)
/
sizeof
(
kernel_events
[
0
]
);
i
++
)
for
(
i
=
0
;
i
<
ARRAY_SIZE
(
kernel_events
);
i
++
)
{
{
struct
event
*
event
=
create_event
(
&
dir_kernel
->
obj
,
&
kernel_events
[
i
],
0
,
1
,
0
,
NULL
);
struct
event
*
event
=
create_event
(
&
dir_kernel
->
obj
,
&
kernel_events
[
i
],
0
,
1
,
0
,
NULL
);
make_object_static
(
(
struct
object
*
)
event
);
make_object_static
(
(
struct
object
*
)
event
);
...
...
server/fd.c
View file @
9e365e4e
...
@@ -535,7 +535,7 @@ static inline void main_loop_epoll(void)
...
@@ -535,7 +535,7 @@ static inline void main_loop_epoll(void)
if
(
!
active_users
)
break
;
/* last user removed by a timeout */
if
(
!
active_users
)
break
;
/* last user removed by a timeout */
if
(
epoll_fd
==
-
1
)
break
;
/* an error occurred with epoll */
if
(
epoll_fd
==
-
1
)
break
;
/* an error occurred with epoll */
ret
=
epoll_wait
(
epoll_fd
,
events
,
sizeof
(
events
)
/
sizeof
(
events
[
0
]
),
timeout
);
ret
=
epoll_wait
(
epoll_fd
,
events
,
ARRAY_SIZE
(
events
),
timeout
);
set_current_time
();
set_current_time
();
/* put the events into the pollfd array first, like poll does */
/* put the events into the pollfd array first, like poll does */
...
@@ -646,9 +646,9 @@ static inline void main_loop_epoll(void)
...
@@ -646,9 +646,9 @@ static inline void main_loop_epoll(void)
ts
.
tv_sec
=
timeout
/
1000
;
ts
.
tv_sec
=
timeout
/
1000
;
ts
.
tv_nsec
=
(
timeout
%
1000
)
*
1000000
;
ts
.
tv_nsec
=
(
timeout
%
1000
)
*
1000000
;
ret
=
kevent
(
kqueue_fd
,
NULL
,
0
,
events
,
sizeof
(
events
)
/
sizeof
(
events
[
0
]
),
&
ts
);
ret
=
kevent
(
kqueue_fd
,
NULL
,
0
,
events
,
ARRAY_SIZE
(
events
),
&
ts
);
}
}
else
ret
=
kevent
(
kqueue_fd
,
NULL
,
0
,
events
,
sizeof
(
events
)
/
sizeof
(
events
[
0
]
),
NULL
);
else
ret
=
kevent
(
kqueue_fd
,
NULL
,
0
,
events
,
ARRAY_SIZE
(
events
),
NULL
);
set_current_time
();
set_current_time
();
...
@@ -750,9 +750,9 @@ static inline void main_loop_epoll(void)
...
@@ -750,9 +750,9 @@ static inline void main_loop_epoll(void)
ts
.
tv_sec
=
timeout
/
1000
;
ts
.
tv_sec
=
timeout
/
1000
;
ts
.
tv_nsec
=
(
timeout
%
1000
)
*
1000000
;
ts
.
tv_nsec
=
(
timeout
%
1000
)
*
1000000
;
ret
=
port_getn
(
port_fd
,
events
,
sizeof
(
events
)
/
sizeof
(
events
[
0
]
),
&
nget
,
&
ts
);
ret
=
port_getn
(
port_fd
,
events
,
ARRAY_SIZE
(
events
),
&
nget
,
&
ts
);
}
}
else
ret
=
port_getn
(
port_fd
,
events
,
sizeof
(
events
)
/
sizeof
(
events
[
0
]
),
&
nget
,
NULL
);
else
ret
=
port_getn
(
port_fd
,
events
,
ARRAY_SIZE
(
events
),
&
nget
,
NULL
);
if
(
ret
==
-
1
)
break
;
/* an error occurred with event completion */
if
(
ret
==
-
1
)
break
;
/* an error occurred with event completion */
...
...
server/mapping.c
View file @
9e365e4e
...
@@ -695,7 +695,7 @@ static unsigned int get_image_params( struct mapping *mapping, file_pos_t file_s
...
@@ -695,7 +695,7 @@ static unsigned int get_image_params( struct mapping *mapping, file_pos_t file_s
/* load the section headers */
/* load the section headers */
pos
+=
sizeof
(
nt
.
Signature
)
+
sizeof
(
nt
.
FileHeader
)
+
nt
.
FileHeader
.
SizeOfOptionalHeader
;
pos
+=
sizeof
(
nt
.
Signature
)
+
sizeof
(
nt
.
FileHeader
)
+
nt
.
FileHeader
.
SizeOfOptionalHeader
;
if
(
nt
.
FileHeader
.
NumberOfSections
>
sizeof
(
sec
)
/
sizeof
(
sec
[
0
]
))
return
STATUS_INVALID_IMAGE_FORMAT
;
if
(
nt
.
FileHeader
.
NumberOfSections
>
ARRAY_SIZE
(
sec
))
return
STATUS_INVALID_IMAGE_FORMAT
;
size
=
sizeof
(
*
sec
)
*
nt
.
FileHeader
.
NumberOfSections
;
size
=
sizeof
(
*
sec
)
*
nt
.
FileHeader
.
NumberOfSections
;
if
(
!
mapping
->
size
)
mapping
->
size
=
mapping
->
image
.
map_size
;
if
(
!
mapping
->
size
)
mapping
->
size
=
mapping
->
image
.
map_size
;
else
if
(
mapping
->
size
>
mapping
->
image
.
map_size
)
return
STATUS_SECTION_TOO_BIG
;
else
if
(
mapping
->
size
>
mapping
->
image
.
map_size
)
return
STATUS_SECTION_TOO_BIG
;
...
...
server/queue.c
View file @
9e365e4e
...
@@ -1666,7 +1666,7 @@ static int queue_mouse_message( struct desktop *desktop, user_handle_t win, cons
...
@@ -1666,7 +1666,7 @@ static int queue_mouse_message( struct desktop *desktop, user_handle_t win, cons
queue_hardware_message
(
desktop
,
msg
,
0
);
queue_hardware_message
(
desktop
,
msg
,
0
);
}
}
for
(
i
=
0
;
i
<
sizeof
(
messages
)
/
sizeof
(
messages
[
0
]
);
i
++
)
for
(
i
=
0
;
i
<
ARRAY_SIZE
(
messages
);
i
++
)
{
{
if
(
!
messages
[
i
])
continue
;
if
(
!
messages
[
i
])
continue
;
if
(
!
(
flags
&
(
1
<<
i
)))
continue
;
if
(
!
(
flags
&
(
1
<<
i
)))
continue
;
...
@@ -1695,7 +1695,7 @@ static int queue_mouse_message( struct desktop *desktop, user_handle_t win, cons
...
@@ -1695,7 +1695,7 @@ static int queue_mouse_message( struct desktop *desktop, user_handle_t win, cons
if
(
hook_flags
&
SEND_HWMSG_INJECTED
)
msg_data
->
flags
=
LLMHF_INJECTED
;
if
(
hook_flags
&
SEND_HWMSG_INJECTED
)
msg_data
->
flags
=
LLMHF_INJECTED
;
/* specify a sender only when sending the last message */
/* specify a sender only when sending the last message */
if
(
!
(
flags
&
((
1
<<
sizeof
(
messages
)
/
sizeof
(
messages
[
0
]
))
-
1
)))
if
(
!
(
flags
&
((
1
<<
ARRAY_SIZE
(
messages
))
-
1
)))
{
{
if
(
!
(
wait
=
send_hook_ll_message
(
desktop
,
msg
,
input
,
sender
)))
if
(
!
(
wait
=
send_hook_ll_message
(
desktop
,
msg
,
input
,
sender
)))
queue_hardware_message
(
desktop
,
msg
,
0
);
queue_hardware_message
(
desktop
,
msg
,
0
);
...
...
server/registry.c
View file @
9e365e4e
...
@@ -178,7 +178,7 @@ static const struct object_ops key_ops =
...
@@ -178,7 +178,7 @@ static const struct object_ops key_ops =
static
inline
int
is_wow6432node
(
const
WCHAR
*
name
,
unsigned
int
len
)
static
inline
int
is_wow6432node
(
const
WCHAR
*
name
,
unsigned
int
len
)
{
{
return
(
len
==
sizeof
(
wow6432node
)
&&
return
(
len
==
sizeof
(
wow6432node
)
&&
!
memicmpW
(
name
,
wow6432node
,
sizeof
(
wow6432node
)
/
sizeof
(
WCHAR
)
));
!
memicmpW
(
name
,
wow6432node
,
ARRAY_SIZE
(
wow6432node
)
));
}
}
/*
/*
...
@@ -439,9 +439,9 @@ static inline void get_req_path( struct unicode_str *str, int skip_root )
...
@@ -439,9 +439,9 @@ static inline void get_req_path( struct unicode_str *str, int skip_root )
str
->
len
=
(
get_req_data_size
()
/
sizeof
(
WCHAR
))
*
sizeof
(
WCHAR
);
str
->
len
=
(
get_req_data_size
()
/
sizeof
(
WCHAR
))
*
sizeof
(
WCHAR
);
if
(
skip_root
&&
str
->
len
>=
sizeof
(
root_name
)
&&
if
(
skip_root
&&
str
->
len
>=
sizeof
(
root_name
)
&&
!
memicmpW
(
str
->
str
,
root_name
,
sizeof
(
root_name
)
/
sizeof
(
WCHAR
)
))
!
memicmpW
(
str
->
str
,
root_name
,
ARRAY_SIZE
(
root_name
)
))
{
{
str
->
str
+=
sizeof
(
root_name
)
/
sizeof
(
WCHAR
);
str
->
str
+=
ARRAY_SIZE
(
root_name
);
str
->
len
-=
sizeof
(
root_name
);
str
->
len
-=
sizeof
(
root_name
);
}
}
}
}
...
@@ -691,8 +691,8 @@ static struct key *follow_symlink( struct key *key, int iteration )
...
@@ -691,8 +691,8 @@ static struct key *follow_symlink( struct key *key, int iteration )
path
.
str
=
value
->
data
;
path
.
str
=
value
->
data
;
path
.
len
=
(
value
->
len
/
sizeof
(
WCHAR
))
*
sizeof
(
WCHAR
);
path
.
len
=
(
value
->
len
/
sizeof
(
WCHAR
))
*
sizeof
(
WCHAR
);
if
(
path
.
len
<=
sizeof
(
root_name
))
return
NULL
;
if
(
path
.
len
<=
sizeof
(
root_name
))
return
NULL
;
if
(
memicmpW
(
path
.
str
,
root_name
,
sizeof
(
root_name
)
/
sizeof
(
WCHAR
)
))
return
NULL
;
if
(
memicmpW
(
path
.
str
,
root_name
,
ARRAY_SIZE
(
root_name
)
))
return
NULL
;
path
.
str
+=
sizeof
(
root_name
)
/
sizeof
(
WCHAR
);
path
.
str
+=
ARRAY_SIZE
(
root_name
);
path
.
len
-=
sizeof
(
root_name
);
path
.
len
-=
sizeof
(
root_name
);
key
=
root_key
;
key
=
root_key
;
...
@@ -2052,9 +2052,9 @@ DECL_HANDLER(create_key)
...
@@ -2052,9 +2052,9 @@ DECL_HANDLER(create_key)
class
.
len
=
(
class
.
len
/
sizeof
(
WCHAR
))
*
sizeof
(
WCHAR
);
class
.
len
=
(
class
.
len
/
sizeof
(
WCHAR
))
*
sizeof
(
WCHAR
);
if
(
!
objattr
->
rootdir
&&
name
.
len
>=
sizeof
(
root_name
)
&&
if
(
!
objattr
->
rootdir
&&
name
.
len
>=
sizeof
(
root_name
)
&&
!
memicmpW
(
name
.
str
,
root_name
,
sizeof
(
root_name
)
/
sizeof
(
WCHAR
)
))
!
memicmpW
(
name
.
str
,
root_name
,
ARRAY_SIZE
(
root_name
)
))
{
{
name
.
str
+=
sizeof
(
root_name
)
/
sizeof
(
WCHAR
);
name
.
str
+=
ARRAY_SIZE
(
root_name
);
name
.
len
-=
sizeof
(
root_name
);
name
.
len
-=
sizeof
(
root_name
);
}
}
...
@@ -2210,9 +2210,9 @@ DECL_HANDLER(load_registry)
...
@@ -2210,9 +2210,9 @@ DECL_HANDLER(load_registry)
}
}
if
(
!
objattr
->
rootdir
&&
name
.
len
>=
sizeof
(
root_name
)
&&
if
(
!
objattr
->
rootdir
&&
name
.
len
>=
sizeof
(
root_name
)
&&
!
memicmpW
(
name
.
str
,
root_name
,
sizeof
(
root_name
)
/
sizeof
(
WCHAR
)
))
!
memicmpW
(
name
.
str
,
root_name
,
ARRAY_SIZE
(
root_name
)
))
{
{
name
.
str
+=
sizeof
(
root_name
)
/
sizeof
(
WCHAR
);
name
.
str
+=
ARRAY_SIZE
(
root_name
);
name
.
len
-=
sizeof
(
root_name
);
name
.
len
-=
sizeof
(
root_name
);
}
}
...
...
server/token.c
View file @
9e365e4e
...
@@ -791,12 +791,11 @@ struct token *token_create_admin( void )
...
@@ -791,12 +791,11 @@ struct token *token_create_admin( void )
const
SID
*
user_sid
=
security_unix_uid_to_sid
(
getuid
()
);
const
SID
*
user_sid
=
security_unix_uid_to_sid
(
getuid
()
);
ACL
*
default_dacl
=
create_default_dacl
(
user_sid
);
ACL
*
default_dacl
=
create_default_dacl
(
user_sid
);
alias_admins_sid
=
security_sid_alloc
(
&
nt_authority
,
sizeof
(
alias_admins_subauth
)
/
sizeof
(
alias_admins_subauth
[
0
]
),
alias_admins_sid
=
security_sid_alloc
(
&
nt_authority
,
ARRAY_SIZE
(
alias_admins_subauth
),
alias_admins_subauth
);
alias_admins_subauth
);
alias_users_sid
=
security_sid_alloc
(
&
nt_authority
,
sizeof
(
alias_users_subauth
)
/
sizeof
(
alias_users_subauth
[
0
]
),
alias_users_sid
=
security_sid_alloc
(
&
nt_authority
,
ARRAY_SIZE
(
alias_users_subauth
),
alias_users_subauth
);
alias_users_subauth
);
logon_sid
=
security_sid_alloc
(
&
nt_authority
,
sizeof
(
logon_subauth
)
/
sizeof
(
logon_subauth
[
0
]),
logon_sid
=
security_sid_alloc
(
&
nt_authority
,
ARRAY_SIZE
(
logon_subauth
),
logon_subauth
);
logon_subauth
);
if
(
alias_admins_sid
&&
alias_users_sid
&&
logon_sid
&&
default_dacl
)
if
(
alias_admins_sid
&&
alias_users_sid
&&
logon_sid
&&
default_dacl
)
{
{
...
@@ -836,8 +835,8 @@ struct token *token_create_admin( void )
...
@@ -836,8 +835,8 @@ struct token *token_create_admin( void )
{
logon_sid
,
SE_GROUP_ENABLED
|
SE_GROUP_ENABLED_BY_DEFAULT
|
SE_GROUP_MANDATORY
|
SE_GROUP_LOGON_ID
},
{
logon_sid
,
SE_GROUP_ENABLED
|
SE_GROUP_ENABLED_BY_DEFAULT
|
SE_GROUP_MANDATORY
|
SE_GROUP_LOGON_ID
},
};
};
static
const
TOKEN_SOURCE
admin_source
=
{
"SeMgr"
,
{
0
,
0
}};
static
const
TOKEN_SOURCE
admin_source
=
{
"SeMgr"
,
{
0
,
0
}};
token
=
create_token
(
TRUE
,
user_sid
,
admin_groups
,
sizeof
(
admin_groups
)
/
sizeof
(
admin_groups
[
0
]
),
token
=
create_token
(
TRUE
,
user_sid
,
admin_groups
,
ARRAY_SIZE
(
admin_groups
),
admin_privs
,
sizeof
(
admin_privs
)
/
sizeof
(
admin_privs
[
0
]
),
default_dacl
,
admin_privs
,
ARRAY_SIZE
(
admin_privs
),
default_dacl
,
admin_source
,
NULL
,
-
1
);
admin_source
,
NULL
,
-
1
);
/* we really need a primary group */
/* we really need a primary group */
assert
(
token
->
primary_group
);
assert
(
token
->
primary_group
);
...
...
server/trace.c
View file @
9e365e4e
...
@@ -1145,7 +1145,7 @@ static void dump_varargs_filesystem_event( const char *prefix, data_size_t size
...
@@ -1145,7 +1145,7 @@ static void dump_varargs_filesystem_event( const char *prefix, data_size_t size
data_size_t
len
=
(
offsetof
(
struct
filesystem_event
,
name
[
event
->
len
]
)
+
sizeof
(
int
)
-
1
)
data_size_t
len
=
(
offsetof
(
struct
filesystem_event
,
name
[
event
->
len
]
)
+
sizeof
(
int
)
-
1
)
/
sizeof
(
int
)
*
sizeof
(
int
);
/
sizeof
(
int
)
*
sizeof
(
int
);
if
(
size
<
len
)
break
;
if
(
size
<
len
)
break
;
if
(
event
->
action
<
sizeof
(
actions
)
/
sizeof
(
actions
[
0
]
)
&&
actions
[
event
->
action
])
if
(
event
->
action
<
ARRAY_SIZE
(
actions
)
&&
actions
[
event
->
action
])
fprintf
(
stderr
,
"{action=%s"
,
actions
[
event
->
action
]
);
fprintf
(
stderr
,
"{action=%s"
,
actions
[
event
->
action
]
);
else
else
fprintf
(
stderr
,
"{action=%u"
,
event
->
action
);
fprintf
(
stderr
,
"{action=%u"
,
event
->
action
);
...
...
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