FreeRDP
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 
29 errno_t _itoa_s(int value, char* buffer, size_t sizeInCharacters, int radix)
30 {
31  int length = 0;
32 
33  length = sprintf_s(NULL, 0, "%d", value);
34 
35  if (length < 0)
36  return -1;
37 
38  if (sizeInCharacters < (size_t)length)
39  return -1;
40 
41  (void)sprintf_s(buffer, length + 1, "%d", value);
42 
43  return 0;
44 }
45 
46 #endif