From 2abaf64c1252cd9ff7979ab3dcbd2ef6e5208e42 Mon Sep 17 00:00:00 2001 From: Linus Dierheimer Date: Wed, 17 Nov 2021 12:07:08 +0100 Subject: [PATCH] fix a compiler warning in ffStrbufEnsureCapacity --- src/util/FFstrbuf.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/util/FFstrbuf.c b/src/util/FFstrbuf.c index 69f88ff77..5ad290d58 100644 --- a/src/util/FFstrbuf.c +++ b/src/util/FFstrbuf.c @@ -104,6 +104,12 @@ void ffStrbufEnsureCapacity(FFstrbuf* strbuf, uint32_t capacity) if(strbuf->allocated > capacity || capacity == 0) return; + if(capacity == UINT32_MAX) + { + capacity = UINT32_MAX - 1; + fprintf(stderr, "Warning: ffStrbufEnsureCapacity called with UINT32_MAX. Highest allowed value is UINT32_MAX - 1. Reducing capacity.\n"); + } + setCapacity(strbuf, capacity + 1); // + 1 for the null byte }