Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
Tetragramm
GitHub Repository: Tetragramm/opencv
Path: blob/master/3rdparty/libtiff/snprintf.c
16337 views
1
/**
2
* Workaround for lack of snprintf(3) in Visual Studio. See
3
* http://stackoverflow.com/questions/2915672/snprintf-and-visual-studio-2010/8712996#8712996
4
* It's a trivial wrapper around the builtin _vsnprintf_s and
5
* _vscprintf functions.
6
*/
7
8
#ifdef _MSC_VER
9
10
#include <stdio.h>
11
#include <stdarg.h>
12
13
int _TIFF_vsnprintf_f(char* str, size_t size, const char* format, va_list ap)
14
{
15
int count = -1;
16
17
if (size != 0)
18
count = _vsnprintf_s(str, size, _TRUNCATE, format, ap);
19
if (count == -1)
20
count = _vscprintf(format, ap);
21
22
return count;
23
}
24
25
int _TIFF_snprintf_f(char* str, size_t size, const char* format, ...)
26
{
27
int count;
28
va_list ap;
29
30
va_start(ap, format);
31
count = vsnprintf(str, size, format, ap);
32
va_end(ap);
33
34
return count;
35
}
36
37
#endif // _MSC_VER
38
39
40