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
42c044ae
Commit
42c044ae
authored
Jan 19, 2021
by
Jacek Caban
Committed by
Alexandre Julliard
Jan 19, 2021
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
jscript: Support VT_DATE to string conversion.
Signed-off-by:
Jacek Caban
<
jacek@codeweavers.com
>
Signed-off-by:
Alexandre Julliard
<
julliard@winehq.org
>
parent
3fb0e893
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
40 additions
and
3 deletions
+40
-3
date.c
dlls/jscript/date.c
+25
-0
jscript.h
dlls/jscript/jscript.h
+1
-0
jsutils.c
dlls/jscript/jsutils.c
+11
-3
lang.js
dlls/jscript/tests/lang.js
+3
-0
No files found.
dlls/jscript/date.c
View file @
42c044ae
...
...
@@ -2483,3 +2483,28 @@ HRESULT variant_date_to_number(double date, double *ret)
make_time
(
st
.
wHour
,
st
.
wMinute
,
st
.
wSecond
,
st
.
wMilliseconds
));
return
S_OK
;
}
HRESULT
variant_date_to_string
(
script_ctx_t
*
ctx
,
double
date
,
jsstr_t
**
r
)
{
DateInstance
*
date_obj
;
jsval_t
val
;
double
time
;
HRESULT
hres
;
hres
=
variant_date_to_number
(
date
,
&
time
);
if
(
FAILED
(
hres
))
return
hres
;
hres
=
create_date
(
ctx
,
NULL
,
time
,
&
date_obj
);
if
(
FAILED
(
hres
))
return
hres
;
hres
=
dateobj_to_string
(
date_obj
,
&
val
);
jsdisp_release
(
&
date_obj
->
dispex
);
if
(
FAILED
(
hres
))
return
hres
;
assert
(
is_string
(
val
));
*
r
=
get_string
(
val
);
return
hres
;
}
dlls/jscript/jscript.h
View file @
42c044ae
...
...
@@ -361,6 +361,7 @@ HRESULT jsval_strict_equal(jsval_t,jsval_t,BOOL*) DECLSPEC_HIDDEN;
HRESULT
variant_change_type
(
script_ctx_t
*
,
VARIANT
*
,
VARIANT
*
,
VARTYPE
)
DECLSPEC_HIDDEN
;
HRESULT
variant_date_to_number
(
double
,
double
*
)
DECLSPEC_HIDDEN
;
HRESULT
variant_date_to_string
(
script_ctx_t
*
,
double
,
jsstr_t
**
)
DECLSPEC_HIDDEN
;
HRESULT
decode_source
(
WCHAR
*
)
DECLSPEC_HIDDEN
;
...
...
dlls/jscript/jsutils.c
View file @
42c044ae
...
...
@@ -773,9 +773,17 @@ HRESULT to_string(script_ctx_t *ctx, jsval_t val, jsstr_t **str)
case
JSV_BOOL
:
*
str
=
jsstr_alloc
(
get_bool
(
val
)
?
L"true"
:
L"false"
);
break
;
default:
FIXME
(
"unsupported %s
\n
"
,
debugstr_jsval
(
val
));
return
E_NOTIMPL
;
default:
{
const
VARIANT
*
v
=
get_variant
(
val
);
switch
(
V_VT
(
v
))
{
case
VT_DATE
:
return
variant_date_to_string
(
ctx
,
V_DATE
(
v
),
str
);
default:
FIXME
(
"unsupported %s
\n
"
,
debugstr_variant
(
v
));
return
E_NOTIMPL
;
}
}
}
return
*
str
?
S_OK
:
E_OUTOFMEMORY
;
...
...
dlls/jscript/tests/lang.js
View file @
42c044ae
...
...
@@ -200,14 +200,17 @@ ok(tmp === 3, "tmp = " + tmp);
ok
(
getVT
(
+
d
)
===
"VT_R8"
,
"vt +v_date(0) = "
+
getVT
(
d
));
ok
(
getVT
(
d
/
d
)
===
"VT_I4"
,
"vt v_date(0) / v_date(0) = "
+
getVT
(
d
/
d
));
ok
((
+
d
)
===
e
,
"+v_date(0) = "
+
(
+
d
)
+
" expected "
+
e
);
ok
((
""
+
d
).
match
(
/^Sat Dec 30 00:00:00 .* 1899$/
)
!=
null
,
"+v_date(0) = "
+
d
);
d
=
v_date
(
2.5
);
e
=
Date
.
parse
(
"Mon Jan 1 12:00:00 1900"
);
ok
((
+
d
)
===
e
,
"+v_date(2.5) = "
+
(
+
d
));
ok
((
""
+
d
).
match
(
/^Mon Jan 1 12:00:00 .* 1900$/
)
!=
null
,
"+v_date(2.5) = "
+
d
);
d
=
v_date
(
42091
);
e
=
Date
.
parse
(
"Sat Mar 28 00:00:00 2015"
);
ok
((
+
d
)
===
e
,
"+v_date(2015y) = "
+
(
+
d
)
+
" expected "
+
e
);
ok
((
""
+
d
).
match
(
/^Sat Mar 28 00:00:00 .* 2015$/
)
!=
null
,
"+v_date(2015y) = "
+
d
);
})();
function
testRecFunc
(
x
)
{
...
...
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