From ecd045978242d90463be757a616f508cd4192bd7 Mon Sep 17 00:00:00 2001 From: Jonathan Schleifer Date: Tue, 8 Jul 2014 00:46:47 +0200 Subject: [PATCH] Add missing definition of _C99_SOURCE --- src/string.c | 3 +-- src/tcpsocket.c | 1 + tests/tests.c | 4 ++-- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/string.c b/src/string.c index 333b501..096807b 100644 --- a/src/string.c +++ b/src/string.c @@ -61,8 +61,7 @@ cfw_strdup(const char *s) if ((copy = malloc(len + 1)) == NULL) return NULL; - memcpy(copy, s, len); - copy[len] = 0; + memcpy(copy, s, len + 1); return copy; } diff --git a/src/tcpsocket.c b/src/tcpsocket.c index 104c6ae..bb6eaa0 100644 --- a/src/tcpsocket.c +++ b/src/tcpsocket.c @@ -24,6 +24,7 @@ * POSSIBILITY OF SUCH DAMAGE. */ +#define _C99_SOURCE #define _POSIX_SOURCE #include diff --git a/tests/tests.c b/tests/tests.c index 90a4bfe..97d3c8e 100644 --- a/tests/tests.c +++ b/tests/tests.c @@ -70,9 +70,9 @@ main() array = cfw_create(cfw_array, cfw_create(cfw_string, "Hallo"), cfw_create(cfw_string, " Welt"), - cfw_create(cfw_string, "!"), NULL); + cfw_create(cfw_string, "!"), (void*)NULL); - str = cfw_new(cfw_string, NULL); + str = cfw_new(cfw_string, (void*)NULL); for (i = 0; i < cfw_array_size(array); i++) cfw_string_append(str, cfw_array_get(array, i));