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
67516448
Commit
67516448
authored
Sep 21, 2008
by
Jacek Caban
Committed by
Alexandre Julliard
Sep 22, 2008
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
jscript: Added String.concat implementation.
parent
1f134b41
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
60 additions
and
2 deletions
+60
-2
string.c
dlls/jscript/string.c
+53
-2
api.js
dlls/jscript/tests/api.js
+7
-0
No files found.
dlls/jscript/string.c
View file @
67516448
...
...
@@ -241,11 +241,62 @@ static HRESULT String_charCodeAt(DispatchEx *dispex, LCID lcid, WORD flags, DISP
return
S_OK
;
}
/* ECMA-262 3rd Edition 15.5.4.6 */
static
HRESULT
String_concat
(
DispatchEx
*
dispex
,
LCID
lcid
,
WORD
flags
,
DISPPARAMS
*
dp
,
VARIANT
*
retv
,
jsexcept_t
*
ei
,
IServiceProvider
*
sp
)
{
FIXME
(
"
\n
"
);
return
E_NOTIMPL
;
BSTR
*
strs
=
NULL
,
ret
=
NULL
;
DWORD
len
=
0
,
i
,
l
,
str_cnt
;
VARIANT
var
;
WCHAR
*
ptr
;
HRESULT
hres
;
TRACE
(
"
\n
"
);
str_cnt
=
arg_cnt
(
dp
)
+
1
;
strs
=
heap_alloc_zero
(
str_cnt
*
sizeof
(
BSTR
));
if
(
!
strs
)
return
E_OUTOFMEMORY
;
V_VT
(
&
var
)
=
VT_DISPATCH
;
V_DISPATCH
(
&
var
)
=
(
IDispatch
*
)
_IDispatchEx_
(
dispex
);
hres
=
to_string
(
dispex
->
ctx
,
&
var
,
ei
,
strs
);
if
(
SUCCEEDED
(
hres
))
{
for
(
i
=
0
;
i
<
arg_cnt
(
dp
);
i
++
)
{
hres
=
to_string
(
dispex
->
ctx
,
get_arg
(
dp
,
i
),
ei
,
strs
+
i
+
1
);
if
(
FAILED
(
hres
))
break
;
}
}
if
(
SUCCEEDED
(
hres
))
{
for
(
i
=
0
;
i
<
str_cnt
;
i
++
)
len
+=
SysStringLen
(
strs
[
i
]);
ptr
=
ret
=
SysAllocStringLen
(
NULL
,
len
);
for
(
i
=
0
;
i
<
str_cnt
;
i
++
)
{
l
=
SysStringLen
(
strs
[
i
]);
memcpy
(
ptr
,
strs
[
i
],
l
*
sizeof
(
WCHAR
));
ptr
+=
l
;
}
}
for
(
i
=
0
;
i
<
str_cnt
;
i
++
)
SysFreeString
(
strs
[
i
]);
heap_free
(
strs
);
if
(
FAILED
(
hres
))
return
hres
;
if
(
retv
)
{
V_VT
(
retv
)
=
VT_BSTR
;
V_BSTR
(
retv
)
=
ret
;
}
else
{
SysFreeString
(
ret
);
}
return
S_OK
;
}
static
HRESULT
String_fixed
(
DispatchEx
*
dispex
,
LCID
lcid
,
WORD
flags
,
DISPPARAMS
*
dp
,
...
...
dlls/jscript/tests/api.js
View file @
67516448
...
...
@@ -133,6 +133,13 @@ ok(tmp === "abcd", "'abcd'.slice() = " + tmp);
tmp
=
"abcd"
.
slice
(
1
);
ok
(
tmp
===
"bcd"
,
"'abcd'.slice(1) = "
+
tmp
);
tmp
=
"abc"
.
concat
([
"d"
,
1
],
2
,
false
);
ok
(
tmp
===
"abcd,12false"
,
"concat returned "
+
tmp
);
var
arr
=
new
Array
(
2
,
"a"
);
arr
.
concat
=
String
.
prototype
.
concat
;
tmp
=
arr
.
concat
(
"d"
);
ok
(
tmp
===
"2,ad"
,
"arr.concat = "
+
tmp
);
var
arr
=
new
Array
();
ok
(
typeof
(
arr
)
===
"object"
,
"arr () is not object"
);
ok
((
arr
.
length
===
0
),
"arr.length is not 0"
);
...
...
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