Changeset 9682


Ignore:
Timestamp:
Dec 7, 2009, 4:06:14 AM (12 years ago)
Author:
charles
Message:

(trunk) fix warnings found by the clang static analyzer, reported & patched by wereHamster

Location:
trunk
Files:
7 edited

Legend:

Unmodified
Added
Removed
  • trunk/daemon/remote.c

    r9671 r9682  
    11751175            char         buf2[512];
    11761176            int64_t      i, j, k;
    1177             tr_bool      isStopped;
    11781177            tr_bool      boolVal;
    1179 
    1180             isStopped = tr_bencDictFindInt( t, "status", &i ) && (i==TR_STATUS_STOPPED);
    11811178
    11821179            printf( "NAME\n" );
     
    18771874        host = tr_strdup( DEFAULT_HOST );
    18781875
    1879     exit_status |= readargs( argc, (const char**)argv );
    1880     if( reqCount )
    1881         exit_status = processRequests( host, port, (const char**)reqs, reqCount );
    1882     else {
     1876    readargs( argc, (const char**)argv );
     1877    if( reqCount == 0 ) {
    18831878        showUsage( );
    18841879        return EXIT_FAILURE;
    18851880    }
    18861881
     1882    exit_status = processRequests( host, port, (const char**)reqs, reqCount );
    18871883
    18881884    for( i=0; i<reqCount; ++i )
  • trunk/gtk/details.c

    r9671 r9682  
    11931193    int * peerCount;
    11941194    GtkTreeIter iter;
     1195    GtkTreeModel * model;
    11951196    GHashTable * hash = di->peer_hash;
    11961197    GtkListStore * store = di->peer_store;
    1197     GtkTreeModel * model = GTK_TREE_MODEL( store );
    11981198    struct tr_peer_stat ** peers;
    11991199
  • trunk/gtk/main.c

    r9642 r9682  
    251251refreshDetailsDialog( struct cbdata * data, GtkWidget * details )
    252252{
    253     GtkTreeSelection * s = tr_window_get_selection( data->wind );
     253    GtkTreeSelection * s;
    254254    GtkTreeModel * model;
    255255    GSList * ids = NULL;
  • trunk/gtk/makemeta-ui.c

    r9671 r9682  
    6060onProgressDialogRefresh( gpointer data )
    6161{
    62     char * str;
     62    char * str = NULL;
    6363    MakeMetaUI * ui = data;
    6464    const tr_metainfo_builder * b = ui->builder;
     
    8181    else if( b->result == TR_MAKEMETA_IO_WRITE )
    8282        str = g_strdup_printf( _( "Error writing \"%s\": %s" ), b->errfile, g_strerror( b->my_errno ) );
    83     gtk_label_set_text( GTK_LABEL( ui->progress_label ), str );
    84     g_free( str );
     83    else
     84        g_assert_not_reached( );
     85
     86    if( str != NULL ) {
     87        gtk_label_set_text( GTK_LABEL( ui->progress_label ), str );
     88        g_free( str );
     89    }
    8590
    8691    /* progress bar */
  • trunk/gtk/tr-core.c

    r9645 r9682  
    956956tr_core_add_metainfo( TrCore      * core,
    957957                      const char  * payload,
    958                       gboolean    * setme_success,
     958                      gboolean    * setme_handled,
    959959                      GError     ** gerr UNUSED )
    960960{
     
    963963    if( !session )
    964964    {
    965         *setme_success = FALSE;
     965        *setme_handled = FALSE;
    966966    }
    967967    else if( gtr_is_supported_url( payload ) || gtr_is_magnet_link( payload ) )
    968968    {
    969969        tr_core_add_from_url( core, payload );
    970         *setme_success = TRUE;
     970        *setme_handled = TRUE;
    971971    }
    972972    else /* base64-encoded metainfo */
    973973    {
    974         int err;
    975974        int file_length;
    976975        tr_ctor * ctor;
     
    982981
    983982        file_contents = tr_base64_decode( payload, -1, &file_length );
    984         err = tr_ctorSetMetainfo( ctor, (const uint8_t*)file_contents, file_length );
    985 
    986         if( !err )
    987             err = add_ctor( core, ctor, do_prompt, TRUE );
     983        tr_ctorSetMetainfo( ctor, (const uint8_t*)file_contents, file_length );
     984        add_ctor( core, ctor, do_prompt, TRUE );
    988985
    989986        tr_free( file_contents );
    990987        tr_core_torrents_added( core );
    991         *setme_success = TRUE;
     988        *setme_handled = TRUE;
    992989    }
    993990
  • trunk/gtk/tr-window.c

    r9602 r9682  
    881881
    882882    /* main menu */
    883     w = mainmenu = action_get_widget( "/main-window-menu" );
     883    mainmenu = action_get_widget( "/main-window-menu" );
    884884    w = action_get_widget( "/main-window-menu/torrent-menu/update-tracker" );
    885885#if GTK_CHECK_VERSION( 2, 12, 0 )
     
    889889
    890890    /* toolbar */
    891     w = toolbar = p->toolbar = action_get_widget( "/main-window-toolbar" );
     891    toolbar = p->toolbar = action_get_widget( "/main-window-toolbar" );
    892892    action_set_important( "add-torrent-toolbar", TRUE );
    893893    action_set_important( "show-torrent-properties", TRUE );
  • trunk/gtk/util.c

    r9671 r9682  
    564564{
    565565    /* FIXME: why is this static? */
    566     static gboolean success = FALSE;
     566    static gboolean handled = FALSE;
    567567
    568568#ifdef HAVE_DBUS_GLIB
     
    597597                               G_TYPE_STRING, payload,
    598598                               G_TYPE_INVALID,
    599                                G_TYPE_BOOLEAN, &success,
     599                               G_TYPE_BOOLEAN, &handled,
    600600                               G_TYPE_INVALID );
    601601        if( err )
     
    613613
    614614#endif
    615     return success;
     615    return handled;
    616616}
    617617
Note: See TracChangeset for help on using the changeset viewer.