From a257d0fb89eafe07b0c2203611f788a5170a5d80 Mon Sep 17 00:00:00 2001 From: Charles Kerr Date: Tue, 14 Oct 2008 17:57:44 +0000 Subject: [PATCH] (libT) a few more win32 portability changes from Spry --- libtransmission/platform.h | 3 +++ libtransmission/torrent-ctor.c | 3 ++- libtransmission/utils.c | 9 ++++++++- 3 files changed, 13 insertions(+), 2 deletions(-) diff --git a/libtransmission/platform.h b/libtransmission/platform.h index 71522f436..33031ebdc 100644 --- a/libtransmission/platform.h +++ b/libtransmission/platform.h @@ -35,6 +35,9 @@ #ifdef __BEOS__ #include #define MAX_PATH_LENGTH B_FILE_NAME_LENGTH +#elif defined(WIN32) + #include + #define MAX_PATH_LENGTH MAX_PATH #else #define MAX_PATH_LENGTH 1024 #endif diff --git a/libtransmission/torrent-ctor.c b/libtransmission/torrent-ctor.c index cd42907b8..50162a607 100644 --- a/libtransmission/torrent-ctor.c +++ b/libtransmission/torrent-ctor.c @@ -219,8 +219,9 @@ tr_ctorSetDownloadDir( tr_ctor * ctor, { struct optional_args * args = &ctor->optionalArgs[mode]; - args->isSet_downloadDir = 0; tr_free( args->downloadDir ); + args->downloadDir = NULL; + args->isSet_downloadDir = 0; if( directory ) { diff --git a/libtransmission/utils.c b/libtransmission/utils.c index c93e87829..8198b325f 100644 --- a/libtransmission/utils.c +++ b/libtransmission/utils.c @@ -189,8 +189,11 @@ tr_deepLog( const char * file, ... ) { FILE * fp = tr_getLog( ); - +#ifdef WIN32 + if( fp || IsDebuggerPresent( ) ) +#else if( fp ) +#endif { va_list args; char timestr[64]; @@ -205,6 +208,10 @@ tr_deepLog( const char * file, evbuffer_add_vprintf( buf, fmt, args ); va_end( args ); evbuffer_add_printf( buf, " (%s:%d)\n", base, line ); +#ifdef WIN32 + OutputDebugString( EVBUFFER_DATA( buf ); + if(fp) +#endif (void) fwrite( EVBUFFER_DATA( buf ), 1, EVBUFFER_LENGTH( buf ), fp ); tr_free( base );