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
1045bffc
Commit
1045bffc
authored
Dec 08, 2009
by
Jacek Caban
Committed by
Alexandre Julliard
Dec 08, 2009
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
jscript: Fixed String.split for missing regexp separator.
parent
c665b86c
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
18 additions
and
3 deletions
+18
-3
string.c
dlls/jscript/string.c
+5
-3
regexp.js
dlls/jscript/tests/regexp.js
+13
-0
No files found.
dlls/jscript/string.c
View file @
1045bffc
...
...
@@ -1129,6 +1129,7 @@ static HRESULT String_split(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags, DISP
match_result_t
*
match_result
=
NULL
;
DWORD
length
,
match_cnt
,
i
,
match_len
=
0
;
const
WCHAR
*
str
,
*
ptr
,
*
ptr2
;
BOOL
use_regexp
=
FALSE
;
VARIANT
*
arg
,
var
;
DispatchEx
*
array
;
BSTR
val_str
,
match_str
=
NULL
;
...
...
@@ -1153,6 +1154,7 @@ static HRESULT String_split(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags, DISP
regexp
=
iface_to_jsdisp
((
IUnknown
*
)
V_DISPATCH
(
arg
));
if
(
regexp
)
{
if
(
is_class
(
regexp
,
JSCLASS_REGEXP
))
{
use_regexp
=
TRUE
;
hres
=
regexp_match
(
ctx
,
regexp
,
str
,
length
,
TRUE
,
&
match_result
,
&
match_cnt
);
jsdisp_release
(
regexp
);
if
(
FAILED
(
hres
))
{
...
...
@@ -1183,7 +1185,7 @@ static HRESULT String_split(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags, DISP
if
(
SUCCEEDED
(
hres
))
{
ptr
=
str
;
for
(
i
=
0
;;
i
++
)
{
if
(
match_result
)
{
if
(
use_regexp
)
{
if
(
i
==
match_cnt
)
break
;
ptr2
=
match_result
[
i
].
str
;
...
...
@@ -1209,7 +1211,7 @@ static HRESULT String_split(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags, DISP
if
(
FAILED
(
hres
))
break
;
if
(
match_result
)
if
(
use_regexp
)
ptr
=
match_result
[
i
].
str
+
match_result
[
i
].
len
;
else
if
(
match_str
)
ptr
=
ptr2
+
match_len
;
...
...
@@ -1218,7 +1220,7 @@ static HRESULT String_split(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags, DISP
}
}
if
(
SUCCEEDED
(
hres
)
&&
(
match_str
||
match_result
))
{
if
(
SUCCEEDED
(
hres
)
&&
(
match_str
||
use_regexp
))
{
DWORD
len
=
(
str
+
length
)
-
ptr
;
if
(
len
||
match_str
)
{
...
...
dlls/jscript/tests/regexp.js
View file @
1045bffc
...
...
@@ -301,6 +301,19 @@ ok(r[0] === "1", "r[0] = " + r[0]);
ok
(
r
[
1
]
===
"2"
,
"r[1] = "
+
r
[
1
]);
ok
(
re
.
lastIndex
===
5
,
"re.lastIndex = "
+
re
.
lastIndex
);
r
=
"1 12
\
t3"
.
split
(
re
=
/
\s
+/
).
join
(
";"
);
ok
(
r
===
"1;12;3"
,
"r = "
+
r
);
ok
(
re
.
lastIndex
===
6
,
"re.lastIndex = "
+
re
.
lastIndex
);
r
=
"123"
.
split
(
re
=
/
\s
+/
).
join
(
";"
);
ok
(
r
===
"123"
,
"r = "
+
r
);
ok
(
re
.
lastIndex
===
0
,
"re.lastIndex = "
+
re
.
lastIndex
);
/* another standard violation */
r
=
"1 12
\
t3"
.
split
(
re
=
/
(\s)
+/g
).
join
(
";"
);
ok
(
r
===
"1;12;3"
,
"r = "
+
r
);
ok
(
re
.
lastIndex
===
6
,
"re.lastIndex = "
+
re
.
lastIndex
);
re
=
/,+/
;
re
.
lastIndex
=
4
;
r
=
"1,,2,"
.
split
(
re
);
...
...
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