diff --git a/libtransmission/fdlimit.c b/libtransmission/fdlimit.c index 3ec05cd5b..4a5927fb7 100644 --- a/libtransmission/fdlimit.c +++ b/libtransmission/fdlimit.c @@ -33,11 +33,9 @@ #include #include #include /* basename, dirname */ -#include +#include /* O_LARGEFILE */ -#include /* evhttp.h needs this */ #include -#include #include #include "transmission.h" @@ -88,7 +86,7 @@ myDebug( const char * file, int line, const char * fmt, ... ) enum { - TR_MAX_SOCKETS = 1024, + TR_MAX_SOCKETS = 512, TR_MAX_OPEN_FILES = 16, /* real files, not sockets */ @@ -141,6 +139,9 @@ TrOpenFile( int i, const char * filename, int write ) /* open the file */ flags = write ? (O_RDWR | O_CREAT) : O_RDONLY; +#ifdef O_LARGEFILE + flags |= O_LARGEFILE; +#endif #ifdef WIN32 flags |= O_BINARY; #endif diff --git a/libtransmission/inout.c b/libtransmission/inout.c index 230582a21..f2d16c831 100644 --- a/libtransmission/inout.c +++ b/libtransmission/inout.c @@ -71,7 +71,7 @@ readOrWriteBytes( const tr_torrent * tor, else if( lseek( fd, (off_t)fileOffset, SEEK_SET ) == ((off_t)-1) ) ret = TR_ERROR_IO_OTHER; else if( func( fd, buf, buflen ) != buflen ) - ret = tr_ioErrorFromErrno (); + ret = tr_ioErrorFromErrno( ); else ret = TR_OK; diff --git a/libtransmission/peer-io.c b/libtransmission/peer-io.c index f088938f1..9c47d88e7 100644 --- a/libtransmission/peer-io.c +++ b/libtransmission/peer-io.c @@ -71,7 +71,7 @@ struct tr_peerIo static void didWriteWrapper( struct bufferevent * e, void * userData ) { - tr_peerIo * c = (tr_peerIo *) userData; + tr_peerIo * c = userData; if( c->didWrite != NULL ) (*c->didWrite)( e, c->userData ); } @@ -80,7 +80,7 @@ static void canReadWrapper( struct bufferevent * e, void * userData ) { int done = 0; - tr_peerIo * c = (tr_peerIo *) userData; + tr_peerIo * c = userData; tr_handle * handle = c->handle; if( c->canRead == NULL ) @@ -110,7 +110,7 @@ canReadWrapper( struct bufferevent * e, void * userData ) static void gotErrorWrapper( struct bufferevent * e, short what, void * userData ) { - tr_peerIo * c = (tr_peerIo *) userData; + tr_peerIo * c = userData; if( c->gotError != NULL ) (*c->gotError)( e, what, c->userData ); }