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
c1372814
Commit
c1372814
authored
Sep 17, 2008
by
Jacek Caban
Committed by
Alexandre Julliard
Sep 18, 2008
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
jscript: Added to_string(VT_I4) implementation.
parent
788197d5
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
42 additions
and
2 deletions
+42
-2
jsutils.c
dlls/jscript/jsutils.c
+37
-2
lang.js
dlls/jscript/tests/lang.js
+5
-0
No files found.
dlls/jscript/jsutils.c
View file @
c1372814
...
...
@@ -253,19 +253,54 @@ HRESULT to_int32(script_ctx_t *ctx, VARIANT *v, jsexcept_t *ei, INT *ret)
return
S_OK
;
}
static
BSTR
int_to_bstr
(
INT
i
)
{
WCHAR
buf
[
12
],
*
p
;
BOOL
neg
=
FALSE
;
if
(
!
i
)
{
static
const
WCHAR
zeroW
[]
=
{
'0'
,
0
};
return
SysAllocString
(
zeroW
);
}
if
(
i
<
0
)
{
neg
=
TRUE
;
i
=
-
i
;
}
p
=
buf
+
sizeof
(
buf
)
/
sizeof
(
*
buf
)
-
1
;
*
p
--
=
0
;
while
(
i
)
{
*
p
--
=
i
%
10
+
'0'
;
i
/=
10
;
}
if
(
neg
)
*
p
=
'-'
;
else
p
++
;
return
SysAllocString
(
p
);
}
/* ECMA-262 3rd Edition 9.8 */
HRESULT
to_string
(
script_ctx_t
*
ctx
,
VARIANT
*
v
,
jsexcept_t
*
ei
,
BSTR
*
str
)
{
switch
(
V_VT
(
v
))
{
case
VT_I4
:
*
str
=
int_to_bstr
(
V_I4
(
v
));
break
;
case
VT_BSTR
:
*
str
=
SysAllocString
(
V_BSTR
(
v
));
return
S_OK
;
break
;
default:
FIXME
(
"unsupported vt %d
\n
"
,
V_VT
(
v
));
return
E_NOTIMPL
;
}
return
E_NOTIMPL
;
return
*
str
?
S_OK
:
E_OUTOFMEMORY
;
}
/* ECMA-262 3rd Edition 9.9 */
...
...
dlls/jscript/tests/lang.js
View file @
c1372814
...
...
@@ -312,6 +312,10 @@ ok(+true === 1, "+true !== 1");
ok
(
+
false
===
0
,
"+false !== 0"
);
ok
(
+
null
===
0
,
"+null !== 0"
);
ok
(
""
+
0
===
"0"
,
"
\"\"
+ 0 !==
\"
0
\"
"
);
ok
(
""
+
123
===
"123"
,
"
\"\"
+ 123 !==
\"
123
\"
"
);
ok
(
""
+
(
-
5
)
===
"-5"
,
"
\"\"
+ (-5) !==
\"
-5
\"
"
);
ok
(
1
<
3.4
,
"1 < 3.4 failed"
);
ok
(
!
(
3.4
<
1
),
"3.4 < 1"
);
ok
(
"abc"
<
"abcd"
,
"abc < abcd failed"
);
...
...
@@ -544,5 +548,6 @@ ok(tmp.length === 7, "tmp.length !== 7");
ok
(
tmp
[
"0"
]
===
undefined
,
"tmp[0] is not undefined"
);
ok
(
tmp
[
"3"
]
===
2
,
"tmp[3] !== 2"
);
ok
(
tmp
[
"6"
]
===
true
,
"tmp[6] !== true"
);
ok
(
tmp
[
2
]
===
1
,
"tmp[2] !== 1"
);
reportSuccess
();
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