Skip to content

Commit

Permalink
resolved some warnings
Browse files Browse the repository at this point in the history
  • Loading branch information
DissolveDZ committed Sep 30, 2023
1 parent 0dcf0d5 commit 8a80802
Showing 1 changed file with 5 additions and 6 deletions.
11 changes: 5 additions & 6 deletions src/rtext.c
Original file line number Diff line number Diff line change
Expand Up @@ -1367,17 +1367,16 @@ const char *TextFormat(const char *text, ...)
va_list args;
va_start(args, text);

int length = vsnprintf(NULL, 0, text, args); // Determine the length of the formatted string
if (length < 0)
int length = vsnprintf(NULL, 0, text, args);

if (length < 0 || length >= MAX_TEXT_BUFFER_LENGTH)
{
// Handle error
va_end(args);
return NULL;
}

va_end(args); // Reset the va_list

va_start(args, text); // Start again for the actual formatting
va_end(args);
va_start(args, text);
vsnprintf(formatBuffer, length + 1, text, args); // Format the string and copy it to the result buffer
va_end(args);

Expand Down

0 comments on commit 8a80802

Please sign in to comment.