Changeset 2210
- Timestamp:
- Jun 27, 2007, 11:22:09 PM (15 years ago)
- Location:
- trunk/libtransmission
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/libtransmission/torrent.c
r2207 r2210 270 270 return TR_EDUPLICATE; 271 271 272 if( pathIsInUse( h, destination, info->name ) )273 return TR_E RROR_IO_DUP_DOWNLOAD;272 if( destination && pathIsInUse( h, destination, info->name ) ) 273 return TR_EDUPLICATE; 274 274 275 275 return TR_OK; … … 280 280 const char * path, 281 281 const char * destination, 282 tr_info_t * setme_info, 283 int * setme_canAdd ) 282 tr_info_t * setme_info ) 284 283 { 285 284 int ret; … … 291 290 ret = tr_metainfoParseFile( setme_info, h->tag, path, FALSE ); 292 291 293 if( setme_canAdd)294 *setme_canAdd = ret ? ret :infoCanAdd( h, destination, setme_info );292 if( ret == TR_OK ) 293 ret = infoCanAdd( h, destination, setme_info ); 295 294 296 295 return ret; … … 305 304 { 306 305 int val; 307 int err = 0;308 306 tr_torrent_t * tor = NULL; 309 307 310 if(( val = tr_torrentParse( h, destination, path, NULL , &err)))308 if(( val = tr_torrentParse( h, destination, path, NULL ))) 311 309 *error = val; 312 else if( err )313 *error = err;314 310 else if(!(( tor = tr_new0( tr_torrent_t, 1 )))) 315 311 *error = TR_EOTHER; … … 326 322 const char * hashStr, 327 323 const char * destination, 328 tr_info_t * setme_info, 329 int * setme_canAdd ) 324 tr_info_t * setme_info ) 330 325 { 331 326 int ret; … … 337 332 ret = tr_metainfoParseHash( setme_info, h->tag, hashStr ); 338 333 339 if( setme_canAdd)340 *setme_canAdd = ret ? ret :infoCanAdd( h, destination, setme_info );334 if( ret == TR_OK ) 335 ret = infoCanAdd( h, destination, setme_info ); 341 336 342 337 return ret; … … 352 347 { 353 348 int val; 354 int err = 0;355 349 tr_torrent_t * tor = NULL; 356 350 357 if(( val = tr_torrentParseHash( h, hashStr, destination, NULL , &err)))351 if(( val = tr_torrentParseHash( h, hashStr, destination, NULL ))) 358 352 *error = val; 359 else if( err )360 *error = err;361 353 else if(!(( tor = tr_new0( tr_torrent_t, 1 )))) 362 354 *error = TR_EOTHER; … … 374 366 size_t size, 375 367 const char * destination, 376 tr_info_t * setme_info, 377 int * setme_canAdd ) 368 tr_info_t * setme_info ) 378 369 { 379 370 int ret; … … 385 376 ret = tr_metainfoParseData( setme_info, h->tag, data, size, FALSE ); 386 377 387 if( setme_canAdd)388 *setme_canAdd = ret ? ret :infoCanAdd( h, destination, setme_info );378 if( ret == TR_OK ) 379 ret = infoCanAdd( h, destination, setme_info ); 389 380 390 381 return ret; … … 400 391 { 401 392 int val; 402 int err = 0;403 393 tr_torrent_t * tor = NULL; 404 394 405 if(( val = tr_torrentParseData( h, data, size, destination, NULL , &err )))395 if(( val = tr_torrentParseData( h, data, size, destination, NULL ))) 406 396 *error = val; 407 else if( err )408 *error = err;409 397 else if(!(( tor = tr_new0( tr_torrent_t, 1 )))) 410 398 *error = TR_EOTHER; -
trunk/libtransmission/transmission.h
r2207 r2210 275 275 * Parses the specified metainfo file. 276 276 * 277 * Returns TR_OK or TR_INVALID based on whether or not the 278 * metainfo file is successfully parsed. 277 * Returns TR_OK if it parsed and can be added to Transmission. 278 * Returns TR_INVALID if it couldn't be parsed. 279 * Returns TR_EDUPLICATE if it parsed but can't be added. 279 280 * 280 * If parsing succeeded and "setme_info" is non-NULL,281 * it will be populated with the file's information.281 * "destination" can be NULL if you don't need to know whether 282 * or not the torrent can be added. 282 283 * 283 * If "setme_canAdd" is non-NULL, it will be set to TR_OK, 284 * TR_EDUPLICATE, TR_ERROR_IO_DUP_DOWNLOAD, or TR_EINVALID. 285 * 286 * "destination" is used for the canAdd tests, so it can 287 * be NULL if "setme_canAdd" is too. 284 " "setme_info" can be NULL if you don't need the information. 285 * If the metainfo can be parsed and setme_info is non-NULL, 286 * it will be filled with the metadata's info. 288 287 */ 289 288 int tr_torrentParse( const tr_handle_t * handle, 290 289 const char * metainfo_filename, 291 290 const char * destination, 292 tr_info_t * setme_info, 293 int * setme_canAdd ); 291 tr_info_t * setme_info ); 294 292 295 293 /***********************************************************************
Note: See TracChangeset
for help on using the changeset viewer.