Changeset 5065


Ignore:
Timestamp:
Feb 19, 2008, 4:16:04 AM (14 years ago)
Author:
charles
Message:

cleanup #includes for errno & strerror

Location:
trunk
Files:
18 edited

Legend:

Unmodified
Added
Removed
  • trunk/gtk/main.c

    r5064 r5065  
    2424
    2525#include <sys/param.h>
    26 #include <errno.h>
    2726#include <signal.h>
    2827#include <string.h>
  • trunk/gtk/tr_torrent.c

    r5064 r5065  
    2323 *****************************************************************************/
    2424
    25 #include <errno.h>
    2625#include <string.h>
    2726#include <unistd.h>
  • trunk/gtk/util.c

    r5015 r5065  
    2525#include <sys/types.h>
    2626#include <sys/stat.h>
    27 #include <errno.h>
    2827#include <signal.h>
    2928#include <stdarg.h>
  • trunk/libtransmission/fastresume.c

    r5014 r5065  
    4343
    4444#include <assert.h>
    45 #include <errno.h>
    4645#include <stdio.h>
    4746#include <stdlib.h>
  • trunk/libtransmission/fdlimit.c

    r4856 r5065  
    164164    if( file->fd == -1 ) {
    165165        const int err = errno;
    166         tr_err( "Couldn't open '%s': %s", filename, strerror(err) );
     166        tr_err( "Couldn't open '%s': %s", filename, tr_strerror(err) );
    167167        return tr_ioErrorFromErrno( err );
    168168    }
     
    388388    if( isReserved || ( gFd->normal < getSocketMax( gFd ) ) )
    389389        if( ( s = socket( AF_INET, type, 0 ) ) < 0 )
    390             tr_err( "Couldn't create socket (%s)", strerror( sockerrno ) );
     390            tr_err( "Couldn't create socket (%s)", tr_strerror( sockerrno ) );
    391391
    392392    if( s > -1 )
  • trunk/libtransmission/handshake.c

    r4735 r5065  
    10251025    {
    10261026        dbgmsg( handshake, "libevent got an error what==%d, errno=%d (%s)",
    1027                 (int)what, errno, strerror(errno) );
     1027                (int)what, errno, tr_strerror(errno) );
    10281028        tr_handshakeDone( handshake, FALSE );
    10291029    }
  • trunk/libtransmission/inout.c

    r5045 r5065  
    1212
    1313#include <assert.h>
     14#include <errno.h>
    1415#include <stdlib.h>
    1516#include <string.h>
  • trunk/libtransmission/makemeta.c

    r4404 r5065  
    5858    i = stat( buf, &sb );
    5959    if( i ) {
    60         tr_err("makemeta couldn't stat \"%s\"; skipping. (%s)", buf, strerror(errno));
     60        tr_err("makemeta couldn't stat \"%s\"; skipping. (%s)", buf, tr_strerror(errno));
    6161        return list;
    6262    }
  • trunk/libtransmission/metainfo.c

    r5052 r5065  
    615615    if( !file )
    616616    {
    617         tr_err( "Could not open file (%s) (%s)", path, strerror( errno ) );
     617        tr_err( "Could not open file (%s) (%s)", path, tr_strerror( errno ) );
    618618        return TR_EINVALID;
    619619    }
     
    621621    if( fwrite( buf, 1, buflen, file ) != buflen )
    622622    {
    623         tr_err( "Could not write file (%s) (%s)", path, strerror( errno ) );
     623        tr_err( "Could not write file (%s) (%s)", path, tr_strerror( errno ) );
    624624        fclose( file );
    625625        return TR_EINVALID;
  • trunk/libtransmission/natpmp.c

    r4599 r5065  
    1515#include <time.h>
    1616#include <inttypes.h>
    17 #include <string.h> /* strerror */
    1817
    1918#ifdef WIN32
     
    7170        tr_dbg( KEY "%s returned success (%d)", func, ret );
    7271    else
    73         tr_err( KEY "%s returned error %d, errno is %d (%s)", func, ret, errno, strerror(errno) );
     72        tr_err( KEY "%s returned error %d, errno is %d (%s)", func, ret, errno, tr_strerror(errno) );
    7473}
    7574
  • trunk/libtransmission/net.c

    r4600 r5065  
    9494        {
    9595            tr_err( "Couldn't set socket to non-blocking mode (%s)",
    96                     strerror( sockerrno ) );
     96                    tr_strerror( sockerrno ) );
    9797            tr_netClose( fd );
    9898            fd = -1;
     
    135135        tr_err( "Couldn't connect socket %d to %s, port %d (errno %d - %s)",
    136136                s, inet_ntoa(*addr), port,
    137                 sockerrno, strerror(sockerrno) );
     137                sockerrno, tr_strerror(sockerrno) );
    138138        tr_netClose( s );
    139139        s = -1;
     
    177177               sizeof( struct sockaddr_in ) ) )
    178178    {
    179         tr_err( "Couldn't bind port %d: %s", port, strerror(sockerrno) );
     179        tr_err( "Couldn't bind port %d: %s", port, tr_strerror(sockerrno) );
    180180        tr_netClose( s );
    181181        return -1;
  • trunk/libtransmission/peer-msgs.c

    r5045 r5065  
    16531653    if( what & ( EVBUFFER_EOF | EVBUFFER_ERROR ) )
    16541654        dbgmsg( vmsgs, "libevent got an error! what=%hd, errno=%d (%s)",
    1655                 what, errno, strerror(errno) );
     1655                what, errno, tr_strerror(errno) );
    16561656    fireError( vmsgs, TR_ERROR );
    16571657}
  • trunk/libtransmission/platform.c

    r4404 r5065  
    4141
    4242#include <assert.h>
    43 #include <errno.h>
    4443#include <stdio.h>
    4544#include <stdlib.h>
  • trunk/libtransmission/shared.c

    r4597 r5065  
    117117        } else {
    118118            tr_err( NATKEY "unable to open port %d to listen for incoming peer connections (errno is %d - %s)",
    119                     s->publicPort, errno, strerror(errno) );
     119                    s->publicPort, errno, tr_strerror(errno) );
    120120            s->bindPort = -1;
    121121            s->bindSocket = -1;
  • trunk/libtransmission/trevent.c

    r4789 r5065  
    1212
    1313#include <assert.h>
    14 #include <errno.h>
    1514#include <stdlib.h>
    1615#include <string.h>
  • trunk/libtransmission/upnp.c

    r4404 r5065  
    1414#include <errno.h>
    1515#include <stdio.h> /* snprintf */
    16 #include <string.h> /* strerror */
    1716
    1817#include <miniupnp/miniwget.h>
     
    9089        devlist = upnpDiscover( 2000, NULL, NULL );
    9190        if( devlist == NULL ) {
    92             tr_err( KEY "upnpDiscover returned NULL (errno %d - %s)", errno, strerror(errno) );
     91            tr_err( KEY "upnpDiscover returned NULL (errno %d - %s)", errno, tr_strerror(errno) );
    9392        }
    9493        errno = 0;
     
    10099        } else {
    101100            handle->state = TR_UPNP_ERR;
    102             tr_err( KEY "UPNP_GetValidIGD failed.  (errno %d - %s)", errno, strerror(errno) );
     101            tr_err( KEY "UPNP_GetValidIGD failed.  (errno %d - %s)", errno, tr_strerror(errno) );
    103102            tr_err( KEY "If your router supports UPnP, please make sure UPnP is enabled!" );
    104103        }
     
    155154            handle->state = TR_UPNP_IDLE;
    156155        } else {
    157             tr_err( KEY "Port forwarding failed with err %d (%d - %s)", err, errno, strerror(errno) );
     156            tr_err( KEY "Port forwarding failed with err %d (%d - %s)", err, errno, tr_strerror(errno) );
    158157            tr_err( KEY "If your router supports UPnP, please make sure UPnP is enabled!" );
    159158            handle->port = -1;
  • trunk/libtransmission/utils.c

    r5011 r5065  
    2828#include <stdio.h>
    2929#include <stdlib.h>
    30 #include <string.h>
     30#include <string.h> /* strerror */
    3131
    3232#include <sys/time.h>
     
    361361    if( stat( path, &sb ) )
    362362    {
    363         tr_err( "Couldn't get information for file \"%s\" %s", path, strerror(errno) );
     363        tr_err( "Couldn't get information for file \"%s\" %s", path, tr_strerror(errno) );
    364364        return NULL;
    365365    }
     
    375375    if( !file )
    376376    {
    377         tr_err( "Couldn't open file \"%s\" %s", path, strerror(errno) );
     377        tr_err( "Couldn't open file \"%s\" %s", path, tr_strerror(errno) );
    378378        return NULL;
    379379    }
     
    388388    if( fread( buf, sb.st_size, 1, file ) != 1 )
    389389    {
    390         tr_err( "Error reading \"%s\" %s", path, strerror(errno) );
     390        tr_err( "Error reading \"%s\" %s", path, tr_strerror(errno) );
    391391        free( buf );
    392392        fclose( file );
     
    441441            if( tr_mkdir( path, permissions ) ) {
    442442                const int err = errno;
    443                 tr_err( "Couldn't create directory %s (%s)", path, strerror( err ) );
     443                tr_err( "Couldn't create directory %s (%s)", path, tr_strerror( err ) );
    444444                tr_free( path );
    445445                errno = err;
     
    505505            return TR_ERROR_IO_FILE_TOO_BIG;
    506506        default:
    507             tr_dbg( "generic i/o errno from errno: %s", strerror( errno ) );
     507            tr_dbg( "generic i/o errno from errno: %s", tr_strerror( errno ) );
    508508            return TR_ERROR_IO_OTHER;
    509509    }
     
    596596    if( p )
    597597        free( p );
     598}
     599
     600const char*
     601tr_strerror( int i )
     602{
     603    const char * ret = strerror( i );
     604    if( ret == NULL )
     605        ret = "Unknown Error";
     606    return ret;
    598607}
    599608
  • trunk/libtransmission/utils.h

    r4734 r5065  
    119119char* tr_strndup( const char * str, int len );
    120120
     121const char* tr_strerror( int );
     122
    121123/***
    122124****
Note: See TracChangeset for help on using the changeset viewer.