fix a compiler warning in ffStrbufEnsureCapacity

This commit is contained in:
Linus Dierheimer
2021-11-17 12:07:08 +01:00
parent 4e818c981a
commit 2abaf64c12
+6
View File
@@ -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
}