line |
true |
false |
branch |
111
|
0 |
0 |
assert(CT_INDEX(chunk_num) == 0); |
114
|
0 |
0 |
assert(ctx->chunk_table == 0 || ctx->chunk_table[index - 1] != 0); /* table is empty or full */ |
|
0 |
0 |
assert(ctx->chunk_table == 0 || ctx->chunk_table[index - 1] != 0); /* table is empty or full */ |
115
|
0 |
0 |
assert(index <= ctx->allocated); |
118
|
0 |
0 |
if (index >= ctx->allocated) { |
120
|
0 |
0 |
size_t new_size = (ctx->allocated == 0 ? 64 : ctx->allocated * 2); |
122
|
0 |
0 |
assert(index == ctx->allocated); |
126
|
0 |
0 |
if (new_block == 0) { |
139
|
0 |
0 |
assert(index < ctx->allocated); |
140
|
0 |
0 |
assert(ctx->chunk_table != 0); |
141
|
0 |
0 |
assert(ctx->chunk_table[index] == 0); |
144
|
0 |
0 |
if (ctx->chunk_table[index] == 0) ctx->error = 1; |
158
|
0 |
1 |
if (ctx->chunk_table != 0) { |
159
|
0 |
0 |
assert(table_size <= ctx->allocated); |
160
|
0 |
0 |
assert(table_size == ctx->allocated || ctx->chunk_table[table_size] == 0); |
|
0 |
0 |
assert(table_size == ctx->allocated || ctx->chunk_table[table_size] == 0); |
161
|
0 |
0 |
for (i = 0; i < table_size; i++) free(ctx->chunk_table[i]); |
193
|
0 |
0 |
if (ctx->error) return; |
194
|
0 |
0 |
assert(ctx->index <= ED2K_CHUNK_SIZE); |
195
|
0 |
0 |
assert(type == AICH_HASH_FULL_TREE ? ctx->chunk_table != 0 : ctx->block_hashes != 0); |
|
0 |
0 |
assert(type == AICH_HASH_FULL_TREE ? ctx->chunk_table != 0 : ctx->block_hashes != 0); |
198
|
0 |
0 |
blocks_stack[0] = blocks = (unsigned)(type == AICH_HASH_FULL_TREE ? |
206
|
0 |
0 |
while (blocks > 1) { |
210
|
0 |
0 |
assert(level < 56); /* assumption filesize < (2^56 * 9MiB) */ |
218
|
0 |
0 |
if (type == AICH_HASH_FULL_TREE) { |
226
|
0 |
0 |
for (; level > 0 && (path & 0x01) == 0; path >>= 1) { |
|
0 |
0 |
for (; level > 0 && (path & 0x01) == 0; path >>= 1) { |
234
|
0 |
0 |
memcpy((level > 0 ? sha1_stack[level] : result), leaf_hash, 20); |
236
|
0 |
0 |
if (level == 0) break; |
263
|
0 |
0 |
assert(type != 0); |
264
|
0 |
0 |
assert(ctx->index <= ED2K_CHUNK_SIZE); |
267
|
0 |
0 |
if ((type & AICH_PROCESS_FLUSH_BLOCK) != 0) |
270
|
0 |
0 |
if (ctx->block_hashes == NULL) { |
272
|
0 |
0 |
if (ctx->block_hashes == NULL) { |
279
|
0 |
0 |
assert(((ctx->index - 1) / FULL_BLOCK_SIZE) < BLOCKS_PER_CHUNK); |
284
|
0 |
0 |
if (ctx->index >= ED2K_CHUNK_SIZE || (type & AICH_PROCESS_FINAL_BLOCK)) { |
|
0 |
0 |
if (ctx->index >= ED2K_CHUNK_SIZE || (type & AICH_PROCESS_FINAL_BLOCK)) { |
288
|
0 |
0 |
if (CT_INDEX(ctx->chunks_number) == 0) { |
290
|
0 |
0 |
if (ctx->error) return; |
292
|
0 |
0 |
assert(ctx->chunk_table != 0); |
293
|
0 |
0 |
assert(ctx->block_hashes != 0); |
299
|
0 |
0 |
if (!(type & AICH_PROCESS_FINAL_BLOCK) || ctx->chunks_number == 0) { |
|
0 |
0 |
if (!(type & AICH_PROCESS_FINAL_BLOCK) || ctx->chunks_number == 0) { |
305
|
0 |
0 |
if (ctx->chunks_number > 0) { |
325
|
0 |
2 |
if (ctx->error) return; |
327
|
2 |
0 |
while (size > 0) { |
329
|
2 |
0 |
unsigned block_left = (left_in_chunk <= LAST_BLOCK_SIZE ? left_in_chunk : |
331
|
0 |
2 |
assert(block_left > 0); |
333
|
0 |
2 |
if (size >= block_left) { |
349
|
0 |
2 |
assert(ctx->index < ED2K_CHUNK_SIZE); |
364
|
2 |
0 |
if (ctx->chunks_number == 0 && ctx->block_hashes == NULL) { |
|
2 |
0 |
if (ctx->chunks_number == 0 && ctx->block_hashes == NULL) { |
365
|
0 |
2 |
assert(ctx->index < FULL_BLOCK_SIZE); |
374
|
2 |
0 |
if (result) memcpy(result, hash, sha1_hash_size); |
379
|
0 |
0 |
if ((ctx->index % FULL_BLOCK_SIZE) > 0) { |
381
|
0 |
0 |
rhash_aich_process_block(ctx, ctx->block_hashes != NULL ? |
386
|
0 |
0 |
if (ctx->chunks_number == 0) { |
390
|
0 |
0 |
if (ctx->index > 0) { |
394
|
0 |
0 |
assert(ctx->chunks_number > 0); |
395
|
0 |
0 |
assert(ctx->block_hashes != NULL); |
402
|
0 |
0 |
if (result) memcpy(result, hash, sha1_hash_size); |