Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
W
wine-winehq
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-winehq
Commits
448e68ab
Commit
448e68ab
authored
Jan 09, 2023
by
Alexandre Julliard
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
kernelbase: Fix FindNLSStringEx for strings with no primary weights.
Wine-Bug:
https://bugs.winehq.org/show_bug.cgi?id=53583
Wine-Bug:
https://bugs.winehq.org/show_bug.cgi?id=53837
parent
1bc133a3
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
45 additions
and
31 deletions
+45
-31
locale.c
dlls/kernel32/tests/locale.c
+10
-0
locale.c
dlls/kernelbase/locale.c
+35
-31
No files found.
dlls/kernel32/tests/locale.c
View file @
448e68ab
...
...
@@ -6741,6 +6741,16 @@ static void test_FindNLSStringEx(void)
{
localeW
,
FIND_ENDSWITH
,
L"SimpleSimple"
,
L"Simp"
,
-
1
,
0xdeadbeef
},
{
localeW
,
FIND_FROMSTART
,
comb_s_accent1W
,
comb_s_accent2W
,
0
,
6
},
{
localeW
,
FIND_FROMSTART
,
comb_q_accent1W
,
comb_q_accent2W
,
2
,
7
},
{
localeW
,
FIND_STARTSWITH
,
L"--Option"
,
L"--"
,
0
,
2
},
{
localeW
,
FIND_ENDSWITH
,
L"Option--"
,
L"--"
,
6
,
2
},
{
localeW
,
FIND_FROMSTART
,
L"----"
,
L"--"
,
0
,
2
},
{
localeW
,
FIND_FROMEND
,
L"----"
,
L"--"
,
2
,
2
},
{
localeW
,
FIND_FROMSTART
,
L"opt1--opt2--opt3"
,
L"--"
,
4
,
2
},
{
localeW
,
FIND_FROMEND
,
L"opt1--opt2--opt3"
,
L"--"
,
10
,
2
},
{
localeW
,
FIND_FROMSTART
,
L"x-oss-security"
,
L"x-oss-"
,
0
,
6
},
{
localeW
,
FIND_FROMSTART
,
L"x-oss-security"
,
L"-oss"
,
1
,
4
},
{
localeW
,
FIND_FROMSTART
,
L"x-oss-security"
,
L"-oss--"
,
-
1
,
0xdeadbeef
},
{
localeW
,
FIND_FROMEND
,
L"x-oss-oss2"
,
L"-oss"
,
5
,
4
},
};
unsigned
int
i
;
...
...
dlls/kernelbase/locale.c
View file @
448e68ab
...
...
@@ -3892,7 +3892,7 @@ static int find_substring( const struct sortguid *sortid, DWORD flags, const WCH
struct
sortkey_state
val
;
BYTE
primary
[
32
];
BYTE
primary_val
[
256
];
int
i
,
start
,
found
=
-
1
,
foundlen
,
pos
=
0
;
int
i
,
start
,
len
,
found
=
-
1
,
foundlen
=
0
,
pos
=
0
;
BOOL
have_extra
,
have_extra_val
;
BYTE
case_mask
=
0x3f
;
UINT
except
=
sortid
->
except
;
...
...
@@ -3915,43 +3915,47 @@ static int find_substring( const struct sortguid *sortid, DWORD flags, const WCH
for
(
start
=
0
;
start
<
srclen
;
start
++
)
{
pos
=
start
;
while
(
pos
<
srclen
&&
s
.
primary_pos
<
val
.
key_primary
.
len
)
for
(
len
=
start
+
1
;
len
<=
srclen
;
len
++
)
{
while
(
pos
<
srclen
&&
!
s
.
key_primary
.
len
)
pos
+=
append_weights
(
sortid
,
flags
,
src
,
srclen
,
pos
,
case_mask
,
except
,
compr_tables
,
&
s
,
TRUE
);
if
(
s
.
primary_pos
+
s
.
key_primary
.
len
>
val
.
key_primary
.
len
)
goto
next
;
if
(
memcmp
(
primary
,
val
.
key_primary
.
buf
+
s
.
primary_pos
,
s
.
key_primary
.
len
))
goto
next
;
s
.
primary_pos
+=
s
.
key_primary
.
len
;
s
.
key_primary
.
len
=
0
;
}
if
(
s
.
primary_pos
<
val
.
key_primary
.
len
)
goto
next
;
pos
=
start
;
while
(
pos
<
len
&&
s
.
primary_pos
<=
val
.
key_primary
.
len
)
{
while
(
pos
<
len
&&
!
s
.
key_primary
.
len
)
pos
+=
append_weights
(
sortid
,
flags
,
src
,
srclen
,
pos
,
case_mask
,
except
,
compr_tables
,
&
s
,
TRUE
);
if
(
s
.
primary_pos
+
s
.
key_primary
.
len
>
val
.
key_primary
.
len
)
goto
next
;
if
(
memcmp
(
primary
,
val
.
key_primary
.
buf
+
s
.
primary_pos
,
s
.
key_primary
.
len
))
goto
next
;
s
.
primary_pos
+=
s
.
key_primary
.
len
;
s
.
key_primary
.
len
=
0
;
}
if
(
s
.
primary_pos
<
val
.
key_primary
.
len
)
goto
next
;
have_extra
=
remove_unneeded_weights
(
sortid
,
&
s
);
if
(
compare_sortkeys
(
&
s
.
key_diacritic
,
&
val
.
key_diacritic
,
FALSE
))
goto
next
;
if
(
compare_sortkeys
(
&
s
.
key_case
,
&
val
.
key_case
,
FALSE
))
goto
next
;
have_extra
=
remove_unneeded_weights
(
sortid
,
&
s
);
if
(
compare_sortkeys
(
&
s
.
key_diacritic
,
&
val
.
key_diacritic
,
FALSE
))
goto
next
;
if
(
compare_sortkeys
(
&
s
.
key_case
,
&
val
.
key_case
,
FALSE
))
goto
next
;
if
(
have_extra
&&
have_extra_val
)
{
for
(
i
=
0
;
i
<
4
;
i
++
)
if
(
compare_sortkeys
(
&
s
.
key_extra
[
i
],
&
val
.
key_extra
[
i
],
i
!=
1
))
goto
next
;
}
else
if
(
have_extra
||
have_extra_val
)
goto
next
;
if
(
have_extra
&&
have_extra_val
)
{
for
(
i
=
0
;
i
<
4
;
i
++
)
if
(
compare_sortkeys
(
&
s
.
key_extra
[
i
],
&
val
.
key_extra
[
i
],
i
!=
1
))
goto
next
;
}
else
if
(
have_extra
||
have_extra_val
)
goto
next
;
if
(
compare_sortkeys
(
&
s
.
key_special
,
&
val
.
key_special
,
FALSE
))
goto
next
;
if
(
compare_sortkeys
(
&
s
.
key_special
,
&
val
.
key_special
,
FALSE
))
goto
next
;
found
=
start
;
foundlen
=
pos
-
start
;
if
(
flags
&
FIND_FROMSTART
)
break
;
found
=
start
;
foundlen
=
pos
-
start
;
len
=
srclen
;
/* no need to continue checking longer strings */
next:
next:
/* reset state */
s
.
key_primary
.
len
=
s
.
key_diacritic
.
len
=
s
.
key_case
.
len
=
s
.
key_special
.
len
=
0
;
s
.
key_extra
[
0
].
len
=
s
.
key_extra
[
1
].
len
=
s
.
key_extra
[
2
].
len
=
s
.
key_extra
[
3
].
len
=
0
;
s
.
primary_pos
=
0
;
}
if
(
flags
&
FIND_STARTSWITH
)
break
;
/* reset state */
s
.
key_primary
.
len
=
s
.
key_diacritic
.
len
=
s
.
key_case
.
len
=
s
.
key_special
.
len
=
0
;
s
.
key_extra
[
0
].
len
=
s
.
key_extra
[
1
].
len
=
s
.
key_extra
[
2
].
len
=
s
.
key_extra
[
3
].
len
=
0
;
s
.
primary_pos
=
0
;
if
(
flags
&
FIND_FROMSTART
&&
found
!=
-
1
)
break
;
}
if
(
found
!=
-
1
)
...
...
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