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
e71ffcde
Commit
e71ffcde
authored
Apr 01, 2020
by
Alexandre Julliard
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
kernel32: Avoid using memchrW().
Signed-off-by:
Alexandre Julliard
<
julliard@winehq.org
>
parent
ce30db50
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
11 additions
and
13 deletions
+11
-13
profile.c
dlls/kernel32/profile.c
+8
-10
volume.c
dlls/kernel32/volume.c
+3
-3
No files found.
dlls/kernel32/profile.c
View file @
e71ffcde
...
@@ -311,7 +311,7 @@ static PROFILESECTION *PROFILE_Load(HANDLE hFile, ENCODING * pEncoding)
...
@@ -311,7 +311,7 @@ static PROFILESECTION *PROFILE_Load(HANDLE hFile, ENCODING * pEncoding)
WCHAR
*
szFile
;
WCHAR
*
szFile
;
const
WCHAR
*
szLineStart
,
*
szLineEnd
;
const
WCHAR
*
szLineStart
,
*
szLineEnd
;
const
WCHAR
*
szValueStart
,
*
szEnd
,
*
next_line
;
const
WCHAR
*
szValueStart
,
*
szEnd
,
*
next_line
;
int
l
ine
=
0
,
l
en
;
int
len
;
PROFILESECTION
*
section
,
*
first_section
;
PROFILESECTION
*
section
,
*
first_section
;
PROFILESECTION
**
next_section
;
PROFILESECTION
**
next_section
;
PROFILEKEY
*
key
,
*
prev_key
,
**
next_key
;
PROFILEKEY
*
key
,
*
prev_key
,
**
next_key
;
...
@@ -402,14 +402,10 @@ static PROFILESECTION *PROFILE_Load(HANDLE hFile, ENCODING * pEncoding)
...
@@ -402,14 +402,10 @@ static PROFILESECTION *PROFILE_Load(HANDLE hFile, ENCODING * pEncoding)
while
(
next_line
<
szEnd
)
while
(
next_line
<
szEnd
)
{
{
szLineStart
=
next_line
;
szLineStart
=
next_line
;
next_line
=
memchrW
(
szLineStart
,
'\n'
,
szEnd
-
szLineStart
);
while
(
next_line
<
szEnd
&&
*
next_line
!=
'\n'
&&
*
next_line
!=
'\r'
)
next_line
++
;
if
(
!
next_line
)
next_line
=
memchrW
(
szLineStart
,
'\r'
,
szEnd
-
szLineStart
);
while
(
next_line
<
szEnd
&&
(
*
next_line
==
'\n'
||
*
next_line
==
'\r'
))
next_line
++
;
if
(
!
next_line
)
next_line
=
szEnd
;
else
next_line
++
;
szLineEnd
=
next_line
;
szLineEnd
=
next_line
;
line
++
;
/* get rid of white space */
/* get rid of white space */
while
(
szLineStart
<
szLineEnd
&&
PROFILE_isspaceW
(
*
szLineStart
))
szLineStart
++
;
while
(
szLineStart
<
szLineEnd
&&
PROFILE_isspaceW
(
*
szLineStart
))
szLineStart
++
;
while
((
szLineEnd
>
szLineStart
)
&&
PROFILE_isspaceW
(
szLineEnd
[
-
1
]))
szLineEnd
--
;
while
((
szLineEnd
>
szLineStart
)
&&
PROFILE_isspaceW
(
szLineEnd
[
-
1
]))
szLineEnd
--
;
...
@@ -421,8 +417,8 @@ static PROFILESECTION *PROFILE_Load(HANDLE hFile, ENCODING * pEncoding)
...
@@ -421,8 +417,8 @@ static PROFILESECTION *PROFILE_Load(HANDLE hFile, ENCODING * pEncoding)
for
(
len
=
szLineEnd
-
szLineStart
;
len
>
0
;
len
--
)
if
(
szLineStart
[
len
-
1
]
==
']'
)
break
;
for
(
len
=
szLineEnd
-
szLineStart
;
len
>
0
;
len
--
)
if
(
szLineStart
[
len
-
1
]
==
']'
)
break
;
if
(
!
len
)
if
(
!
len
)
{
{
WARN
(
"Invalid section header
at line %d
: %s
\n
"
,
WARN
(
"Invalid section header: %s
\n
"
,
line
,
debugstr_wn
(
szLineStart
,
(
int
)(
szLineEnd
-
szLineStart
))
);
debugstr_wn
(
szLineStart
,
(
int
)(
szLineEnd
-
szLineStart
))
);
}
}
else
else
{
{
...
@@ -450,7 +446,8 @@ static PROFILESECTION *PROFILE_Load(HANDLE hFile, ENCODING * pEncoding)
...
@@ -450,7 +446,8 @@ static PROFILESECTION *PROFILE_Load(HANDLE hFile, ENCODING * pEncoding)
/* get rid of white space after the name and before the start
/* get rid of white space after the name and before the start
* of the value */
* of the value */
len
=
szLineEnd
-
szLineStart
;
len
=
szLineEnd
-
szLineStart
;
if
((
szValueStart
=
memchrW
(
szLineStart
,
'='
,
szLineEnd
-
szLineStart
))
!=
NULL
)
for
(
szValueStart
=
szLineStart
;
szValueStart
<
szLineEnd
;
szValueStart
++
)
if
(
*
szValueStart
==
'='
)
break
;
if
(
szValueStart
<
szLineEnd
)
{
{
const
WCHAR
*
szNameEnd
=
szValueStart
;
const
WCHAR
*
szNameEnd
=
szValueStart
;
while
((
szNameEnd
>
szLineStart
)
&&
PROFILE_isspaceW
(
szNameEnd
[
-
1
]))
szNameEnd
--
;
while
((
szNameEnd
>
szLineStart
)
&&
PROFILE_isspaceW
(
szNameEnd
[
-
1
]))
szNameEnd
--
;
...
@@ -458,6 +455,7 @@ static PROFILESECTION *PROFILE_Load(HANDLE hFile, ENCODING * pEncoding)
...
@@ -458,6 +455,7 @@ static PROFILESECTION *PROFILE_Load(HANDLE hFile, ENCODING * pEncoding)
szValueStart
++
;
szValueStart
++
;
while
(
szValueStart
<
szLineEnd
&&
PROFILE_isspaceW
(
*
szValueStart
))
szValueStart
++
;
while
(
szValueStart
<
szLineEnd
&&
PROFILE_isspaceW
(
*
szValueStart
))
szValueStart
++
;
}
}
else
szValueStart
=
NULL
;
if
(
len
||
!
prev_key
||
*
prev_key
->
name
)
if
(
len
||
!
prev_key
||
*
prev_key
->
name
)
{
{
...
...
dlls/kernel32/volume.c
View file @
e71ffcde
...
@@ -674,7 +674,7 @@ BOOL WINAPI GetVolumeInformationW( LPCWSTR root, LPWSTR label, DWORD label_len,
...
@@ -674,7 +674,7 @@ BOOL WINAPI GetVolumeInformationW( LPCWSTR root, LPWSTR label, DWORD label_len,
IO_STATUS_BLOCK
io
;
IO_STATUS_BLOCK
io
;
OBJECT_ATTRIBUTES
attr
;
OBJECT_ATTRIBUTES
attr
;
FILE_FS_DEVICE_INFORMATION
info
;
FILE_FS_DEVICE_INFORMATION
info
;
WCHAR
*
p
;
unsigned
int
i
;
enum
fs_type
type
=
FS_UNKNOWN
;
enum
fs_type
type
=
FS_UNKNOWN
;
BOOL
ret
=
FALSE
;
BOOL
ret
=
FALSE
;
...
@@ -685,8 +685,8 @@ BOOL WINAPI GetVolumeInformationW( LPCWSTR root, LPWSTR label, DWORD label_len,
...
@@ -685,8 +685,8 @@ BOOL WINAPI GetVolumeInformationW( LPCWSTR root, LPWSTR label, DWORD label_len,
return
FALSE
;
return
FALSE
;
}
}
/* there must be exactly one backslash in the name, at the end */
/* there must be exactly one backslash in the name, at the end */
p
=
memchrW
(
nt_name
.
Buffer
+
4
,
'\\'
,
(
nt_name
.
Length
-
4
)
/
sizeof
(
WCHAR
)
)
;
for
(
i
=
4
;
i
<
nt_name
.
Length
/
sizeof
(
WCHAR
);
i
++
)
if
(
nt_name
.
Buffer
[
i
]
==
'\\'
)
break
;
if
(
p
!=
nt_name
.
Buffer
+
nt_name
.
Length
/
sizeof
(
WCHAR
)
-
1
)
if
(
i
!=
nt_name
.
Length
/
sizeof
(
WCHAR
)
-
1
)
{
{
/* check if root contains an explicit subdir */
/* check if root contains an explicit subdir */
if
(
root
[
0
]
&&
root
[
1
]
==
':'
)
root
+=
2
;
if
(
root
[
0
]
&&
root
[
1
]
==
':'
)
root
+=
2
;
...
...
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