# HG changeset patch # User Mike Becker # Date 1456500784 -3600 # Node ID b20d6088795c8d4ba8d8e32fa5e5a2b42ef3e4b2 # Parent e056e4e0b08eef54016b6627c415a4c4635f0785 fixed further usages of SIZE_MAX diff -r e056e4e0b08e -r b20d6088795c test/buffer_tests.c --- a/test/buffer_tests.c Fri Feb 26 16:22:20 2016 +0100 +++ b/test/buffer_tests.c Fri Feb 26 16:33:04 2016 +0100 @@ -27,7 +27,6 @@ */ #include "buffer_tests.h" -#include UCX_TEST(test_ucx_buffer_new) { UcxBuffer *b = ucx_buffer_new(NULL, 16, UCX_BUFFER_AUTOEXTEND); @@ -88,7 +87,8 @@ int r; UCX_TEST_BEGIN - size_t bigpos = SIZE_MAX - 5000; + const size_t sizemax = (size_t)-1; + size_t bigpos = sizemax - 5000; b->pos = bigpos; r = ucx_buffer_seek(b, 5016, SEEK_CUR); UCX_TEST_ASSERT(r != 0, "seek cur overflow"); @@ -96,8 +96,8 @@ "failed seek shall leave pos unchanged"); b->pos = 0; - b->size = SIZE_MAX / 2 + 32; - off_t bigoff = SIZE_MAX / 2 - 16; + b->size = sizemax / 2 + 32; + off_t bigoff = sizemax / 2 - 16; r = ucx_buffer_seek(b, -bigoff, SEEK_CUR); UCX_TEST_ASSERT(r != 0, "seek cur underflow"); UCX_TEST_ASSERT(b->pos == 0, @@ -593,7 +593,7 @@ UCX_TEST_ASSERT((b->size == 0 && b->pos == 0), "pos and size shall remain unchanged"); - UCX_TEST_ASSERT(ucx_buffer_extend(b, SIZE_MAX - 60) != 0, + UCX_TEST_ASSERT(ucx_buffer_extend(b, (size_t) - 61) != 0, "shall fail and return a non-zero value on overflow"); UCX_TEST_END diff -r e056e4e0b08e -r b20d6088795c ucx/avl.h --- a/ucx/avl.h Fri Feb 26 16:22:20 2016 +0100 +++ b/ucx/avl.h Fri Feb 26 16:33:04 2016 +0100 @@ -44,7 +44,7 @@ #include "ucx.h" #include "allocator.h" -#include +#include #ifdef __cplusplus extern "C" { diff -r e056e4e0b08e -r b20d6088795c ucx/utils.h --- a/ucx/utils.h Fri Feb 26 16:22:20 2016 +0100 +++ b/ucx/utils.h Fri Feb 26 16:33:04 2016 +0100 @@ -45,7 +45,7 @@ #include "ucx.h" #include "string.h" #include "allocator.h" -#include +#include #include #include @@ -95,7 +95,7 @@ * @return total number of bytes copied */ #define ucx_stream_hcopy(src,dest,rfnc,wfnc) ucx_stream_copy(\ - src, dest, (read_func)rfnc, (write_func)wfnc, NULL, 0x100, SIZE_MAX) + src, dest, (read_func)rfnc, (write_func)wfnc, NULL, 0x100, (size_t)-1) /** * Shorthand for ucx_stream_copy using the default copy buffer and a copy limit.