summaryrefslogtreecommitdiffstats
path: root/cython
diff options
context:
space:
mode:
authorGravatar Martin Szulecki2014-07-30 17:00:43 +0200
committerGravatar Martin Szulecki2014-07-30 17:00:43 +0200
commit7e5f4da929a60ba81c17a67fd8c9166cb1f2e9da (patch)
tree3699e4258d414316cdb2d0210e58c7f77f31e21b /cython
parentcf739732cff1b102acc24e82f630195b760fc884 (diff)
downloadlibplist-7e5f4da929a60ba81c17a67fd8c9166cb1f2e9da.tar.gz
libplist-7e5f4da929a60ba81c17a67fd8c9166cb1f2e9da.tar.bz2
cython: Fix compiler warning about uninitialized struct tm field
Diffstat (limited to 'cython')
-rw-r--r--cython/plist_util.c17
1 files 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);
}