static int parseCommandLine ( int argc, const char ** argv );
static void sigHandler ( int signal );
-char*
+static char*
tr_strlratio( char * buf, double ratio, size_t buflen )
{
if( (int)ratio == TR_RATIO_NA )
"Usage: "MY_NAME" [options] <torrent-filename>";
}
-const struct tr_option options[] = {
+static const struct tr_option options[] = {
{ 'a', "announce", "Set the new torrent's announce URL", "a", 1, "<url>" },
{ 'b', "blocklist", "Enable peer blocklists", "b", 0, NULL },
{ 'B', "no-blocklist", "Disable peer blocklists", "B", 0, NULL },
"Usage: "MY_NAME" [options]";
}
-const struct tr_option options[] = {
+static const struct tr_option options[] = {
{ 'a', "acl", "Access Control List. (Default: "TR_DEFAULT_RPC_ACL")", "a", 1, "<list>" },
{ 'b', "blocklist", "Enable peer blocklists", "b", 0, NULL },
{ 'B', "no-blocklist", "Disable peer blocklists", "B", 0, NULL },
{
char sizestr[64];
double percent = (double)have / length;
- strlsize( sizestr, length, sizeof( sizestr ) );
const char * pristr;
+ strlsize( sizestr, length, sizeof( sizestr ) );
switch( priority ) {
case TR_PRI_LOW: pristr = "Low"; break;
case TR_PRI_HIGH: pristr = "High"; break;
#include <glib/gi18n.h>
#include <gtk/gtk.h>
#include <libtransmission/transmission.h>
+#include "actions.h"
#include "conf.h"
#include "tr-core.h"
#include "tr-prefs.h"
#define UNUSED G_GNUC_UNUSED
-extern void doAction (const char * action_name, gpointer user_data );
+static TrCore * myCore = NULL;
-static TrCore * myCore = 0;
-
-static GtkActionGroup * myGroup = 0;
+static GtkActionGroup * myGroup = NULL;
static void
action_cb ( GtkAction * a, gpointer user_data )
}
BuiltinIconInfo;
-const BuiltinIconInfo my_fallback_icons [] =
+static const BuiltinIconInfo my_fallback_icons [] =
{
{ tr_icon_logo, "transmission" },
{ tr_icon_lock, "transmission-lock" }
GdkPixbuf * p;
GtkIconSet * icon_set;
- p = gdk_pixbuf_new_from_inline( -1, my_fallback_icons[i].raw, FALSE, 0 );
+ p = gdk_pixbuf_new_from_inline( -1, my_fallback_icons[i].raw, FALSE, NULL );
width = gdk_pixbuf_get_width( p );
icon_set = gtk_icon_set_new_from_pixbuf( p );
gtk_icon_theme_add_builtin_icon( name, width, p );
GtkWidget* action_get_widget ( const char * path );
+void doAction( const char * action_name, gpointer user_data );
+
#endif
GtkWidget * manual_announce_countdown_lb;
};
-GtkWidget*
+static GtkWidget*
tracker_page_new( TrTorrent * gtor )
{
GtkWidget * t;
if( didlock && ( didinit || cf_init( configDir, &err ) ) )
{
+ GtkWindow * win;
+
tr_handle * h = tr_sessionInitFull(
configDir,
"gtk",
cbdata->core = tr_core_new( h );
/* create main window now to be a parent to any error dialogs */
- GtkWindow * win = GTK_WINDOW( tr_window_new( myUIManager, cbdata->core ) );
+ win = GTK_WINDOW( tr_window_new( myUIManager, cbdata->core ) );
g_signal_connect( win, "window-state-event", G_CALLBACK(windowStateChanged), cbdata );
g_signal_connect( win, "size-allocate", G_CALLBACK(onMainWindowSizeAllocated), cbdata );
}
}
-gboolean
+static gboolean
updatemodel( gpointer gdata )
{
struct cbdata *data = gdata;
{
gboolean allowHibernation;
tr_handle * session = tr_core_handle( core );
+ tr_torrent * tor = NULL;
/* allow hibernation unless we have active torrents */
allowHibernation = TRUE;
- tr_torrent * tor = NULL;
while(( tor = tr_torrentNext( session, tor ))) {
if( tr_torrentGetStatus( tor ) != TR_STATUS_STOPPED ) {
allowHibernation = FALSE;
static void
testing_port_cb( GtkWidget * unused UNUSED, gpointer l )
{
+ struct test_port_data * data;
+
gtk_label_set_markup( GTK_LABEL( l ), _( "<i>Testing port...</i>" ) );
+
/* wait three seconds to give the port forwarding time to kick in */
- struct test_port_data * data = g_new0( struct test_port_data, 1 );
+ data = g_new0( struct test_port_data, 1 );
data->label = l;
data->alive = g_object_get_data( G_OBJECT( l ), "alive" );
g_timeout_add( 3000, testing_port_begin, data );
}
if( ok && !data->abortFlag )
{
+ char * cmd;
filename2 = g_strdup_printf( "%s.txt", filename );
g_snprintf( data->secondary, sizeof( data->secondary ),
_( "Uncompressing blocklist..." ) );
g_idle_add( blocklistDialogSetSecondary, data );
- char * cmd = g_strdup_printf( "zcat %s > %s ", filename, filename2 );
+ cmd = g_strdup_printf( "zcat %s > %s ", filename, filename2 );
tr_dbg( "%s", cmd );
system( cmd );
g_free( cmd );
char *
tr_torrent_status_str ( TrTorrent * gtor )
{
- char * top = 0;
+ char * top = NULL;
const tr_stat * st = tr_torrent_stat( gtor );
#define FILTER_TEXT_MODE_KEY "tr-filter-text-mode"
#define FILTER_TOGGLES_KEY "tr-filter-toggles"
-PrivateData*
+static PrivateData*
get_private_data( TrWindow * w )
{
return g_object_get_data (G_OBJECT(w), PRIVATE_DATA_KEY);
onYinYangReleased( GtkWidget * w UNUSED, GdkEventButton * button UNUSED, gpointer vprivate )
{
PrivateData * p = vprivate;
- gtk_menu_popup( GTK_MENU( p->status_menu ), 0, 0, 0, 0, 0, gtk_get_current_event_time( ) );
+ gtk_menu_popup( GTK_MENU( p->status_menu ), NULL, NULL, NULL, NULL, 0, gtk_get_current_event_time( ) );
}
#define STATS_MODE "stats-mode"
gpointer menu )
{
if ( icon_pos == SEXY_ICON_ENTRY_PRIMARY )
- gtk_menu_popup ( GTK_MENU( menu ), 0, 0, 0, 0, 0, gtk_get_current_event_time( ) );
+ gtk_menu_popup ( GTK_MENU( menu ), NULL, NULL, NULL, NULL, 0, gtk_get_current_event_time( ) );
}
/***
-const char * fallback_ui_file =
+static const char * fallback_ui_file =
"<ui>\n"
" <menubar name='main-window-menu'>\n"
" <menu action='torrent-menu'>\n"
#define VERBOSE 0
-int test = 0;
+static int test = 0;
#define check(A) { \
++test; \
tr_benc * top,
const uint8_t ** setme_end )
{
+ int err;
tr_ptrArray * parentStack = tr_ptrArrayNew( );
+
top->type = 0; /* not initialized yet */
- const int err = tr_bencParseImpl( buf, end, top, parentStack, setme_end );
+ err = tr_bencParseImpl( buf, end, top, parentStack, setme_end );
if( err )
tr_bencFree( top );
+
tr_ptrArrayFree( parentStack, NULL );
return err;
}
return;
}
- b->rules = mmap( 0, st.st_size, PROT_READ, MAP_PRIVATE, fd, 0 );
+ b->rules = mmap( NULL, st.st_size, PROT_READ, MAP_PRIVATE, fd, 0 );
if( !b->rules ) {
tr_err( err_fmt, b->filename, tr_strerror(errno) );
close( fd );
#include <libevent/event.h> /* evbuffer */
#include "transmission.h"
+#include "clients.h"
#include "utils.h"
static int
#include <evutil.h>
#include "transmission.h"
+#include "fdlimit.h"
#include "list.h"
#include "net.h"
#include "platform.h" /* tr_lock */
handshake->doneUserData );
}
-void
+static void
tr_handshakeDone( tr_handshake * handshake, int isOK )
{
dbgmsg( handshake, "handshakeDone: %s", isOK ? "connected" : "aborting" );
#define VERBOSE 0
-int test = 0;
+static int test = 0;
#define check(A) { \
++test; \
#include "transmission.h"
#include "bencode.h"
+#include "json.h"
#include "ptrarray.h"
#include "utils.h"
if( builder->comment && *builder->comment )
tr_bencDictAddStr( &top, "comment", builder->comment );
tr_bencDictAddStr( &top, "created by", TR_NAME "/" LONG_VERSION_STRING );
- tr_bencDictAddInt( &top, "creation date", time(0) );
+ tr_bencDictAddInt( &top, "creation date", time(NULL) );
tr_bencDictAddStr( &top, "encoding", "UTF-8" );
makeInfoDict( tr_bencDictAddDict( &top, "info", 666 ), builder );
}
}
}
-tr_publisher_tag
-tr_peerMsgsSubscribe( tr_peermsgs * peer,
- tr_delivery_func func,
- void * userData )
-{
- return tr_publisherSubscribe( peer->publisher, func, userData );
-}
-
void
tr_peerMsgsUnsubscribe( tr_peermsgs * peer,
tr_publisher_tag tag )
***
**/
-int
+static int
tr_ptrArrayLowerBound( const tr_ptrArray * t,
const void * ptr,
int compare( const void *,const void * ),
#define VERBOSE 0
-int test = 0;
+static int test = 0;
#define check(A) { \
++test; \
typedef const char* (handler)( tr_handle*, tr_benc*, tr_benc* );
-struct method {
+static struct method {
const char * name;
handler * func;
} methods[] = {
#include "transmission.h"
#include "bencode.h"
#include "platform.h" /* tr_sessionGetConfigDir() */
+#include "stats.h"
#include "utils.h" /* tr_buildPath */
/***
tr_session_stats * setme )
{
const struct tr_stats_handle * stats = getStats( handle );
- assert( stats );
tr_session_stats current;
+ assert( stats );
tr_sessionGetStats( handle, ¤t );
addStats( setme, &stats->old, ¤t );
}
****
***/
-tr_tracker *
+static tr_tracker *
findTracker( tr_session * session, const uint8_t * hash )
{
tr_torrent * torrent = tr_torrentFindFromHash( session, hash );
if( responseCode == HTTP_OK )
{
tr_benc benc;
- const int bencLoaded = !tr_bencLoad( response, responseLen, &benc, 0 );
+ const int bencLoaded = !tr_bencLoad( response, responseLen,
+ &benc, NULL );
publishErrorClear( t );
if( bencLoaded && tr_bencIsDict( &benc ) )
{
if( responseCode == HTTP_OK )
{
tr_benc benc, *files;
- const int bencLoaded = !tr_bencLoad( response, responseLen, &benc, 0 );
+ const int bencLoaded = !tr_bencLoad( response, responseLen,
+ &benc, NULL );
if( bencLoaded && tr_bencDictFindDict( &benc, "files", &files ) )
{
int i;
const char* tr_sessionGetProxy ( const tr_session * );
int tr_sessionGetProxyPort ( const tr_session * );
tr_proxy_type tr_sessionGetProxyType ( const tr_session * );
+const char* tr_sessionGetProxyUsername ( const tr_session * );
const char* tr_sessionGetProxyPassword ( const tr_session * );
void tr_sessionSetProxyEnabled ( tr_session *, int isEnabled );
void tr_sessionSetProxyAuthEnabled ( tr_session *, int isEnabled );
#define NUM_LOOPS 200
#endif
-int test = 0;
+static int test = 0;
#define check(A) { \
++test; \