Merge of trunk into branch-1.4.x.

git-svn-id: https://pupnp.svn.sourceforge.net/svnroot/pupnp/branches/branch-1.4.x@156 119443c7-1b9e-41f8-b6fc-b9c35fce742c
This commit is contained in:
Marcelo Roberto Jimenez
2007-04-17 04:06:11 +00:00
parent 25620c1967
commit 85a8da77f2
13 changed files with 141 additions and 49 deletions

View File

@@ -1,16 +1,77 @@
*************************************************************************
Version 1.4.4
*************************************************************************
2007-04-06 Marcelo Jimenez <mroberto(at)users.sourceforge.net>
* SF Tracker [ 1695399 ] Typo in util.h
Submitted By: Luke Kim - nereusuj
Unix sleep is in seconds but WIN32 Sleep is in milliseconds.
2007-04-17 Marcelo Jimenez <mroberto(at)users.sourceforge.net>
* SF Tracker [ 1652827 ] UpnpRegisterRootDevice returned -104
Submitted By: Michael Andersen - miwer
Issue was found to be related to sizeof (size_t) != sizeof (int)
on AMD64 systems. Emil Ljungdahl's AMD64 patch has been applied along
with some other fixes. Original user report follows:
When I run upnpd I get the above mentioned error (UPNP_E_OUTOF_MEMORY).
I've tried with 1.4.1 and 1.4.2-RC3, it's the same. I don't understand why,
because I have plenty of RAM, and I even tried closing some applications,
but it didn't help.
$ upnpd eth1 br0
The following is logged in the /var/log/messages:
Feb 6 01:33:47 server upnpd[6933]: Error registering the root device with
descDocUrl: http://192.168.0.1:49152/gatedesc.xml
Feb 6 01:33:47 server upnpd[6933]: UpnpRegisterRootDevice returned -104
I tried enabling debugging and it looks like it cannot allocate memory
through the membuffer_append function. It's wierd because it's only a few
bytes.
Please note, that I enabled some extra debugging lines that were commented,
in order to get more information. See attached files.
************************************************************************* *************************************************************************
Version 1.4.3 Version 1.4.3
************************************************************************* *************************************************************************
2007-03-13 Marcelo Jimenez <mroberto(at)users.sourceforge.net>
* SF Tracker [ 1663004 ] Compile on Cygwin
Submitted By: Jon Foster - jongfoster
This patch gives basic support for building under Cygwin - it compiles,
links, and a simple UPnP device application can initialise. I'm not sure
if it actually works yet, but this is definitely a step in the right
direction.
Patch is against the 1.4.1 release. Changes are:
* threadutil/inc/ithread.h: Fix the ithread mutex support to use
documented, portable APIs (if present) rather than the Non-Portable (_NP)
ones it uses now. This is required because Cygwin implements only the
portable API.
* threadutil/src/ThreadPool.c: Fake SetPolicyType() to do nothing on Cygwin
because otherwise it fails. Should probably investigate why it fails and
add a proper implementation later.
* upnp/src/api/upnpapi.c: On Cygwin, zero out the GlobalHndMutex structure
before initialising it. Without this, the initialisation fails. This
appears to be a bug in Cygwin.
* upnp/src/genlib/net/uri/uri.c: Use gethostbyname() on Cygwin.
2007-03-05 Oxy <oxygenic(at)users.sourceforge.net> 2007-03-05 Oxy <oxygenic(at)users.sourceforge.net>
* Code adapted and typedefs added to compile cleanly under Windows * Code adapted and typedefs added to compile cleanly under Windows
with Borland C++ Builder and MS Visual C++ with Borland C++ Builder and MS Visual C++
2007-03-03 Marcelo Jimenez <mroberto(at)users.sourceforge.net> 2007-03-03 Marcelo Jimenez <mroberto(at)users.sourceforge.net>
* Fixed nasty segmentation fault bug on membuffer.c. * Fixed nasty segmentation fault bug on membuffer.c.
************************************************************************* *************************************************************************
Version 1.4.2 Version 1.4.2
************************************************************************* *************************************************************************

