|
Packit Service |
def718 |
#ifndef __snprintf_compat_h
|
|
Packit Service |
def718 |
#define __snprintf_compat_h
|
|
Packit Service |
def718 |
|
|
Packit Service |
def718 |
/**
|
|
Packit Service |
def718 |
* @file
|
|
Packit Service |
def718 |
* @brief Do not use, json-c internal, may be changed or removed at any time.
|
|
Packit Service |
def718 |
*/
|
|
Packit Service |
def718 |
|
|
Packit Service |
def718 |
/*
|
|
Packit Service |
def718 |
* Microsoft's _vsnprintf and _snprint don't always terminate
|
|
Packit Service |
def718 |
* the string, so use wrappers that ensure that.
|
|
Packit Service |
def718 |
*/
|
|
Packit Service |
def718 |
|
|
Packit Service |
def718 |
#include <stdarg.h>
|
|
Packit Service |
def718 |
|
|
Packit Service |
def718 |
#if !defined(HAVE_SNPRINTF) && defined(_MSC_VER)
|
|
Packit Service |
def718 |
static int json_c_vsnprintf(char *str, size_t size, const char *format, va_list ap)
|
|
Packit Service |
def718 |
{
|
|
Packit Service |
def718 |
int ret;
|
|
Packit Service |
def718 |
ret = _vsnprintf(str, size, format, ap);
|
|
Packit Service |
def718 |
str[size - 1] = '\0';
|
|
Packit Service |
def718 |
return ret;
|
|
Packit Service |
def718 |
}
|
|
Packit Service |
def718 |
#define vsnprintf json_c_vsnprintf
|
|
Packit Service |
def718 |
|
|
Packit Service |
def718 |
static int json_c_snprintf(char *str, size_t size, const char *format, ...)
|
|
Packit Service |
def718 |
{
|
|
Packit Service |
def718 |
va_list ap;
|
|
Packit Service |
def718 |
int ret;
|
|
Packit Service |
def718 |
va_start(ap, format);
|
|
Packit Service |
def718 |
ret = json_c_vsnprintf(str, size, format, ap);
|
|
Packit Service |
def718 |
va_end(ap);
|
|
Packit Service |
def718 |
return ret;
|
|
Packit Service |
def718 |
}
|
|
Packit Service |
def718 |
#define snprintf json_c_snprintf
|
|
Packit Service |
def718 |
|
|
Packit Service |
def718 |
#elif !defined(HAVE_SNPRINTF) /* !HAVE_SNPRINTF */
|
|
Packit Service |
def718 |
# error Need vsnprintf!
|
|
Packit Service |
def718 |
#endif /* !HAVE_SNPRINTF && defined(WIN32) */
|
|
Packit Service |
def718 |
|
|
Packit Service |
def718 |
#endif /* __snprintf_compat_h */
|