| 450 | } |
| 451 | |
| 452 | static int write_midx_pack_names(struct hashfile *f, void *data) |
| 453 | { |
| 454 | struct write_midx_context *ctx = data; |
| 455 | uint32_t i; |
| 456 | unsigned char padding[MIDX_CHUNK_ALIGNMENT]; |
| 457 | size_t written = 0; |
| 458 | |
| 459 | for (i = 0; i < ctx->nr; i++) { |
| 460 | size_t writelen; |
| 461 | |
| 462 | if (ctx->info[i].expired) |
| 463 | continue; |
| 464 | |
| 465 | if (ctx->version == MIDX_VERSION_V1 && |
| 466 | i && strcmp(ctx->info[i].pack_name, |
| 467 | ctx->info[i - 1].pack_name) <= 0) |
| 468 | BUG("incorrect pack-file order: %s before %s", |
| 469 | ctx->info[i - 1].pack_name, |
| 470 | ctx->info[i].pack_name); |
| 471 | |
| 472 | writelen = strlen(ctx->info[i].pack_name) + 1; |
| 473 | hashwrite(f, ctx->info[i].pack_name, writelen); |
| 474 | written += writelen; |
| 475 | } |
| 476 | |
| 477 | /* add padding to be aligned */ |
| 478 | i = MIDX_CHUNK_ALIGNMENT - (written % MIDX_CHUNK_ALIGNMENT); |
| 479 | if (i < MIDX_CHUNK_ALIGNMENT) { |
| 480 | memset(padding, 0, sizeof(padding)); |
| 481 | hashwrite(f, padding, i); |
| 482 | } |
| 483 | |
| 484 | return 0; |
| 485 | } |
| 486 | |
| 487 | static int write_midx_bitmapped_packs(struct hashfile *f, void *data) |
| 488 | { |
nothing calls this directly
no test coverage detected