2
THANKS
View File

@@ -9,6 +9,7 @@ exempt of errors.
- Arno Willig - Arno Willig
- Chaos - Chaos
- David Maass - David Maass
- Emil Ljungdahl
- Erik Johansson - Erik Johansson
- Eric Tanguy - Eric Tanguy
- Erwan Velu - Erwan Velu
@@ -18,6 +19,7 @@ exempt of errors.
- Jonathan (no_dice) - Jonathan (no_dice)
- Leuk_He - Leuk_He
- Loigu - Loigu
- Luke Kim
- Marcelo Roberto Jimenez - Marcelo Roberto Jimenez
- Markus Strobl - Markus Strobl
- Nektarios K. Papadopoulos - Nektarios K. Papadopoulos

View File

@@ -10,7 +10,7 @@
AC_PREREQ(2.60) AC_PREREQ(2.60)
AC_INIT([libupnp], [1.4.3], [mroberto@users.sourceforge.net]) AC_INIT([libupnp], [1.4.4], [mroberto@users.sourceforge.net])
# *Independently* of the above libupnp package version, the libtool version # *Independently* of the above libupnp package version, the libtool version
# of the 3 libraries need to be updated whenever there is a change released : # of the 3 libraries need to be updated whenever there is a change released :
# "current:revision:age" (this is NOT the same as the package version), where: # "current:revision:age" (this is NOT the same as the package version), where:

View File

@@ -47,11 +47,21 @@ extern "C" {
#include <unistd.h> #include <unistd.h>
#endif #endif
#ifdef PTHREAD_MUTEX_RECURSIVE
/* This system has SuS2-compliant mutex attributes.
* E.g. on Cygwin, where we don't have the old nonportable (NP) symbols
*/
#define ITHREAD_MUTEX_FAST_NP PTHREAD_MUTEX_NORMAL
#define ITHREAD_MUTEX_RECURSIVE_NP PTHREAD_MUTEX_RECURSIVE
#define ITHREAD_MUTEX_ERRORCHECK_NP PTHREAD_MUTEX_ERRORCHECK
#else
#define ITHREAD_MUTEX_FAST_NP PTHREAD_MUTEX_FAST_NP #define ITHREAD_MUTEX_FAST_NP PTHREAD_MUTEX_FAST_NP
#define ITHREAD_MUTEX_RECURSIVE_NP PTHREAD_MUTEX_RECURSIVE_NP #define ITHREAD_MUTEX_RECURSIVE_NP PTHREAD_MUTEX_RECURSIVE_NP
#define ITHREAD_MUTEX_ERRORCHECK_NP PTHREAD_MUTEX_ERRORCHECK_NP #define ITHREAD_MUTEX_ERRORCHECK_NP PTHREAD_MUTEX_ERRORCHECK_NP
#endif
#define ITHREAD_CANCELED PTHREAD_CANCELED #define ITHREAD_CANCELED PTHREAD_CANCELED
/*************************************************************************** /***************************************************************************
* Name: ithread_t * Name: ithread_t
@@ -181,8 +191,11 @@ extern "C" {
* Returns EINVAL if the kind is not supported. * Returns EINVAL if the kind is not supported.
* See man page for pthread_mutexattr_setkind_np * See man page for pthread_mutexattr_setkind_np
*****************************************************************************/ *****************************************************************************/
#ifdef PTHREAD_MUTEX_RECURSIVE
#define ithread_mutexattr_setkind_np pthread_mutexattr_settype
#else
#define ithread_mutexattr_setkind_np pthread_mutexattr_setkind_np #define ithread_mutexattr_setkind_np pthread_mutexattr_setkind_np
#endif
/**************************************************************************** /****************************************************************************
* Function: ithread_mutexattr_getkind_np * Function: ithread_mutexattr_getkind_np
@@ -203,7 +216,11 @@ extern "C" {
* Always returns 0. * Always returns 0.
* See man page for pthread_mutexattr_getkind_np * See man page for pthread_mutexattr_getkind_np
*****************************************************************************/ *****************************************************************************/
#ifdef PTHREAD_MUTEX_RECURSIVE
#define ithread_mutexattr_getkind_np pthread_mutexattr_gettype
#else
#define ithread_mutexattr_getkind_np pthread_mutexattr_getkind_np #define ithread_mutexattr_getkind_np pthread_mutexattr_getkind_np
#endif
/**************************************************************************** /****************************************************************************
@@ -542,8 +559,10 @@ extern "C" {
#endif #endif
#ifndef PTHREAD_MUTEX_RECURSIVE
//NK: Added for satisfying the gcc compiler //NK: Added for satisfying the gcc compiler
EXPORT_SPEC int pthread_mutexattr_setkind_np(pthread_mutexattr_t *attr, int kind); EXPORT_SPEC int pthread_mutexattr_setkind_np(pthread_mutexattr_t *attr, int kind);
#endif
#ifdef __cplusplus #ifdef __cplusplus
} }

View File

@@ -90,6 +90,10 @@ FreeThreadPoolJob( ThreadPool * tp,
static int static int
SetPolicyType( PolicyType in ) SetPolicyType( PolicyType in )
{ {
#ifdef __CYGWIN__
/* TODO not currently working... */
return 0;
#else
#ifdef WIN32 #ifdef WIN32
return sched_setscheduler( 0, in); return sched_setscheduler( 0, in);
#else #else
@@ -99,6 +103,7 @@ SetPolicyType( PolicyType in )
current.sched_priority = DEFAULT_SCHED_PARAM; current.sched_priority = DEFAULT_SCHED_PARAM;
return sched_setscheduler( 0, in, &current ); return sched_setscheduler( 0, in, &current );
#endif #endif
#endif
} }
/**************************************************************************** /****************************************************************************

View File

@@ -207,6 +207,11 @@ int UpnpInit( IN const char *HostIP,
( UPNP_INFO, API, __FILE__, __LINE__, "Inside UpnpInit \n" ); ( UPNP_INFO, API, __FILE__, __LINE__, "Inside UpnpInit \n" );
) )
//initialize mutex //initialize mutex
#ifdef __CYGWIN__
/* On Cygwin, pthread_mutex_init() fails without this memset. */
/* TODO: Fix Cygwin so we don't need this memset(). */
memset(&GlobalHndMutex, 0, sizeof(GlobalHndMutex));
#endif
if( ithread_mutex_init( &GlobalHndMutex, NULL ) != 0 ) { if( ithread_mutex_init( &GlobalHndMutex, NULL ) != 0 ) {
return UPNP_E_INIT_FAILED; return UPNP_E_INIT_FAILED;
} }

