* EXPORT_SPEC missing on some declarations in ixml/inc/ixml.h.
Thanks to David Maass. * sizeof is unsigned, so %zu is more adequate than %zd. * Using an invented printf directive PRIzu that on MSVC expands to "lu", and on normal C99 compilers expands to "zu". * Rewrote raw_find_str. Now it no longer uses strcasestr(), but it transforms the first input buffer into lowercase. git-svn-id: https://pupnp.svn.sourceforge.net/svnroot/pupnp/trunk@184 119443c7-1b9e-41f8-b6fc-b9c35fce742c
This commit is contained in:
parent
3fa207984a
commit
4ceb6c67d1
15
ChangeLog
15
ChangeLog
@ -2,6 +2,21 @@
|
|||||||
Version 1.4.7
|
Version 1.4.7
|
||||||
*************************************************************************
|
*************************************************************************
|
||||||
|
|
||||||
|
2007-05-15 Marcelo Jimenez <mroberto(at)users.sourceforge.net>
|
||||||
|
* EXPORT_SPEC missing on some declarations in ixml/inc/ixml.h.
|
||||||
|
Thanks to David Maass.
|
||||||
|
|
||||||
|
2007-05-15 Marcelo Jimenez <mroberto(at)users.sourceforge.net>
|
||||||
|
* sizeof is unsigned, so %zu is more adequate than %zd.
|
||||||
|
|
||||||
|
2007-05-15 Marcelo Jimenez <mroberto(at)users.sourceforge.net>
|
||||||
|
* Using an invented printf directive PRIzu that on MSVC
|
||||||
|
expands to "lu", and on normal C99 compilers expands to "zu".
|
||||||
|
|
||||||
|
2007-05-15 Marcelo Jimenez <mroberto(at)users.sourceforge.net>
|
||||||
|
* Rewrote raw_find_str. Now it no longer uses strcasestr(), but it
|
||||||
|
transforms the first input buffer into lowercase.
|
||||||
|
|
||||||
2007-05-08 Marcelo Jimenez <mroberto(at)users.sourceforge.net>
|
2007-05-08 Marcelo Jimenez <mroberto(at)users.sourceforge.net>
|
||||||
* Fix for debug printf format strings. size_t are not expected
|
* Fix for debug printf format strings. size_t are not expected
|
||||||
in a string format like "%.*s".
|
in a string format like "%.*s".
|
||||||
|
@ -1738,7 +1738,7 @@ ixmlNodeList_free(IXML_NodeList *nList
|
|||||||
* of the DOM tree or {\tt NULL} on an error.
|
* of the DOM tree or {\tt NULL} on an error.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
DOMString
|
EXPORT_SPEC DOMString
|
||||||
ixmlPrintDocument(IXML_Document *doc);
|
ixmlPrintDocument(IXML_Document *doc);
|
||||||
|
|
||||||
/** Renders a {\bf Node} and all sub-elements into an XML text
|
/** Renders a {\bf Node} and all sub-elements into an XML text
|
||||||
@ -1756,7 +1756,7 @@ ixmlPrintDocument(IXML_Document *doc);
|
|||||||
* of the DOM tree or {\tt NULL} on an error.
|
* of the DOM tree or {\tt NULL} on an error.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
DOMString
|
EXPORT_SPEC DOMString
|
||||||
ixmlPrintNode(IXML_Node *doc
|
ixmlPrintNode(IXML_Node *doc
|
||||||
/** The root of the {\bf Node} tree to render to XML text. */
|
/** The root of the {\bf Node} tree to render to XML text. */
|
||||||
);
|
);
|
||||||
@ -1777,7 +1777,7 @@ ixmlPrintNode(IXML_Node *doc
|
|||||||
* of the DOM tree or {\tt NULL} on an error.
|
* of the DOM tree or {\tt NULL} on an error.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
DOMString
|
EXPORT_SPEC DOMString
|
||||||
ixmlDocumenttoString(IXML_Document *doc);
|
ixmlDocumenttoString(IXML_Document *doc);
|
||||||
|
|
||||||
/** Renders a {\bf Node} and all sub-elements into an XML text
|
/** Renders a {\bf Node} and all sub-elements into an XML text
|
||||||
@ -1809,7 +1809,7 @@ ixmlNodetoString(IXML_Node *doc
|
|||||||
* characters are replaced by the {\bf errorChar}, and invalid "&" entities
|
* characters are replaced by the {\bf errorChar}, and invalid "&" entities
|
||||||
* are left untranslated. The parsing is then allowed to continue.
|
* are left untranslated. The parsing is then allowed to continue.
|
||||||
*/
|
*/
|
||||||
void
|
EXPORT_SPEC void
|
||||||
ixmlRelaxParser(char errorChar);
|
ixmlRelaxParser(char errorChar);
|
||||||
|
|
||||||
|
|
||||||
|
@ -36,6 +36,7 @@
|
|||||||
|
|
||||||
//@{
|
//@{
|
||||||
|
|
||||||
|
|
||||||
#if defined MYLIB_LARGEFILE_SENSITIVE && _FILE_OFFSET_BITS+0 != 64
|
#if defined MYLIB_LARGEFILE_SENSITIVE && _FILE_OFFSET_BITS+0 != 64
|
||||||
#if defined __GNUC__
|
#if defined __GNUC__
|
||||||
#warning libupnp requires largefile mode - use AC_SYS_LARGEFILE
|
#warning libupnp requires largefile mode - use AC_SYS_LARGEFILE
|
||||||
@ -44,16 +45,18 @@
|
|||||||
#endif
|
#endif
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#ifdef __FreeBSD__
|
#ifdef __FreeBSD__
|
||||||
#include <time.h>
|
#include <time.h>
|
||||||
#endif
|
#endif
|
||||||
#include "ixml.h"
|
#include "ixml.h"
|
||||||
#include "upnpconfig.h"
|
#include "upnpconfig.h"
|
||||||
#if UPNP_HAVE_DEBUG
|
#if UPNP_HAVE_DEBUG
|
||||||
# include "upnpdebug.h"
|
#include "upnpdebug.h"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
#ifdef WIN32
|
#ifdef WIN32
|
||||||
#ifndef UPNP_STATIC_LIB
|
#ifndef UPNP_STATIC_LIB
|
||||||
#ifdef LIBUPNP_EXPORTS
|
#ifdef LIBUPNP_EXPORTS
|
||||||
@ -65,16 +68,21 @@
|
|||||||
#else
|
#else
|
||||||
#define EXPORT_SPEC
|
#define EXPORT_SPEC
|
||||||
#endif
|
#endif
|
||||||
#ifdef UPNP_USE_MSVCPP // define some things the M$ VC++ doesn't knows
|
#ifdef UPNP_USE_MSVCPP // define some things the M$ VC++ doesn't know
|
||||||
typedef __int64 int64_t;
|
typedef __int64 int64_t;
|
||||||
|
#define PRId64 "I64d"
|
||||||
|
#define PRIzu "lu"
|
||||||
#endif
|
#endif
|
||||||
#ifdef UPNP_USE_BCBPP // define some things Borland Builder doesn't knows
|
#ifdef UPNP_USE_BCBPP // define some things Borland Builder doesn't know
|
||||||
typedef __int64 int64_t;
|
typedef __int64 int64_t;
|
||||||
|
#define PRIzu "zu"
|
||||||
#endif
|
#endif
|
||||||
#else
|
#else
|
||||||
#define EXPORT_SPEC
|
#define EXPORT_SPEC
|
||||||
|
#define PRIzu "zu"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
#ifndef WIN32
|
#ifndef WIN32
|
||||||
#define UpnpCloseSocket close
|
#define UpnpCloseSocket close
|
||||||
#else
|
#else
|
||||||
@ -87,6 +95,7 @@
|
|||||||
#define SOCKET int
|
#define SOCKET int
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
#ifndef WIN32
|
#ifndef WIN32
|
||||||
#include <netinet/in.h>
|
#include <netinet/in.h>
|
||||||
#else
|
#else
|
||||||
@ -94,8 +103,10 @@
|
|||||||
#include <time.h>
|
#include <time.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
#include <sys/types.h>
|
#include <sys/types.h>
|
||||||
|
|
||||||
|
|
||||||
#define NUM_HANDLE 200
|
#define NUM_HANDLE 200
|
||||||
#define LINE_SIZE 180
|
#define LINE_SIZE 180
|
||||||
#define NAME_SIZE 256
|
#define NAME_SIZE 256
|
||||||
@ -104,7 +115,6 @@
|
|||||||
#define SERL_NUMR_SIZE 64
|
#define SERL_NUMR_SIZE 64
|
||||||
#define MODL_DESC_SIZE 64
|
#define MODL_DESC_SIZE 64
|
||||||
#define UPNP_INFINITE -1
|
#define UPNP_INFINITE -1
|
||||||
|
|
||||||
#define UPNP_USING_CHUNKED -3
|
#define UPNP_USING_CHUNKED -3
|
||||||
#define UPNP_UNTIL_CLOSE -4
|
#define UPNP_UNTIL_CLOSE -4
|
||||||
|
|
||||||
@ -2724,3 +2734,4 @@ EXPORT_SPEC void UpnpFree(
|
|||||||
//@} The API
|
//@} The API
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
@ -574,7 +574,7 @@ genaInitNotify( IN UpnpDevice_Handle device_handle,
|
|||||||
}
|
}
|
||||||
|
|
||||||
sprintf( headers, "CONTENT-TYPE: text/xml\r\nCONTENT-LENGTH: "
|
sprintf( headers, "CONTENT-TYPE: text/xml\r\nCONTENT-LENGTH: "
|
||||||
"%zd\r\nNT: upnp:event\r\nNTS: upnp:propchange\r\n",
|
"%"PRIzu"\r\nNT: upnp:event\r\nNTS: upnp:propchange\r\n",
|
||||||
strlen( propertySet ) + 1 );
|
strlen( propertySet ) + 1 );
|
||||||
|
|
||||||
//schedule thread for initial notification
|
//schedule thread for initial notification
|
||||||
|
@ -2422,29 +2422,42 @@ raw_to_int( IN memptr * raw_value,
|
|||||||
*
|
*
|
||||||
* Description: Find a substring from raw character string buffer
|
* Description: Find a substring from raw character string buffer
|
||||||
*
|
*
|
||||||
|
* Side effects: raw_value is transformed to lowercase.
|
||||||
|
*
|
||||||
* Returns:
|
* Returns:
|
||||||
* int - index at which the substring is found.
|
* int - index at which the substring is found.
|
||||||
************************************************************************/
|
************************************************************************/
|
||||||
int
|
int
|
||||||
raw_find_str( IN memptr * raw_value,
|
raw_find_str( IN memptr *raw_value,
|
||||||
IN const char *str )
|
IN const char *str )
|
||||||
{
|
{
|
||||||
char c;
|
char c;
|
||||||
char *ptr;
|
char *ptr;
|
||||||
|
int i = 0;
|
||||||
|
|
||||||
c = raw_value->buf[raw_value->length]; // save
|
// save
|
||||||
raw_value->buf[raw_value->length] = 0; // null-terminate
|
c = raw_value->buf[raw_value->length];
|
||||||
|
|
||||||
// Use strcasestr because the string may not always be exact case
|
// Make it lowercase
|
||||||
ptr = strcasestr( raw_value->buf, str );
|
for (i = 0; raw_value->buf[i]; ++i) {
|
||||||
|
raw_value->buf[i] = tolower(raw_value->buf[i]);
|
||||||
|
}
|
||||||
|
|
||||||
raw_value->buf[raw_value->length] = c; // restore
|
// null-terminate
|
||||||
|
raw_value->buf[raw_value->length] = 0;
|
||||||
|
|
||||||
|
// Find the substring position
|
||||||
|
ptr = strstr( raw_value->buf, str );
|
||||||
|
|
||||||
|
// restore the "length" byte
|
||||||
|
raw_value->buf[raw_value->length] = c;
|
||||||
|
|
||||||
if( ptr == 0 ) {
|
if( ptr == 0 ) {
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
return ptr - raw_value->buf; // return index
|
// return index
|
||||||
|
return ptr - raw_value->buf;
|
||||||
}
|
}
|
||||||
|
|
||||||
/************************************************************************
|
/************************************************************************
|
||||||
|
@ -643,7 +643,7 @@ http_Download( IN const char *url_str,
|
|||||||
*temp = '/';
|
*temp = '/';
|
||||||
DBGONLY( UpnpPrintf
|
DBGONLY( UpnpPrintf
|
||||||
( UPNP_INFO, HTTP, __FILE__, __LINE__,
|
( UPNP_INFO, HTTP, __FILE__, __LINE__,
|
||||||
"HOSTNAME : %s Length : %zu\n", hoststr, hostlen );
|
"HOSTNAME : %s Length : %"PRIzu"\n", hoststr, hostlen );
|
||||||
)
|
)
|
||||||
|
|
||||||
ret_code = http_MakeMessage(
|
ret_code = http_MakeMessage(
|
||||||
@ -800,7 +800,7 @@ MakePostMessage( const char *url_str,
|
|||||||
hostlen = strlen( hoststr );
|
hostlen = strlen( hoststr );
|
||||||
*temp = '/';
|
*temp = '/';
|
||||||
DBGONLY( UpnpPrintf( UPNP_INFO, HTTP, __FILE__, __LINE__,
|
DBGONLY( UpnpPrintf( UPNP_INFO, HTTP, __FILE__, __LINE__,
|
||||||
"HOSTNAME : %s Length : %zd\n", hoststr, hostlen );
|
"HOSTNAME : %s Length : %"PRIzu"\n", hoststr, hostlen );
|
||||||
)
|
)
|
||||||
|
|
||||||
if( contentLength >= 0 ) {
|
if( contentLength >= 0 ) {
|
||||||
@ -1137,7 +1137,7 @@ MakeGetMessage( const char *url_str,
|
|||||||
hostlen = strlen( hoststr );
|
hostlen = strlen( hoststr );
|
||||||
*temp = '/';
|
*temp = '/';
|
||||||
DBGONLY( UpnpPrintf( UPNP_INFO, HTTP, __FILE__, __LINE__,
|
DBGONLY( UpnpPrintf( UPNP_INFO, HTTP, __FILE__, __LINE__,
|
||||||
"HOSTNAME : %s Length : %zd\n", hoststr, hostlen );
|
"HOSTNAME : %s Length : %"PRIzu"\n", hoststr, hostlen );
|
||||||
)
|
)
|
||||||
|
|
||||||
if( proxy_str ) {
|
if( proxy_str ) {
|
||||||
@ -1906,7 +1906,7 @@ http_MakeMessage( INOUT membuffer * buf,
|
|||||||
{
|
{
|
||||||
num = ( int )va_arg( argp, int );
|
num = ( int )va_arg( argp, int );
|
||||||
|
|
||||||
sprintf( tempbuf, "%zu", num );
|
sprintf( tempbuf, "%"PRIzu, num );
|
||||||
if( membuffer_append( buf, tempbuf, strlen( tempbuf ) ) != 0 ) {
|
if( membuffer_append( buf, tempbuf, strlen( tempbuf ) ) != 0 ) {
|
||||||
goto error_handler;
|
goto error_handler;
|
||||||
}
|
}
|
||||||
@ -2214,7 +2214,7 @@ MakeGetMessageEx( const char *url_str,
|
|||||||
*temp = '/';
|
*temp = '/';
|
||||||
|
|
||||||
DBGONLY( UpnpPrintf( UPNP_INFO, HTTP, __FILE__, __LINE__,
|
DBGONLY( UpnpPrintf( UPNP_INFO, HTTP, __FILE__, __LINE__,
|
||||||
"HOSTNAME : %s Length : %zd\n",
|
"HOSTNAME : %s Length : %"PRIzu"\n",
|
||||||
hoststr, hostlen );
|
hoststr, hostlen );
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@ -393,7 +393,7 @@ DBGONLY( void print_uri( uri_type * in ) {
|
|||||||
************************************************************************/
|
************************************************************************/
|
||||||
DBGONLY( void print_token( token * in ) {
|
DBGONLY( void print_token( token * in ) {
|
||||||
int i = 0;
|
int i = 0;
|
||||||
printf( "Token Size : %zd\n\'", in->size );
|
printf( "Token Size : %"PRIzu"\n\'", in->size );
|
||||||
for( i = 0; i < in->size; i++ ) {
|
for( i = 0; i < in->size; i++ ) {
|
||||||
putchar( in->buff[i] );}
|
putchar( in->buff[i] );}
|
||||||
putchar( '\'' ); putchar( '\n' );}
|
putchar( '\'' ); putchar( '\n' );}
|
||||||
|
@ -456,6 +456,8 @@ int raw_to_int( IN memptr* raw_value, int base );
|
|||||||
*
|
*
|
||||||
* Description: Find a substring from raw character string buffer
|
* Description: Find a substring from raw character string buffer
|
||||||
*
|
*
|
||||||
|
* Side effects: raw_value is transformed to lowercase.
|
||||||
|
*
|
||||||
* Returns:
|
* Returns:
|
||||||
* int - index at which the substring is found.
|
* int - index at which the substring is found.
|
||||||
************************************************************************/
|
************************************************************************/
|
||||||
|
Loading…
x
Reference in New Issue
Block a user