mirror of
https://github.com/transmission/transmission
synced 2025-01-31 03:12:44 +00:00
(libt) remove some more instances of MAX_PATH_LENGTH
This commit is contained in:
parent
b04be5fb2e
commit
53339a1498
2 changed files with 13 additions and 14 deletions
|
@ -161,17 +161,16 @@ loadBlocklists( tr_session * session )
|
|||
instead */
|
||||
tr_blocklist * b;
|
||||
const char * dot = strrchr( d->d_name, '.' );
|
||||
const int len = dot ? dot - d->d_name : (int)strlen(
|
||||
d->d_name );
|
||||
char tmp[MAX_PATH_LENGTH];
|
||||
tr_snprintf( tmp, sizeof( tmp ),
|
||||
"%s%c%*.*s.bin", dirname, TR_PATH_DELIMITER,
|
||||
len, len,
|
||||
d->d_name );
|
||||
const int len = dot ? dot - d->d_name
|
||||
: (int)strlen( d->d_name );
|
||||
char * tmp = tr_strdup_printf(
|
||||
"%s" TR_PATH_DELIMITER_STR "%*.*s.bin",
|
||||
dirname, len, len, d->d_name );
|
||||
b = _tr_blocklistNew( tmp, isEnabled );
|
||||
_tr_blocklistSetContent( b, filename );
|
||||
tr_list_append( &list, b );
|
||||
++newCount;
|
||||
tr_free( tmp );
|
||||
}
|
||||
|
||||
tr_free( filename );
|
||||
|
|
|
@ -27,7 +27,7 @@ struct optional_args
|
|||
|
||||
unsigned int isPaused : 1;
|
||||
uint16_t peerLimit;
|
||||
char downloadDir[MAX_PATH_LENGTH];
|
||||
char * downloadDir;
|
||||
};
|
||||
|
||||
/** Opaque class used when instantiating torrents.
|
||||
|
@ -219,15 +219,13 @@ tr_ctorSetDownloadDir( tr_ctor * ctor,
|
|||
{
|
||||
struct optional_args * args = &ctor->optionalArgs[mode];
|
||||
|
||||
args->isSet_downloadDir = 0;
|
||||
tr_free( args->downloadDir );
|
||||
|
||||
if( directory )
|
||||
{
|
||||
args->isSet_downloadDir = 1;
|
||||
tr_strlcpy( args->downloadDir, directory, sizeof( args->downloadDir ) );
|
||||
}
|
||||
else
|
||||
{
|
||||
args->isSet_downloadDir = 0;
|
||||
*args->downloadDir = '\0';
|
||||
args->downloadDir = tr_strdup( directory );
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -314,6 +312,8 @@ void
|
|||
tr_ctorFree( tr_ctor * ctor )
|
||||
{
|
||||
clearMetainfo( ctor );
|
||||
tr_free( ctor->optionalArgs[1].downloadDir );
|
||||
tr_free( ctor->optionalArgs[0].downloadDir );
|
||||
tr_free( ctor );
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue