385 // Copy the argument list so that we have something to provide to vsnprintf in case we have to call it again. |
385 // Copy the argument list so that we have something to provide to vsnprintf in case we have to call it again. |
386 va_list argsCopy; |
386 va_list argsCopy; |
387 va_copy(argsCopy, args); |
387 va_copy(argsCopy, args); |
388 |
388 |
389 // First, attempt to format using a fixed-size buffer. |
389 // First, attempt to format using a fixed-size buffer. |
390 static char buffer[64]; |
390 static char buffer[1024]; |
391 size_t length = vsnprintf(buffer, sizeof buffer, formatString, args); |
391 size_t length = vsnprintf(buffer, sizeof buffer, formatString, args); |
392 |
392 |
393 if (length < sizeof buffer) |
393 if (length < sizeof buffer) |
394 { |
394 { |
395 // vsnprintf succeeded in fitting the formatted string into the buffer, so we're done. |
395 // vsnprintf succeeded in fitting the formatted string into the buffer, so we're done. |