Ignore:
Timestamp:
Dec 20, 2010, 2:07:51 AM (11 years ago)
Author:
charles
Message:

(trunk) #3836 "libevent2 support" -- bump libevent2 requirement to 2.0.10. This will break the Mac build for a minute intil BMW applies his Mac patch

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/libtransmission/utils.c

    r11490 r11548  
    4343#include <unistd.h> /* stat(), getcwd(), getpagesize() */
    4444
    45 #include "event.h"
     45#include <event2/buffer.h>
     46#include <event2/event.h>
    4647
    4748#ifdef WIN32
     
    248249        evbuffer_add_printf( buf, " (%s:%d)\n", base, line );
    249250        /* FIXME(libevent2) ifdef this out for nonwindows platforms */
    250         OutputDebugString( EVBUFFER_DATA( buf ) );
     251        OutputDebugString( evbuffer_pullup( buf, -1 ) );
    251252        if(fp) /* FIXME(libevent2) tr_getLog() should return an fd, then use evbuffer_write() here ) */
    252             (void) fwrite( EVBUFFER_DATA( buf ), 1, EVBUFFER_LENGTH( buf ), fp );
     253            (void) fwrite( evbuffer_pullup( buf, -1 ), 1, evbuffer_get_length( buf ), fp );
    253254
    254255        tr_free( base );
     
    693694
    694695char*
     696evbuffer_free_to_str( struct evbuffer * buf )
     697{
     698    const size_t n = evbuffer_get_length( buf );
     699    char * ret = tr_new( char, n + 1 );
     700    evbuffer_copyout( buf, ret, n );
     701    evbuffer_free( buf );
     702    ret[n] = '\0';
     703    return ret;
     704}
     705
     706char*
    695707tr_strdup( const void * in )
    696708{
     
    12501262strip_non_utf8( const char * in, size_t inlen )
    12511263{
    1252     char * ret;
    12531264    const char * end;
    12541265    const char zero = '\0';
     
    12671278    evbuffer_add( buf, in, inlen );
    12681279    evbuffer_add( buf, &zero, 1 );
    1269     ret = tr_memdup( EVBUFFER_DATA( buf ), EVBUFFER_LENGTH( buf ) );
    1270     evbuffer_free( buf );
    1271     return ret;
     1280    return evbuffer_free_to_str( buf );
    12721281}
    12731282
Note: See TracChangeset for help on using the changeset viewer.