diff --git a/libtransmission/internal.h b/libtransmission/internal.h index f000cfb00..67d1ddb06 100644 --- a/libtransmission/internal.h +++ b/libtransmission/internal.h @@ -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 ) { diff --git a/libtransmission/peeraz.h b/libtransmission/peeraz.h index 27a859991..6d9bd5431 100644 --- a/libtransmission/peeraz.h +++ b/libtransmission/peeraz.h @@ -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 ) { diff --git a/libtransmission/peerparse.h b/libtransmission/peerparse.h index e1ffc9254..f684a79c8 100644 --- a/libtransmission/peerparse.h +++ b/libtransmission/peerparse.h @@ -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 ) {