Guard _XOPEN_SOURCE definitions, and cast strptime to (char *) explicitly.

This commit is contained in:
Aaron Hamilton
2015-01-22 01:32:38 +00:00
parent 6b17698276
commit 055dc9ce13
3 changed files with 12 additions and 5 deletions

View File

@@ -16,8 +16,10 @@
* Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*
*/
#ifndef __OpenBSD__
#define _XOPEN_SOURCE // for strptime
#endif
#include <jansson.h>
#include <stdio.h>
#include <stdlib.h>
@@ -156,7 +158,7 @@ static int _decode_folder_get_info(mfhttp * conn, void *data)
created = json_object_get(node, "created");
if (created != NULL) {
memset(&tm, 0, sizeof(struct tm));
ret = strptime(json_string_value(created), "%F %T", &tm);
ret = (char *) strptime(json_string_value(created), "%F %T", &tm);
if (ret[0] != '\0') {
fprintf(stderr, "cannot parse time\n");
} else {