* @brief Platform independent wrapper for sprintf_s / snprintf * * @param Buffer output buffer * @param BufferSize size of the output buffer * @param Format format string * @return INT number of characters written, or -1 on error */
| 26 | * @return INT number of characters written, or -1 on error |
| 27 | */ |
| 28 | INT |
| 29 | PlatformSprintf(char * Buffer, SIZE_T BufferSize, const char * Format, ...) |
| 30 | { |
| 31 | va_list Args; |
| 32 | va_start(Args, Format); |
| 33 | INT Result; |
| 34 | #if defined(_WIN32) || defined(_WIN64) |
| 35 | Result = vsprintf_s(Buffer, BufferSize, Format, Args); |
| 36 | #elif defined(__linux__) |
| 37 | Result = vsnprintf(Buffer, BufferSize, Format, Args); |
| 38 | #else |
| 39 | # error "Unsupported platform" |
| 40 | #endif |
| 41 | va_end(Args); |
| 42 | return Result; |
| 43 | } |
| 44 | |
| 45 | ///////////////////////////////////////////////// |
| 46 | /// ... New Unified API ... |
no outgoing calls
no test coverage detected