re-enable an assertion that was commented out.

fix a size_t range warning, change error code for wrptr().
This commit is contained in:
Enno Rehling 2015-05-24 14:01:37 +02:00
parent 0c3e310e39
commit a5f056b4b6
2 changed files with 2 additions and 6 deletions

View File

@ -700,7 +700,7 @@ static void statistic_test(CuTest *tc, int peasants, int luck, int maxp,
for (i = 0; i < 1000; ++i) { for (i = 0; i < 1000; ++i) {
effect = peasant_luck_effect(peasants, luck, maxp, variance); effect = peasant_luck_effect(peasants, luck, maxp, variance);
CuAssertTrue(tc, min_value <= effect); CuAssertTrue(tc, min_value <= effect);
// broken CuAssertTrue(tc, max_value >= effect); CuAssertTrue(tc, max_value >= effect);
} }
} }

View File

@ -12,10 +12,6 @@ int wrptr(char **ptr, size_t * size, size_t bytes)
if (bytes == 0) { if (bytes == 0) {
return 0; return 0;
} }
if (bytes < 0) {
*size = 0;
return EINVAL;
}
if (bytes <= *size) { if (bytes <= *size) {
*ptr += bytes; *ptr += bytes;
*size -= bytes; *size -= bytes;
@ -24,7 +20,7 @@ int wrptr(char **ptr, size_t * size, size_t bytes)
*ptr += *size; *ptr += *size;
*size = 0; *size = 0;
return ENAMETOOLONG; return ERANGE;
} }
#ifndef HAVE_STRLCPY #ifndef HAVE_STRLCPY