win32config.h 1.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051
  1. /*
  2. * Summary: Windows configuration header
  3. * Description: Windows configuration header
  4. *
  5. * Copy: See Copyright for the status of this software.
  6. *
  7. * Author: Igor Zlatkovic
  8. */
  9. #ifndef __LIBXSLT_WIN32_CONFIG__
  10. #define __LIBXSLT_WIN32_CONFIG__
  11. /* snprintf emulation taken from http://stackoverflow.com/a/8712996/1956010 */
  12. #if defined(_MSC_VER) && _MSC_VER < 1900
  13. #include <stdarg.h>
  14. #include <stdio.h>
  15. #define snprintf c99_snprintf
  16. #define vsnprintf c99_vsnprintf
  17. __inline int c99_vsnprintf(char *outBuf, size_t size, const char *format, va_list ap)
  18. {
  19. int count = -1;
  20. if (size != 0)
  21. count = _vsnprintf_s(outBuf, size, _TRUNCATE, format, ap);
  22. if (count == -1)
  23. count = _vscprintf(format, ap);
  24. return count;
  25. }
  26. __inline int c99_snprintf(char *outBuf, size_t size, const char *format, ...)
  27. {
  28. int count;
  29. va_list ap;
  30. va_start(ap, format);
  31. count = c99_vsnprintf(outBuf, size, format, ap);
  32. va_end(ap);
  33. return count;
  34. }
  35. #endif /* defined(_MSC_VER) && _MSC_VER < 1900 */
  36. #define HAVE_SYS_STAT_H
  37. #define HAVE__STAT
  38. #endif /* __LIBXSLT_WIN32_CONFIG__ */