Changeset 1215
- Timestamp:
- Dec 14, 2006, 3:28:17 PM (16 years ago)
- Location:
- branches/io/libtransmission
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/io/libtransmission/inout.c
r1207 r1215 106 106 /*********************************************************************** 107 107 * tr_ioRead 108 ***********************************************************************109 *110 108 **********************************************************************/ 111 109 int tr_ioRead( tr_io_t * io, int index, int begin, int length, … … 123 121 /*********************************************************************** 124 122 * tr_ioWrite 125 ***********************************************************************126 *127 123 **********************************************************************/ 128 124 int tr_ioWrite( tr_io_t * io, int index, int begin, int length, … … 137 133 int pieceSize; 138 134 int startBlock, endBlock; 135 int ret; 139 136 140 137 if( io->pieceSlot[index] < 0 ) … … 148 145 (uint64_t) inf->pieceSize + (uint64_t) begin; 149 146 150 if( writeBytes( io, offset, length, buf) )151 { 152 return 1;147 if( ( ret = writeBytes( io, offset, length, buf ) ) ) 148 { 149 return ret; 153 150 } 154 151 … … 327 324 int file; 328 325 iofunc readOrWrite = isWrite ? (iofunc) write : (iofunc) read; 326 int ret = 0; 329 327 330 328 /* Release the torrent lock so the UI can still update itself if … … 336 334 { 337 335 tr_err( "readOrWriteBytes: trying to write more than a piece" ); 338 goto fail; 336 ret = TR_ERROR_ASSERT; 337 goto cleanup; 339 338 } 340 339 … … 354 353 tr_err( "readOrWriteBytes: offset out of range (%"PRIu64", %d, %d)", 355 354 offset, size, isWrite ); 356 goto fail; 355 ret = TR_ERROR_ASSERT; 356 goto cleanup; 357 357 } 358 358 … … 376 376 if( file < 0 ) 377 377 { 378 goto fail; 378 ret = file; 379 goto cleanup; 379 380 } 380 381 … … 383 384 { 384 385 tr_fdFileRelease( tor->fdlimit, file ); 385 goto fail; 386 ret = TR_ERROR_IO_OTHER; 387 goto cleanup; 386 388 } 387 389 … … 390 392 { 391 393 tr_fdFileRelease( tor->fdlimit, file ); 392 goto fail; 394 ret = TR_ERROR_IO_OTHER; 395 goto cleanup; 393 396 } 394 397 … … 404 407 } 405 408 409 cleanup: 406 410 tr_lockLock( &tor->lock ); 407 return 0; 408 409 fail: 410 tr_lockLock( &tor->lock ); 411 return 1; 411 return ret; 412 412 } 413 413 -
branches/io/libtransmission/inout.h
r346 r1215 31 31 32 32 tr_io_t * tr_ioInit ( tr_torrent_t * ); 33 34 /*********************************************************************** 35 * tr_ioRead, tr_ioWrite 36 *********************************************************************** 37 * Reads or writes the block specified by the piece index, the offset in 38 * that piece and the size of the block. Returns 0 if successful, 39 * TR_ERROR_ASSERT if the parameters are incorrect, one of the 40 * TR_ERROR_IO_* otherwise. 41 **********************************************************************/ 33 42 int tr_ioRead ( tr_io_t *, int, int, int, uint8_t * ); 34 43 int tr_ioWrite ( tr_io_t *, int, int, int, uint8_t * ); 44 35 45 void tr_ioClose ( tr_io_t * ); 36 46 void tr_ioSaveResume ( tr_io_t * ); -
branches/io/libtransmission/transmission.h
r1198 r1215 56 56 * Error codes 57 57 **********************************************************************/ 58 /* General errors */ 59 #define TR_ERROR_ASSERT -1 60 /* I/O errors */ 58 61 #define TR_ERROR_IO_PARENT -10 59 62 #define TR_ERROR_IO_PERMISSIONS -11
Note: See TracChangeset
for help on using the changeset viewer.