(trunk libT) make tr_bencDictMerge() support limited nested merges

This commit is contained in:
Charles Kerr 2008-12-12 02:26:33 +00:00
parent 72b9845a5e
commit 0471e6d765
1 changed files with 7 additions and 1 deletions

View File

@ -1355,6 +1355,7 @@ tr_bencMergeDicts( tr_benc * target, const tr_benc * source )
{ {
int64_t i64; int64_t i64;
const char * str; const char * str;
tr_benc * t;
if( tr_bencGetInt( val, &i64 ) ) if( tr_bencGetInt( val, &i64 ) )
{ {
@ -1366,9 +1367,14 @@ tr_bencMergeDicts( tr_benc * target, const tr_benc * source )
tr_bencDictRemove( target, key ); tr_bencDictRemove( target, key );
tr_bencDictAddStr( target, key, str ); tr_bencDictAddStr( target, key, str );
} }
else if( tr_bencIsDict( val ) && tr_bencDictFindDict( target, key, &t ) )
{
tr_bencMergeDicts( t, val );
}
else else
{ {
tr_err( "tr_bencMergeDicts skipping \"%s\"", key );
tr_dbg( "tr_bencMergeDicts skipping \"%s\"", key );
} }
} }
} }