Hans Leidekker : webservices: Fix use of month as array index.
Alexandre Julliard
julliard at winehq.org
Wed Feb 15 16:06:23 CST 2017
Module: wine
Branch: master
Commit: aaab5410a1b76de6f8aeb1e2fa4d8ca27e717c61
URL: http://source.winehq.org/git/wine.git/?a=commit;h=aaab5410a1b76de6f8aeb1e2fa4d8ca27e717c61
Author: Hans Leidekker <hans at codeweavers.com>
Date: Wed Feb 15 14:17:09 2017 +0100
webservices: Fix use of month as array index.
Signed-off-by: Hans Leidekker <hans at codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard at winehq.org>
---
dlls/webservices/tests/writer.c | 4 ++++
dlls/webservices/writer.c | 5 ++---
2 files changed, 6 insertions(+), 3 deletions(-)
diff --git a/dlls/webservices/tests/writer.c b/dlls/webservices/tests/writer.c
index 039de55..be6504d 100644
--- a/dlls/webservices/tests/writer.c
+++ b/dlls/webservices/tests/writer.c
@@ -2716,6 +2716,10 @@ static void test_datetime(void)
{ 0x701ce51ced5d800, WS_DATETIME_FORMAT_LOCAL, S_OK, "<t>1601-01-01T07:00:00+00:00</t>",
"<t>1601-01-01T01:00:00-06:00</t>" /* win7 */ },
{ 0, WS_DATETIME_FORMAT_NONE + 1, WS_E_INVALID_FORMAT },
+ { 0x38a080649c000, WS_DATETIME_FORMAT_UTC, S_OK, "<t>0004-02-28T00:00:00Z</t>" },
+ { 0x38ad130b38000, WS_DATETIME_FORMAT_UTC, S_OK, "<t>0004-02-29T00:00:00Z</t>" },
+ { 0x8c1505f0e438000, WS_DATETIME_FORMAT_UTC, S_OK, "<t>2000-02-29T00:00:00Z</t>" },
+ { 0x8d46035e7870000, WS_DATETIME_FORMAT_UTC, S_OK, "<t>2017-03-01T00:00:00Z</t>" },
};
HRESULT hr;
WS_XML_WRITER *writer;
diff --git a/dlls/webservices/writer.c b/dlls/webservices/writer.c
index f01a5a0..4415a24 100644
--- a/dlls/webservices/writer.c
+++ b/dlls/webservices/writer.c
@@ -1203,7 +1203,7 @@ static inline int year_size( int year )
static ULONG format_datetime( const WS_DATETIME *ptr, unsigned char *buf )
{
static const char fmt[] = "%04u-%02u-%02uT%02u:%02u:%02u";
- int day, hour, min, sec, sec_frac, month = 1, year = 1, tz_hour;
+ int day, hour, min, sec, sec_frac, month = 0, year = 1, tz_hour;
unsigned __int64 ticks, day_ticks;
ULONG len;
@@ -1235,9 +1235,8 @@ static ULONG format_datetime( const WS_DATETIME *ptr, unsigned char *buf )
day -= month_days[leap_year( year )][month];
month++;
}
- day++;
- len = sprintf( (char *)buf, fmt, year, month, day, hour, min, sec );
+ len = sprintf( (char *)buf, fmt, year, month + 1, day + 1, hour, min, sec );
if (sec_frac)
{
static const char fmt_frac[] = ".%07u";
More information about the wine-cvs
mailing list