diff --git a/src/output/output_csv.c b/src/output/output_csv.c index 52ee7dca..94699444 100644 --- a/src/output/output_csv.c +++ b/src/output/output_csv.c @@ -84,8 +84,8 @@ typedef char *(*string_function_t)(char *, recordHandle_t *); } while (0) #define STREAMBUFFSIZE 4096 -#define STREAMLEN(ptr) \ - (ptr - streamBuff); \ +#define STREAMLEN(ptr) \ + ((ptrdiff_t)STREAMBUFFSIZE - (ptr - streamBuff)); \ assert((ptr - streamBuff) < STREAMBUFFSIZE) static char *streamBuff = NULL; diff --git a/src/output/output_json.c b/src/output/output_json.c index 98774b26..2e105ed7 100644 --- a/src/output/output_json.c +++ b/src/output/output_json.c @@ -115,8 +115,8 @@ static uint32_t recordCount = 0; } while (0) #define STREAMBUFFSIZE 4096 -#define STREAMLEN(ptr) \ - (ptr - streamBuff); \ +#define STREAMLEN(ptr) \ + ((ptrdiff_t)STREAMBUFFSIZE - (ptr - streamBuff)); \ assert((ptr - streamBuff) < STREAMBUFFSIZE) static char *streamBuff = NULL; diff --git a/src/output/output_ndjson.c b/src/output/output_ndjson.c index 5891df28..362a08a7 100644 --- a/src/output/output_ndjson.c +++ b/src/output/output_ndjson.c @@ -103,8 +103,8 @@ static uint32_t recordCount = 0; } while (0) #define STREAMBUFFSIZE 4096 -#define STREAMLEN(ptr) \ - (ptr - streamBuff); \ +#define STREAMLEN(ptr) \ + ((ptrdiff_t)STREAMBUFFSIZE - (ptr - streamBuff)); \ assert((ptr - streamBuff) < STREAMBUFFSIZE) static char *streamBuff = NULL;