From: Michael Tremer Date: Mon, 8 Jan 2018 17:01:08 +0000 (+0000) Subject: writer: Move alignment into each section writer X-Git-Tag: 0.9.0~113 X-Git-Url: http://git.ipfire.org/?p=people%2Fms%2Flibloc.git;a=commitdiff_plain;h=fda89f2448ee9cc7807ec7a88510c7d5ad975f5f writer: Move alignment into each section writer Signed-off-by: Michael Tremer --- diff --git a/src/writer.c b/src/writer.c index 84331d0..1867e90 100644 --- a/src/writer.c +++ b/src/writer.c @@ -219,6 +219,8 @@ static int loc_database_write_as_section(struct loc_writer* writer, DEBUG(writer->ctx, "AS section has a length of %zu bytes\n", as_length); header->as_length = htobe32(as_length); + align_page_boundary(offset, f); + return 0; } @@ -386,6 +388,8 @@ static int loc_database_write_networks(struct loc_writer* writer, header->network_data_length = htobe32(network_data_length); + align_page_boundary(offset, f); + return 0; } @@ -427,15 +431,11 @@ LOC_EXPORT int loc_writer_write(struct loc_writer* writer, FILE* f) { if (r) return r; - align_page_boundary(&offset, f); - // Write all networks r = loc_database_write_networks(writer, &header, &offset, f); if (r) return r; - align_page_boundary(&offset, f); - // Write pool r = loc_database_write_pool(writer, &header, &offset, f); if (r)