mirror of
https://github.com/transmission/transmission
synced 2024-12-25 01:03:01 +00:00
make values in newly created .torrent files alphabetically sorted
This commit is contained in:
parent
02447d12b5
commit
a459ba3a74
1 changed files with 29 additions and 29 deletions
|
@ -317,17 +317,6 @@ makeInfoDict ( benc_val_t * dict,
|
|||
|
||||
tr_bencDictReserve( dict, 5 );
|
||||
|
||||
val = tr_bencDictAdd( dict, "name" );
|
||||
strlcpy( base, builder->top, sizeof( base ) );
|
||||
tr_bencInitStrDup ( val, basename( base ) );
|
||||
|
||||
val = tr_bencDictAdd( dict, "piece length" );
|
||||
tr_bencInitInt( val, builder->pieceSize );
|
||||
|
||||
pch = getHashInfo( builder );
|
||||
val = tr_bencDictAdd( dict, "pieces" );
|
||||
tr_bencInitStr( val, pch, SHA_DIGEST_LENGTH * builder->pieceCount, 0 );
|
||||
|
||||
if ( builder->isSingleFile )
|
||||
{
|
||||
val = tr_bencDictAdd( dict, "length" );
|
||||
|
@ -340,6 +329,17 @@ makeInfoDict ( benc_val_t * dict,
|
|||
makeFilesList( val, builder );
|
||||
}
|
||||
|
||||
val = tr_bencDictAdd( dict, "name" );
|
||||
strlcpy( base, builder->top, sizeof( base ) );
|
||||
tr_bencInitStrDup ( val, basename( base ) );
|
||||
|
||||
val = tr_bencDictAdd( dict, "piece length" );
|
||||
tr_bencInitInt( val, builder->pieceSize );
|
||||
|
||||
pch = getHashInfo( builder );
|
||||
val = tr_bencDictAdd( dict, "pieces" );
|
||||
tr_bencInitStr( val, pch, SHA_DIGEST_LENGTH * builder->pieceCount, 0 );
|
||||
|
||||
val = tr_bencDictAdd( dict, "private" );
|
||||
tr_bencInitInt( val, builder->isPrivate ? 1 : 0 );
|
||||
}
|
||||
|
@ -356,6 +356,11 @@ static void tr_realMakeMetaInfo ( tr_metainfo_builder_t * builder )
|
|||
val = tr_bencDictAdd( &top, "announce" );
|
||||
tr_bencInitStrDup( val, builder->announce );
|
||||
|
||||
if( builder->comment && *builder->comment ) {
|
||||
val = tr_bencDictAdd( &top, "comment" );
|
||||
tr_bencInitStrDup( val, builder->comment );
|
||||
}
|
||||
|
||||
val = tr_bencDictAdd( &top, "created by" );
|
||||
tr_bencInitStrDup( val, TR_NAME "/" LONG_VERSION_STRING );
|
||||
|
||||
|
@ -365,11 +370,6 @@ static void tr_realMakeMetaInfo ( tr_metainfo_builder_t * builder )
|
|||
val = tr_bencDictAdd( &top, "encoding" );
|
||||
tr_bencInitStrDup( val, "UTF-8" );
|
||||
|
||||
if( builder->comment && *builder->comment ) {
|
||||
val = tr_bencDictAdd( &top, "comment" );
|
||||
tr_bencInitStrDup( val, builder->comment );
|
||||
}
|
||||
|
||||
val = tr_bencDictAdd( &top, "info" );
|
||||
tr_bencInit( val, TYPE_DICT );
|
||||
tr_bencDictReserve( val, 666 );
|
||||
|
|
Loading…
Reference in a new issue