Changeset 1172 for trunk/libtorrent/src/data/chunk.cc
- Timestamp:
- 08/25/10 03:14:19 (21 months ago)
- Files:
-
- 1 modified
-
trunk/libtorrent/src/data/chunk.cc (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/libtorrent/src/data/chunk.cc
r1105 r1172 114 114 115 115 uint32_t 116 Chunk::incore_length(uint32_t pos ) {117 uint32_t lengthIncore= 0;116 Chunk::incore_length(uint32_t pos, uint32_t length) { 117 uint32_t result = 0; 118 118 iterator itr = at_position(pos); 119 119 … … 121 121 throw internal_error("Chunk::incore_length(...) at end()"); 122 122 123 do { 124 uint32_t length = itr->incore_length(pos); 125 126 pos += length; 127 lengthIncore += length; 123 length = std::min(length, chunk_size() - pos); 124 125 do { 126 uint32_t incore_len = itr->incore_length(pos, length); 127 128 if (incore_len > length) 129 throw internal_error("Chunk::incore_length(...) incore_len > length."); 130 131 pos += incore_len; 132 length -= incore_len; 133 result += incore_len; 128 134 129 135 } while (pos == itr->position() + itr->size() && ++itr != end()); 130 136 131 return lengthIncore;137 return result; 132 138 } 133 139
