Changeset 12148


Ignore:
Timestamp:
Mar 13, 2011, 8:21:55 AM (6 years ago)
Author:
jordan
Message:

(trunk libT) use libevent's portability wrapper for strcasecmp()

Location:
trunk/libtransmission
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • trunk/libtransmission/makemeta.c

    r12143 r12148  
    1515#include <stdio.h> /* FILE, stderr */
    1616#include <stdlib.h> /* qsort */
    17 #include <string.h> /* strcmp, strlen, strcasecmp */
     17#include <string.h> /* strcmp, strlen */
    1818
    1919#include <sys/types.h>
     
    2121#include <unistd.h>
    2222#include <dirent.h>
     23
     24#include <event2/util.h> /* evutil_ascii_strcasecmp() */
    2325
    2426#include "transmission.h"
     
    106108
    107109static int
    108 builderFileCompare( const void * va,
    109                     const void * vb )
     110builderFileCompare( const void * va, const void * vb )
    110111{
    111112    const tr_metainfo_builder_file * a = va;
    112113    const tr_metainfo_builder_file * b = vb;
    113114
    114     return strcasecmp( a->filename, b->filename );
     115    return evutil_ascii_strcasecmp( a->filename, b->filename );
    115116}
    116117
  • trunk/libtransmission/rpc-server.c

    r12142 r12148  
    5656#define TR_N_ELEMENTS( ary ) ( sizeof( ary ) / sizeof( *ary ) )
    5757
    58 #ifdef WIN32
    59 #define strncasecmp _strnicmp
    60 #endif
    61 
    6258struct tr_rpc_server
    6359{
     
    600596
    601597        auth = evhttp_find_header( req->input_headers, "Authorization" );
    602         if( auth && !strncasecmp( auth, "basic ", 6 ) )
     598        if( auth && !evutil_ascii_strncasecmp( auth, "basic ", 6 ) )
    603599        {
    604600            int    plen;
  • trunk/libtransmission/session.c

    r12121 r12148  
    253253
    254254static int
    255 parse_tos(const char *string)
     255parse_tos( const char *str )
    256256{
    257257    char *p;
    258258    int value;
    259259
    260     if(strcasecmp(string, "") == 0 || strcasecmp(string, "default") == 0)
     260    if( !evutil_ascii_strcasecmp( str, "" ) )
    261261        return 0;
    262     else if(strcasecmp(string, "lowcost") == 0 ||
    263             strcasecmp(string, "mincost") == 0)
     262    if( !evutil_ascii_strcasecmp( str, "default" ) )
     263        return 0;
     264
     265    if( !evutil_ascii_strcasecmp( str, "lowcost" ) )
    264266        return 0x10;
    265     else if(strcasecmp(string, "throughput") == 0)
     267    if( !evutil_ascii_strcasecmp( str, "mincost" ) )
     268        return 0x10;
     269
     270    if( !evutil_ascii_strcasecmp( str, "throughput" ) )
    266271        return 0x08;
    267     else if(strcasecmp(string, "reliability") == 0)
     272    if( !evutil_ascii_strcasecmp( str, "reliability" ) )
    268273        return 0x04;
    269     else if(strcasecmp(string, "lowdelay") == 0)
     274    if( !evutil_ascii_strcasecmp( str, "lowdelay" ) )
    270275        return 0x02;
    271276
    272     value = strtol(string, &p, 0);
    273     if(p == NULL || p == string)
     277    value = strtol( str, &p, 0 );
     278    if( !p || ( p == str ) )
    274279        return 0;
    275280
  • trunk/libtransmission/torrent.c

    r12132 r12148  
    102102
    103103    while(( tor = tr_torrentNext( session, tor )))
    104         if( !strcasecmp( str, tor->info.hashString ) )
     104        if( !evutil_ascii_strcasecmp( str, tor->info.hashString ) )
    105105            return tor;
    106106
  • trunk/libtransmission/utils.c

    r12143 r12148  
    855855        return FALSE;
    856856
    857     return !strncasecmp( str + str_len - suffix_len, suffix, suffix_len );
     857    return !evutil_ascii_strncasecmp( str + str_len - suffix_len, suffix, suffix_len );
    858858}
    859859
Note: See TracChangeset for help on using the changeset viewer.