Changeset 6924 for trunk/libtransmission/utils.c
- Timestamp:
- Oct 19, 2008, 5:43:04 PM (14 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
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.