use tr_bool instead of C bitfields. (http://blogs.msdn.com/oldnewthing/archive/2008/11/26/9143050.aspx)
This commit is contained in:
parent
b3c4061b1c
commit
d12af295c1
|
@ -83,8 +83,8 @@ bytesUsed( struct bratecontrol * r, size_t size )
|
|||
|
||||
struct tr_band
|
||||
{
|
||||
unsigned int isLimited : 1;
|
||||
unsigned int honorParentLimits : 1;
|
||||
tr_bool isLimited;
|
||||
tr_bool honorParentLimits;
|
||||
size_t bytesLeft;
|
||||
double desiredSpeed;
|
||||
struct bratecontrol raw;
|
||||
|
|
|
@ -46,7 +46,7 @@ struct tr_ip_range
|
|||
|
||||
struct tr_blocklist
|
||||
{
|
||||
unsigned int isEnabled : 1;
|
||||
tr_bool isEnabled;
|
||||
int fd;
|
||||
size_t ruleCount;
|
||||
size_t byteCount;
|
||||
|
|
|
@ -32,8 +32,8 @@
|
|||
|
||||
struct tr_completion
|
||||
{
|
||||
unsigned int sizeWhenDoneIsDirty : 1;
|
||||
unsigned int haveValidIsDirty : 1;
|
||||
tr_bool sizeWhenDoneIsDirty;
|
||||
tr_bool haveValidIsDirty;
|
||||
|
||||
tr_torrent * tor;
|
||||
|
||||
|
|
|
@ -30,6 +30,8 @@
|
|||
#include "crypto.h"
|
||||
#include "utils.h"
|
||||
|
||||
typedef uint8_t tr_bool;
|
||||
|
||||
/**
|
||||
***
|
||||
**/
|
||||
|
@ -86,9 +88,9 @@ struct tr_crypto
|
|||
RC4_KEY dec_key;
|
||||
RC4_KEY enc_key;
|
||||
uint8_t torrentHash[SHA_DIGEST_LENGTH];
|
||||
unsigned int isIncoming : 1;
|
||||
unsigned int torrentHashIsSet : 1;
|
||||
unsigned int mySecretIsSet : 1;
|
||||
tr_bool isIncoming;
|
||||
tr_bool torrentHashIsSet;
|
||||
tr_bool mySecretIsSet;
|
||||
uint8_t myPublicKey[KEY_LEN];
|
||||
uint8_t mySecret[KEY_LEN];
|
||||
};
|
||||
|
|
|
@ -79,12 +79,12 @@ enum
|
|||
|
||||
struct tr_openfile
|
||||
{
|
||||
unsigned int isCheckedOut : 1;
|
||||
unsigned int isWritable : 1;
|
||||
unsigned int closeWhenDone : 1;
|
||||
char filename[MAX_PATH_LENGTH];
|
||||
int fd;
|
||||
uint64_t date;
|
||||
tr_bool isCheckedOut;
|
||||
tr_bool isWritable;
|
||||
tr_bool closeWhenDone;
|
||||
char filename[MAX_PATH_LENGTH];
|
||||
int fd;
|
||||
uint64_t date;
|
||||
};
|
||||
|
||||
struct tr_fd_s
|
||||
|
|
|
@ -89,8 +89,8 @@ enum
|
|||
|
||||
struct tr_handshake
|
||||
{
|
||||
unsigned int havePeerID : 1;
|
||||
unsigned int haveSentBitTorrentHandshake : 1;
|
||||
tr_bool havePeerID;
|
||||
tr_bool haveSentBitTorrentHandshake;
|
||||
tr_peerIo * io;
|
||||
tr_crypto * crypto;
|
||||
struct tr_handle * handle;
|
||||
|
|
|
@ -45,9 +45,9 @@ tr_natpmp_state;
|
|||
|
||||
struct tr_natpmp
|
||||
{
|
||||
tr_bool isMapped;
|
||||
tr_bool hasDiscovered;
|
||||
int port;
|
||||
unsigned int isMapped : 1;
|
||||
unsigned int hasDiscovered : 1;
|
||||
time_t renewTime;
|
||||
time_t commandTime;
|
||||
tr_natpmp_state state;
|
||||
|
|
|
@ -74,17 +74,17 @@ getPacketOverhead( size_t d )
|
|||
|
||||
struct tr_datatype
|
||||
{
|
||||
unsigned int isPieceData : 1;
|
||||
size_t length;
|
||||
tr_bool isPieceData;
|
||||
size_t length;
|
||||
};
|
||||
|
||||
struct tr_peerIo
|
||||
{
|
||||
unsigned int isEncrypted : 1;
|
||||
unsigned int isIncoming : 1;
|
||||
unsigned int peerIdIsSet : 1;
|
||||
unsigned int extendedProtocolSupported : 1;
|
||||
unsigned int fastPeersSupported : 1;
|
||||
tr_bool isEncrypted;
|
||||
tr_bool isIncoming;
|
||||
tr_bool peerIdIsSet;
|
||||
tr_bool extendedProtocolSupported;
|
||||
tr_bool fastPeersSupported;
|
||||
|
||||
int magicNumber;
|
||||
|
||||
|
|
|
@ -41,11 +41,11 @@ enum
|
|||
|
||||
typedef struct tr_peer
|
||||
{
|
||||
unsigned int peerIsChoked : 1;
|
||||
unsigned int peerIsInterested : 1;
|
||||
unsigned int clientIsChoked : 1;
|
||||
unsigned int clientIsInterested : 1;
|
||||
unsigned int doPurge : 1;
|
||||
tr_bool peerIsChoked;
|
||||
tr_bool peerIsInterested;
|
||||
tr_bool clientIsChoked;
|
||||
tr_bool clientIsInterested;
|
||||
tr_bool doPurge;
|
||||
|
||||
/* number of bad pieces they've contributed to */
|
||||
uint8_t strikes;
|
||||
|
|
|
@ -107,7 +107,7 @@ struct peer_atom
|
|||
|
||||
typedef struct
|
||||
{
|
||||
unsigned int isRunning : 1;
|
||||
tr_bool isRunning;
|
||||
|
||||
uint8_t hash[SHA_DIGEST_LENGTH];
|
||||
int * pendingRequestCount;
|
||||
|
@ -1842,9 +1842,9 @@ tr_peerMgrPeerStats( const tr_peerMgr * manager,
|
|||
|
||||
struct ChokeData
|
||||
{
|
||||
unsigned int doUnchoke : 1;
|
||||
unsigned int isInterested : 1;
|
||||
unsigned int isChoked : 1;
|
||||
tr_bool doUnchoke;
|
||||
tr_bool isInterested;
|
||||
tr_bool isChoked;
|
||||
int rate;
|
||||
tr_peer * peer;
|
||||
};
|
||||
|
|
|
@ -261,10 +261,10 @@ struct tr_incoming
|
|||
|
||||
struct tr_peermsgs
|
||||
{
|
||||
unsigned int peerSentBitfield : 1;
|
||||
unsigned int peerSupportsPex : 1;
|
||||
unsigned int clientSentLtepHandshake : 1;
|
||||
unsigned int peerSentLtepHandshake : 1;
|
||||
tr_bool peerSentBitfield;
|
||||
tr_bool peerSupportsPex;
|
||||
tr_bool clientSentLtepHandshake;
|
||||
tr_bool peerSentLtepHandshake;
|
||||
|
||||
uint8_t state;
|
||||
uint8_t ut_pex_id;
|
||||
|
|
|
@ -32,8 +32,8 @@ getKey( void ) { return _( "Port Forwarding" ); }
|
|||
|
||||
struct tr_shared
|
||||
{
|
||||
unsigned int isEnabled : 1;
|
||||
unsigned int isShuttingDown : 1;
|
||||
tr_bool isEnabled;
|
||||
tr_bool isShuttingDown;
|
||||
|
||||
tr_port_forwarding natpmpStatus;
|
||||
tr_port_forwarding upnpStatus;
|
||||
|
|
|
@ -47,9 +47,9 @@
|
|||
|
||||
struct tr_rpc_server
|
||||
{
|
||||
unsigned int isEnabled : 1;
|
||||
unsigned int isPasswordEnabled : 1;
|
||||
unsigned int isWhitelistEnabled : 1;
|
||||
tr_bool isEnabled;
|
||||
tr_bool isPasswordEnabled;
|
||||
tr_bool isWhitelistEnabled;
|
||||
uint16_t port;
|
||||
struct evhttp * httpd;
|
||||
tr_handle * session;
|
||||
|
|
|
@ -56,13 +56,13 @@ struct tr_bandwidth;
|
|||
|
||||
struct tr_handle
|
||||
{
|
||||
unsigned int isPortSet : 1;
|
||||
unsigned int isPexEnabled : 1;
|
||||
unsigned int isBlocklistEnabled : 1;
|
||||
unsigned int isProxyEnabled : 1;
|
||||
unsigned int isProxyAuthEnabled : 1;
|
||||
unsigned int isClosed : 1;
|
||||
unsigned int useLazyBitfield : 1;
|
||||
tr_bool isPortSet;
|
||||
tr_bool isPexEnabled;
|
||||
tr_bool isBlocklistEnabled;
|
||||
tr_bool isProxyEnabled;
|
||||
tr_bool isProxyAuthEnabled;
|
||||
tr_bool isClosed;
|
||||
tr_bool useLazyBitfield;
|
||||
|
||||
tr_encryption_mode encryptionMode;
|
||||
|
||||
|
|
|
@ -22,11 +22,11 @@
|
|||
|
||||
struct optional_args
|
||||
{
|
||||
unsigned int isSet_paused : 1;
|
||||
unsigned int isSet_connected : 1;
|
||||
unsigned int isSet_downloadDir : 1;
|
||||
tr_bool isSet_paused;
|
||||
tr_bool isSet_connected;
|
||||
tr_bool isSet_downloadDir;
|
||||
|
||||
unsigned int isPaused : 1;
|
||||
tr_bool isPaused;
|
||||
uint16_t peerLimit;
|
||||
char * downloadDir;
|
||||
};
|
||||
|
@ -36,11 +36,11 @@ struct optional_args
|
|||
struct tr_ctor
|
||||
{
|
||||
const tr_handle * handle;
|
||||
unsigned int saveInOurTorrentsDir : 1;
|
||||
unsigned int doDelete : 1;
|
||||
tr_bool saveInOurTorrentsDir;
|
||||
tr_bool doDelete;
|
||||
|
||||
unsigned int isSet_metainfo : 1;
|
||||
unsigned int isSet_delete : 1;
|
||||
tr_bool isSet_metainfo;
|
||||
tr_bool isSet_delete;
|
||||
tr_benc metainfo;
|
||||
char * sourceFile;
|
||||
|
||||
|
|
|
@ -217,8 +217,8 @@ struct tr_torrent
|
|||
tr_torrent_completeness_func * completeness_func;
|
||||
void * completeness_func_user_data;
|
||||
|
||||
unsigned int isRunning : 1;
|
||||
unsigned int isDeleting : 1;
|
||||
tr_bool isRunning;
|
||||
tr_bool isDeleting;
|
||||
|
||||
uint16_t maxConnectedPeers;
|
||||
|
||||
|
|
|
@ -70,7 +70,7 @@ enum
|
|||
|
||||
struct tr_tracker
|
||||
{
|
||||
unsigned int isRunning : 1;
|
||||
tr_bool isRunning;
|
||||
|
||||
uint8_t randOffset;
|
||||
|
||||
|
|
|
@ -55,6 +55,7 @@ extern "C" {
|
|||
typedef uint32_t tr_file_index_t;
|
||||
typedef uint32_t tr_piece_index_t;
|
||||
typedef uint64_t tr_block_index_t;
|
||||
typedef uint8_t tr_bool;
|
||||
|
||||
/**
|
||||
* @brief returns Transmission's default configuration file directory.
|
||||
|
@ -1047,26 +1048,26 @@ int tr_torrentCanManualUpdate( const tr_torrent * torrent );
|
|||
|
||||
typedef struct tr_peer_stat
|
||||
{
|
||||
unsigned int isEncrypted : 1;
|
||||
unsigned int isDownloadingFrom : 1;
|
||||
unsigned int isUploadingTo : 1;
|
||||
tr_bool isEncrypted;
|
||||
tr_bool isDownloadingFrom;
|
||||
tr_bool isUploadingTo;
|
||||
|
||||
unsigned int peerIsChoked : 1;
|
||||
unsigned int peerIsInterested : 1;
|
||||
unsigned int clientIsChoked : 1;
|
||||
unsigned int clientIsInterested : 1;
|
||||
unsigned int isIncoming : 1;
|
||||
tr_bool peerIsChoked;
|
||||
tr_bool peerIsInterested;
|
||||
tr_bool clientIsChoked;
|
||||
tr_bool clientIsInterested;
|
||||
tr_bool isIncoming;
|
||||
|
||||
uint8_t from;
|
||||
uint16_t port;
|
||||
uint8_t from;
|
||||
uint16_t port;
|
||||
|
||||
char addr[16];
|
||||
char client[80];
|
||||
char flagStr[32];
|
||||
char addr[16];
|
||||
char client[80];
|
||||
char flagStr[32];
|
||||
|
||||
float progress;
|
||||
float rateToPeer;
|
||||
float rateToClient;
|
||||
float progress;
|
||||
float rateToPeer;
|
||||
float rateToClient;
|
||||
}
|
||||
tr_peer_stat;
|
||||
|
||||
|
@ -1149,8 +1150,8 @@ tr_piece;
|
|||
struct tr_info
|
||||
{
|
||||
/* Flags */
|
||||
unsigned int isPrivate : 1;
|
||||
unsigned int isMultifile : 1;
|
||||
tr_bool isPrivate;
|
||||
tr_bool isMultifile;
|
||||
|
||||
/* General info */
|
||||
uint8_t hash[SHA_DIGEST_LENGTH];
|
||||
|
|
|
@ -132,7 +132,7 @@ typedef int timer_func ( void* );
|
|||
|
||||
struct tr_timer
|
||||
{
|
||||
unsigned int inCallback : 1;
|
||||
tr_bool inCallback;
|
||||
timer_func * func;
|
||||
void * user_data;
|
||||
struct tr_event_handle * eh;
|
||||
|
|
|
@ -37,12 +37,12 @@ tr_upnp_state;
|
|||
|
||||
struct tr_upnp
|
||||
{
|
||||
tr_bool hasDiscovered;
|
||||
struct UPNPUrls urls;
|
||||
struct IGDdatas data;
|
||||
int port;
|
||||
char lanaddr[16];
|
||||
unsigned int isMapped;
|
||||
unsigned int hasDiscovered : 1;
|
||||
tr_upnp_state state;
|
||||
};
|
||||
|
||||
|
|
|
@ -45,7 +45,7 @@
|
|||
|
||||
struct tr_web
|
||||
{
|
||||
unsigned int closing : 1;
|
||||
tr_bool closing;
|
||||
int prev_running;
|
||||
int still_running;
|
||||
long timer_ms;
|
||||
|
|
|
@ -26,8 +26,8 @@
|
|||
|
||||
struct tr_webseed
|
||||
{
|
||||
unsigned int busy : 1;
|
||||
unsigned int dead : 1;
|
||||
tr_bool busy;
|
||||
tr_bool dead;
|
||||
|
||||
uint8_t hash[SHA_DIGEST_LENGTH];
|
||||
|
||||
|
|
Loading…
Reference in New Issue