From 7e5f4da929a60ba81c17a67fd8c9166cb1f2e9da Mon Sep 17 00:00:00 2001 From: Martin Szulecki Date: Wed, 30 Jul 2014 17:00:43 +0200 Subject: cython: Fix compiler warning about uninitialized struct tm field --- cython/plist_util.c | 17 ++++++++--------- 1 file changed, 8 insertions(+), 9 deletions(-) diff --git a/cython/plist_util.c b/cython/plist_util.c index 70c5be3..4f922e5 100644 --- a/cython/plist_util.c +++ b/cython/plist_util.c @@ -11,15 +11,14 @@ void datetime_to_ints(PyObject* obj, int32_t* sec, int32_t* usec) { usec = NULL; return; } - struct tm t = { - PyDateTime_DATE_GET_SECOND(obj), - PyDateTime_DATE_GET_MINUTE(obj), - PyDateTime_DATE_GET_HOUR(obj), - PyDateTime_GET_DAY(obj), - PyDateTime_GET_MONTH(obj)-1, - PyDateTime_GET_YEAR(obj)-1900, - 0,0,0 - }; + struct tm t; + memset(&t, 0, sizeof(t)); + t.tm_sec = PyDateTime_DATE_GET_SECOND(obj); + t.tm_min = PyDateTime_DATE_GET_MINUTE(obj); + t.tm_hour = PyDateTime_DATE_GET_HOUR(obj); + t.tm_mday = PyDateTime_GET_DAY(obj); + t.tm_mon = PyDateTime_GET_MONTH(obj)-1; + t.tm_year = PyDateTime_GET_YEAR(obj)-1900; *sec = (int32_t)mktime(&t); *usec = PyDateTime_DATE_GET_MICROSECOND(obj); } -- cgit v1.2.1