From 65f0f3effd63cdef6c44f1b26889e6da68904933 Mon Sep 17 00:00:00 2001 From: Jordan Lee Date: Thu, 31 Mar 2011 16:41:52 +0000 Subject: [PATCH] (trunk libT) copyediting: peer-io's "EncryptionMode" type had a name too similar to tr_encryption_mode... rename it to reduce potential confusion --- libtransmission/peer-io.c | 12 ++++++------ libtransmission/peer-io.h | 23 ++++++++++++----------- 2 files changed, 18 insertions(+), 17 deletions(-) diff --git a/libtransmission/peer-io.c b/libtransmission/peer-io.c index 3cdbd573c..c3afd378f 100644 --- a/libtransmission/peer-io.c +++ b/libtransmission/peer-io.c @@ -956,13 +956,13 @@ tr_peerIoGetWriteBufferSpace( const tr_peerIo * io, uint64_t now ) **/ void -tr_peerIoSetEncryption( tr_peerIo * io, uint32_t encryptionMode ) +tr_peerIoSetEncryption( tr_peerIo * io, tr_encryption_type encryption_type ) { assert( tr_isPeerIo( io ) ); - assert( encryptionMode == PEER_ENCRYPTION_NONE - || encryptionMode == PEER_ENCRYPTION_RC4 ); + assert( encryption_type == PEER_ENCRYPTION_NONE + || encryption_type == PEER_ENCRYPTION_RC4 ); - io->encryptionMode = encryptionMode; + io->encryption_type = encryption_type; } /** @@ -995,7 +995,7 @@ evbuffer_peek_all( struct evbuffer * buf, size_t * setme_vecCount ) static void maybeEncryptBuffer( tr_peerIo * io, struct evbuffer * buf ) { - if( io->encryptionMode == PEER_ENCRYPTION_RC4 ) + if( io->encryption_type == PEER_ENCRYPTION_RC4 ) { size_t i, n; struct evbuffer_iovec * iovec = evbuffer_peek_all( buf, &n ); @@ -1066,7 +1066,7 @@ tr_peerIoReadBytes( tr_peerIo * io, struct evbuffer * inbuf, void * bytes, size_ assert( tr_isPeerIo( io ) ); assert( evbuffer_get_length( inbuf ) >= byteCount ); - switch( io->encryptionMode ) + switch( io->encryption_type ) { case PEER_ENCRYPTION_NONE: evbuffer_remove( inbuf, bytes, byteCount ); diff --git a/libtransmission/peer-io.h b/libtransmission/peer-io.h index 8645c1fd8..eff3ac2de 100644 --- a/libtransmission/peer-io.h +++ b/libtransmission/peer-io.h @@ -47,6 +47,15 @@ typedef enum } ReadState; +typedef enum +{ + /* these match the values in MSE's crypto_select */ + PEER_ENCRYPTION_NONE = ( 1 << 0 ), + PEER_ENCRYPTION_RC4 = ( 1 << 1 ) +} +tr_encryption_type; + + typedef ReadState ( *tr_can_read_cb )( struct tr_peerIo * io, void * user_data, size_t * setme_piece_byte_count ); @@ -76,7 +85,7 @@ typedef struct tr_peerIo int magicNumber; - uint32_t encryptionMode; + tr_encryption_type encryption_type; bool isSeed; tr_port port; @@ -278,20 +287,12 @@ static inline struct tr_crypto * tr_peerIoGetCrypto( tr_peerIo * io ) return io->crypto; } -typedef enum -{ - /* these match the values in MSE's crypto_select */ - PEER_ENCRYPTION_NONE = ( 1 << 0 ), - PEER_ENCRYPTION_RC4 = ( 1 << 1 ) -} -EncryptionMode; - -void tr_peerIoSetEncryption( tr_peerIo * io, uint32_t encryptionMode ); +void tr_peerIoSetEncryption( tr_peerIo * io, tr_encryption_type encryption_type ); static inline bool tr_peerIoIsEncrypted( const tr_peerIo * io ) { - return ( io != NULL ) && ( io->encryptionMode == PEER_ENCRYPTION_RC4 ); + return ( io != NULL ) && ( io->encryption_type == PEER_ENCRYPTION_RC4 ); } void evbuffer_add_uint8 ( struct evbuffer * outbuf, uint8_t byte ); -- 2.40.0