FreeRDP
Loading...
Searching...
No Matches
conversion.c
1
20#include <winpr/config.h>
21
22#include <winpr/crt.h>
23#include <winpr/string.h>
24
25/* Data Conversion: http://msdn.microsoft.com/en-us/library/0heszx3w/ */
26
27#ifndef _WIN32
28
29errno_t _itoa_s(int value, char* buffer, size_t sizeInCharacters, WINPR_ATTR_UNUSED int radix)
30{
31 int length = sprintf_s(NULL, 0, "%d", value);
32
33 if (length < 0)
34 return -1;
35
36 if (sizeInCharacters < (size_t)length)
37 return -1;
38
39 (void)sprintf_s(buffer, WINPR_ASSERTING_INT_CAST(size_t, length + 1), "%d", value);
40
41 return 0;
42}
43
44#endif