Branch Coverage

_aich.c
Criterion Covered Total %
branch 11 166 6.6


line true false branch
103 0 0 assert(CT_INDEX(chunk_num) == 0);
109 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 */
110 0 0 assert(index <= ctx->allocated);
113 0 0 if (index >= ctx->allocated) {
115 0 0 size_t new_size = (ctx->allocated == 0 ? 64 : ctx->allocated * 2);
117 0 0 assert(index == ctx->allocated);
121 0 0 if (new_block == 0) {
134 0 0 assert(index < ctx->allocated);
135 0 0 assert(ctx->chunk_table != 0);
136 0 0 assert(ctx->chunk_table[index] == 0);
139 0 0 if (ctx->chunk_table[index] == 0)
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++)
190 0 0 if (ctx->error)
192 0 0 assert(ctx->index <= ED2K_CHUNK_SIZE);
193 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);
196 0 0 blocks_stack[0] = blocks = (unsigned)(type == AICH_HASH_FULL_TREE ?
204 0 0 while (blocks > 1) {
208 0 0 assert(level < 56); /* assumption filesize < (2^56 * 9MiB) */
216 0 0 if (type == AICH_HASH_FULL_TREE) {
224 0 0 for (; level > 0 && (path & 0x01) == 0; path >>= 1) {
0 0 for (; level > 0 && (path & 0x01) == 0; path >>= 1) {
232 0 0 memcpy((level > 0 ? sha1_stack[level] : result), leaf_hash, 20);
234 0 0 if (level == 0) break;
261 0 0 assert(type != 0);
262 0 0 assert(ctx->index <= ED2K_CHUNK_SIZE);
265 0 0 if ((type & AICH_PROCESS_FLUSH_BLOCK) != 0)
268 0 0 if (ctx->block_hashes == NULL) {
270 0 0 if (ctx->block_hashes == NULL) {
277 0 0 assert(((ctx->index - 1) / FULL_BLOCK_SIZE) < BLOCKS_PER_CHUNK);
282 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)) {
286 0 0 if (CT_INDEX(ctx->chunks_count) == 0) {
288 0 0 if (ctx->error)
291 0 0 assert(ctx->chunk_table != 0);
292 0 0 assert(ctx->block_hashes != 0);
298 0 0 if (!(type & AICH_PROCESS_FINAL_BLOCK) || ctx->chunks_count == 0) {
0 0 if (!(type & AICH_PROCESS_FINAL_BLOCK) || ctx->chunks_count == 0) {
304 0 0 if (ctx->chunks_count > 0) {
324 0 2 if (ctx->error)
326 2 0 while (size > 0) {
328 2 0 unsigned block_left = (left_in_chunk <= LAST_BLOCK_SIZE ? left_in_chunk :
330 0 2 assert(block_left > 0);
332 0 2 if (size >= block_left) {
348 0 2 assert(ctx->index < ED2K_CHUNK_SIZE);
363 2 0 if (ctx->chunks_count == 0 && ctx->block_hashes == NULL) {
2 0 if (ctx->chunks_count == 0 && ctx->block_hashes == NULL) {
364 0 2 assert(ctx->index < FULL_BLOCK_SIZE);
373 2 0 if (result) memcpy(result, hash, sha1_hash_size);
378 0 0 if ((ctx->index % FULL_BLOCK_SIZE) > 0) {
380 0 0 rhash_aich_process_block(ctx, ctx->block_hashes != NULL ?
385 0 0 if (ctx->chunks_count == 0) {
389 0 0 if (ctx->index > 0) {
393 0 0 assert(ctx->chunks_count > 0);
394 0 0 assert(ctx->block_hashes != NULL);
401 0 0 if (result) memcpy(result, hash, sha1_hash_size);
420 0 0 const size_t block_hashes_size = (ctx->block_hashes ? BLOCK_HASHES_SIZE : 0);
424 0 0 if (!out)
426 0 0 if (size < exported_size)
432 0 0 if (ctx->block_hashes) {
436 0 0 if (chunk_table_size > 0) {
439 0 0 assert(ctx->chunk_table != NULL);
440 0 0 for (index = 0; left_size > 0; index++) {
447 0 0 assert(left_size == 0);
449 0 0 assert(!out || (size_t)(out_ptr - (char*)out) == exported_size);
0 0 assert(!out || (size_t)(out_ptr - (char*)out) == exported_size);
476 0 0 if (size < imported_size)
478 0 0 if(*(size_t*)in_ptr != sizeof(aich_ctx))
484 0 0 block_hashes_size = (ctx->block_hashes ? BLOCK_HASHES_SIZE : 0);
487 0 0 if (size < imported_size)
489 0 0 if (ctx->block_hashes != NULL) {
491 0 0 if (!ctx->block_hashes)
496 0 0 if (ctx->allocated > 0) {
499 0 0 if (!ctx->chunk_table) {
504 0 0 for (index = 0; chunk_table_size > 0; index++) {
507 0 0 assert(index < ctx->allocated);
509 0 0 if (ctx->chunk_table[index] == 0) {
518 0 0 assert((size_t)(in_ptr - (char*)in) == imported_size);