Created the macros PRIzd and PRIzx to deal with MSVC lack of C99.
Thanks to Iain Denniston for pointing it out.
This commit is contained in:
@@ -2,10 +2,17 @@
|
|||||||
Version 1.6.13
|
Version 1.6.13
|
||||||
*******************************************************************************
|
*******************************************************************************
|
||||||
|
|
||||||
|
2011-03-11 Marcelo Roberto Jimenez <mroberto(at)users.sourceforge.net>
|
||||||
|
|
||||||
|
Created the macros PRIzd and PRIzx to deal with MSVC lack of C99.
|
||||||
|
Thanks to Iain Denniston for pointing it out.
|
||||||
|
|
||||||
2011-03-08 Iain Denniston <iain.denniston(at)gmail.com>
|
2011-03-08 Iain Denniston <iain.denniston(at)gmail.com>
|
||||||
|
|
||||||
Fixes for headers when compiled under C++
|
Fixes for headers when compiled under C++
|
||||||
|
|
||||||
2011-03-08 Iain Denniston <iain.denniston(at)gmail.com>
|
2011-03-08 Iain Denniston <iain.denniston(at)gmail.com>
|
||||||
|
|
||||||
Fix for uuid_unpack incorrect shift precedence.
|
Fix for uuid_unpack incorrect shift precedence.
|
||||||
|
|
||||||
*******************************************************************************
|
*******************************************************************************
|
||||||
|
@@ -34,14 +34,18 @@
|
|||||||
/*
|
/*
|
||||||
* UPNP_INLINE
|
* UPNP_INLINE
|
||||||
* PRId64
|
* PRId64
|
||||||
|
* PRIzd
|
||||||
* PRIzu
|
* PRIzu
|
||||||
|
* PRIzx
|
||||||
*/
|
*/
|
||||||
#ifdef UPNP_USE_MSVCPP
|
#ifdef UPNP_USE_MSVCPP
|
||||||
/* define some things the M$ VC++ doesn't know */
|
/* define some things the M$ VC++ doesn't know */
|
||||||
#define UPNP_INLINE
|
#define UPNP_INLINE
|
||||||
typedef __int64 int64_t;
|
typedef __int64 int64_t;
|
||||||
#define PRId64 "I64d"
|
#define PRId64 "I64d"
|
||||||
|
#define PRIzd "ld"
|
||||||
#define PRIzu "lu"
|
#define PRIzu "lu"
|
||||||
|
#define PRIzx "lx"
|
||||||
#endif /* UPNP_USE_MSVCPP */
|
#endif /* UPNP_USE_MSVCPP */
|
||||||
|
|
||||||
#ifdef UPNP_USE_BCBPP
|
#ifdef UPNP_USE_BCBPP
|
||||||
@@ -51,7 +55,9 @@
|
|||||||
#warning The Borland C compiler is probably broken on PRId64,
|
#warning The Borland C compiler is probably broken on PRId64,
|
||||||
#warning please someone provide a proper fix here
|
#warning please someone provide a proper fix here
|
||||||
#define PRId64 "I64d"
|
#define PRId64 "I64d"
|
||||||
|
#define PRIzd "zd"
|
||||||
#define PRIzu "zu"
|
#define PRIzu "zu"
|
||||||
|
#define PRIzx "zx"
|
||||||
#endif /* UPNP_USE_BCBPP */
|
#endif /* UPNP_USE_BCBPP */
|
||||||
|
|
||||||
#ifdef __GNUC__
|
#ifdef __GNUC__
|
||||||
@@ -60,7 +66,9 @@
|
|||||||
* runtime printf which ends up getting called, not the glibc
|
* runtime printf which ends up getting called, not the glibc
|
||||||
* printf, so it genuinely doesn't have "zu"
|
* printf, so it genuinely doesn't have "zu"
|
||||||
*/
|
*/
|
||||||
|
#define PRIzd "ld"
|
||||||
#define PRIzu "lu"
|
#define PRIzu "lu"
|
||||||
|
#define PRIzx "lx"
|
||||||
#endif /* __GNUC__ */
|
#endif /* __GNUC__ */
|
||||||
#else
|
#else
|
||||||
/*!
|
/*!
|
||||||
@@ -93,13 +101,15 @@
|
|||||||
/* #define PRId64 PRId64 */
|
/* #define PRId64 PRId64 */
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
* \brief Supply the PRIzu printf() macro.
|
* \brief Supply the PRIz* printf() macros.
|
||||||
*
|
*
|
||||||
* This macro was invented so that we can live a little longer with
|
* These macros were invented so that we can live a little longer with
|
||||||
* MSVC lack of C99. "z" is the correct printf() size specifier for
|
* MSVC lack of C99. "z" is the correct printf() size specifier for
|
||||||
* the size_t type.
|
* the size_t type.
|
||||||
*/
|
*/
|
||||||
|
#define PRIzd "zd"
|
||||||
#define PRIzu "zu"
|
#define PRIzu "zu"
|
||||||
|
#define PRIzx "zx"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@@ -446,7 +446,7 @@ int http_SendMessage(SOCKINFO *info, int *TimeOut, const char *fmt, ...)
|
|||||||
/* Copy CRLF at the end of the chunk */
|
/* Copy CRLF at the end of the chunk */
|
||||||
memcpy(file_buf + num_read, "\r\n", 2);
|
memcpy(file_buf + num_read, "\r\n", 2);
|
||||||
/* Hex length for the chunk size. */
|
/* Hex length for the chunk size. */
|
||||||
sprintf(Chunk_Header, "%zx", num_read);
|
sprintf(Chunk_Header, "%" PRIzx, num_read);
|
||||||
/*itoa(num_read,Chunk_Header,16); */
|
/*itoa(num_read,Chunk_Header,16); */
|
||||||
strcat(Chunk_Header, "\r\n");
|
strcat(Chunk_Header, "\r\n");
|
||||||
/* Copy the chunk size header */
|
/* Copy the chunk size header */
|
||||||
@@ -850,7 +850,7 @@ int http_WriteHttpPost( IN void *Handle,
|
|||||||
if (!tempbuf)
|
if (!tempbuf)
|
||||||
return UPNP_E_OUTOF_MEMORY;
|
return UPNP_E_OUTOF_MEMORY;
|
||||||
/* begin chunk */
|
/* begin chunk */
|
||||||
sprintf(tempbuf, "%zx\r\n", *size);
|
sprintf(tempbuf, "%" PRIzx "\r\n", *size);
|
||||||
tempSize = strlen(tempbuf);
|
tempSize = strlen(tempbuf);
|
||||||
memcpy(tempbuf + tempSize, buf, *size);
|
memcpy(tempbuf + tempSize, buf, *size);
|
||||||
memcpy(tempbuf + tempSize + *size, "\r\n", 2);
|
memcpy(tempbuf + tempSize + *size, "\r\n", 2);
|
||||||
|
Reference in New Issue
Block a user