32/64 bits portability issues on *printf.

Use %zd for size_t, and cast to (long long) for off_t.


git-svn-id: https://pupnp.svn.sourceforge.net/svnroot/pupnp/trunk@129 119443c7-1b9e-41f8-b6fc-b9c35fce742c
This commit is contained in:
Marcelo Roberto Jimenez 2007-02-09 19:54:22 +00:00
parent e31fcce11d
commit 08834bf0f0
4 changed files with 23 additions and 10 deletions

View File

@ -2,6 +2,11 @@
Version 1.4.2 Version 1.4.2
************************************************************************* *************************************************************************
2007-02-09 Marcelo Jimenez <mroberto(at)users.sourceforge.net>
* 32/64 bits portability issues on *printf.
Use %zd for size_t, and cast to (long long) for off_t.
2007-02-02 Marcelo Jimenez <mroberto(at)users.sourceforge.net> 2007-02-02 Marcelo Jimenez <mroberto(at)users.sourceforge.net>
* Bumped the program version to 1.4.2 in config.ac. * Bumped the program version to 1.4.2 in config.ac.

View File

@ -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: "
"%d\r\nNT: upnp:event\r\nNTS: upnp:propchange\r\n", "%zd\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

View File

@ -637,7 +637,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 : %d\n", hoststr, hostlen ); "HOSTNAME : %s Length : %zu\n", hoststr, hostlen );
) )
ret_code = http_MakeMessage( ret_code = http_MakeMessage(
@ -1903,7 +1903,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", bignum ); sprintf( tempbuf, "%lld", (long long)bignum );
if( membuffer_append( buf, tempbuf, strlen( tempbuf ) ) != 0 ) { if( membuffer_append( buf, tempbuf, strlen( tempbuf ) ) != 0 ) {
goto error_handler; goto error_handler;
} }

View File

@ -633,7 +633,7 @@ get_file_info( IN const char *filename,
DBGONLY( UpnpPrintf( UPNP_INFO, HTTP, __FILE__, __LINE__, DBGONLY( UpnpPrintf( UPNP_INFO, HTTP, __FILE__, __LINE__,
"file info: %s, length: %lld, last_mod=%s readable=%d\n", "file info: %s, length: %lld, last_mod=%s readable=%d\n",
filename, info->file_length, filename, (long long)info->file_length,
asctime( gmtime( &info->last_modified ) ), asctime( gmtime( &info->last_modified ) ),
info->is_readable ); ) info->is_readable ); )
@ -984,28 +984,36 @@ CreateHTTPRangeResponseHeader( char *ByteRangeSpecifier,
Instr->RangeOffset = FirstByte; Instr->RangeOffset = FirstByte;
Instr->ReadSendSize = LastByte - FirstByte + 1; Instr->ReadSendSize = LastByte - FirstByte + 1;
sprintf( Instr->RangeHeader, "CONTENT-RANGE: bytes %lld-%lld/%lld\r\n", FirstByte, LastByte, FileLength ); //Data between two range. sprintf( Instr->RangeHeader,
"CONTENT-RANGE: bytes %lld-%lld/%lld\r\n",
(long long)FirstByte,
(long long)LastByte,
(long long)FileLength ); //Data between two range.
} else if( FirstByte >= 0 && LastByte == -1 } else if( FirstByte >= 0 && LastByte == -1
&& FirstByte < FileLength ) { && FirstByte < FileLength ) {
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", FirstByte, "CONTENT-RANGE: bytes %lld-%lld/%lld\r\n",
FileLength - 1, FileLength ); (long long)FirstByte,
(long long)(FileLength - 1),
(long long)FileLength );
} else if( FirstByte == -1 && LastByte > 0 ) { } else if( FirstByte == -1 && LastByte > 0 ) {
if( LastByte >= FileLength ) { if( LastByte >= FileLength ) {
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-%lld/%lld\r\n",
FileLength - 1, FileLength ); (long long)(FileLength - 1),
(long long)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 %lld-%lld/%lld\r\n",
FileLength - LastByte + 1, FileLength, (long long)(FileLength - LastByte + 1),
FileLength ); (long long)FileLength,
(long long)FileLength );
} }
} else { } else {
free( RangeInput ); free( RangeInput );