- Timestamp:
- Jan 19, 2009, 2:05:43 PM (13 years ago)
- Location:
- trunk/libtransmission
- Files:
-
- 10 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/libtransmission/ConvertUTF.c
r7656 r7748 44 44 #endif 45 45 #include <string.h> /* strlen() */ 46 #include <unistd.h> /* ssize_t */47 46 #include "ConvertUTF.h" 48 47 … … 352 351 */ 353 352 Boolean 354 tr_utf8_validate( const char * str, ssize_t max_len, const char ** end )353 tr_utf8_validate( const char * str, int max_len, const char ** end ) 355 354 { 356 355 const UTF8* source = (const UTF8*) str; -
trunk/libtransmission/ConvertUTF.h
r7656 r7748 5 5 #error only libtransmission should #include this header. 6 6 #endif 7 8 #include <unistd.h> /* ssize_t */9 7 10 8 /* … … 154 152 155 153 /* intended to work the same as g_utf8_validate */ 156 Boolean tr_utf8_validate( const char * str, ssize_t max_len, const char ** end );154 Boolean tr_utf8_validate( const char * str, int max_len, const char ** end ); 157 155 158 156 -
trunk/libtransmission/bandwidth.c
r7663 r7748 224 224 { 225 225 const size_t increment = 1024; 226 const ssize_t bytesUsed = tr_peerIoFlush( peers[i], dir, increment );227 228 dbgmsg( "peer #%d of %d used % zd bytes in this pass", i, n, bytesUsed );229 230 if( bytesUsed == ( ssize_t)increment )226 const int bytesUsed = tr_peerIoFlush( peers[i], dir, increment ); 227 228 dbgmsg( "peer #%d of %d used %d bytes in this pass", i, n, bytesUsed ); 229 230 if( bytesUsed == (int)increment ) 231 231 ++i; 232 232 else { -
trunk/libtransmission/peer-io.c
r7747 r7748 237 237 } 238 238 239 static ssize_t239 static int 240 240 tr_evbuffer_write( tr_peerIo * io, int fd, size_t howmuch ) 241 241 { 242 242 int e; 243 ssize_t n;243 int n; 244 244 struct evbuffer * buffer = io->outbuf; 245 245 … … 248 248 errno = 0; 249 249 #ifdef WIN32 250 n = send(fd, buffer->buffer, howmuch, 0 );250 n = (int) send(fd, buffer->buffer, howmuch, 0 ); 251 251 #else 252 n = write(fd, buffer->buffer, howmuch );252 n = (int) write(fd, buffer->buffer, howmuch ); 253 253 #endif 254 254 e = errno; 255 dbgmsg( io, "wrote % zd to peer (%s)", n, (n==-1?strerror(e):"") );255 dbgmsg( io, "wrote %d to peer (%s)", n, (n==-1?strerror(e):"") ); 256 256 257 257 if( n > 0 ) … … 763 763 ***/ 764 764 765 static ssize_t765 static int 766 766 tr_peerIoTryRead( tr_peerIo * io, size_t howmuch ) 767 767 { 768 ssize_t res = 0;768 int res = 0; 769 769 770 770 if(( howmuch = tr_bandwidthClamp( &io->bandwidth, TR_DOWN, howmuch ))) … … 775 775 e = errno; 776 776 777 dbgmsg( io, "read % zd from peer (%s)", res, (res==-1?strerror(e):"") );777 dbgmsg( io, "read %d from peer (%s)", res, (res==-1?strerror(e):"") ); 778 778 779 779 if( EVBUFFER_LENGTH( io->inbuf ) ) … … 785 785 if( res == 0 ) 786 786 what |= EVBUFFER_EOF; 787 dbgmsg( io, "tr_peerIoTryRead got an error. res is % zd, what is %hd, errno is %d (%s)", res, what, e, strerror( e ) );787 dbgmsg( io, "tr_peerIoTryRead got an error. res is %d, what is %hd, errno is %d (%s)", res, what, e, strerror( e ) ); 788 788 io->gotError( io, what, io->userData ); 789 789 } … … 793 793 } 794 794 795 static ssize_t795 static int 796 796 tr_peerIoTryWrite( tr_peerIo * io, size_t howmuch ) 797 797 { 798 ssize_t n = 0;798 int n = 0; 799 799 800 800 if(( howmuch = tr_bandwidthClamp( &io->bandwidth, TR_UP, howmuch ))) … … 811 811 { 812 812 const short what = EVBUFFER_WRITE | EVBUFFER_ERROR; 813 dbgmsg( io, "tr_peerIoTryWrite got an error. res is % zd, what is %hd, errno is %d (%s)", n, what, e, strerror( e ) );813 dbgmsg( io, "tr_peerIoTryWrite got an error. res is %d, what is %hd, errno is %d (%s)", n, what, e, strerror( e ) ); 814 814 io->gotError( io, what, io->userData ); 815 815 } … … 819 819 } 820 820 821 ssize_t821 int 822 822 tr_peerIoFlush( tr_peerIo * io, tr_direction dir, size_t limit ) 823 823 { 824 ssize_t bytesUsed;824 int bytesUsed; 825 825 826 826 assert( tr_isPeerIo( io ) ); … … 835 835 } 836 836 837 dbgmsg( io, "flushing peer-io, direction %d, limit %zu, bytesUsed % zd", (int)dir, limit, bytesUsed );837 dbgmsg( io, "flushing peer-io, direction %d, limit %zu, bytesUsed %d", (int)dir, limit, bytesUsed ); 838 838 return bytesUsed; 839 839 } -
trunk/libtransmission/peer-io.h
r7747 r7748 77 77 int socket; 78 78 79 ssize_trefCount;79 int refCount; 80 80 81 81 uint8_t peerId[SHA_DIGEST_LENGTH]; … … 361 361 tr_bool isEnabled ); 362 362 363 ssize_ttr_peerIoFlush( tr_peerIo * io,363 int tr_peerIoFlush( tr_peerIo * io, 364 364 tr_direction dir, 365 365 size_t byteLimit ); -
trunk/libtransmission/rpcimpl.c
r7744 r7748 981 981 tr_rpc_request_exec_json( tr_session * session, 982 982 const void * request_json, 983 ssize_trequest_len,983 int request_len, 984 984 tr_rpc_response_func callback, 985 985 void * callback_user_data ) … … 1033 1033 tr_rpc_parse_list_str( tr_benc * setme, 1034 1034 const char * str_in, 1035 ssize_tlen )1035 int len ) 1036 1036 1037 1037 { … … 1080 1080 tr_rpc_request_exec_uri( tr_session * session, 1081 1081 const void * request_uri, 1082 ssize_trequest_len,1082 int request_len, 1083 1083 tr_rpc_response_func callback, 1084 1084 void * callback_user_data ) -
trunk/libtransmission/rpcimpl.h
r7744 r7748 14 14 #define TR_RPC_H 15 15 16 #include <unistd.h> /* ssize_t */17 18 16 /*** 19 17 **** RPC processing … … 29 27 void tr_rpc_request_exec_json( tr_session * session, 30 28 const void * request_json, 31 ssize_trequest_len,29 int request_len, 32 30 tr_rpc_response_func callback, 33 31 void * callback_user_data ); … … 36 34 void tr_rpc_request_exec_uri( tr_session * session, 37 35 const void * request_uri, 38 ssize_trequest_len,36 int request_len, 39 37 tr_rpc_response_func callback, 40 38 void * callback_user_data ); … … 42 40 void tr_rpc_parse_list_str( struct tr_benc * setme, 43 41 const char * list_str, 44 ssize_tlist_str_len );42 int list_str_len ); 45 43 46 44 -
trunk/libtransmission/utils-test.c
r7656 r7748 2 2 #include <string.h> /* strcmp */ 3 3 #include "transmission.h" 4 #include <unistd.h> /* ssize_t */5 4 #include "ConvertUTF.h" /* tr_utf8_validate*/ 6 5 #include "platform.h" -
trunk/libtransmission/utils.c
r7743 r7748 638 638 639 639 char* 640 tr_strndup( const void * in, ssize_t len )640 tr_strndup( const void * in, int len ) 641 641 { 642 642 char * out = NULL; … … 1326 1326 1327 1327 char* 1328 tr_utf8clean( const char * str, ssize_t max_len, tr_bool * err )1328 tr_utf8clean( const char * str, int max_len, tr_bool * err ) 1329 1329 { 1330 1330 const char zero = '\0'; … … 1337 1337 1338 1338 if( max_len < 0 ) 1339 max_len = ( ssize_t) strlen( str );1339 max_len = (int) strlen( str ); 1340 1340 1341 1341 while( !tr_utf8_validate ( str, max_len, &end ) ) 1342 1342 { 1343 const ssize_t good_len = end - str;1343 const int good_len = end - str; 1344 1344 1345 1345 evbuffer_add( buf, str, good_len ); -
trunk/libtransmission/utils.h
r7743 r7748 239 239 240 240 char* tr_utf8clean( const char * str, 241 ssize_tmax_len,241 int max_len, 242 242 tr_bool * err ); 243 243 … … 303 303 304 304 /** @param in is a void* so that callers can pass in both signed & unsigned without a cast */ 305 char* tr_strndup( const void * in, ssize_t len ) TR_GNUC_MALLOC;305 char* tr_strndup( const void * in, int len ) TR_GNUC_MALLOC; 306 306 307 307 /** @param in is a void* so that callers can pass in both signed & unsigned without a cast */
Note: See TracChangeset
for help on using the changeset viewer.