remove TR_NTOHL macro

This commit is contained in:
Charles Kerr 2007-07-19 10:37:30 +00:00
parent 6dd7c2fac2
commit 6d21f2fb16
3 changed files with 12 additions and 13 deletions

View File

@ -87,7 +87,6 @@ int vasprintf( char **, const char *, va_list );
/* Convenient macros to perform uint32_t endian conversions with
char pointers */
#define TR_NTOHL(p,a) (a) = tr_ntohl((p))
#define TR_HTONL(a,p) tr_htonl((a), ( uint8_t * )(p))
static inline uint32_t tr_ntohl( uint8_t * p )
{

View File

@ -284,7 +284,7 @@ parseAZMessageHeader( tr_peer_t * peer, uint8_t * buf, int len,
return TR_NET_BLOCK;
}
/* message length */
TR_NTOHL( buf, msglen );
msglen = tr_ntohl( buf );
msglen += 4;
off = 4;
if( msglen > len )
@ -297,7 +297,7 @@ parseAZMessageHeader( tr_peer_t * peer, uint8_t * buf, int len,
return TR_NET_CLOSE;
}
/* name length */
TR_NTOHL( buf + off, namelen );
namelen = tr_ntohl( buf + off );
off += 4;
if( off + namelen + 1 > msglen )
{

View File

@ -113,7 +113,7 @@ static int parseHave( tr_torrent_t * tor, tr_peer_t * peer,
return TR_ERROR_ASSERT;
}
TR_NTOHL( p, piece );
piece = tr_ntohl( p );
if( ( uint32_t )inf->pieceCount <= piece )
{
peer_dbg( "GET have, invalid piece" );
@ -214,9 +214,9 @@ static int parseRequest( tr_torrent_t * tor, tr_peer_t * peer,
return TR_OK;
}
TR_NTOHL( p, index );
TR_NTOHL( &p[4], begin );
TR_NTOHL( &p[8], length );
index = tr_ntohl( p );
begin = tr_ntohl( &p[4] );
length = tr_ntohl( &p[8] );
if( inf->pieceCount <= index )
{
@ -293,8 +293,8 @@ static int parsePiece( tr_torrent_t * tor, tr_peer_t * peer,
return TR_ERROR_ASSERT;
}
TR_NTOHL( p, index );
TR_NTOHL( &p[4], begin );
index = tr_ntohl( p );
begin = tr_ntohl( &p[4] );
if( inf->pieceCount <= index )
{
@ -396,9 +396,9 @@ static int parseCancel( tr_torrent_t * tor, tr_peer_t * peer,
return TR_ERROR_ASSERT;
}
TR_NTOHL( p, index );
TR_NTOHL( &p[4], begin );
TR_NTOHL( &p[8], length );
index = tr_ntohl( p );
begin = tr_ntohl( &p[4] );
length = tr_ntohl( &p[8] );
if( inf->pieceCount <= index )
{
@ -453,7 +453,7 @@ parseMessageHeader( tr_peer_t * peer, uint8_t * buf, int buflen,
}
/* Get payload size */
TR_NTOHL( buf, *msglen );
*msglen = tr_ntohl( buf );
if( 4 + *msglen > buflen )
{