Fixes for compilation under Windows (specifically MSVC). Also added MSVC supported "_inline", and fixed some WIN32 specific warnings.

This commit is contained in:
Iain Denniston
2011-03-18 12:35:19 +00:00
committed by Marcelo Roberto Jimenez
parent fed316ff3e
commit 92ea719804
15 changed files with 59 additions and 28 deletions

View File

@@ -28,16 +28,19 @@
/* Other systems have strncasecmp */
#endif
/* strnlen() is a GNU extension. */
#if HAVE_STRNLEN
extern size_t strnlen(const char *s, size_t maxlen);
#else /* HAVE_STRNLEN */
static size_t strnlen(const char *s, size_t n)
{
const char *p = (const char *)memchr(s, 0, n);
return p ? p - s : n;
}
#endif /* HAVE_STRNLEN */
#ifndef UPNP_USE_MSVCPP
/* VC has strnlen which is already included but with (potentially) different linkage */
/* strnlen() is a GNU extension. */
#if HAVE_STRNLEN
extern size_t strnlen(const char *s, size_t maxlen);
#else /* HAVE_STRNLEN */
static size_t strnlen(const char *s, size_t n)
{
const char *p = (const char *)memchr(s, 0, n);
return p ? p - s : n;
}
#endif /* HAVE_STRNLEN */
#endif /* WIN32 */
/* strndup() is a GNU extension. */
#if HAVE_STRNDUP && !defined(WIN32)