Commit 18420826 authored by Sebastian Lackner's avatar Sebastian Lackner Committed by Alexandre Julliard

jscript: Do not include terminating \0 in result returned by Date_toLocale{Date,Time}String.

parent 69437afe
......@@ -925,7 +925,7 @@ static HRESULT Date_toLocaleDateString(script_ctx_t *ctx, vdisp_t *jsthis, WORD
WCHAR *ptr;
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)
return E_OUTOFMEMORY;
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;
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)
return E_OUTOFMEMORY;
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"),
"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(Math.floor(Math.PI*100) === 314, "Math.PI = " + Math.PI);
Math.PI = "test";
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment