Changeset 6924
- Timestamp:
- Oct 19, 2008, 5:43:04 PM (12 years ago)
- Location:
- trunk/libtransmission
- Files:
-
- 6 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/libtransmission/Makefile.am
r6798 r6924 151 151 echo '#define USERAGENT_PREFIX "'@USERAGENT_PREFIX@'"' >> version.h 152 152 echo '#define SVN_REVISION "'`svn info | grep "Revision" | awk -F': ' '{print $$2}'`'"' >> version.h 153 echo '#define SVN_REVISION_NUM '`svn info | grep "Revision" | awk -F': ' '{print $$2}'`'' >> version.h 153 154 echo '#define SHORT_VERSION_STRING "'@USERAGENT_PREFIX@'"' >> version.h 154 155 echo '#define LONG_VERSION_STRING "'@USERAGENT_PREFIX@' ('`svn info | grep "Revision" | awk -F': ' '{print $$2}'`')"' >> version.h -
trunk/libtransmission/fdlimit.c
r6906 r6924 490 490 491 491 tr_free( gFd ); 492 gFd = NULL; 492 493 } 493 494 -
trunk/libtransmission/net.h
r6906 r6924 29 29 #include <inttypes.h> 30 30 #include <winsock2.h> 31 typedef int socklen_t;32 typedef uint16_t tr_port_t;31 typedef int socklen_t; 32 typedef uint16_t tr_port_t; 33 33 #elif defined( __BEOS__ ) 34 34 #include <sys/socket.h> 35 35 #include <netinet/in.h> 36 typedef unsigned short tr_port_t;37 typedef int socklen_t;36 typedef unsigned short tr_port_t; 37 typedef int socklen_t; 38 38 #else 39 39 #include <sys/types.h> … … 41 41 #include <netinet/in.h> 42 42 #include <arpa/inet.h> 43 typedef in_port_t tr_port_t;43 typedef in_port_t tr_port_t; 44 44 #endif 45 45 -
trunk/libtransmission/platform.c
r6902 r6924 466 466 "Application Support", "Transmission", NULL ); 467 467 #elif defined( WIN32 ) 468 char appdata[MAX_PATH_LENGTH];469 SHGetFolderPath( NULL, CSIDL_APPDATA, NULL, 0, appdata);470 s = tr_buildPath( appdata, "Transmission", NULL );468 char configDir[MAX_PATH_LENGTH]; 469 GetModuleFileName( GetModuleHandle( NULL ), configDir, sizeof( configDir ) ); 470 s = tr_buildPath( basename( configDir ), "Transmission", NULL ); 471 471 #else 472 472 if( ( s = getenv( "XDG_CONFIG_HOME" ) ) ) … … 514 514 else 515 515 { 516 516 517 #ifdef SYS_DARWIN 517 CFURLRef appURL = CFBundleCopyBundleURL( 518 519 CFStringRef appRef = CFURLCopyFileSystemPath(520 appURL,kCFURLPOSIXPathStyle );521 const char * appString = CFStringGetCStringPtr( 522 appRef,CFStringGetFastestEncoding( appRef ) );518 519 CFURLRef appURL = CFBundleCopyBundleURL( CFBundleGetMainBundle( ) ); 520 CFStringRef appRef = CFURLCopyFileSystemPath( appURL, 521 kCFURLPOSIXPathStyle ); 522 const char * appString = CFStringGetCStringPtr( appRef, 523 CFStringGetFastestEncoding( appRef ) ); 523 524 CFRelease( appURL ); 524 525 CFRelease( appRef ); 525 526 526 527 s = tr_buildPath( appString, "Contents", "Resources", "web", NULL ); 527 #elif defined( WIN32 ) 528 529 #warning hey win32 people is this good or is there a better implementation of the next four lines 530 char appdata[MAX_PATH_LENGTH]; 531 SHGetFolderPath( NULL, CSIDL_APPDATA, NULL, 0, appdata ); 532 s = tr_buildPath( appdata, "Transmission", NULL ); 533 #else 528 529 #elif defined( WIN32 ) 530 531 /* SHGetFolderPath explicitly requires MAX_PATH length */ 532 char dir[MAX_PATH]; 533 534 /* Generally, Web interface should be stored in a Web subdir of 535 * calling executable dir. */ 536 537 if( s == NULL ) { 538 /* First, we should check personal AppData/Transmission/Web */ 539 SHGetFolderPath( NULL, CSIDL_COMMON_APPDATA, NULL, 0, dir ); 540 s = tr_buildPath( dir, "Transmission", "Web", NULL ); 541 if( !isClutchDir( s ) ) { 542 tr_free( s ); 543 s = NULL; 544 } 545 } 546 547 if( s == NULL ) { 548 /* check personal AppData */ 549 SHGetFolderPath( NULL, CSIDL_APPDATA, NULL, 0, dir ); 550 s = tr_buildPath( dir, "Transmission", "Web", NULL ); 551 if( !isClutchDir( s ) ) { 552 tr_free( s ); 553 s = NULL; 554 } 555 } 556 557 if( s == NULL) { 558 /* check calling module place */ 559 GetModuleFileName( GetModuleHandle( NULL ), dir, sizeof( dir ) ); 560 s = tr_buildPath( dirname( dir ), "Web", NULL ); 561 if( !isClutchDir( s ) ) { 562 tr_free( s ); 563 s = NULL; 564 } 565 } 566 567 #else /* everyone else, follow the XDG spec */ 568 534 569 tr_list *candidates = NULL, *l; 535 570 … … 574 609 575 610 tr_list_free( &candidates, tr_free ); 576 #endif 611 612 #endif 613 577 614 } 578 615 } -
trunk/libtransmission/transmission.h
r6897 r6924 63 63 * "$HOME/Library/Application Support/Transmission" is returned. 64 64 * - otherwise, if we're running on WIN32, 65 * "$ CSIDL_APPDATA/Transmission" is returned.65 * "$EXE_FOLDER/Transmission" is returned. 66 66 * - otherwise, if XDG_CONFIG_HOME is set, 67 67 * "$XDG_CONFIG_HOME/transmission" is returned. -
trunk/libtransmission/utils.c
r6907 r6924 56 56 static tr_msg_list ** messageQueueTail = &messageQueue; 57 57 58 #ifndef WIN32 59 /* make null versions of these win32 functions */ 60 static int IsDebuggerPresent( void ) { return FALSE; } 61 static void OutputDebugString( const void * unused UNUSED ) { } 62 #endif 63 58 64 void 59 65 tr_msgInit( void ) … … 157 163 **/ 158 164 165 static struct tm * 166 tr_localtime_r( time_t *_clock, struct tm *_result ) 167 { 168 #ifdef HAVE_LOCALTIME_R 169 return localtime_r( _clock, _result ); 170 #else 171 struct tm *p = localtime( _clock ); 172 if( p ) 173 *(_result) = *p; 174 return p; 175 #endif 176 } 177 159 178 char* 160 179 tr_getLogTimeStr( char * buf, … … 170 189 gettimeofday( &tv, NULL ); 171 190 172 #ifdef WIN32 173 now_tm = *localtime( &now ); 174 #else 175 localtime_r( &now, &now_tm ); 176 #endif 191 tr_localtime_r( &now, &now_tm ); 177 192 strftime( tmp, sizeof( tmp ), "%H:%M:%S", &now_tm ); 178 193 milliseconds = (int)( tv.tv_usec / 1000 ); … … 190 205 { 191 206 FILE * fp = tr_getLog( ); 192 #ifdef WIN32193 207 if( fp || IsDebuggerPresent( ) ) 194 #else195 if( fp )196 #endif197 208 { 198 209 va_list args; … … 209 220 va_end( args ); 210 221 evbuffer_add_printf( buf, " (%s:%d)\n", base, line ); 211 #ifdef WIN32212 222 OutputDebugString( EVBUFFER_DATA( buf ) ); 213 223 if(fp) 214 #endif 215 (void) fwrite( EVBUFFER_DATA( buf ), 1, EVBUFFER_LENGTH( buf ), fp ); 224 (void) fwrite( EVBUFFER_DATA( buf ), 1, EVBUFFER_LENGTH( buf ), fp ); 216 225 217 226 tr_free( base ); … … 255 264 evbuffer_add_vprintf( buf, fmt, ap ); 256 265 va_end( ap ); 266 267 OutputDebugString( EVBUFFER_DATA( buf ) ); 257 268 258 269 if( EVBUFFER_LENGTH( buf ) )
Note: See TracChangeset
for help on using the changeset viewer.