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); |
121
|
0 |
0 |
assert(index == ctx->allocated); |
125
|
0 |
0 |
if (ctx->chunk_table == 0) { |
135
|
0 |
0 |
assert(index < ctx->allocated); |
136
|
0 |
0 |
assert(ctx->chunk_table != 0); |
137
|
0 |
0 |
assert(ctx->chunk_table[index] == 0); |
140
|
0 |
0 |
if (ctx->chunk_table[index] == 0) ctx->error = 1; |
154
|
0 |
1 |
if (ctx->chunk_table != 0) { |
155
|
0 |
0 |
assert(table_size <= ctx->allocated); |
156
|
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); |
157
|
0 |
0 |
for (i = 0; i < table_size; i++) free(ctx->chunk_table[i]); |
189
|
0 |
0 |
if (ctx->error) return; |
190
|
0 |
0 |
assert(ctx->index <= ED2K_CHUNK_SIZE); |
191
|
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); |
194
|
0 |
0 |
blocks_stack[0] = blocks = (unsigned)(type == AICH_HASH_FULL_TREE ? |
202
|
0 |
0 |
while (blocks > 1) { |
206
|
0 |
0 |
assert(level < 56); /* assumption filesize < (2^56 * 9MiB) */ |
214
|
0 |
0 |
if (type == AICH_HASH_FULL_TREE) { |
222
|
0 |
0 |
for (; level > 0 && (path & 0x01) == 0; path >>= 1) { |
|
0 |
0 |
for (; level > 0 && (path & 0x01) == 0; path >>= 1) { |
230
|
0 |
0 |
memcpy((level > 0 ? sha1_stack[level] : result), leaf_hash, 20); |
232
|
0 |
0 |
if (level == 0) break; |
259
|
0 |
0 |
assert(type != 0); |
260
|
0 |
0 |
assert(ctx->index <= ED2K_CHUNK_SIZE); |
263
|
0 |
0 |
if ((type & AICH_PROCESS_FLUSH_BLOCK) != 0) |
266
|
0 |
0 |
if (ctx->block_hashes == NULL) { |
268
|
0 |
0 |
if (ctx->block_hashes == NULL) { |
275
|
0 |
0 |
assert(((ctx->index - 1) / FULL_BLOCK_SIZE) < BLOCKS_PER_CHUNK); |
280
|
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)) { |
284
|
0 |
0 |
if (CT_INDEX(ctx->chunks_number) == 0) { |
286
|
0 |
0 |
if (ctx->error) return; |
288
|
0 |
0 |
assert(ctx->chunk_table != 0); |
289
|
0 |
0 |
assert(ctx->block_hashes != 0); |
295
|
0 |
0 |
if (!(type & AICH_PROCESS_FINAL_BLOCK) || ctx->chunks_number == 0) { |
|
0 |
0 |
if (!(type & AICH_PROCESS_FINAL_BLOCK) || ctx->chunks_number == 0) { |
301
|
0 |
0 |
if (ctx->chunks_number > 0) { |
321
|
0 |
2 |
if (ctx->error) return; |
323
|
2 |
0 |
while (size > 0) { |
325
|
2 |
0 |
unsigned block_left = (left_in_chunk <= LAST_BLOCK_SIZE ? left_in_chunk : |
327
|
0 |
2 |
assert(block_left > 0); |
329
|
0 |
2 |
if (size >= block_left) { |
345
|
0 |
2 |
assert(ctx->index < ED2K_CHUNK_SIZE); |
360
|
2 |
0 |
if (ctx->chunks_number == 0 && ctx->block_hashes == NULL) { |
|
2 |
0 |
if (ctx->chunks_number == 0 && ctx->block_hashes == NULL) { |
361
|
0 |
2 |
assert(ctx->index < FULL_BLOCK_SIZE); |
370
|
2 |
0 |
if (result) memcpy(result, hash, sha1_hash_size); |
375
|
0 |
0 |
if ((ctx->index % FULL_BLOCK_SIZE) > 0) { |
377
|
0 |
0 |
rhash_aich_process_block(ctx, ctx->block_hashes != NULL ? |
382
|
0 |
0 |
if (ctx->chunks_number == 0) { |
386
|
0 |
0 |
if (ctx->index > 0) { |
390
|
0 |
0 |
assert(ctx->chunks_number > 0); |
391
|
0 |
0 |
assert(ctx->block_hashes != NULL); |
398
|
0 |
0 |
if (result) memcpy(result, hash, sha1_hash_size); |