- bytes_for_posting_lists += encoded.size();
- }
-
- // Stick an empty block at the end as sentinel.
- corpus.filename_blocks.push_back("");
-
- // Write the offsets to the filenames.
- size_t bytes_for_filename_index = 0, bytes_for_filenames = 0;
- offset = hdr.filename_index_offset_bytes + corpus.filename_blocks.size() * sizeof(offset);
- for (const string &filename : corpus.filename_blocks) {
- fwrite(&offset, sizeof(offset), 1, outfp);
- offset += filename.size();
- bytes_for_filename_index += sizeof(offset);
- bytes_for_filenames += filename.size();
- }
-
- // Write the actual filenames.
- for (const string &filename : corpus.filename_blocks) {
- fwrite(filename.data(), filename.size(), 1, outfp);