Ignore:
Timestamp:
Oct 19, 2008, 5:43:04 PM (14 years ago)
Author:
charles
Message:

further win32 portability fixes from Spry

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/libtransmission/utils.c

    r6907 r6924  
    5656static tr_msg_list ** messageQueueTail = &messageQueue;
    5757
     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
    5864void
    5965tr_msgInit( void )
     
    157163**/
    158164
     165static struct tm *
     166tr_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
    159178char*
    160179tr_getLogTimeStr( char * buf,
     
    170189    gettimeofday( &tv, NULL );
    171190
    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 );
    177192    strftime( tmp, sizeof( tmp ), "%H:%M:%S", &now_tm );
    178193    milliseconds = (int)( tv.tv_usec / 1000 );
     
    190205{
    191206    FILE * fp = tr_getLog( );
    192 #ifdef WIN32
    193207    if( fp || IsDebuggerPresent( ) )
    194 #else
    195     if( fp )
    196 #endif
    197208    {
    198209        va_list           args;
     
    209220        va_end( args );
    210221        evbuffer_add_printf( buf, " (%s:%d)\n", base, line );
    211 #ifdef WIN32
    212222        OutputDebugString( EVBUFFER_DATA( buf ) );
    213223        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 );
    216225
    217226        tr_free( base );
     
    255264        evbuffer_add_vprintf( buf, fmt, ap );
    256265        va_end( ap );
     266
     267        OutputDebugString( EVBUFFER_DATA( buf ) );
    257268
    258269        if( EVBUFFER_LENGTH( buf ) )
Note: See TracChangeset for help on using the changeset viewer.