line |
true |
false |
branch |
53
|
0 |
2 |
assert(BT_MIN_HASH_LENGTH == bt_default_piece_length(0)); |
78
|
1 |
3 |
for (i = 0; i < vect->size; i++) { |
92
|
0 |
1 |
assert(ctx != NULL); |
117
|
2 |
0 |
if (vect->size >= vect->allocated) { |
118
|
0 |
2 |
size_t size = (vect->allocated == 0 ? 128 : vect->allocated * 2); |
120
|
0 |
2 |
if (new_array == NULL) return 0; /* failed: no memory */ |
141
|
2 |
0 |
if ((ctx->piece_count % BT_BLOCK_SIZE) == 0) { |
143
|
2 |
0 |
if (block == NULL || !bt_vector_add_ptr(&ctx->hash_blocks, block)) { |
|
0 |
2 |
if (block == NULL || !bt_vector_add_ptr(&ctx->hash_blocks, block)) { |
144
|
0 |
0 |
if (block) free(block); |
178
|
0 |
0 |
if (info == NULL) { |
185
|
0 |
0 |
if (!bt_vector_add_ptr(&ctx->files, info)) { |
191
|
0 |
0 |
if (ctx->piece_count == 0 && ctx->index == 0) { |
|
0 |
0 |
if (ctx->piece_count == 0 && ctx->index == 0) { |
210
|
0 |
2 |
assert(ctx->index < ctx->piece_length); |
212
|
2 |
0 |
while (size > 0) { |
215
|
2 |
0 |
if (size < rest) { |
239
|
2 |
0 |
if (ctx->index > 0) { |
244
|
2 |
0 |
if (result) memcpy(result, ctx->btih, btih_hash_size); |
260
|
4 |
16 |
if (length >= ctx->content.allocated && !ctx->error) { |
|
4 |
0 |
if (length >= ctx->content.allocated && !ctx->error) { |
262
|
2 |
2 |
if (length < 64) length = 64; |
265
|
0 |
4 |
if (new_str == NULL) { |
286
|
0 |
14 |
if (!bt_str_ensure_length(ctx, ctx->content.length + length)) return; |
287
|
0 |
14 |
assert(ctx->content.str != 0); |
302
|
4 |
0 |
if (name) bt_str_append(ctx, name); |
305
|
0 |
4 |
if (!bt_str_ensure_length(ctx, ctx->content.length + 22)) return; |
327
|
0 |
0 |
if (name) bt_str_append(ctx, name); |
328
|
0 |
0 |
if (!bt_str_ensure_length(ctx, ctx->content.length + len + 21)) return; |
350
|
0 |
2 |
if (!bt_str_ensure_length(ctx, ctx->content.length + pieces_length + 21)) |
360
|
2 |
2 |
for (size = (int)ctx->piece_count, i = 0; size > 0; |
382
|
2 |
0 |
if (total_size < 16777216) return BT_MIN_HASH_LENGTH; |
383
|
0 |
0 |
if (total_size >= I64(4294967296) ) return 8388608; |
384
|
0 |
0 |
for (hi_bit = 16777216 << 1; hi_bit <= total_size; hi_bit <<= 1); |
392
|
0 |
0 |
for (; p >= path && *p != '/' && *p != '\\'; p--); |
|
0 |
0 |
for (; p >= path && *p != '/' && *p != '\\'; p--); |
|
0 |
0 |
for (; p >= path && *p != '/' && *p != '\\'; p--); |
400
|
0 |
0 |
for (; p > path && (*p == '/' || *p == '\\'); p--) *p = 0; |
|
0 |
0 |
for (; p > path && (*p == '/' || *p == '\\'); p--) *p = 0; |
|
0 |
0 |
for (; p > path && (*p == '/' || *p == '\\'); p--) *p = 0; |
401
|
0 |
0 |
if (p <= path) return "BATCH_DIR"; |
425
|
0 |
2 |
assert(ctx->content.str == NULL); |
427
|
0 |
2 |
if (ctx->piece_length == 0) { |
428
|
0 |
0 |
if (ctx->files.size == 1) { |
434
|
2 |
0 |
if ((ctx->options & BT_OPT_INFOHASH_ONLY) == 0) { |
437
|
0 |
2 |
if (ctx->announce.array && ctx->announce.size > 0) { |
|
0 |
0 |
if (ctx->announce.array && ctx->announce.size > 0) { |
441
|
0 |
0 |
if (ctx->announce.size > 1) { |
446
|
0 |
0 |
for (i = 0; i < ctx->announce.size; i++) { |
447
|
0 |
0 |
if (i > 0) { |
456
|
0 |
2 |
if (ctx->program_name) { |
469
|
0 |
2 |
if (ctx->files.size > 1) { |
476
|
0 |
0 |
for (i = 0; i < ctx->files.size; i++) { |
485
|
0 |
2 |
else if (ctx->files.size > 0) { |
496
|
0 |
2 |
if (ctx->options & BT_OPT_PRIVATE) { |
579
|
0 |
0 |
if (!announce_url || announce_url[0] == '\0') return 0; |
|
0 |
0 |
if (!announce_url || announce_url[0] == '\0') return 0; |
581
|
0 |
0 |
if (!url_copy) return 0; |
582
|
0 |
0 |
if (bt_vector_add_ptr(&ctx->announce, url_copy)) |
597
|
0 |
0 |
assert(ctx->content.str); |