mingw portability fixes

This commit is contained in:
Charles Kerr 2008-01-10 18:52:46 +00:00
parent d40a341c76
commit 3a6396a3cb
9 changed files with 18 additions and 8 deletions

View File

@ -15,7 +15,6 @@
#include <inttypes.h> /* uint8_t */
#include <string.h> /* memcpy */
#include <stdarg.h>
#include <netinet/in.h> /* struct in_addr */
#include <openssl/bn.h>
#include <openssl/dh.h>

View File

@ -14,7 +14,13 @@
#define TR_PEER_MGR_PRIVATE_H
#include <inttypes.h> /* uint16_t */
#ifdef WIN32
#include <winsock2.h> /* struct in_addr */
#else
#include <netinet/in.h> /* struct in_addr */
#endif
#include "publish.h" /* tr_publisher_tag */
struct tr_bitfield;

View File

@ -17,7 +17,6 @@
#include <limits.h> /* INT_MAX */
#include <libgen.h> /* basename */
#include <arpa/inet.h> /* inet_ntoa */
#include <event.h>
@ -742,7 +741,7 @@ getPreferredBlocks( Torrent * t, uint64_t * setmeCount )
memcpy( walk, req[s], sizeof(uint64_t) * reqCount[s] );
walk += reqCount[s];
}
assert( ( walk - ret ) == blockCount );
assert( ( walk - ret ) == ( int )blockCount );
*setmeCount = blockCount;
/* cleanup */

View File

@ -14,7 +14,12 @@
#define TR_PEER_MGR_H
#include <inttypes.h> /* uint16_t */
#ifdef WIN32
#include <winsock2.h> /* struct in_addr */
#else
#include <netinet/in.h> /* struct in_addr */
#endif
struct in_addr;
struct tr_handle;

View File

@ -17,8 +17,6 @@
#include <string.h>
#include <libgen.h> /* basename */
#include <netinet/in.h> /* struct in_addr */
#include <event.h>
#include "transmission.h"

View File

@ -22,6 +22,7 @@
* DEALINGS IN THE SOFTWARE.
*****************************************************************************/
#include <errno.h>
#include <string.h>
#include <stdio.h>

View File

@ -16,7 +16,6 @@
#include <string.h> /* strcmp, strchr */
#include <libgen.h> /* basename */
#include <sys/queue.h> /* evhttp.h needs this */
#include <event.h>
#include <evhttp.h>

View File

@ -17,8 +17,6 @@
#include <stdio.h>
#include <signal.h>
#include <sys/queue.h> /* for evhttp */
#include <sys/types.h> /* for evhttp */
#include <event.h>
#include <evdns.h>

View File

@ -94,7 +94,12 @@ tr_getLogTimeStr( char * buf, int buflen )
now = time( NULL );
gettimeofday( &tv, NULL );
#ifdef WIN32
now_tm = *localtime( &now );
#else
localtime_r( &now, &now_tm );
#endif
strftime( tmp, sizeof(tmp), "%H:%M:%S", &now_tm );
milliseconds = (int)(tv.tv_usec / 1000);
snprintf( buf, buflen, "%s.%03d", tmp, milliseconds );