Changeset 10502


Ignore:
Timestamp:
Apr 20, 2010, 11:14:00 PM (9 years ago)
Author:
charles
Message:

(trunk libT) #3136 "slashes in magnet names" -- fixed in trunk for 2.00

Location:
trunk/libtransmission
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • trunk/libtransmission/metainfo.c

    r10239 r10502  
    3535***/
    3636
     37char*
     38tr_metainfoGetBasename( const tr_info * inf )
     39{
     40    char *ret, *pch, *name;
     41
     42    name = tr_strdup( inf->name );
     43    for( pch=name; pch && *pch; ++pch )
     44        if( *pch == '/' )
     45            *pch = '_';
     46   
     47    ret = tr_strdup_printf( "%s.%16.16s", name, inf->hashString );
     48
     49    tr_free( name );
     50    return ret;
     51}
     52
    3753static char*
    3854getTorrentFilename( const tr_session * session,
    3955                    const tr_info *   inf )
    4056{
    41     return tr_strdup_printf( "%s%c%s.%16.16s.torrent",
    42                              tr_getTorrentDir( session ),
    43                              TR_PATH_DELIMITER,
    44                              inf->name,
    45                              inf->hashString );
     57    char * base = tr_metainfoGetBasename( inf );
     58    char * filename = tr_strdup_printf( "%s" TR_PATH_DELIMITER_STR "%s.torrent",
     59                                        tr_getTorrentDir( session ), base );
     60    tr_free( base );
     61    return filename;
    4662}
    4763
  • trunk/libtransmission/metainfo.h

    r10084 r10502  
    3535                         tr_info    * inf );
    3636
     37char* tr_metainfoGetBasename( const tr_info * );
     38
    3739
    3840#endif
  • trunk/libtransmission/resume.c

    r10500 r10502  
    1818#include "bencode.h"
    1919#include "completion.h"
     20#include "metainfo.h" /* tr_metainfoGetBasename() */
    2021#include "peer-mgr.h" /* pex */
    21 #include "platform.h" /* tr_getResumeDir */
     22#include "platform.h" /* tr_getResumeDir() */
    2223#include "resume.h"
    2324#include "session.h"
     
    6869getResumeFilename( const tr_torrent * tor )
    6970{
    70     return tr_strdup_printf( "%s%c%s.%16.16s.resume",
    71                              tr_getResumeDir( tor->session ),
    72                              TR_PATH_DELIMITER,
    73                              tr_torrentName( tor ),
    74                              tor->info.hashString );
     71    char * base = tr_metainfoGetBasename( tr_torrentInfo( tor ) );
     72    char * filename = tr_strdup_printf( "%s" TR_PATH_DELIMITER_STR "%s.resume",
     73                                        tr_getResumeDir( tor->session ), base );
     74    tr_free( base );
     75    return filename;
    7576}
    7677
  • trunk/libtransmission/torrent-magnet.c

    r10390 r10502  
    7676            int i;
    7777            struct tr_incomplete_metadata * m;
    78             int n = ( size + ( METADATA_PIECE_SIZE - 1 ) ) / METADATA_PIECE_SIZE;
    79             dbgmsg( tor, "there are %d pieces", n );
     78            const int n = ( size + ( METADATA_PIECE_SIZE - 1 ) ) / METADATA_PIECE_SIZE;
     79            dbgmsg( tor, "metadata is %d bytes in %d pieces", size, n );
    8080
    8181            m = tr_new( struct tr_incomplete_metadata, 1 );
Note: See TracChangeset for help on using the changeset viewer.