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
77c3dc54
Commit
77c3dc54
authored
Sep 24, 2012
by
Jacek Caban
Committed by
Alexandre Julliard
Sep 24, 2012
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
jscript: Added support for limit argument in String.split.
parent
79ea850e
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
32 additions
and
4 deletions
+32
-4
string.c
dlls/jscript/string.c
+15
-4
api.js
dlls/jscript/tests/api.js
+17
-0
No files found.
dlls/jscript/string.c
View file @
77c3dc54
...
...
@@ -25,6 +25,8 @@
WINE_DEFAULT_DEBUG_CHANNEL
(
jscript
);
#define UINT32_MAX 0xffffffff
typedef
struct
{
jsdisp_t
dispex
;
...
...
@@ -1082,6 +1084,7 @@ static HRESULT String_split(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags, unsi
match_result_t
*
match_result
=
NULL
;
DWORD
length
,
match_cnt
,
i
,
match_len
=
0
;
const
WCHAR
*
str
,
*
ptr
,
*
ptr2
;
unsigned
limit
=
UINT32_MAX
;
BOOL
use_regexp
=
FALSE
;
jsdisp_t
*
array
;
BSTR
val_str
,
match_str
=
NULL
,
tmp_str
;
...
...
@@ -1089,8 +1092,8 @@ static HRESULT String_split(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags, unsi
TRACE
(
"
\n
"
);
if
(
argc
!=
1
)
{
FIXME
(
"unsupported arg
s
\n
"
);
if
(
argc
!=
1
&&
argc
!=
2
)
{
FIXME
(
"unsupported arg
c %u
\n
"
,
argc
);
return
E_NOTIMPL
;
}
...
...
@@ -1098,6 +1101,14 @@ static HRESULT String_split(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags, unsi
if
(
FAILED
(
hres
))
return
hres
;
if
(
argc
>
1
&&
!
is_undefined
(
argv
[
1
]))
{
hres
=
to_uint32
(
ctx
,
argv
[
1
],
&
limit
);
if
(
FAILED
(
hres
))
{
SysFreeString
(
val_str
);
return
hres
;
}
}
if
(
is_object_instance
(
argv
[
0
]))
{
jsdisp_t
*
regexp
;
...
...
@@ -1133,7 +1144,7 @@ static HRESULT String_split(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags, unsi
if
(
SUCCEEDED
(
hres
))
{
ptr
=
str
;
for
(
i
=
0
;;
i
++
)
{
for
(
i
=
0
;
i
<
limit
;
i
++
)
{
if
(
use_regexp
)
{
if
(
i
==
match_cnt
)
break
;
...
...
@@ -1168,7 +1179,7 @@ static HRESULT String_split(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags, unsi
}
}
if
(
SUCCEEDED
(
hres
)
&&
(
match_str
||
use_regexp
))
{
if
(
SUCCEEDED
(
hres
)
&&
(
match_str
||
use_regexp
)
&&
i
<
limit
)
{
DWORD
len
=
(
str
+
length
)
-
ptr
;
if
(
len
||
match_str
)
{
...
...
dlls/jscript/tests/api.js
View file @
77c3dc54
...
...
@@ -512,6 +512,23 @@ ok(r[0] === "1", "r[0] = " + r[0]);
ok
(
r
[
1
]
===
"2"
,
"r[1] = "
+
r
[
1
]);
ok
(
r
[
2
]
===
""
,
"r[2] = "
+
r
[
2
]);
r
=
"1,2,3"
.
split
(
","
,
2
);
ok
(
typeof
(
r
)
===
"object"
,
"typeof(r) = "
+
typeof
(
r
));
ok
(
r
.
length
===
2
,
"r.length = "
+
r
.
length
);
ok
(
r
[
0
]
===
"1"
,
"r[0] = "
+
r
[
0
]);
ok
(
r
[
1
]
===
"2"
,
"r[1] = "
+
r
[
1
]);
r
=
"1,2,3"
.
split
(
","
,
0
);
ok
(
typeof
(
r
)
===
"object"
,
"typeof(r) = "
+
typeof
(
r
));
ok
(
r
.
length
===
0
,
"r.length = "
+
r
.
length
);
r
=
"1,2,3"
.
split
(
","
,
-
1
);
ok
(
typeof
(
r
)
===
"object"
,
"typeof(r) = "
+
typeof
(
r
));
ok
(
r
.
length
===
3
,
"r.length = "
+
r
.
length
);
ok
(
r
[
0
]
===
"1"
,
"r[0] = "
+
r
[
0
]);
ok
(
r
[
1
]
===
"2"
,
"r[1] = "
+
r
[
1
]);
ok
(
r
[
2
]
===
"3"
,
"r[1] = "
+
r
[
1
]);
tmp
=
"abcd"
.
indexOf
(
"bc"
,
0
);
ok
(
tmp
===
1
,
"indexOf = "
+
tmp
);
tmp
=
"abcd"
.
indexOf
(
"bc"
,
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