Changeset 5


Ignore:
Timestamp:
Jan 12, 2006, 6:32:29 PM (15 years ago)
Author:
root
Message:

Update 2005-11-18

Location:
trunk
Files:
7 added
5 edited

Legend:

Unmodified
Added
Removed
  • trunk/Jamfile

    r3 r5  
    4545    Depends package : Transmission-$(VERSION_STRING)-OSX.dmg ;
    4646}
     47else if $(GTK) = yes
     48{
     49    SubInclude TOP gtk ;
     50}
    4751
    4852SubInclude TOP libtransmission ;
  • trunk/configure

    r2 r5  
    1111    --disable-openssl      Disable OpenSSL, use built-in SHA1 implementation
    1212    --openssl-prefix=PATH  Location of OpenSSL headers and library
     13    --disable-gtk          Don't build the GTK+ GUI
    1314
    1415  Some influential environment variables:
     
    4344}
    4445
     46gtk_test()
     47{
     48  cat > testconf.c << EOF
     49  #include <gtk/gtk.h>
     50  int main()
     51  {
     52    gtk_main();
     53  }
     54EOF
     55  if $CC `pkg-config gtk+-2.0 --cflags --libs 2>/dev/null` -o testconf testconf.c
     56  then
     57    echo "GTK+: yes"
     58    GTK=yes
     59    GTKCCFLAGS=`pkg-config gtk+-2.0 --cflags`
     60    GTKLINKLIBS=`pkg-config gtk+-2.0 --libs`
     61  else
     62    echo "GTK+: no"
     63    GTK=no
     64  fi
     65  rm -f testconf.c testconf
     66}
     67
    4568#
    4669# Defaults settings
     
    5376DEFINES="$DEFINES _GNU_SOURCE"
    5477openssl_disable=0
     78gtk_disable=0
     79GTK=no
     80GTKCCFLAGS=
     81GTKLINKLIBS=
    5582
    5683#
     
    6693    x--openssl-prefix=*)
    6794      OPENSSL_PREFIX="$param";
     95      ;;
     96    x--disable-gtk)
     97      gtk_disable="1";
    6898      ;;
    6999    x--help)
     
    126156echo "System:  $SYSTEM"
    127157
     158# Check for GTK
     159if pkg-config gtk+-2.0
     160then
     161    echo "GTK+: yes"
     162    GTK=yes
     163    GTKCCFLAGS=`pkg-config gtk+-2.0 --cflags`
     164    GTKLINKLIBS=`pkg-config gtk+-2.0 --libs`
     165else
     166    echo "GTK+: no"
     167    GTK=no
     168fi
     169
    128170#
    129171# OpenSSL settings
     
    136178
    137179#
     180# GTK settings
     181#
     182if [ ${gtk_disable} = 1 ]; then
     183  echo "GTK+: no"
     184else
     185    gtk_test
     186fi
     187
     188#
    138189# Generate config.jam
    139190#
    140191rm -f config.jam
    141192cat > config.jam << EOF
    142 CC         = $CC ;
    143 LINK       = $CC ;
    144 CCFLAGS    = $CFLAGS ;
    145 DEFINES    = $DEFINES ;
    146 LINKLIBS   = $LINKLIBS ;
     193CC          = $CC ;
     194LINK        = $CC ;
     195CCFLAGS     = $CFLAGS ;
     196DEFINES     = $DEFINES ;
     197LINKLIBS    = $LINKLIBS ;
     198GTK         = $GTK ;
     199GTKCCFLAGS  = $GTKCCFLAGS ;
     200GTKLINKLIBS = $GTKLINKLIBS ;
    147201EOF
    148202if [ -n "$OPENSSL_PREFIX" ]; then
    149203cat >> config.jam << EOF
    150 HDRS      += $OPENSSL_PREFIX/include ;
    151 LINKFLAGS += -L$OPENSSL_PREFIX/lib ;
     204HDRS       += $OPENSSL_PREFIX/include ;
     205LINKFLAGS  += -L$OPENSSL_PREFIX/lib ;
    152206EOF
    153207fi
  • trunk/libtransmission/completion.c

    r3 r5  
    2626{
    2727    tr_completion_t * cp;
    28     int i;
    29 
    30     cp                   = calloc( 1, sizeof( tr_completion_t ) );
     28
     29    cp                   = malloc( sizeof( tr_completion_t ) );
    3130    cp->tor              = tor;
    32     cp->blockBitfield    = calloc( 1, ( tor->blockCount + 7 ) / 8 );
    33     cp->blockDownloaders = calloc( 1, tor->blockCount );
    34     cp->pieceBitfield    = calloc( 1, ( tor->info.pieceCount + 7 ) / 8 );
    35     cp->missingBlocks    = calloc( 1, tor->info.pieceCount * sizeof( int ) );
    36 
    37     for( i = 0; i < tor->info.pieceCount; i++ )
    38     {
    39         cp->missingBlocks[i] = tr_pieceCountBlocks( i );
    40     }
     31    cp->blockBitfield    = malloc( ( tor->blockCount + 7 ) / 8 );
     32    cp->blockDownloaders = malloc( tor->blockCount );
     33    cp->pieceBitfield    = malloc( ( tor->info.pieceCount + 7 ) / 8 );
     34    cp->missingBlocks    = malloc( tor->info.pieceCount * sizeof( int ) );
     35
     36    tr_cpReset( cp );
    4137
    4238    return cp;
     
    5046    free( cp->missingBlocks );
    5147    free( cp );
     48}
     49
     50void tr_cpReset( tr_completion_t * cp )
     51{
     52    tr_torrent_t * tor = cp->tor;
     53    int i;
     54
     55    cp->blockCount = 0;
     56    memset( cp->blockBitfield,    0, ( tor->blockCount + 7 ) / 8 );
     57    memset( cp->blockDownloaders, 0, tor->blockCount );
     58    memset( cp->pieceBitfield,    0, ( tor->info.pieceCount + 7 ) / 8 );
     59    for( i = 0; i < tor->info.pieceCount; i++ )
     60    {
     61        cp->missingBlocks[i] = tr_pieceCountBlocks( i );
     62    }
    5263}
    5364
  • trunk/libtransmission/completion.h

    r3 r5  
    3333tr_completion_t * tr_cpInit( tr_torrent_t * );
    3434void              tr_cpClose( tr_completion_t * );
     35void              tr_cpReset( tr_completion_t * );
    3536
    3637/* General */
  • trunk/libtransmission/transmission.c

    r3 r5  
    482482    tr_lockLock( tor->lock );
    483483
     484    tr_cpReset( tor->completion );
    484485    tor->io     = tr_ioInit( tor );
    485486    tor->status = tr_cpIsSeeding( tor->completion ) ?
Note: See TracChangeset for help on using the changeset viewer.