#include "lock.h"
#include "logo.h"
+#define UNUSED G_GNUC_UNUSED
+
static TrCore * myCore = NULL;
static GtkActionGroup * myGroup = NULL;
torrent.h \
tracker.h \
tr-getopt.h \
- tr-gnuc.h \
transmission.h \
trevent.h \
upnp.h \
#ifndef TR_BLOCKLIST_H
#define TR_BLOCKLIST_H
-#include "tr-gnuc.h"
-
struct in_addr;
typedef struct tr_blocklist tr_blocklist;
tr_blocklist* _tr_blocklistNew( const char * filename,
- int isEnabled ) TR_GNUC_MALLOC;
+ int isEnabled );
-int _tr_blocklistExists ( const tr_blocklist * blocklist );
+int _tr_blocklistExists( const tr_blocklist * );
-const char* _tr_blocklistGetFilename ( const tr_blocklist * blocklist );
+const char* _tr_blocklistGetFilename( const tr_blocklist * );
-int _tr_blocklistGetRuleCount( const tr_blocklist * blocklist );
+int _tr_blocklistGetRuleCount( const tr_blocklist * );
-void _tr_blocklistFree ( tr_blocklist * blocklist );
+void _tr_blocklistFree( tr_blocklist * );
-int _tr_blocklistIsEnabled ( tr_blocklist * blocklist );
+int _tr_blocklistIsEnabled( tr_blocklist * );
-void _tr_blocklistSetEnabled ( tr_blocklist * blocklist,
- int isEnabled );
+void _tr_blocklistSetEnabled( tr_blocklist *,
+ int isEnabled );
-int _tr_blocklistHasAddress ( tr_blocklist * blocklist,
- const struct in_addr * addr );
+int _tr_blocklistHasAddress(
+ tr_blocklist *,
+ const struct
+ in_addr * addr );
-int _tr_blocklistSetContent ( tr_blocklist * blocklist,
- const char * filename );
+int _tr_blocklistSetContent(
+ tr_blocklist *,
+ const char * filename );
#endif
tr_handshake * tr_handshakeNew( struct tr_peerIo * io,
tr_encryption_mode encryptionMode,
handshakeDoneCB doneCB,
- void * doneUserData )
- TR_GNUC_MALLOC;
+ void * doneUserData );
const struct in_addr * tr_handshakeGetAddr(
- const struct tr_handshake * handshake,
- uint16_t * setme_port );
+ const struct tr_handshake * handshake,
+ uint16_t
+ * setme_port );
void tr_handshakeAbort( tr_handshake * handshake );
***
**/
-#include "tr-gnuc.h"
-
struct in_addr;
struct evbuffer;
struct bufferevent;
***
**/
-tr_peerIo* tr_peerIoNewOutgoing( struct tr_handle * session,
- const struct in_addr * addr,
- int port,
- const uint8_t * torrentHash )
- TR_GNUC_MALLOC;
+tr_peerIo* tr_peerIoNewOutgoing(
+ struct tr_handle * session,
+ const struct in_addr * addr,
+ int port,
+ const uint8_t *
+ torrentHash );
-tr_peerIo* tr_peerIoNewIncoming( struct tr_handle * session,
- const struct in_addr * addr,
- uint16_t port,
- int socket )
- TR_GNUC_MALLOC;
+tr_peerIo* tr_peerIoNewIncoming( struct tr_handle * session,
+ const struct in_addr * addr,
+ uint16_t port,
+ int socket );
void tr_peerIoFree( tr_peerIo * io );
const char* tr_peerIoGetAddrStr( const tr_peerIo * io );
const struct in_addr*tr_peerIoGetAddress( const tr_peerIo * io,
- uint16_t * port );
+ uint16_t * port );
const uint8_t* tr_peerIoGetTorrentHash( tr_peerIo * io );
int tr_peerIoHasTorrentHash( const tr_peerIo * io );
-void tr_peerIoSetTorrentHash( tr_peerIo * io,
+void tr_peerIoSetTorrentHash( tr_peerIo * io,
const uint8_t * hash );
int tr_peerIoReconnect( tr_peerIo * io );
int tr_peerIoWantsBandwidth( const tr_peerIo * io,
tr_direction );
+#if 0
+void tr_peerIoTryRead( tr_peerIo * io );
+
+#endif
+
void tr_peerIoWrite( tr_peerIo * io,
const void * writeme,
size_t writemeLen );
#include <inttypes.h> /* uint16_t */
-#include "net.h" /* struct in_addr */
-#include "tr-gnuc.h"
+#ifdef WIN32
+ #include <winsock2.h> /* struct in_addr */
+#else
+ #include <netinet/in.h> /* struct in_addr */
+#endif
struct in_addr;
struct tr_handle;
int tr_pexCompare( const void * a, const void * b );
-tr_peerMgr* tr_peerMgrNew( struct tr_handle * ) TR_GNUC_MALLOC;
+tr_peerMgr* tr_peerMgrNew( struct tr_handle * );
void tr_peerMgrFree( tr_peerMgr * manager );
#define TR_NAME "Transmission"
-#include "tr-gnuc.h"
+#ifndef UNUSED
+ #ifdef __GNUC__
+ #define UNUSED __attribute__ ( ( unused ) )
+ #else
+ #define UNUSED
+ #endif
+#endif
enum
{
typedef enum { TR_NET_OK, TR_NET_ERROR, TR_NET_WAIT } tr_tristate_t;
-uint8_t* tr_peerIdNew( void ) TR_GNUC_MALLOC;
+uint8_t* tr_peerIdNew( void );
const uint8_t* tr_getPeerId( void );
-#ifndef TR_GNUC_H
-#define TR_GNUC_H 1
-
-#ifndef UNUSED
- #ifdef __GNUC__
- #define UNUSED __attribute__ ( ( unused ) )
- #else
- #define UNUSED
- #endif
-#endif
-
-#ifndef TR_GNUC_PRINTF
- #ifdef __GNUC__
- #define TR_GNUC_PRINTF( fmt,\
- args ) __attribute__ ( ( format ( printf, fmt,\
- args ) ) )
- #else
- #define TR_GNUC_PRINTF( fmt, args )
- #endif
-#endif
-
-#ifndef TR_GNUC_NULL_TERMINATED
- #if __GNUC__ >= 4
- #define TR_GNUC_NULL_TERMINATED __attribute__ ( ( __sentinel__ ) )
- #else
- #define TR_GNUC_NULL_TERMINATED
- #endif
-#endif
-
-#if __GNUC__ > 2 || ( __GNUC__ == 2 && __GNUC_MINOR__ >= 96 )
- #define TR_GNUC_CONST __attribute__ ( ( __const ) )
- #define TR_GNUC_PURE __attribute__ ( ( __pure__ ) )
- #define TR_GNUC_MALLOC __attribute__ ( ( __malloc__ ) )
-#else
- #define TR_GNUC_CONST
- #define TR_GNUC_PURE
- #define TR_GNUC_MALLOC
-#endif
-
-#endif
extern "C" {
#endif
-#include "tr-gnuc.h"
#include "version.h"
#include <inttypes.h> /* uintN_t */
struct tr_benc;
-tr_ctor* tr_ctorNew( const tr_handle * handle ) TR_GNUC_MALLOC;
+tr_ctor* tr_ctorNew( const tr_handle * handle );
void tr_ctorFree( tr_ctor * ctor );
TR_EDUPLICATE if there's already a matching torrent object. */
tr_torrent * tr_torrentNew( tr_handle * handle,
const tr_ctor * ctor,
- int * setmeError ) TR_GNUC_MALLOC;
+ int * setmeError );
/** @} */
#define TRUE 1
#endif
-#include "tr-gnuc.h"
+#ifndef UNUSED
+ #ifdef __GNUC__
+ #define UNUSED __attribute__ ( ( unused ) )
+ #else
+ #define UNUSED
+ #endif
+#endif
+
+#ifndef TR_GNUC_PRINTF
+ #ifdef __GNUC__
+ #define TR_GNUC_PRINTF( fmt,\
+ args ) __attribute__ ( ( format ( printf, fmt,\
+ args ) ) )
+ #else
+ #define TR_GNUC_PRINTF( fmt, args )
+ #endif
+#endif
+
+#ifndef TR_GNUC_NULL_TERMINATED
+ #if __GNUC__ >= 4
+ #define TR_GNUC_NULL_TERMINATED __attribute__ ( ( __sentinel__ ) )
+ #else
+ #define TR_GNUC_NULL_TERMINATED
+ #endif
+#endif
+
+#if __GNUC__ > 2 || ( __GNUC__ == 2 && __GNUC_MINOR__ >= 96 )
+ #define TR_GNUC_PURE __attribute__ ( ( __pure__ ) )
+ #define TR_GNUC_MALLOC __attribute__ ( ( __malloc__ ) )
+#else
+ #define TR_GNUC_PURE
+ #define TR_GNUC_MALLOC
+#endif
+
/***
****
/* return the current date in milliseconds */
-uint64_t tr_date( void ) TR_GNUC_CONST;
+uint64_t tr_date( void );
/* wait the specified number of milliseconds */
-void tr_wait( uint64_t delay_milliseconds ) TR_GNUC_CONST;
+void tr_wait( uint64_t delay_milliseconds );
/***
****
const char * fmt,
... ) TR_GNUC_PRINTF( 3, 4 );
-const char* tr_strerror( int ) TR_GNUC_CONST;
+const char* tr_strerror( int );
char* tr_strstrip( char * str );
&& tr_bitfieldHasFast( bitfield, nth ) )
double tr_getRatio( double numerator,
- double denominator ) TR_GNUC_CONST;
+ double denominator );
#ifdef __cplusplus
}