Changes between Initial Version and Version 1 of BuildingTransmissionQtWindows/transmission-2.00-Qt-build.diff


Ignore:
Timestamp:
Jun 18, 2010, 1:28:23 AM (12 years ago)
Author:
rb07
Comment:

--

Legend:

Unmodified
Added
Removed
Modified
  • BuildingTransmissionQtWindows/transmission-2.00-Qt-build.diff

    v1 v1  
     1diff -NaurX /home/rberber/diff-excludes.txt transmission-2.00-orig/configure transmission-2.00/configure
     2--- transmission-2.00-orig/configure    2010-06-15 20:33:46.000000000 -0500
     3+++ transmission-2.00/configure 2010-06-17 18:52:25.000000000 -0500
     4@@ -19312,6 +19312,11 @@
     5   WIN32_FALSE=
     6 fi
     7 
     8+case $host_os in
     9+    mingw*)
     10+            libevent_extra_libs+="-lws2_32"
     11+    ;;
     12+esac
     13 
     14 
     15 ac_config_files="$ac_config_files Makefile transmission.spec cli/Makefile daemon/Makefile doc/Makefile libtransmission/Makefile third-party/Makefile third-party/miniupnp/Makefile third-party/libnatpmp/Makefile third-party/dht/Makefile macosx/Makefile gtk/Makefile gtk/icons/Makefile web/Makefile web/images/Makefile web/images/buttons/Makefile web/images/graphics/Makefile web/images/progress/Makefile web/javascript/Makefile web/javascript/jquery/Makefile web/stylesheets/Makefile po/Makefile.in"
     16diff -NaurX /home/rberber/diff-excludes.txt transmission-2.00-orig/libtransmission/JSON_parser.h transmission-2.00/libtransmission/JSON_parser.h
     17--- transmission-2.00-orig/libtransmission/JSON_parser.h        2010-06-15 20:32:58.000000000 -0500
     18+++ transmission-2.00/libtransmission/JSON_parser.h     2010-06-17 18:52:25.000000000 -0500
     19@@ -11,7 +11,7 @@
     20 #include <stddef.h>
     21 
     22 /* Windows DLL stuff */
     23-#ifdef _WIN32
     24+#if defined(WIN32) && !defined(STATICLIB)
     25 #      ifdef JSON_PARSER_DLL_EXPORTS
     26 #              define JSON_PARSER_DLL_API __declspec(dllexport)
     27 #      else
     28diff -NaurX /home/rberber/diff-excludes.txt transmission-2.00-orig/libtransmission/Makefile.in transmission-2.00/libtransmission/Makefile.in
     29--- transmission-2.00-orig/libtransmission/Makefile.in  2010-06-15 20:33:47.000000000 -0500
     30+++ transmission-2.00/libtransmission/Makefile.in       2010-06-17 18:52:25.000000000 -0500
     31@@ -88,7 +88,7 @@
     32 bencode_test_OBJECTS = $(am_bencode_test_OBJECTS)
     33 am__DEPENDENCIES_1 = ./libtransmission.a \
     34        $(top_builddir)/third-party/miniupnp/libminiupnp.a \
     35-       $(top_builddir)/third-party/libnatpmp/libnatpmp.a
     36+       $(top_builddir)/third-party/libnatpmp/libnatpmp.a
     37 bencode_test_DEPENDENCIES = $(am__DEPENDENCIES_1)
     38 AM_V_lt = $(am__v_lt_$(V))
     39 am__v_lt_ = $(am__v_lt_$(AM_DEFAULT_VERBOSITY))
     40@@ -501,6 +501,7 @@
     41     ./libtransmission.a  \
     42     $(top_builddir)/third-party/miniupnp/libminiupnp.a \
     43     $(top_builddir)/third-party/libnatpmp/libnatpmp.a \
     44+    -liphlpapi \
     45     @INTLLIBS@ \
     46     @DHT_LIBS@ \
     47     @LIBCURL_LIBS@ \
     48diff -NaurX /home/rberber/diff-excludes.txt transmission-2.00-orig/libtransmission/announcer.c transmission-2.00/libtransmission/announcer.c
     49--- transmission-2.00-orig/libtransmission/announcer.c  2010-06-15 20:32:58.000000000 -0500
     50+++ transmission-2.00/libtransmission/announcer.c       2010-06-17 18:52:25.000000000 -0500
     51@@ -1407,7 +1407,7 @@
     52             /* %1$ld - http status code, such as 404
     53              * %2$s - human-readable explanation of the http status code */
     54             char * buf = tr_strdup_printf(
     55-                _( "tracker gave HTTP Response Code %1$ld (%2$s)" ),
     56+                _( "tracker gave HTTP Response Code %ld (%s)" ),
     57                 responseCode,
     58                 tr_webGetResponseStr( responseCode ) );
     59 
     60@@ -1733,7 +1733,7 @@
     61                                                tier->lastScrapeStr, sizeof( tier->lastScrapeStr ) );
     62             else
     63                 tr_snprintf( tier->lastScrapeStr, sizeof( tier->lastScrapeStr ),
     64-                             _( "tracker gave HTTP Response Code %1$ld (%2$s)" ),
     65+                             _( "tracker gave HTTP Response Code %ld (%s)" ),
     66                              responseCode, tr_webGetResponseStr( responseCode ) );
     67             tr_tordbg( tier->tor, "%s", tier->lastScrapeStr );
     68         }
     69@@ -1764,7 +1764,7 @@
     70                             sizeof( tier->lastScrapeStr ) );
     71             else
     72                 tr_snprintf( tier->lastScrapeStr, sizeof( tier->lastScrapeStr ),
     73-                             _( "tracker gave HTTP Response Code %1$ld (%2$s)" ),
     74+                             _( "tracker gave HTTP Response Code %ld (%s)" ),
     75                              responseCode, tr_webGetResponseStr( responseCode ) );
     76         }
     77 
     78diff -NaurX /home/rberber/diff-excludes.txt transmission-2.00-orig/libtransmission/bencode.c transmission-2.00/libtransmission/bencode.c
     79--- transmission-2.00-orig/libtransmission/bencode.c    2010-06-15 20:32:58.000000000 -0500
     80+++ transmission-2.00/libtransmission/bencode.c 2010-06-17 18:52:25.000000000 -0500
     81@@ -17,6 +17,11 @@
     82 #include <stdio.h>
     83 #include <stdlib.h> /* realpath() */
     84 #include <string.h>
     85+#ifdef WIN32
     86+ #include <fcntl.h>
     87+ #define fsync         _commit
     88+ static char *realpath();
     89+#endif
     90 
     91 #include <sys/types.h> /* stat() */
     92 #include <sys/stat.h> /* stat() */
     93@@ -1629,7 +1634,12 @@
     94         filename = buf;
     95 
     96     /* if the file already exists, try to move it out of the way & keep it as a backup */
     97+#ifdef WIN32
     98+    tmp = tr_strdup_printf( "%s_tmp.XXXXXX", filename );
     99+    #define mkstemp(t) open(mktemp(t), O_CREAT | O_EXCL | O_RDWR | O_BINARY, 0600);
     100+#else
     101     tmp = tr_strdup_printf( "%s.tmp.XXXXXX", filename );
     102+#endif
     103     fd = mkstemp( tmp );
     104     if( fd >= 0 )
     105     {
     106@@ -1653,21 +1663,21 @@
     107                 else
     108                 {
     109                     err = errno;
     110-                    tr_err( _( "Couldn't save file \"%1$s\": %2$s" ), filename, tr_strerror( err ) );
     111+                    tr_err( _( "Couldn't save file \"%s\": %s" ), filename, tr_strerror( err ) );
     112                     unlink( tmp );
     113                 }
     114             }
     115             else
     116             {
     117                 err = errno;
     118-                tr_err( _( "Couldn't save file \"%1$s\": %2$s" ), filename, tr_strerror( err ) );
     119+                tr_err( _( "Couldn't save file \"%s\": %s" ), filename, tr_strerror( err ) );
     120                 unlink( tmp );
     121             }
     122         }
     123         else
     124         {
     125             err = errno;
     126-            tr_err( _( "Couldn't save temporary file \"%1$s\": %2$s" ), tmp, tr_strerror( err ) );
     127+            tr_err( _( "Couldn't save temporary file \"%s\": %s" ), tmp, tr_strerror( err ) );
     128             close( fd );
     129             unlink( tmp );
     130         }
     131@@ -1677,7 +1687,7 @@
     132     else
     133     {
     134         err = errno;
     135-        tr_err( _( "Couldn't save temporary file \"%1$s\": %2$s" ), tmp, tr_strerror( err ) );
     136+        tr_err( _( "Couldn't save temporary file \"%s\": %s" ), tmp, tr_strerror( err ) );
     137     }
     138 
     139     tr_free( tmp );
     140@@ -1710,3 +1720,16 @@
     141     tr_free( content );
     142     return err;
     143 }
     144+
     145+#ifdef WIN32
     146+/* From a message to the Mingw-msys list, circa Jun 2, 2005
     147+ * by Mark Junker.
     148+ */
     149+static
     150+char *realpath(const char *path, char *resolved_path)
     151+{
     152+    if (GetFullPathNameA(path, TR_PATH_MAX, resolved_path, NULL) == 0)
     153+        return NULL;
     154+    return resolved_path;
     155+}
     156+#endif
     157diff -NaurX /home/rberber/diff-excludes.txt transmission-2.00-orig/libtransmission/blocklist.c transmission-2.00/libtransmission/blocklist.c
     158--- transmission-2.00-orig/libtransmission/blocklist.c  2010-06-15 20:32:58.000000000 -0500
     159+++ transmission-2.00/libtransmission/blocklist.c       2010-06-17 19:08:58.000000000 -0500
     160@@ -73,14 +73,14 @@
     161 {
     162     int          fd;
     163     struct stat  st;
     164-    const char * err_fmt = _( "Couldn't read \"%1$s\": %2$s" );
     165+    const char * err_fmt = _( "Couldn't read \"%s\": %s" );
     166 
     167     blocklistClose( b );
     168 
     169     if( stat( b->filename, &st ) == -1 )
     170         return;
     171 
     172-    fd = open( b->filename, O_RDONLY );
     173+    fd = open( b->filename, O_RDONLY | O_BINARY );
     174     if( fd == -1 )
     175     {
     176         tr_err( err_fmt, b->filename, tr_strerror( errno ) );
     177@@ -105,7 +105,7 @@
     178 
     179     {
     180         char * base = tr_basename( b->filename );
     181-        tr_inf( _( "Blocklist \"%s\" contains %'zu entries" ), base, b->ruleCount );
     182+        tr_inf( _( "Blocklist \"%s\" contains %zu entries" ), base, b->ruleCount );
     183         tr_free( base );
     184     }
     185 }
     186@@ -307,7 +307,7 @@
     187     int inCount = 0;
     188     int outCount = 0;
     189     char line[2048];
     190-    const char * err_fmt = _( "Couldn't read \"%1$s\": %2$s" );
     191+    const char * err_fmt = _( "Couldn't read \"%s\": %s" );
     192 
     193     if( !filename )
     194     {
     195@@ -315,7 +315,7 @@
     196         return 0;
     197     }
     198 
     199-    in = fopen( filename, "r" );
     200+    in = fopen( filename, "rb" );
     201     if( !in )
     202     {
     203         tr_err( err_fmt, filename, tr_strerror( errno ) );
     204@@ -352,7 +352,7 @@
     205 
     206         if( fwrite( &range, sizeof( struct tr_ip_range ), 1, out ) != 1 )
     207         {
     208-            tr_err( _( "Couldn't save file \"%1$s\": %2$s" ), b->filename,
     209+            tr_err( _( "Couldn't save file \"%s\": %s" ), b->filename,
     210                    tr_strerror( errno ) );
     211             break;
     212         }
     213@@ -362,7 +362,7 @@
     214 
     215     {
     216         char * base = tr_basename( b->filename );
     217-        tr_inf( _( "Blocklist \"%1$s\" updated with %2$'d entries" ), base, outCount );
     218+        tr_inf( _( "Blocklist \"%s\" updated with %d entries" ), base, outCount );
     219         tr_free( base );
     220     }
     221 
     222diff -NaurX /home/rberber/diff-excludes.txt transmission-2.00-orig/libtransmission/fdlimit.c transmission-2.00/libtransmission/fdlimit.c
     223--- transmission-2.00-orig/libtransmission/fdlimit.c    2010-06-15 20:32:58.000000000 -0500
     224+++ transmission-2.00/libtransmission/fdlimit.c 2010-06-17 18:52:25.000000000 -0500
     225@@ -125,7 +125,7 @@
     226 
     227 #ifdef WIN32
     228 
     229-    HANDLE hFile = CreateFile( filename, GENERIC_WRITE, 0, 0, CREATE_NEW, 0, 0 );
     230+    HANDLE hFile = CreateFile( filename, GENERIC_WRITE, 0, 0, CREATE_NEW, FILE_FLAG_RANDOM_ACCESS, 0 );
     231     if( hFile != INVALID_HANDLE_VALUE )
     232     {
     233         LARGE_INTEGER li;
     234@@ -338,7 +338,7 @@
     235         char * dir = tr_dirname( filename );
     236         const int err = tr_mkdirp( dir, 0777 ) ? errno : 0;
     237         if( err ) {
     238-            tr_err( _( "Couldn't create \"%1$s\": %2$s" ), dir, tr_strerror( err ) );
     239+            tr_err( _( "Couldn't create \"%s\": %s" ), dir, tr_strerror( err ) );
     240             tr_free( dir );
     241             return err;
     242         }
     243@@ -366,7 +366,7 @@
     244     if( file->fd == -1 )
     245     {
     246         const int err = errno;
     247-        tr_err( _( "Couldn't open \"%1$s\": %2$s" ), filename, tr_strerror( err ) );
     248+        tr_err( _( "Couldn't open \"%s\": %s" ), filename, tr_strerror( err ) );
     249         return err;
     250     }
     251 
     252diff -NaurX /home/rberber/diff-excludes.txt transmission-2.00-orig/libtransmission/handshake.c transmission-2.00/libtransmission/handshake.c
     253--- transmission-2.00-orig/libtransmission/handshake.c  2010-06-15 20:32:58.000000000 -0500
     254+++ transmission-2.00/libtransmission/handshake.c       2010-06-17 18:52:25.000000000 -0500
     255@@ -346,7 +346,7 @@
     256 
     257     /* send it */
     258     setReadState( handshake, AWAITING_YB );
     259-    tr_peerIoWrite( handshake->io, outbuf, walk-outbuf, FALSE );
     260+    tr_peerIoWrite( handshake->io, outbuf, walk - outbuf, FALSE );
     261 }
     262 
     263 static uint32_t
     264diff -NaurX /home/rberber/diff-excludes.txt transmission-2.00-orig/libtransmission/metainfo.c transmission-2.00/libtransmission/metainfo.c
     265--- transmission-2.00-orig/libtransmission/metainfo.c   2010-06-15 20:32:58.000000000 -0500
     266+++ transmission-2.00/libtransmission/metainfo.c        2010-06-17 18:52:25.000000000 -0500
     267@@ -112,7 +112,7 @@
     268             out = fopen( name, "wb+" );
     269             if( !out )
     270             {
     271-                tr_nerr( inf->name, _( "Couldn't create \"%1$s\": %2$s" ),
     272+                tr_nerr( inf->name, _( "Couldn't create \"%s\": %s" ),
     273                         name, tr_strerror( errno ) );
     274             }
     275             else
     276diff -NaurX /home/rberber/diff-excludes.txt transmission-2.00-orig/libtransmission/net.c transmission-2.00/libtransmission/net.c
     277--- transmission-2.00-orig/libtransmission/net.c        2010-06-15 20:32:58.000000000 -0500
     278+++ transmission-2.00/libtransmission/net.c     2010-06-17 18:52:25.000000000 -0500
     279@@ -32,8 +32,9 @@
     280 #include <sys/types.h>
     281 
     282 #ifdef WIN32
     283- #include <winsock2.h> /* inet_addr */
     284- #include <WS2tcpip.h>
     285+ #define _WIN32_WINNT  0x0501
     286+ #include <ws2tcpip.h>
     287+ #define EADDRINUSE    WSAEADDRINUSE
     288 #else
     289  #include <sys/socket.h>
     290  #include <netinet/in.h>
     291diff -NaurX /home/rberber/diff-excludes.txt transmission-2.00-orig/libtransmission/net.h transmission-2.00/libtransmission/net.h
     292--- transmission-2.00-orig/libtransmission/net.h        2010-06-15 20:32:58.000000000 -0500
     293+++ transmission-2.00/libtransmission/net.h     2010-06-17 18:52:25.000000000 -0500
     294@@ -31,8 +31,7 @@
     295 
     296 #ifdef WIN32
     297  #include <inttypes.h>
     298- #include <winsock2.h>
     299- #include <WS2tcpip.h>
     300+ #include <ws2tcpip.h>
     301  typedef int socklen_t;
     302 #else
     303  #include <sys/types.h>
     304diff -NaurX /home/rberber/diff-excludes.txt transmission-2.00-orig/libtransmission/peer-io.c transmission-2.00/libtransmission/peer-io.c
     305--- transmission-2.00-orig/libtransmission/peer-io.c    2010-06-15 20:32:58.000000000 -0500
     306+++ transmission-2.00/libtransmission/peer-io.c 2010-06-17 18:52:25.000000000 -0500
     307@@ -19,8 +19,52 @@
     308 
     309 #ifdef WIN32
     310  #include <winsock2.h>
     311+ #define WINDOWS_SUCKS 1
     312+ int fix_errno () {
     313+   int werror= WSAGetLastError();
     314+   switch(werror) {
     315+     case WSAEWOULDBLOCK:      errno = EAGAIN;         break;
     316+     case WSAEINTR:            errno = EINTR;          break;
     317+     case WSAEBADF:            errno = EBADF;          break;
     318+     case WSAEACCES:           errno = EACCES;         break;
     319+     case WSAEFAULT:           errno = EFAULT;         break;
     320+     case WSAEINVAL:           errno = EINVAL;         break;
     321+     case WSAEMFILE:           errno = EMFILE;         break;
     322+     case WSAEINPROGRESS:      errno = werror;         break;  /* net.h has these */
     323+     case WSAEALREADY:         errno = 120;            break;
     324+     case WSAENOTSOCK:         errno = 108;            break;
     325+     case WSAEDESTADDRREQ:     errno = 121;            break;
     326+     case WSAEMSGSIZE:         errno = 122;            break;
     327+     case WSAEPROTOTYPE:       errno = 107;            break;
     328+     case WSAENOPROTOOPT:      errno = 109;            break;
     329+     case WSAEAFNOSUPPORT:     errno = werror;         break;
     330+     case WSAEADDRINUSE:       errno = 112;            break;
     331+     case WSAEADDRNOTAVAIL:    errno = 125;            break;
     332+     case WSAENETDOWN:         errno = 115;            break;
     333+     case WSAENETUNREACH:      errno = werror;         break;
     334+     case WSAENETRESET:                errno = 126;            break;
     335+     case WSAECONNABORTED:     errno = 113;            break;
     336+     case WSAECONNRESET:       errno = werror;         break;
     337+     case WSAENOBUFS:          errno = 105;            break;
     338+     case WSAEISCONN:          errno = 127;            break;
     339+     case WSAENOTCONN:         errno = werror;         break;
     340+     case WSAESHUTDOWN:                errno = 110;            break;
     341+     case WSAETOOMANYREFS:     errno = 129;            break;
     342+     case WSAETIMEDOUT:                errno = 116;            break;
     343+     case WSAECONNREFUSED:     errno = werror;         break;
     344+     case WSAELOOP:            errno = 92;             break;
     345+     case WSAENAMETOOLONG:     errno = ENAMETOOLONG;   break;
     346+     case WSAEHOSTDOWN:                errno = 117;            break;
     347+     case WSAEHOSTUNREACH:                     break;
     348+     default:
     349+       errno = werror;
     350+       break;
     351+   }
     352+   return errno;
     353+ }
     354 #else
     355  #include <arpa/inet.h> /* inet_ntoa */
     356+ #define WINDOWS_SUCKS 0
     357 #endif
     358 
     359 #include <event.h>
     360@@ -223,7 +267,7 @@
     361 
     362     errno = 0;
     363     res = evbuffer_read( io->inbuf, fd, howmuch );
     364-    e = errno;
     365+    e = WINDOWS_SUCKS? fix_errno() : errno;
     366 
     367     if( res > 0 )
     368     {
     369@@ -268,8 +312,8 @@
     370 #else
     371     n = (int) write(fd, buffer->buffer, howmuch );
     372 #endif
     373-    e = errno;
     374-    dbgmsg( io, "wrote %d to peer (%s)", n, (n==-1?strerror(e):"") );
     375+    e = WINDOWS_SUCKS? fix_errno() : errno;
     376+    dbgmsg(io, "wrote %d to peer (%d, %s)", n, e, (n == -1? strerror(e):"no error"));
     377 
     378     if( n > 0 )
     379         evbuffer_drain( buffer, n );
     380@@ -315,18 +359,11 @@
     381     e = errno;
     382 
     383     if (res == -1) {
     384-#ifndef WIN32
     385-/*todo. evbuffer uses WriteFile when WIN32 is set. WIN32 system calls do not
     386- *  *set errno. thus this error checking is not portable*/
     387         if (e == EAGAIN || e == EINTR || e == EINPROGRESS)
     388             goto reschedule;
     389         /* error case */
     390         what |= EVBUFFER_ERROR;
     391 
     392-#else
     393-        goto reschedule;
     394-#endif
     395-
     396     } else if (res == 0) {
     397         /* eof case */
     398         what |= EVBUFFER_EOF;
     399@@ -769,7 +806,7 @@
     400     struct tr_datatype * datatype;
     401 
     402     assert( tr_amInEventThread( io->session ) );
     403-    dbgmsg( io, "adding %zu bytes into io->output", byteCount );
     404+    dbgmsg( io, "adding %u bytes into io->output", byteCount );
     405 
     406     datatype = tr_new( struct tr_datatype, 1 );
     407     datatype->isPieceData = isPieceData != 0;
     408@@ -881,7 +918,7 @@
     409         int e;
     410         errno = 0;
     411         res = evbuffer_read( io->inbuf, io->socket, howmuch );
     412-        e = errno;
     413+        e = WINDOWS_SUCKS? fix_errno() : errno;
     414 
     415         dbgmsg( io, "read %d from peer (%s)", res, (res==-1?strerror(e):"") );
     416 
     417@@ -945,7 +982,7 @@
     418             bytesUsed = tr_peerIoTryWrite( io, limit );
     419     }
     420 
     421-    dbgmsg( io, "flushing peer-io, hasFinishedConnecting %d, direction %d, limit %zu, bytesUsed %d", (int)io->hasFinishedConnecting, (int)dir, limit, bytesUsed );
     422+    dbgmsg( io, "flushing peer-io, hasFinishedConnecting %d, direction %s, limit %u, bytesUsed %d", (int)io->hasFinishedConnecting, (dir == TR_DOWN)? "DOWN":"UP", limit, bytesUsed );
     423     return bytesUsed;
     424 }
     425 
     426diff -NaurX /home/rberber/diff-excludes.txt transmission-2.00-orig/libtransmission/peer-mgr.c transmission-2.00/libtransmission/peer-mgr.c
     427--- transmission-2.00-orig/libtransmission/peer-mgr.c   2010-06-15 20:32:58.000000000 -0500
     428+++ transmission-2.00/libtransmission/peer-mgr.c        2010-06-17 18:52:25.000000000 -0500
     429@@ -15,6 +15,9 @@
     430 #include <stdlib.h> /* qsort */
     431 
     432 #include <event.h>
     433+#ifdef WIN32
     434+  #include <errno.h>
     435+#endif
     436 
     437 #include "transmission.h"
     438 #include "announcer.h"
     439diff -NaurX /home/rberber/diff-excludes.txt transmission-2.00-orig/libtransmission/platform.c transmission-2.00/libtransmission/platform.c
     440--- transmission-2.00-orig/libtransmission/platform.c   2010-06-15 20:32:58.000000000 -0500
     441+++ transmission-2.00/libtransmission/platform.c        2010-06-17 18:52:25.000000000 -0500
     442@@ -352,7 +352,7 @@
     443             }
     444 
     445             if( count )
     446-                tr_inf( _( "Migrated %1$d files from \"%2$s\" to \"%3$s\"" ),
     447+                tr_inf( _( "Migrated %d files from \"%s\" to \"%s\"" ),
     448                         count, oldDir, newDir );
     449             closedir( dirh );
     450         }
     451@@ -436,7 +436,7 @@
     452             s = tr_buildPath( getHomeDir( ), "Library", "Application Support",
     453                               appname, NULL );
     454 #elif defined( WIN32 )
     455-            char appdata[TR_MAX_PATH]; /* SHGetFolderPath() requires MAX_PATH */
     456+            char appdata[TR_PATH_MAX]; /* SHGetFolderPath() requires MAX_PATH */
     457             SHGetFolderPath( NULL, CSIDL_APPDATA, NULL, 0, appdata );
     458             s = tr_buildPath( appdata, appname, NULL );
     459 #elif defined( __HAIKU__ )
     460diff -NaurX /home/rberber/diff-excludes.txt transmission-2.00-orig/libtransmission/platform.h transmission-2.00/libtransmission/platform.h
     461--- transmission-2.00-orig/libtransmission/platform.h   2010-06-15 20:32:58.000000000 -0500
     462+++ transmission-2.00/libtransmission/platform.h        2010-06-17 18:52:25.000000000 -0500
     463@@ -26,8 +26,8 @@
     464 #endif
     465 
     466 #ifdef WIN32
     467- #include <windows.h> /* MAX_PATH */
     468- #define TR_PATH_MAX MAX_PATH
     469+ #include <windef.h> /* MAX_PATH */
     470+ #define TR_PATH_MAX (MAX_PATH + 1)
     471 #else
     472  #include <limits.h> /* PATH_MAX */
     473  #ifdef PATH_MAX
     474diff -NaurX /home/rberber/diff-excludes.txt transmission-2.00-orig/libtransmission/port-forwarding.c transmission-2.00/libtransmission/port-forwarding.c
     475--- transmission-2.00-orig/libtransmission/port-forwarding.c    2010-06-15 20:32:58.000000000 -0500
     476+++ transmission-2.00/libtransmission/port-forwarding.c 2010-06-17 18:52:25.000000000 -0500
     477@@ -84,7 +84,7 @@
     478     newStatus = tr_sharedTraversalStatus( s );
     479 
     480     if( newStatus != oldStatus )
     481-        tr_ninf( getKey( ), _( "State changed from \"%1$s\" to \"%2$s\"" ),
     482+        tr_ninf( getKey( ), _( "State changed from \"%s\" to \"%s\"" ),
     483                 getNatStateStr( oldStatus ),
     484                 getNatStateStr( newStatus ) );
     485 }
     486diff -NaurX /home/rberber/diff-excludes.txt transmission-2.00-orig/libtransmission/rpcimpl.c transmission-2.00/libtransmission/rpcimpl.c
     487--- transmission-2.00-orig/libtransmission/rpcimpl.c    2010-06-15 20:32:58.000000000 -0500
     488+++ transmission-2.00/libtransmission/rpcimpl.c 2010-06-17 18:52:25.000000000 -0500
     489@@ -859,7 +859,7 @@
     490 
     491     if( response_code != 200 )
     492     {
     493-        tr_snprintf( result, sizeof( result ), "http error %ld: %s",
     494+        tr_snprintf( result, sizeof( result ), "portTested: http error %ld: %s",
     495                      response_code, tr_webGetResponseStr( response_code ) );
     496     }
     497     else /* success */
     498@@ -901,19 +901,19 @@
     499 
     500     if( response_code != 200 )
     501     {
     502-        tr_snprintf( result, sizeof( result ), "http error %ld: %s",
     503+        tr_snprintf( result, sizeof( result ), "gotNewBlocklist: http error %ld: %s",
     504                      response_code, tr_webGetResponseStr( response_code ) );
     505     }
     506     else /* successfully fetched the blocklist... */
     507     {
     508         const char * configDir = tr_sessionGetConfigDir( session );
     509         char * filename = tr_buildPath( configDir, "blocklist.tmp", NULL );
     510-        FILE * fp = fopen( filename, "w+" );
     511+        FILE * fp = fopen( filename, "wb+" );
     512 
     513         if( fp == NULL )
     514         {
     515             tr_snprintf( result, sizeof( result ),
     516-                         _( "Couldn't save file \"%1$s\": %2$s" ),
     517+                         _( "Couldn't save file \"%s\": %s" ),
     518                          filename, tr_strerror( errno ) );
     519         }
     520         else
     521@@ -924,7 +924,7 @@
     522             if( n != response_byte_count )
     523             {
     524                 tr_snprintf( result, sizeof( result ),
     525-                             _( "Couldn't save file \"%1$s\": %2$s" ),
     526+                             _( "Couldn't save file \"%s\": %s" ),
     527                              filename, tr_strerror( errno ) );
     528             }
     529             else
     530@@ -1022,7 +1022,7 @@
     531     else
     532     {
     533         char result[1024];
     534-        tr_snprintf( result, sizeof( result ), "http error %ld: %s",
     535+        tr_snprintf( result, sizeof( result ), "gotMetadataFromURL: http error %ld: %s",
     536                      response_code, tr_webGetResponseStr( response_code ) );
     537         tr_idle_function_done( data->data, result );
     538     }
     539diff -NaurX /home/rberber/diff-excludes.txt transmission-2.00-orig/libtransmission/torrent.c transmission-2.00/libtransmission/torrent.c
     540--- transmission-2.00-orig/libtransmission/torrent.c    2010-06-15 20:32:58.000000000 -0500
     541+++ transmission-2.00/libtransmission/torrent.c 2010-06-17 18:52:25.000000000 -0500
     542@@ -1666,6 +1666,19 @@
     543     tr_torrentSetRatioLimitHitCallback( torrent, NULL, NULL );
     544 }
     545 
     546+#ifdef WIN32
     547+#include <pthread.h>   /* asctime_r(), ctime_r(), localtime_r() */
     548+
     549+static void
     550+setenv (const char *name, const char *value, int override)
     551+{
     552+    int len = strlen(name) + strlen(value) + 2;
     553+    char *str = malloc(len);
     554+    sprintf(str, "%s=%s", name, value);
     555+    putenv(str);
     556+    /* leaks memory on purpose (i.e. Windows semantics) */
     557+}
     558+#endif
     559 
     560 static void
     561 torrentCallScript( tr_torrent * tor, const char * script )
     562@@ -1713,7 +1726,7 @@
     563 
     564         if( recentChange )
     565         {
     566-            tr_torinf( tor, _( "State changed from \"%1$s\" to \"%2$s\"" ),
     567+            tr_torinf( tor, _( "State changed from \"%s\" to \"%s\"" ),
     568                       getCompletionString( tor->completeness ),
     569                       getCompletionString( completeness ) );
     570         }
     571diff -NaurX /home/rberber/diff-excludes.txt transmission-2.00-orig/libtransmission/tr-dht.c transmission-2.00/libtransmission/tr-dht.c
     572--- transmission-2.00-orig/libtransmission/tr-dht.c     2010-06-15 20:32:58.000000000 -0500
     573+++ transmission-2.00/libtransmission/tr-dht.c  2010-06-17 18:52:25.000000000 -0500
     574@@ -25,13 +25,19 @@
     575 #include <stdio.h>
     576 
     577 /* posix */
     578-#include <netinet/in.h> /* sockaddr_in */
     579 #include <signal.h> /* sig_atomic_t */
     580 #include <sys/time.h>
     581-#include <sys/types.h>
     582-#include <sys/socket.h> /* socket(), bind() */
     583-#include <netdb.h>
     584 #include <unistd.h> /* close() */
     585+#ifdef WIN32
     586+  #include <inttypes.h>
     587+  #define _WIN32_WINNT  0x0501 /* freeaddrinfo(),getaddrinfo(),getnameinfo() */
     588+  #include <ws2tcpip.h>
     589+#else
     590+  #include <sys/types.h>
     591+  #include <sys/socket.h> /* socket(), bind() */
     592+  #include <netdb.h>
     593+  #include <netinet/in.h> /* sockaddr_in */
     594+#endif
     595 
     596 /* third party */
     597 #include <event.h>
     598@@ -193,7 +199,7 @@
     599             tr_buildPath(cl->session->configDir, "dht.bootstrap", NULL);
     600 
     601         if(bootstrap_file)
     602-            f = fopen(bootstrap_file, "r");
     603+            f = fopen(bootstrap_file, "rb");
     604         if(f != NULL) {
     605             tr_ninf("DHT", "Attempting manual bootstrap");
     606             for(;;) {
     607diff -NaurX /home/rberber/diff-excludes.txt transmission-2.00-orig/libtransmission/tr-lpd.c transmission-2.00/libtransmission/tr-lpd.c
     608--- transmission-2.00-orig/libtransmission/tr-lpd.c     2010-06-15 20:32:58.000000000 -0500
     609+++ transmission-2.00/libtransmission/tr-lpd.c  2010-06-17 18:52:25.000000000 -0500
     610@@ -25,14 +25,21 @@
     611 #include <stdio.h>
     612 
     613 /* posix */
     614-#include <netinet/in.h> /* sockaddr_in */
     615 #include <signal.h> /* sig_atomic_t */
     616 #include <sys/time.h>
     617-#include <sys/types.h>
     618-#include <sys/socket.h> /* socket(), bind() */
     619 #include <unistd.h> /* close() */
     620 #include <fcntl.h> /* fcntl(), O_NONBLOCK */
     621 #include <ctype.h> /* toupper() */
     622+#ifdef WIN32
     623+  #include <inttypes.h>
     624+  #define _WIN32_WINNT  0x0501  /* freeaddrinfo(),getaddrinfo(),getnameinfo() */
     625+  #include <ws2tcpip.h>
     626+  typedef unsigned short in_port_t;
     627+#else
     628+  #include <sys/types.h>
     629+  #include <sys/socket.h> /* socket(), bind() */
     630+  #include <netinet/in.h> /* sockaddr_in */
     631+#endif
     632 
     633 /* third party */
     634 #include <event.h>
     635@@ -125,6 +132,59 @@
     636 * @brief a line-feed, as understood by the LPD protocol */
     637 #define CRLF "\r\n"
     638 
     639+#ifdef WIN32
     640+static const char *
     641+inet_ntop( int af, const void *src, char *dst, socklen_t cnt )
     642+{
     643+    if (af == AF_INET)
     644+    {
     645+        struct sockaddr_in in;
     646+        memset( &in, 0, sizeof( in ) );
     647+        in.sin_family = AF_INET;
     648+        memcpy( &in.sin_addr, src, sizeof( struct in_addr ) );
     649+        getnameinfo((struct sockaddr *)&in, sizeof(struct sockaddr_in),
     650+                    dst, cnt, NULL, 0, NI_NUMERICHOST);
     651+        return dst;
     652+    }
     653+    else if (af == AF_INET6)
     654+    {
     655+        struct sockaddr_in6 in;
     656+        memset( &in, 0, sizeof( in ) );
     657+        in.sin6_family = AF_INET6;
     658+        memcpy( &in.sin6_addr, src, sizeof( struct in_addr6 ) );
     659+        getnameinfo((struct sockaddr *)&in, sizeof(struct sockaddr_in6),
     660+                    dst, cnt, NULL, 0, NI_NUMERICHOST);
     661+        return dst;
     662+    }
     663+    return NULL;
     664+}
     665+
     666+static int
     667+inet_pton(int af, const char *src, void *dst)
     668+{
     669+    struct addrinfo hints;
     670+    struct addrinfo *res;
     671+    struct addrinfo *ressave;
     672+
     673+    memset(&hints, 0, sizeof(struct addrinfo));
     674+    hints.ai_family = af;
     675+
     676+    if (getaddrinfo(src, NULL, &hints, &res) != 0)
     677+        return -1;
     678+
     679+    ressave = res;
     680+
     681+    while (res)
     682+    {
     683+        memcpy(dst, res->ai_addr, res->ai_addrlen);
     684+        res = res->ai_next;
     685+    }
     686+
     687+    freeaddrinfo(ressave);
     688+    return 0;
     689+}
     690+#endif
     691+
     692 
     693 /**
     694 * @defgroup HttpReqProc HTTP-style request handling
     695@@ -242,6 +302,7 @@
     696 * @} */
     697 
     698 
     699+#ifndef WIN32
     700 /**
     701 * @brief Configures additional capabilities for a socket */
     702 static inline int lpd_configureSocket( int sock, int add )
     703@@ -257,6 +318,7 @@
     704 
     705     return add;
     706 }
     707+#endif
     708 
     709 /**
     710 * @brief Initializes Local Peer Discovery for this node
     711@@ -291,7 +353,12 @@
     712             goto fail;
     713 
     714         /* enable non-blocking operation */
     715+#ifdef WIN32
     716+       unsigned long flags= 1;
     717+       if (ioctlsocket(lpd_socket, FIONBIO, &flags) == SOCKET_ERROR)
     718+#else
     719         if( lpd_configureSocket( lpd_socket, O_NONBLOCK ) < 0 )
     720+#endif
     721             goto fail;
     722 
     723         if( setsockopt( lpd_socket, SOL_SOCKET, SO_REUSEADDR,
     724@@ -331,7 +398,12 @@
     725             goto fail;
     726 
     727         /* enable non-blocking operation */
     728+#ifdef WIN32
     729+       unsigned long flags= 1;
     730+       if (ioctlsocket(lpd_socket, FIONBIO, &flags) == SOCKET_ERROR)
     731+#else
     732         if( lpd_configureSocket( lpd_socket2, O_NONBLOCK ) < 0 )
     733+#endif
     734             goto fail;
     735 
     736         /* configure outbound multicast TTL */
     737diff -NaurX /home/rberber/diff-excludes.txt transmission-2.00-orig/libtransmission/trevent.c transmission-2.00/libtransmission/trevent.c
     738--- transmission-2.00-orig/libtransmission/trevent.c    2010-06-15 20:32:58.000000000 -0500
     739+++ transmission-2.00/libtransmission/trevent.c 2010-06-17 18:52:25.000000000 -0500
     740@@ -26,79 +26,95 @@
     741 
     742 #ifdef WIN32
     743 
     744-#include <WinSock2.h>
     745+#include "utils.h"
     746+#include <winsock2.h>
     747 
     748 static int
     749 pgpipe( int handles[2] )
     750 {
     751-        SOCKET s;
     752-        struct sockaddr_in serv_addr;
     753-        int len = sizeof( serv_addr );
     754+    SOCKET s;
     755+    struct sockaddr_in serv_addr;
     756+    int len = sizeof( serv_addr );
     757 
     758-        handles[0] = handles[1] = INVALID_SOCKET;
     759+    handles[0] = handles[1] = INVALID_SOCKET;
     760 
     761-        if ( ( s = socket( AF_INET, SOCK_STREAM, 0 ) ) == INVALID_SOCKET )
     762-        {
     763-/*              ereport(LOG, (errmsg_internal("pgpipe failed to create socket: %ui", WSAGetLastError()))); */
     764-                return -1;
     765-        }
     766+    if ( ( s = socket( AF_INET, SOCK_STREAM, 0 ) ) == INVALID_SOCKET )
     767+    {
     768+        tr_dbg("pgpipe failed to create socket: %ui", WSAGetLastError());
     769+        return -1;
     770+    }
     771 
     772-        memset( &serv_addr, 0, sizeof( serv_addr ) );
     773-        serv_addr.sin_family = AF_INET;
     774-        serv_addr.sin_port = htons(0);
     775-        serv_addr.sin_addr.s_addr = htonl(INADDR_LOOPBACK);
     776-        if (bind(s, (SOCKADDR *) & serv_addr, len) == SOCKET_ERROR)
     777-        {
     778-/*              ereport(LOG, (errmsg_internal("pgpipe failed to bind: %ui", WSAGetLastError()))); */
     779-                closesocket(s);
     780-                return -1;
     781-        }
     782-        if (listen(s, 1) == SOCKET_ERROR)
     783-        {
     784-/*              ereport(LOG, (errmsg_internal("pgpipe failed to listen: %ui", WSAGetLastError()))); */
     785-                closesocket(s);
     786-                return -1;
     787-        }
     788-        if (getsockname(s, (SOCKADDR *) & serv_addr, &len) == SOCKET_ERROR)
     789-        {
     790-/*              ereport(LOG, (errmsg_internal("pgpipe failed to getsockname: %ui", WSAGetLastError()))); */
     791-                closesocket(s);
     792-                return -1;
     793-        }
     794-        if ((handles[1] = socket(PF_INET, SOCK_STREAM, 0)) == INVALID_SOCKET)
     795-        {
     796-/*              ereport(LOG, (errmsg_internal("pgpipe failed to create socket 2: %ui", WSAGetLastError()))); */
     797-                closesocket(s);
     798-                return -1;
     799-        }
     800+    memset( &serv_addr, 0, sizeof( serv_addr ) );
     801+    serv_addr.sin_family = AF_INET;
     802+    serv_addr.sin_port = htons(0);
     803+    serv_addr.sin_addr.s_addr = htonl(INADDR_LOOPBACK);
     804+    if (bind(s, (SOCKADDR *) & serv_addr, len) == SOCKET_ERROR)
     805+    {
     806+        tr_dbg("pgpipe failed to bind: %ui", WSAGetLastError());
     807+        closesocket(s);
     808+        return -1;
     809+    }
     810+    if (listen(s, 1) == SOCKET_ERROR)
     811+    {
     812+        tr_ndbg("event","pgpipe failed to listen: %ui", WSAGetLastError());
     813+        closesocket(s);
     814+        return -1;
     815+    }
     816+    if (getsockname(s, (SOCKADDR *) & serv_addr, &len) == SOCKET_ERROR)
     817+    {
     818+        tr_dbg("pgpipe failed to getsockname: %ui", WSAGetLastError());
     819+        closesocket(s);
     820+        return -1;
     821+    }
     822+    if ((handles[1] = socket(PF_INET, SOCK_STREAM, 0)) == INVALID_SOCKET)
     823+    {
     824+        tr_dbg("pgpipe failed to create socket 2: %ui", WSAGetLastError());
     825+        closesocket(s);
     826+        return -1;
     827+    }
     828 
     829-        if (connect(handles[1], (SOCKADDR *) & serv_addr, len) == SOCKET_ERROR)
     830-        {
     831-/*              ereport(LOG, (errmsg_internal("pgpipe failed to connect socket: %ui", WSAGetLastError()))); */
     832-                closesocket(s);
     833-                return -1;
     834-        }
     835-        if ((handles[0] = accept(s, (SOCKADDR *) & serv_addr, &len)) == INVALID_SOCKET)
     836-        {
     837-/*              ereport(LOG, (errmsg_internal("pgpipe failed to accept socket: %ui", WSAGetLastError()))); */
     838-                closesocket(handles[1]);
     839-                handles[1] = INVALID_SOCKET;
     840-                closesocket(s);
     841-                return -1;
     842-        }
     843+    if (connect(handles[1], (SOCKADDR *) & serv_addr, len) == SOCKET_ERROR)
     844+    {
     845+        tr_dbg("pgpipe failed to connect socket: %ui", WSAGetLastError());
     846+        closesocket(s);
     847+        return -1;
     848+    }
     849+    if ((handles[0] = accept(s, (SOCKADDR *) & serv_addr, &len)) == INVALID_SOCKET)
     850+    {
     851+        tr_dbg("pgpipe failed to accept socket: %ui", WSAGetLastError());
     852+        closesocket(handles[1]);
     853+        handles[1] = INVALID_SOCKET;
     854         closesocket(s);
     855-        return 0;
     856+        return -1;
     857+    }
     858+    closesocket(s);
     859+    return 0;
     860 }
     861 
     862 static int
     863 piperead( int s, char *buf, int len )
     864 {
     865-        int ret = recv(s, buf, len, 0);
     866+    int ret = recv(s, buf, len, 0);
     867+    int werror = 0;
     868 
     869-        if (ret < 0 && WSAGetLastError() == WSAECONNRESET)
     870-                /* EOF on the pipe! (win32 socket based implementation) */
     871-                ret = 0;
     872-        return ret;
     873+    if (ret < 0) {
     874+        werror= WSAGetLastError();
     875+        switch(werror) {
     876+          /* simplified error mapping (not valid for connect) */
     877+            case WSAEWOULDBLOCK:
     878+                errno = EAGAIN;
     879+                break;
     880+           case WSAECONNRESET:
     881+               /* EOF on the pipe! (win32 socket based implementation) */
     882+               ret = 0;
     883+               /* fall through */
     884+            default:
     885+                errno = werror;
     886+                break;
     887+        }
     888+    } else
     889+        errno = 0;
     890+    return ret;
     891 }
     892 
     893 #define pipe(a) pgpipe(a)
     894diff -NaurX /home/rberber/diff-excludes.txt transmission-2.00-orig/libtransmission/utils.c transmission-2.00/libtransmission/utils.c
     895--- transmission-2.00-orig/libtransmission/utils.c      2010-06-15 20:32:58.000000000 -0500
     896+++ transmission-2.00/libtransmission/utils.c   2010-06-17 19:07:26.000000000 -0500
     897@@ -34,6 +34,9 @@
     898 #include <sys/types.h>
     899 #include <sys/stat.h>
     900 #include <unistd.h> /* usleep, stat, getcwd, getpagesize */
     901+#ifdef WIN32
     902+#define getpagesize() 65536
     903+#endif
     904 
     905 #include "event.h"
     906 
     907@@ -481,7 +484,7 @@
     908     struct stat  sb;
     909     int fd;
     910     ssize_t n;
     911-    const char * err_fmt = _( "Couldn't read \"%1$s\": %2$s" );
     912+    const char * err_fmt = _( "Couldn't read \"%s\": %s" );
     913 
     914     /* try to stat the file */
     915     errno = 0;
     916@@ -601,7 +604,7 @@
     917             {
     918                 const int err = errno;
     919                 tr_err( _(
     920-                           "Couldn't create \"%1$s\": %2$s" ), path,
     921+                           "Couldn't create \"%s\": %s" ), path,
     922                        tr_strerror( err ) );
     923                 tr_free( path );
     924                 errno = err;
     925@@ -612,7 +615,7 @@
     926         {
     927             /* Node exists but isn't a folder */
     928             char * buf = tr_strdup_printf( _( "File \"%s\" is in the way" ), path );
     929-            tr_err( _( "Couldn't create \"%1$s\": %2$s" ), path_in, buf );
     930+            tr_err( _( "Couldn't create \"%s\": %s" ), path_in, buf );
     931             tr_free( buf );
     932             tr_free( path );
     933             errno = ENOTDIR;
     934@@ -1429,7 +1432,11 @@
     935     /* copy the file */
     936     in = tr_open_file_for_scanning( oldpath );
     937     out = tr_open_file_for_writing( newpath );
     938+#ifdef WIN32
     939+    buflen = 4096;
     940+#else
     941     buflen = stat( newpath, &st ) ? 4096 : st.st_blksize;
     942+#endif
     943     buf = tr_valloc( buflen );
     944     while( bytesLeft > 0 )
     945     {
     946diff -NaurX /home/rberber/diff-excludes.txt transmission-2.00-orig/libtransmission/web.c transmission-2.00/libtransmission/web.c
     947--- transmission-2.00-orig/libtransmission/web.c        2010-06-15 20:32:58.000000000 -0500
     948+++ transmission-2.00/libtransmission/web.c     2010-06-17 18:52:25.000000000 -0500
     949@@ -10,7 +10,9 @@
     950  * $Id: web.c 10535 2010-04-28 00:32:43Z charles $
     951  */
     952 
     953+#ifndef WIN32
     954 #include <sys/select.h>
     955+#endif
     956 
     957 #include <curl/curl.h>
     958 #include <event.h>
     959@@ -94,7 +96,11 @@
     960     const size_t byteCount = size * nmemb;
     961     struct tr_web_task * task = vtask;
     962     evbuffer_add( task->response, ptr, byteCount );
     963+#ifndef WIN32
     964     dbgmsg( "wrote %zu bytes to task %p's buffer", byteCount, task );
     965+#else
     966+    dbgmsg( "wrote %u bytes to task %p's buffer", byteCount, task);
     967+#endif
     968     return byteCount;
     969 }
     970 
     971@@ -274,7 +280,7 @@
     972         while(( task = tr_list_pop_front( &web->tasks )))
     973         {
     974             curl_multi_add_handle( multi, createEasy( session, task ));
     975-            /*fprintf( stderr, "adding a task.. taskCount is now %d\n", taskCount );*/
     976+           fprintf( stderr, "adding a task.. taskCount is now %d\n", taskCount );
     977             ++taskCount;
     978         }
     979         tr_lockUnlock( web->taskLock );
     980@@ -304,6 +310,9 @@
     981             t.tv_sec =  usec / 1000000;
     982             t.tv_usec = usec % 1000000;
     983 
     984+#ifdef WIN32
     985+           Sleep(msec);        /* Windows' select() doesn't like the parameters below... */
     986+#endif
     987             select( max_fd+1, &r_fd_set, &w_fd_set, &c_fd_set, &t );
     988         }
     989 
     990@@ -323,7 +332,7 @@
     991                 curl_easy_getinfo( e, CURLINFO_RESPONSE_CODE, &task->code );
     992                 curl_multi_remove_handle( multi, e );
     993                 curl_easy_cleanup( e );
     994-/*fprintf( stderr, "removing a completed task.. taskCount is now %d (response code: %d, response len: %d)\n", taskCount, (int)task->code, (int)EVBUFFER_LENGTH(task->response) );*/
     995+               fprintf( stderr, "removing a completed task.. taskCount is now %d (response code: %d, response len: %d)\n", taskCount, (int)task->code, (int)EVBUFFER_LENGTH(task->response) );
     996                 tr_runInEventThread( task->session, task_finish_func, task );
     997                 --taskCount;
     998             }
     999diff -NaurX /home/rberber/diff-excludes.txt transmission-2.00-orig/qt/qtr.pro transmission-2.00/qt/qtr.pro
     1000--- transmission-2.00-orig/qt/qtr.pro   2010-06-15 20:32:59.000000000 -0500
     1001+++ transmission-2.00/qt/qtr.pro        2010-06-17 19:06:14.000000000 -0500
     1002@@ -1,7 +1,7 @@
     1003 TARGET = qtr
     1004 NAME = "Transmission"
     1005 DESCRIPTION = "Transmission: a fast, easy, and free BitTorrent client"
     1006-VERSION = 1.60
     1007+VERSION = 2.00
     1008 LICENSE = "GPL"
     1009 
     1010 target.path = /bin
     1011@@ -9,7 +9,7 @@
     1012 
     1013 CONFIG += qt qdbus thread debug link_pkgconfig
     1014 QT += network
     1015-PKGCONFIG = fontconfig libcurl openssl
     1016+PKGCONFIG = fontconfig libcurl openssl dbus-1
     1017 
     1018 TRANSMISSION_TOP = ..
     1019 INCLUDEPATH += $${TRANSMISSION_TOP}
     1020@@ -17,7 +17,10 @@
     1021 LIBS += $${TRANSMISSION_TOP}/third-party/dht/libdht.a
     1022 LIBS += $${TRANSMISSION_TOP}/third-party/miniupnp/libminiupnp.a
     1023 LIBS += $${TRANSMISSION_TOP}/third-party/libnatpmp/libnatpmp.a
     1024-LIBS += -levent
     1025+unix: LIBS += -levent
     1026+win32:DEFINES += QT_DBUS
     1027+win32:LIBS += -levent -lws2_32 -lintl
     1028+win32:LIBS += -lidn -liconv -lwldap32 -liphlpapi
     1029 
     1030 TRANSLATIONS += transmission_en.ts transmission_ru.ts
     1031 
     1032@@ -31,4 +34,4 @@
     1033            torrent-model.cc triconpushbutton.cc utils.cc watchdir.cc
     1034 HEADERS += $$replace(SOURCES, .cc, .h)
     1035 HEADERS += speed.h types.h
     1036-
     1037+win32:RC_FILE = qtr.rc
     1038diff -NaurX /home/rberber/diff-excludes.txt transmission-2.00-orig/qt/qtr.rc transmission-2.00/qt/qtr.rc
     1039--- transmission-2.00-orig/qt/qtr.rc    1969-12-31 18:00:00.000000000 -0600
     1040+++ transmission-2.00/qt/qtr.rc 2010-06-17 18:52:25.000000000 -0500
     1041@@ -0,0 +1 @@
     1042+IDI_ICON1      ICON    DISCARDABLE "qtr.ico"
     1043diff -NaurX /home/rberber/diff-excludes.txt transmission-2.00-orig/qt/session.cc transmission-2.00/qt/session.cc
     1044--- transmission-2.00-orig/qt/session.cc        2010-06-15 20:32:59.000000000 -0500
     1045+++ transmission-2.00/qt/session.cc     2010-06-17 18:52:25.000000000 -0500
     1046@@ -142,6 +142,7 @@
     1047         case Prefs :: DOWNLOAD_DIR:
     1048         case Prefs :: DSPEED:
     1049         case Prefs :: DSPEED_ENABLED:
     1050+        case Prefs :: ENCRYPTION:
     1051         case Prefs :: INCOMPLETE_DIR:
     1052         case Prefs :: INCOMPLETE_DIR_ENABLED:
     1053         case Prefs :: LPD_ENABLED:
     1054diff -NaurX /home/rberber/diff-excludes.txt transmission-2.00-orig/qt/utils.cc transmission-2.00/qt/utils.cc
     1055--- transmission-2.00-orig/qt/utils.cc  2010-06-15 20:32:59.000000000 -0500
     1056+++ transmission-2.00/qt/utils.cc       2010-06-17 18:52:25.000000000 -0500
     1057@@ -76,12 +76,12 @@
     1058         else if( size < (int64_t)GIGABYTE_FACTOR )
     1059         {
     1060             displayed_size = (double)size / MEGABYTE_FACTOR;
     1061-            str = tr( "%L1 MiB" ).arg( displayed_size,  0, 'f', 1 );
     1062+            str = tr( "%L1 MiB" ).arg( displayed_size,  0, 'f', 2 );
     1063         }
     1064         else
     1065         {
     1066             displayed_size = (double) size / GIGABYTE_FACTOR;
     1067-            str = tr( "%L1 GiB" ).arg( displayed_size,  0, 'f', 1 );
     1068+            str = tr( "%L1 GiB" ).arg( displayed_size,  0, 'f', 3 );
     1069         }
     1070     }
     1071 
     1072diff -NaurX /home/rberber/diff-excludes.txt transmission-2.00-orig/third-party/dht/dht.c transmission-2.00/third-party/dht/dht.c
     1073--- transmission-2.00-orig/third-party/dht/dht.c        2010-06-15 20:33:16.000000000 -0500
     1074+++ transmission-2.00/third-party/dht/dht.c     2010-06-17 18:52:25.000000000 -0500
     1075@@ -39,10 +39,18 @@
     1076 #include <unistd.h>
     1077 #include <fcntl.h>
     1078 #include <sys/time.h>
     1079+#ifndef WIN32
     1080 #include <arpa/inet.h>
     1081 #include <sys/types.h>
     1082 #include <sys/socket.h>
     1083 #include <netinet/in.h>
     1084+#else
     1085+#define WINVER  WindowsXP       /* freeaddrinfo(),getaddrinfo(),getnameinfo() */
     1086+#include <ws2tcpip.h>
     1087+#define random rand            /* int rand() since no long random() */
     1088+const char *inet_ntop(int, const void *, char *, socklen_t);
     1089+#define EAFNOSUPPORT            WSAEAFNOSUPPORT
     1090+#endif
     1091 
     1092 #include "dht.h"
     1093 
     1094@@ -1530,6 +1538,10 @@
     1095 dht_init(int s, int s6, const unsigned char *id, const unsigned char *v)
     1096 {
     1097     int rc;
     1098+#ifdef WIN32
     1099+    unsigned long flags = 1;
     1100+#endif
     1101+
     1102 
     1103     if(dht_socket >= 0 || dht_socket6 >= 0 || buckets || buckets6) {
     1104         errno = EBUSY;
     1105@@ -1548,11 +1560,15 @@
     1106             return -1;
     1107         buckets->af = AF_INET;
     1108 
     1109+#ifndef WIN32
     1110         rc = fcntl(s, F_GETFL, 0);
     1111         if(rc < 0)
     1112             goto fail;
     1113 
     1114         rc = fcntl(s, F_SETFL, (rc | O_NONBLOCK));
     1115+#else
     1116+       rc = ioctlsocket(s, FIONBIO, &flags);
     1117+#endif
     1118         if(rc < 0)
     1119             goto fail;
     1120     }
     1121@@ -1563,11 +1579,15 @@
     1122             return -1;
     1123         buckets6->af = AF_INET6;
     1124 
     1125+#ifndef WIN32
     1126         rc = fcntl(s6, F_GETFL, 0);
     1127         if(rc < 0)
     1128             goto fail;
     1129 
     1130         rc = fcntl(s6, F_SETFL, (rc | O_NONBLOCK));
     1131+#else
     1132+        rc = ioctlsocket(s6, FIONBIO, &flags);
     1133+#endif
     1134         if(rc < 0)
     1135             goto fail;
     1136     }
     1137@@ -2877,3 +2897,29 @@
     1138     debugf("Truncated message.\n");
     1139     return -1;
     1140 }
     1141+
     1142+#ifdef WIN32
     1143+const char *
     1144+inet_ntop (int af, const void *src, char *dst, socklen_t cnt)
     1145+{
     1146+    if (af == AF_INET)
     1147+    {
     1148+        struct sockaddr_in in;
     1149+        memset(&in, 0, sizeof(in));
     1150+        in.sin_family = AF_INET;
     1151+        memcpy(&in.sin_addr, src, sizeof(struct in_addr));
     1152+        getnameinfo((struct sockaddr *)&in, sizeof(struct sockaddr_in), dst, cnt, NULL, 0, NI_NUMERICHOST);
     1153+        return dst;
     1154+    }
     1155+    else if (af == AF_INET6)
     1156+    {
     1157+        struct sockaddr_in6 in;
     1158+        memset(&in, 0, sizeof(in));
     1159+        in.sin6_family = AF_INET6;
     1160+        memcpy(&in.sin6_addr, src, sizeof(struct in_addr6));
     1161+        getnameinfo((struct sockaddr *)&in, sizeof(struct sockaddr_in6), dst, cnt, NULL, 0, NI_NUMERICHOST);
     1162+        return dst;
     1163+    }
     1164+    return NULL;
     1165+}
     1166+#endif
     1167diff -NaurX /home/rberber/diff-excludes.txt transmission-2.00-orig/third-party/miniupnp/miniupnpc.c transmission-2.00/third-party/miniupnp/miniupnpc.c
     1168--- transmission-2.00-orig/third-party/miniupnp/miniupnpc.c     2010-06-15 20:33:16.000000000 -0500
     1169+++ transmission-2.00/third-party/miniupnp/miniupnpc.c  2010-06-17 19:15:56.000000000 -0500
     1170@@ -24,7 +24,7 @@
     1171 #include <winsock2.h>
     1172 #include <ws2tcpip.h>
     1173 #include <io.h>
     1174-#include <IPHlpApi.h>
     1175+#include <iphlpapi.h>
     1176 #define snprintf _snprintf
     1177 #if defined(_MSC_VER) && (_MSC_VER >= 1400)
     1178 #define strncasecmp _memicmp