View File

@@ -41,12 +41,14 @@
#include <stdarg.h> #include <stdarg.h>
#ifndef UPNP_USE_BCBPP #ifndef UPNP_USE_BCBPP
#ifndef UPNP_USE_MSVCPP #ifndef UPNP_USE_MSVCPP
#include <inttypes.h>
#include <stdint.h> #include <stdint.h>
#endif #endif
#endif #endif
#ifndef WIN32 #ifndef WIN32
#include <arpa/inet.h> #include <arpa/inet.h>
#include <fcntl.h>
#include <netinet/in.h> #include <netinet/in.h>
#include <sys/types.h> #include <sys/types.h>
#include <sys/socket.h> #include <sys/socket.h>
@@ -54,7 +56,6 @@
#include <sys/wait.h> #include <sys/wait.h>
#include <unistd.h> #include <unistd.h>
#include <sys/utsname.h> #include <sys/utsname.h>
#include <fcntl.h>
#else #else
#include <winsock2.h> #include <winsock2.h>
#include <malloc.h> #include <malloc.h>
@@ -801,27 +802,30 @@ MakePostMessage( const char *url_str,
"HOSTNAME : %s Length : %d\n", hoststr, hostlen ); "HOSTNAME : %s Length : %d\n", hoststr, hostlen );
) )
if( contentLength >= 0 ) { if( contentLength >= 0 ) {
ret_code = http_MakeMessage( ret_code = http_MakeMessage(
request, 1, 1, request, 1, 1,
"QsbcDCUTNc", "Q" "s" "bcDCU" "T" "Nc",
HTTPMETHOD_POST, url->pathquery.buff, url->pathquery.size, HTTPMETHOD_POST, url->pathquery.buff, url->pathquery.size,
"HOST: ", hoststr, hostlen, "HOST: ",
hoststr, hostlen,
contentType, contentType,
(off_t)contentLength ); (off_t)contentLength );
} else if( contentLength == UPNP_USING_CHUNKED ) { } else if( contentLength == UPNP_USING_CHUNKED ) {
ret_code = http_MakeMessage( ret_code = http_MakeMessage(
request, 1, 1, request, 1, 1,
"QsbcDCUTKc", "Q" "s" "bcDCU" "TKc",
HTTPMETHOD_POST, url->pathquery.buff, url->pathquery.size, HTTPMETHOD_POST, url->pathquery.buff, url->pathquery.size,
"HOST: ", hoststr, hostlen, "HOST: ",
hoststr, hostlen,
contentType ); contentType );
} else if( contentLength == UPNP_UNTIL_CLOSE ) { } else if( contentLength == UPNP_UNTIL_CLOSE ) {
ret_code = http_MakeMessage( ret_code = http_MakeMessage(
request, 1, 1, request, 1, 1,
"QsbcDCUTc", "Q" "s" "bcDCU" "Tc",
HTTPMETHOD_POST, url->pathquery.buff, url->pathquery.size, HTTPMETHOD_POST, url->pathquery.buff, url->pathquery.size,
"HOST: ", hoststr, hostlen, "HOST: ",
hoststr, hostlen,
contentType ); contentType );
} else { } else {
ret_code = UPNP_E_INVALID_PARAM; ret_code = UPNP_E_INVALID_PARAM;
@@ -1815,7 +1819,7 @@ http_MakeMessage( INOUT membuffer * buf,
{ {
char c; char c;
char *s = NULL; char *s = NULL;
int num; size_t num;
off_t bignum; off_t bignum;
size_t length; size_t length;
time_t *loc_time; time_t *loc_time;
@@ -1898,7 +1902,7 @@ http_MakeMessage( INOUT membuffer * buf,
{ {
num = ( int )va_arg( argp, int ); num = ( int )va_arg( argp, int );
sprintf( tempbuf, "%d", num ); sprintf( tempbuf, "%zu", num );
if( membuffer_append( buf, tempbuf, strlen( tempbuf ) ) != 0 ) { if( membuffer_append( buf, tempbuf, strlen( tempbuf ) ) != 0 ) {
goto error_handler; goto error_handler;
} }
@@ -1908,7 +1912,7 @@ http_MakeMessage( INOUT membuffer * buf,
{ {
bignum = ( off_t )va_arg( argp, off_t ); bignum = ( off_t )va_arg( argp, off_t );
sprintf( tempbuf, "%lld", (int64_t)bignum ); sprintf( tempbuf, "%"PRId64, (int64_t)bignum );
if( membuffer_append( buf, tempbuf, strlen( tempbuf ) ) != 0 ) { if( membuffer_append( buf, tempbuf, strlen( tempbuf ) ) != 0 ) {
goto error_handler; goto error_handler;
} }
@@ -2046,7 +2050,7 @@ http_MakeMessage( INOUT membuffer * buf,
method = ( http_method_t ) va_arg( argp, http_method_t ); method = ( http_method_t ) va_arg( argp, http_method_t );
method_str = method_to_str( method ); method_str = method_to_str( method );
url_str = ( const char * )va_arg( argp, const char * ); url_str = ( const char * )va_arg( argp, const char * );
num = ( int )va_arg( argp, int ); // length of url_str num = ( size_t )va_arg( argp, size_t ); // length of url_str
if (http_MakeMessage( if (http_MakeMessage(
buf, http_major_version, http_minor_version, buf, http_major_version, http_minor_version,

View File

@@ -39,7 +39,8 @@
#include <fcntl.h> #include <fcntl.h>
#ifndef UPNP_USE_BCBPP #ifndef UPNP_USE_BCBPP
#ifndef UPNP_USE_MSVCPP #ifndef UPNP_USE_MSVCPP
#include <stdint.h> #include <inttypes.h>
#include <stdint.h>
#endif #endif
#endif #endif
#include "util.h" #include "util.h"
@@ -54,7 +55,7 @@
#include "ssdplib.h" #include "ssdplib.h"
#ifndef WIN32 #ifndef WIN32
#include <unistd.h> #include <unistd.h>
#endif #endif
#include <sys/stat.h> #include <sys/stat.h>
#include "ithread.h" #include "ithread.h"
@@ -990,7 +991,7 @@ CreateHTTPRangeResponseHeader( char *ByteRangeSpecifier,
Instr->RangeOffset = FirstByte; Instr->RangeOffset = FirstByte;
Instr->ReadSendSize = LastByte - FirstByte + 1; Instr->ReadSendSize = LastByte - FirstByte + 1;
sprintf( Instr->RangeHeader, sprintf( Instr->RangeHeader,
"CONTENT-RANGE: bytes %lld-%lld/%lld\r\n", "CONTENT-RANGE: bytes %"PRId64"-%"PRId64"/%"PRId64"\r\n",
(int64_t)FirstByte, (int64_t)FirstByte,
(int64_t)LastByte, (int64_t)LastByte,
(int64_t)FileLength ); //Data between two range. (int64_t)FileLength ); //Data between two range.
@@ -999,7 +1000,7 @@ CreateHTTPRangeResponseHeader( char *ByteRangeSpecifier,
Instr->RangeOffset = FirstByte; Instr->RangeOffset = FirstByte;
Instr->ReadSendSize = FileLength - FirstByte; Instr->ReadSendSize = FileLength - FirstByte;
sprintf( Instr->RangeHeader, sprintf( Instr->RangeHeader,
"CONTENT-RANGE: bytes %lld-%lld/%lld\r\n", "CONTENT-RANGE: bytes %"PRId64"-%"PRId64"/%"PRId64"\r\n",
(int64_t)FirstByte, (int64_t)FirstByte,
(int64_t)(FileLength - 1), (int64_t)(FileLength - 1),
(int64_t)FileLength ); (int64_t)FileLength );
@@ -1008,14 +1009,14 @@ CreateHTTPRangeResponseHeader( char *ByteRangeSpecifier,
Instr->RangeOffset = 0; Instr->RangeOffset = 0;
Instr->ReadSendSize = FileLength; Instr->ReadSendSize = FileLength;
sprintf( Instr->RangeHeader, sprintf( Instr->RangeHeader,
"CONTENT-RANGE: bytes 0-%lld/%lld\r\n", "CONTENT-RANGE: bytes 0-%"PRId64"/%"PRId64"\r\n",
(int64_t)(FileLength - 1), (int64_t)(FileLength - 1),
(int64_t)FileLength ); (int64_t)FileLength );
} else { } else {
Instr->RangeOffset = FileLength - LastByte; Instr->RangeOffset = FileLength - LastByte;
Instr->ReadSendSize = LastByte; Instr->ReadSendSize = LastByte;
sprintf( Instr->RangeHeader, sprintf( Instr->RangeHeader,
"CONTENT-RANGE: bytes %lld-%lld/%lld\r\n", "CONTENT-RANGE: bytes %"PRId64"-%"PRId64"/%"PRId64"\r\n",
(int64_t)(FileLength - LastByte + 1), (int64_t)(FileLength - LastByte + 1),
(int64_t)FileLength, (int64_t)FileLength,
(int64_t)FileLength ); (int64_t)FileLength );
@@ -1206,7 +1207,7 @@ process_request( IN http_message_t * req,
int resp_major, int resp_major,
resp_minor; resp_minor;
xboolean alias_grabbed; xboolean alias_grabbed;
int dummy; size_t dummy;
struct UpnpVirtualDirCallbacks *pVirtualDirCallback; struct UpnpVirtualDirCallbacks *pVirtualDirCallback;
print_http_headers( req ); print_http_headers( req );

View File

@@ -157,7 +157,7 @@ is_escaped( const char *in )
int int
replace_escaped( char *in, replace_escaped( char *in,
int index, int index,
int *max ) size_t *max )
{ {
int tempInt = 0; int tempInt = 0;
char tempChar = 0; char tempChar = 0;
@@ -611,7 +611,9 @@ parse_hostport( const char *in,
int errCode = 0; int errCode = 0;
//call gethostbyname_r (reentrant form of gethostbyname) //call gethostbyname_r (reentrant form of gethostbyname)
#if defined(WIN32) // TODO: Use autoconf to discover this rather than the
// platform-specific stuff below
#if defined(WIN32) || defined(__CYGWIN__)
h=gethostbyname(temp_host_name); h=gethostbyname(temp_host_name);
#elif defined(SPARC_SOLARIS) #elif defined(SPARC_SOLARIS)
errCode = gethostbyname_r( temp_host_name, errCode = gethostbyname_r( temp_host_name,
@@ -731,7 +733,7 @@ parse_scheme( const char *in,
************************************************************************/ ************************************************************************/
int int
remove_escaped_chars( INOUT char *in, remove_escaped_chars( INOUT char *in,
INOUT int *size ) INOUT size_t *size )
{ {
int i = 0; int i = 0;
@@ -1067,7 +1069,7 @@ parse_uri( const char *in,
int int
parse_uri_and_unescape( char *in, parse_uri_and_unescape( char *in,
int max, int max,
uri_type * out ) uri_type *out )
{ {
int ret; int ret;

View File

@@ -96,7 +96,7 @@ typedef struct SOCKET_BUFFER{
//holds a pointer into a larger array //holds a pointer into a larger array
typedef struct TOKEN { typedef struct TOKEN {
char * buff; char * buff;
int size; size_t size;
} token; } token;

View File

@@ -51,8 +51,7 @@ typedef struct // memptr
// note: Total length/capacity should not exceed MAX_INT // note: Total length/capacity should not exceed MAX_INT
typedef struct // membuffer typedef struct // membuffer
{ {
char *buf; // mem buffer; must not write char *buf; // mem buffer; must not write beyond buf[length-1] (read/write)
// beyond buf[length-1] (read/write)
size_t length; // length of buffer (read-only) size_t length; // length of buffer (read-only)
size_t capacity; // total allocated memory (read-only) size_t capacity; // total allocated memory (read-only)
size_t size_inc; // used to increase size; MUST be > 0; (read/write) size_t size_inc; // used to increase size; MUST be > 0; (read/write)
@@ -148,8 +147,7 @@ int memptr_cmp_nocase( IN memptr* m, IN const char* s );
* *
* Note : * Note :
************************************************************************/ ************************************************************************/
int membuffer_set_size( INOUT membuffer* m, int membuffer_set_size( INOUT membuffer* m, IN size_t new_length );
IN size_t new_length );
/************************************************************************ /************************************************************************
* Function : membuffer_init * Function : membuffer_init
@@ -200,8 +198,7 @@ void membuffer_destroy( INOUT membuffer* m );
* *
* Note : * Note :
************************************************************************/ ************************************************************************/
int membuffer_assign( INOUT membuffer* m, IN const void* buf, int membuffer_assign( INOUT membuffer* m, IN const void* buf, IN size_t buf_len );
IN size_t buf_len );
/************************************************************************ /************************************************************************
* Function : membuffer_assign_str * Function : membuffer_assign_str
@@ -237,8 +234,7 @@ int membuffer_assign_str( INOUT membuffer* m, IN const char* c_str );
* *
* Note : * Note :
************************************************************************/ ************************************************************************/
int membuffer_append( INOUT membuffer* m, IN const void* buf, int membuffer_append( INOUT membuffer* m, IN const void* buf, IN size_t buf_len );
IN size_t buf_len );
/************************************************************************ /************************************************************************
* Function : membuffer_append_str * Function : membuffer_append_str
@@ -276,8 +272,7 @@ int membuffer_append_str( INOUT membuffer* m, IN const char* c_str );
* *
* Note : * Note :
************************************************************************/ ************************************************************************/
int membuffer_insert( INOUT membuffer* m, IN const void* buf, int membuffer_insert( INOUT membuffer* m, IN const void* buf, IN size_t buf_len, int index );
IN size_t buf_len, int index );
/************************************************************************ /************************************************************************
@@ -298,8 +293,7 @@ int membuffer_insert( INOUT membuffer* m, IN const void* buf,
* *
* Note : * Note :
************************************************************************/ ************************************************************************/
void membuffer_delete( INOUT membuffer* m, IN int index, void membuffer_delete( INOUT membuffer* m, IN int index, IN size_t num_bytes );
IN size_t num_bytes );
/************************************************************************ /************************************************************************
@@ -336,8 +330,7 @@ char* membuffer_detach( INOUT membuffer* m );
* Note : 'new_buf' must be allocted using malloc or realloc so * Note : 'new_buf' must be allocted using malloc or realloc so
* that it can be freed using free() * that it can be freed using free()
************************************************************************/ ************************************************************************/
void membuffer_attach( INOUT membuffer* m, IN char* new_buf, void membuffer_attach( INOUT membuffer* m, IN char* new_buf, IN size_t buf_len );
IN size_t buf_len );
#ifdef __cplusplus #ifdef __cplusplus
} // extern "C" } // extern "C"
#endif // __cplusplus #endif // __cplusplus

View File

@@ -87,7 +87,7 @@ enum uriType { absolute, relative };
* holds a pointer into a larger array */ * holds a pointer into a larger array */
typedef struct TOKEN { typedef struct TOKEN {
const char *buff; const char *buff;
int size; size_t size;
} token; } token;
@@ -124,7 +124,7 @@ typedef struct URL_LIST {
* Parameters : * Parameters :
* char * in ; string of characters * char * in ; string of characters
* int index ; index at which to start checking the characters * int index ; index at which to start checking the characters
* int *max ; * size_t *max ;
* *
* Description : Replaces an escaped sequence with its unescaped version * Description : Replaces an escaped sequence with its unescaped version
* as in http://www.ietf.org/rfc/rfc2396.txt (RFC explaining URIs) * as in http://www.ietf.org/rfc/rfc2396.txt (RFC explaining URIs)
@@ -137,7 +137,7 @@ typedef struct URL_LIST {
* string are shifted over, and NULL characters are placed at the * string are shifted over, and NULL characters are placed at the
* end of the string. * end of the string.
************************************************************************/ ************************************************************************/
int replace_escaped(char * in, int index, int *max); int replace_escaped(char * in, int index, size_t *max);
/************************************************************************ /************************************************************************
* Function : copy_URL_list * Function : copy_URL_list
@@ -303,7 +303,7 @@ int parse_hostport(const char *in, int max, hostport_type *out );
* *
* Parameters : * Parameters :
* INOUT char *in ; string of characters to be modified * INOUT char *in ; string of characters to be modified
* INOUT int *size ; size limit for the number of characters * INOUT size_t *size ; size limit for the number of characters
* *
* Description : removes http escaped characters such as: "%20" and * Description : removes http escaped characters such as: "%20" and
* replaces them with their character representation. i.e. * replaces them with their character representation. i.e.
@@ -315,7 +315,7 @@ int parse_hostport(const char *in, int max, hostport_type *out );
* *
* Note : * Note :
************************************************************************/ ************************************************************************/
int remove_escaped_chars(char *in,int *size); int remove_escaped_chars(char *in, size_t *size);
/************************************************************************ /************************************************************************
* Function : remove_dots * Function : remove_dots

View File

@@ -163,7 +163,7 @@ void linecopylen( OUT char dest[LINE_SIZE], IN const char* src, IN size_t srclen
#define strcasecmp stricmp #define strcasecmp stricmp
#define strncasecmp strnicmp #define strncasecmp strnicmp
#define sleep Sleep #define sleep(a) Sleep((a)*1000)
#define usleep(a) Sleep((a)/1000) #define usleep(a) Sleep((a)/1000)
#endif #endif