From a5f056b4b6ef8461b042dec79374efef5ad68134 Mon Sep 17 00:00:00 2001 From: Enno Rehling Date: Sun, 24 May 2015 14:01:37 +0200 Subject: [PATCH] re-enable an assertion that was commented out. fix a size_t range warning, change error code for wrptr(). --- src/laws.test.c | 2 +- src/util/bsdstring.c | 6 +----- 2 files changed, 2 insertions(+), 6 deletions(-) diff --git a/src/laws.test.c b/src/laws.test.c index 987b27773..58cba3942 100644 --- a/src/laws.test.c +++ b/src/laws.test.c @@ -700,7 +700,7 @@ static void statistic_test(CuTest *tc, int peasants, int luck, int maxp, for (i = 0; i < 1000; ++i) { effect = peasant_luck_effect(peasants, luck, maxp, variance); CuAssertTrue(tc, min_value <= effect); -// broken CuAssertTrue(tc, max_value >= effect); + CuAssertTrue(tc, max_value >= effect); } } diff --git a/src/util/bsdstring.c b/src/util/bsdstring.c index c43847da1..4205b9480 100644 --- a/src/util/bsdstring.c +++ b/src/util/bsdstring.c @@ -12,10 +12,6 @@ int wrptr(char **ptr, size_t * size, size_t bytes) if (bytes == 0) { return 0; } - if (bytes < 0) { - *size = 0; - return EINVAL; - } if (bytes <= *size) { *ptr += bytes; *size -= bytes; @@ -24,7 +20,7 @@ int wrptr(char **ptr, size_t * size, size_t bytes) *ptr += *size; *size = 0; - return ENAMETOOLONG; + return ERANGE; } #ifndef HAVE_STRLCPY