Ignore:
Timestamp:
Jan 24, 2006, 2:57:03 AM (16 years ago)
Author:
joshe
Message:

Do some basic HTTP header parsing to check for 2xx response code.
Start looking for dictionary in the body instead of the entire response.
Add a memmem() implementation.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/oneport/libtransmission/utils.c

    r1 r44  
    6262    return rand() % sup;
    6363}
     64
     65void * tr_memmem( const void *vbig, size_t big_len,
     66                  const void *vlittle, size_t little_len )
     67{
     68    const char *big = vbig;
     69    const char *little = vlittle;
     70    size_t ii, jj;
     71
     72    if( 0 == big_len || 0 == little_len )
     73    {
     74        return NULL;
     75    }
     76
     77    for( ii = 0; ii + little_len <= big_len; ii++ )
     78    {
     79        for( jj = 0; jj < little_len; jj++ )
     80        {
     81            if( big[ii + jj] != little[jj] )
     82            {
     83                break;
     84            }
     85        }
     86        if( jj == little_len )
     87        {
     88            return (char*)big + ii;
     89        }
     90    }
     91
     92    return NULL;
     93}
Note: See TracChangeset for help on using the changeset viewer.