jscript: Do not include terminating \0 in result returned by Date_toLocale{Date,Time}String.
Signed-off-by: Sebastian Lackner <sebastian@fds-team.de> Signed-off-by: Jacek Caban <jacek@codeweavers.com> Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
parent
69437afed1
commit
18420826aa
@ -925,7 +925,7 @@ static HRESULT Date_toLocaleDateString(script_ctx_t *ctx, vdisp_t *jsthis, WORD
|
|||||||
WCHAR *ptr;
|
WCHAR *ptr;
|
||||||
|
|
||||||
len = GetDateFormatW(ctx->lcid, DATE_LONGDATE, &st, NULL, NULL, 0);
|
len = GetDateFormatW(ctx->lcid, DATE_LONGDATE, &st, NULL, NULL, 0);
|
||||||
date_str = jsstr_alloc_buf(len, &ptr);
|
date_str = jsstr_alloc_buf(len-1, &ptr);
|
||||||
if(!date_str)
|
if(!date_str)
|
||||||
return E_OUTOFMEMORY;
|
return E_OUTOFMEMORY;
|
||||||
GetDateFormatW(ctx->lcid, DATE_LONGDATE, &st, NULL, ptr, len);
|
GetDateFormatW(ctx->lcid, DATE_LONGDATE, &st, NULL, ptr, len);
|
||||||
@ -964,7 +964,7 @@ static HRESULT Date_toLocaleTimeString(script_ctx_t *ctx, vdisp_t *jsthis, WORD
|
|||||||
WCHAR *ptr;
|
WCHAR *ptr;
|
||||||
|
|
||||||
len = GetTimeFormatW(ctx->lcid, 0, &st, NULL, NULL, 0);
|
len = GetTimeFormatW(ctx->lcid, 0, &st, NULL, NULL, 0);
|
||||||
date_str = jsstr_alloc_buf(len, &ptr);
|
date_str = jsstr_alloc_buf(len-1, &ptr);
|
||||||
if(!date_str)
|
if(!date_str)
|
||||||
return E_OUTOFMEMORY;
|
return E_OUTOFMEMORY;
|
||||||
GetTimeFormatW(ctx->lcid, 0, &st, NULL, ptr, len);
|
GetTimeFormatW(ctx->lcid, 0, &st, NULL, ptr, len);
|
||||||
|
@ -2130,6 +2130,11 @@ ok(Date.parse("Tue, 22 Mar 2016 09:57:55 -0300") === Date.parse("Tue, 22 Mar 201
|
|||||||
ok(Date.parse("Tue, 22 Mar 2016 09:57:55 +0400") === Date.parse("Tue, 22 Mar 2016 09:57:55 UTC+0400"),
|
ok(Date.parse("Tue, 22 Mar 2016 09:57:55 +0400") === Date.parse("Tue, 22 Mar 2016 09:57:55 UTC+0400"),
|
||||||
"Date.parse(\"Tue, 22 Mar 2016 09:57:55 +0400\") = " + Date.parse("Tue, 22 Mar 2016 09:57:55 +0400"));
|
"Date.parse(\"Tue, 22 Mar 2016 09:57:55 +0400\") = " + Date.parse("Tue, 22 Mar 2016 09:57:55 +0400"));
|
||||||
|
|
||||||
|
tmp = (new Date()).toLocaleDateString();
|
||||||
|
ok(tmp.charCodeAt(tmp.length-1) != 0, "invalid null byte");
|
||||||
|
tmp = (new Date()).toLocaleTimeString();
|
||||||
|
ok(tmp.charCodeAt(tmp.length-1) != 0, "invalid null byte");
|
||||||
|
|
||||||
ok(typeof(Math.PI) === "number", "typeof(Math.PI) = " + typeof(Math.PI));
|
ok(typeof(Math.PI) === "number", "typeof(Math.PI) = " + typeof(Math.PI));
|
||||||
ok(Math.floor(Math.PI*100) === 314, "Math.PI = " + Math.PI);
|
ok(Math.floor(Math.PI*100) === 314, "Math.PI = " + Math.PI);
|
||||||
Math.PI = "test";
|
Math.PI = "test";
|
||||||
|
Loading…
x
Reference in New Issue
Block a user