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
6c6af641
Commit
6c6af641
authored
Jul 18, 2018
by
Michael Stefaniuc
Committed by
Alexandre Julliard
Jul 19, 2018
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
sxs: Use the ARRAY_SIZE() macro.
Signed-off-by:
Michael Stefaniuc
<
mstefani@winehq.org
>
Signed-off-by:
Alexandre Julliard
<
julliard@winehq.org
>
parent
baf4cb39
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
13 additions
and
13 deletions
+13
-13
cache.c
dlls/sxs/cache.c
+9
-9
name.c
dlls/sxs/name.c
+4
-4
No files found.
dlls/sxs/cache.c
View file @
6c6af641
...
@@ -103,7 +103,7 @@ static unsigned int build_sxs_path( WCHAR *path )
...
@@ -103,7 +103,7 @@ static unsigned int build_sxs_path( WCHAR *path )
unsigned
int
len
=
GetWindowsDirectoryW
(
path
,
MAX_PATH
);
unsigned
int
len
=
GetWindowsDirectoryW
(
path
,
MAX_PATH
);
memcpy
(
path
+
len
,
winsxsW
,
sizeof
(
winsxsW
)
);
memcpy
(
path
+
len
,
winsxsW
,
sizeof
(
winsxsW
)
);
return
len
+
sizeof
(
winsxsW
)
/
sizeof
(
winsxsW
[
0
]
)
-
1
;
return
len
+
ARRAY_SIZE
(
winsxsW
)
-
1
;
}
}
static
WCHAR
*
build_assembly_name
(
const
WCHAR
*
arch
,
const
WCHAR
*
name
,
const
WCHAR
*
token
,
static
WCHAR
*
build_assembly_name
(
const
WCHAR
*
arch
,
const
WCHAR
*
name
,
const
WCHAR
*
token
,
...
@@ -111,7 +111,7 @@ static WCHAR *build_assembly_name( const WCHAR *arch, const WCHAR *name, const W
...
@@ -111,7 +111,7 @@ static WCHAR *build_assembly_name( const WCHAR *arch, const WCHAR *name, const W
{
{
static
const
WCHAR
fmtW
[]
=
static
const
WCHAR
fmtW
[]
=
{
'%'
,
's'
,
'_'
,
'%'
,
's'
,
'_'
,
'%'
,
's'
,
'_'
,
'%'
,
's'
,
'_'
,
'n'
,
'o'
,
'n'
,
'e'
,
'_'
,
'd'
,
'e'
,
'a'
,
'd'
,
'b'
,
'e'
,
'e'
,
'f'
,
0
};
{
'%'
,
's'
,
'_'
,
'%'
,
's'
,
'_'
,
'%'
,
's'
,
'_'
,
'%'
,
's'
,
'_'
,
'n'
,
'o'
,
'n'
,
'e'
,
'_'
,
'd'
,
'e'
,
'a'
,
'd'
,
'b'
,
'e'
,
'e'
,
'f'
,
0
};
unsigned
int
buflen
=
sizeof
(
fmtW
)
/
sizeof
(
fmtW
[
0
]
);
unsigned
int
buflen
=
ARRAY_SIZE
(
fmtW
);
WCHAR
*
ret
,
*
p
;
WCHAR
*
ret
,
*
p
;
buflen
+=
strlenW
(
arch
);
buflen
+=
strlenW
(
arch
);
...
@@ -133,7 +133,7 @@ static WCHAR *build_manifest_path( const WCHAR *arch, const WCHAR *name, const W
...
@@ -133,7 +133,7 @@ static WCHAR *build_manifest_path( const WCHAR *arch, const WCHAR *name, const W
unsigned
int
len
;
unsigned
int
len
;
if
(
!
(
path
=
build_assembly_name
(
arch
,
name
,
token
,
version
,
&
len
)))
return
NULL
;
if
(
!
(
path
=
build_assembly_name
(
arch
,
name
,
token
,
version
,
&
len
)))
return
NULL
;
len
+=
sizeof
(
fmtW
)
/
sizeof
(
fmtW
[
0
]
);
len
+=
ARRAY_SIZE
(
fmtW
);
len
+=
build_sxs_path
(
sxsdir
);
len
+=
build_sxs_path
(
sxsdir
);
if
(
!
(
ret
=
HeapAlloc
(
GetProcessHeap
(),
0
,
len
*
sizeof
(
WCHAR
)
)))
if
(
!
(
ret
=
HeapAlloc
(
GetProcessHeap
(),
0
,
len
*
sizeof
(
WCHAR
)
)))
{
{
...
@@ -150,7 +150,7 @@ static WCHAR *build_policy_name( const WCHAR *arch, const WCHAR *name, const WCH
...
@@ -150,7 +150,7 @@ static WCHAR *build_policy_name( const WCHAR *arch, const WCHAR *name, const WCH
{
{
static
const
WCHAR
fmtW
[]
=
static
const
WCHAR
fmtW
[]
=
{
'%'
,
's'
,
'_'
,
'%'
,
's'
,
'_'
,
'%'
,
's'
,
'_'
,
'n'
,
'o'
,
'n'
,
'e'
,
'_'
,
'd'
,
'e'
,
'a'
,
'd'
,
'b'
,
'e'
,
'e'
,
'f'
,
0
};
{
'%'
,
's'
,
'_'
,
'%'
,
's'
,
'_'
,
'%'
,
's'
,
'_'
,
'n'
,
'o'
,
'n'
,
'e'
,
'_'
,
'd'
,
'e'
,
'a'
,
'd'
,
'b'
,
'e'
,
'e'
,
'f'
,
0
};
unsigned
int
buflen
=
sizeof
(
fmtW
)
/
sizeof
(
fmtW
[
0
]
);
unsigned
int
buflen
=
ARRAY_SIZE
(
fmtW
);
WCHAR
*
ret
,
*
p
;
WCHAR
*
ret
,
*
p
;
buflen
+=
strlenW
(
arch
);
buflen
+=
strlenW
(
arch
);
...
@@ -171,7 +171,7 @@ static WCHAR *build_policy_path( const WCHAR *arch, const WCHAR *name, const WCH
...
@@ -171,7 +171,7 @@ static WCHAR *build_policy_path( const WCHAR *arch, const WCHAR *name, const WCH
unsigned
int
len
;
unsigned
int
len
;
if
(
!
(
path
=
build_policy_name
(
arch
,
name
,
token
,
&
len
)))
return
NULL
;
if
(
!
(
path
=
build_policy_name
(
arch
,
name
,
token
,
&
len
)))
return
NULL
;
len
+=
sizeof
(
fmtW
)
/
sizeof
(
fmtW
[
0
]
);
len
+=
ARRAY_SIZE
(
fmtW
);
len
+=
build_sxs_path
(
sxsdir
);
len
+=
build_sxs_path
(
sxsdir
);
len
+=
strlenW
(
version
);
len
+=
strlenW
(
version
);
if
(
!
(
ret
=
HeapAlloc
(
GetProcessHeap
(),
0
,
len
*
sizeof
(
WCHAR
)
)))
if
(
!
(
ret
=
HeapAlloc
(
GetProcessHeap
(),
0
,
len
*
sizeof
(
WCHAR
)
)))
...
@@ -501,9 +501,9 @@ static WCHAR *build_policy_filename( const WCHAR *arch, const WCHAR *name, const
...
@@ -501,9 +501,9 @@ static WCHAR *build_policy_filename( const WCHAR *arch, const WCHAR *name, const
if
(
!
(
fullname
=
build_policy_name
(
arch
,
name
,
token
,
&
len
)))
return
NULL
;
if
(
!
(
fullname
=
build_policy_name
(
arch
,
name
,
token
,
&
len
)))
return
NULL
;
len
+=
build_sxs_path
(
sxsdir
);
len
+=
build_sxs_path
(
sxsdir
);
len
+=
sizeof
(
policiesW
)
/
sizeof
(
policiesW
[
0
]
)
-
1
;
len
+=
ARRAY_SIZE
(
policiesW
)
-
1
;
len
+=
strlenW
(
version
);
len
+=
strlenW
(
version
);
len
+=
sizeof
(
suffixW
)
/
sizeof
(
suffixW
[
0
]
)
-
1
;
len
+=
ARRAY_SIZE
(
suffixW
)
-
1
;
if
(
!
(
ret
=
HeapAlloc
(
GetProcessHeap
(),
0
,
(
len
+
1
)
*
sizeof
(
WCHAR
)
)))
if
(
!
(
ret
=
HeapAlloc
(
GetProcessHeap
(),
0
,
(
len
+
1
)
*
sizeof
(
WCHAR
)
)))
{
{
HeapFree
(
GetProcessHeap
(),
0
,
fullname
);
HeapFree
(
GetProcessHeap
(),
0
,
fullname
);
...
@@ -572,8 +572,8 @@ static WCHAR *build_manifest_filename( const WCHAR *arch, const WCHAR *name, con
...
@@ -572,8 +572,8 @@ static WCHAR *build_manifest_filename( const WCHAR *arch, const WCHAR *name, con
if
(
!
(
fullname
=
build_assembly_name
(
arch
,
name
,
token
,
version
,
&
len
)))
return
NULL
;
if
(
!
(
fullname
=
build_assembly_name
(
arch
,
name
,
token
,
version
,
&
len
)))
return
NULL
;
len
+=
build_sxs_path
(
sxsdir
);
len
+=
build_sxs_path
(
sxsdir
);
len
+=
sizeof
(
manifestsW
)
/
sizeof
(
manifestsW
[
0
]
)
-
1
;
len
+=
ARRAY_SIZE
(
manifestsW
)
-
1
;
len
+=
sizeof
(
suffixW
)
/
sizeof
(
suffixW
[
0
]
)
-
1
;
len
+=
ARRAY_SIZE
(
suffixW
)
-
1
;
if
(
!
(
ret
=
HeapAlloc
(
GetProcessHeap
(),
0
,
(
len
+
1
)
*
sizeof
(
WCHAR
)
)))
if
(
!
(
ret
=
HeapAlloc
(
GetProcessHeap
(),
0
,
(
len
+
1
)
*
sizeof
(
WCHAR
)
)))
{
{
HeapFree
(
GetProcessHeap
(),
0
,
fullname
);
HeapFree
(
GetProcessHeap
(),
0
,
fullname
);
...
...
dlls/sxs/name.c
View file @
6c6af641
...
@@ -329,25 +329,25 @@ static HRESULT parse_displayname( struct name *name, const WCHAR *displayname )
...
@@ -329,25 +329,25 @@ static HRESULT parse_displayname( struct name *name, const WCHAR *displayname )
while
(
*
q
&&
*
q
!=
'='
)
q
++
;
while
(
*
q
&&
*
q
!=
'='
)
q
++
;
if
(
!*
q
)
return
E_INVALIDARG
;
if
(
!*
q
)
return
E_INVALIDARG
;
len
=
q
-
p
;
len
=
q
-
p
;
if
(
len
==
sizeof
(
archW
)
/
sizeof
(
archW
[
0
]
)
-
1
&&
!
memcmp
(
p
,
archW
,
len
*
sizeof
(
WCHAR
)
))
if
(
len
==
ARRAY_SIZE
(
archW
)
-
1
&&
!
memcmp
(
p
,
archW
,
len
*
sizeof
(
WCHAR
)
))
{
{
p
=
++
q
;
p
=
++
q
;
if
(
!
(
name
->
arch
=
parse_value
(
p
,
&
len
)))
return
E_INVALIDARG
;
if
(
!
(
name
->
arch
=
parse_value
(
p
,
&
len
)))
return
E_INVALIDARG
;
q
+=
len
;
q
+=
len
;
}
}
else
if
(
len
==
sizeof
(
tokenW
)
/
sizeof
(
tokenW
[
0
]
)
-
1
&&
!
memcmp
(
p
,
tokenW
,
len
*
sizeof
(
WCHAR
)
))
else
if
(
len
==
ARRAY_SIZE
(
tokenW
)
-
1
&&
!
memcmp
(
p
,
tokenW
,
len
*
sizeof
(
WCHAR
)
))
{
{
p
=
++
q
;
p
=
++
q
;
if
(
!
(
name
->
token
=
parse_value
(
p
,
&
len
)))
return
E_INVALIDARG
;
if
(
!
(
name
->
token
=
parse_value
(
p
,
&
len
)))
return
E_INVALIDARG
;
q
+=
len
;
q
+=
len
;
}
}
else
if
(
len
==
sizeof
(
typeW
)
/
sizeof
(
typeW
[
0
]
)
-
1
&&
!
memcmp
(
p
,
typeW
,
len
*
sizeof
(
WCHAR
)
))
else
if
(
len
==
ARRAY_SIZE
(
typeW
)
-
1
&&
!
memcmp
(
p
,
typeW
,
len
*
sizeof
(
WCHAR
)
))
{
{
p
=
++
q
;
p
=
++
q
;
if
(
!
(
name
->
type
=
parse_value
(
p
,
&
len
)))
return
E_INVALIDARG
;
if
(
!
(
name
->
type
=
parse_value
(
p
,
&
len
)))
return
E_INVALIDARG
;
q
+=
len
;
q
+=
len
;
}
}
else
if
(
len
==
sizeof
(
versionW
)
/
sizeof
(
versionW
[
0
]
)
-
1
&&
!
memcmp
(
p
,
versionW
,
len
*
sizeof
(
WCHAR
)
))
else
if
(
len
==
ARRAY_SIZE
(
versionW
)
-
1
&&
!
memcmp
(
p
,
versionW
,
len
*
sizeof
(
WCHAR
)
))
{
{
p
=
++
q
;
p
=
++
q
;
if
(
!
(
name
->
version
=
parse_value
(
p
,
&
len
)))
return
E_INVALIDARG
;
if
(
!
(
name
->
version
=
parse_value
(
p
,
&
len
)))
return
E_INVALIDARG
;
...
...
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