Skip to content

Commit

Permalink
[CBRD-25525] Modify cub_vsnprintf() to support vsnprintf() in Windows…
Browse files Browse the repository at this point in the history
… build (#5409) : to release/11.3 (#5421)

http://jira.cubrid.org/browse/CBRD-25525

Match the return value of vsnprintf() function and cub_vsnprint() of Windows version.
vsnprintf() is supported in Windows, but other functions also call mapped functions, so the existing method is maintained.
backport [CBRD-25525] Modify cub_vsnprintf() to support vsnprintf() in Windows build #5409
  • Loading branch information
ctshim authored Aug 21, 2024
1 parent d84ebb5 commit 5c4899c
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion src/base/porting.c
Original file line number Diff line number Diff line change
Expand Up @@ -1476,6 +1476,11 @@ cub_vsnprintf (char *buffer, size_t count, const char *format, va_list argptr)
{
int len = _vscprintf_p (format, argptr) + 1;

if (count == 0)
{
return (len - 1);
}

if (len > (int) count)
{
char *cp = (char *) malloc (len);
Expand All @@ -1495,7 +1500,7 @@ cub_vsnprintf (char *buffer, size_t count, const char *format, va_list argptr)
buffer[count - 1] = 0;

free (cp);
return (int) count;
return (int) len;
}

return _vsprintf_p (buffer, count, format, argptr);
Expand Down

0 comments on commit 5c4899c

Please sign in to comment.