Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
wine
Manage
Activity
Members
Labels
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Container Registry
Model registry
Operate
Terraform modules
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Tayshawnna Jackson
wine
Commits
15b07c2a
Commit
15b07c2a
authored
15 years ago
by
Piotr Caban
Committed by
Alexandre Julliard
15 years ago
Browse files
Options
Downloads
Patches
Plain Diff
jscript: Improve to_string implementation.
parent
a5d95365
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
dlls/jscript/jsutils.c
+18
-9
18 additions, 9 deletions
dlls/jscript/jsutils.c
dlls/jscript/tests/api.js
+7
-0
7 additions, 0 deletions
dlls/jscript/tests/api.js
with
25 additions
and
9 deletions
dlls/jscript/jsutils.c
+
18
−
9
View file @
15b07c2a
...
...
@@ -512,6 +512,8 @@ HRESULT to_string(script_ctx_t *ctx, VARIANT *v, jsexcept_t *ei, BSTR *str)
const
WCHAR
nullW
[]
=
{
'n'
,
'u'
,
'l'
,
'l'
,
0
};
const
WCHAR
trueW
[]
=
{
't'
,
'r'
,
'u'
,
'e'
,
0
};
const
WCHAR
falseW
[]
=
{
'f'
,
'a'
,
'l'
,
's'
,
'e'
,
0
};
const
WCHAR
NaNW
[]
=
{
'N'
,
'a'
,
'N'
,
0
};
const
WCHAR
InfinityW
[]
=
{
'-'
,
'I'
,
'n'
,
'f'
,
'i'
,
'n'
,
'i'
,
't'
,
'y'
,
0
};
switch
(
V_VT
(
v
))
{
case
VT_EMPTY
:
...
...
@@ -524,16 +526,23 @@ HRESULT to_string(script_ctx_t *ctx, VARIANT *v, jsexcept_t *ei, BSTR *str)
*
str
=
int_to_bstr
(
V_I4
(
v
));
break
;
case
VT_R8
:
{
VARIANT
strv
;
HRESULT
hres
;
V_VT
(
&
strv
)
=
VT_EMPTY
;
hres
=
VariantChangeTypeEx
(
&
strv
,
v
,
MAKELCID
(
MAKELANGID
(
LANG_ENGLISH
,
SUBLANG_ENGLISH_US
),
SORT_DEFAULT
),
0
,
VT_BSTR
);
if
(
FAILED
(
hres
))
return
hres
;
if
(
isnan
(
V_R8
(
v
)))
*
str
=
SysAllocString
(
NaNW
);
else
if
(
isinf
(
V_R8
(
v
)))
*
str
=
SysAllocString
(
V_R8
(
v
)
<
0
?
InfinityW
:
InfinityW
+
1
);
else
{
VARIANT
strv
;
HRESULT
hres
;
V_VT
(
&
strv
)
=
VT_EMPTY
;
hres
=
VariantChangeTypeEx
(
&
strv
,
v
,
MAKELCID
(
MAKELANGID
(
LANG_ENGLISH
,
SUBLANG_ENGLISH_US
),
SORT_DEFAULT
),
0
,
VT_BSTR
);
if
(
FAILED
(
hres
))
return
hres
;
*
str
=
V_BSTR
(
&
strv
);
return
S_OK
;
*
str
=
V_BSTR
(
&
strv
);
return
S_OK
;
}
break
;
}
case
VT_BSTR
:
*
str
=
SysAllocString
(
V_BSTR
(
v
));
...
...
This diff is collapsed.
Click to expand it.
dlls/jscript/tests/api.js
+
7
−
0
View file @
15b07c2a
...
...
@@ -566,6 +566,13 @@ ok(tmp === 0, "(new Number()).valueOf = " + tmp);
tmp
=
Number
.
prototype
.
valueOf
();
ok
(
tmp
===
0
,
"
Number.prototype.valueOf =
"
+
tmp
);
num
=
new
Number
(
NaN
);
ok
(
num
.
toString
()
===
"
NaN
"
,
"
num.toString() =
"
+
num
.
toString
());
num
=
new
Number
(
-
Infinity
);
ok
(
num
.
toString
()
===
"
-Infinity
"
,
"
num.toString() =
"
+
num
.
toString
());
num
=
new
Number
(
Infinity
);
ok
(
num
.
toString
()
===
"
Infinity
"
,
"
num.toString() =
"
+
num
.
toString
());
tmp
=
Math
.
min
(
1
);
ok
(
tmp
===
1
,
"
Math.min(1) =
"
+
tmp
);
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment