ifcviewer: drop unused SidecarHeader reserved field, bump v8 -> v9

The reserved uint32_t was always written as 0 and never inspected on
read.  Removing it shrinks the header from 16 to 12 bytes; the version
bump makes pre-existing sidecars fail the version check cleanly rather
than misreading by 4 bytes.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
This commit is contained in:
Dion Moult
2026-04-28 19:40:00 +10:00
parent 8282f691e8
commit 633c613da2
3 changed files with 8 additions and 8 deletions
+3 -4
View File
@@ -17,9 +17,9 @@
* *
********************************************************************************/
// v8 layout (all multi-byte fields native-endian; endianness marker in header).
// v9 layout (all multi-byte fields native-endian; endianness marker in header).
//
// SidecarHeader (16 bytes)
// SidecarHeader (12 bytes)
//
// uint32_t num_vertex_bytes
// uint8_t[] vertex data (12 B/vertex: pos u16x3 + oct-normal i8x2 + rgba8)
@@ -46,7 +46,6 @@ struct SidecarHeader {
uint32_t magic;
uint32_t version;
uint32_t endian;
uint32_t reserved;
};
// foo.ifc -> foo.ifcview
@@ -87,7 +86,7 @@ bool writeSidecar(const std::string& ifc_path, const SidecarData& data) {
FILE* f = fopen(path.c_str(), "wb");
if (!f) return false;
SidecarHeader hdr = { SIDECAR_MAGIC, SIDECAR_VERSION, SIDECAR_ENDIAN, 0 };
SidecarHeader hdr = { SIDECAR_MAGIC, SIDECAR_VERSION, SIDECAR_ENDIAN };
if (fwrite(&hdr, sizeof(hdr), 1, f) != 1) { fclose(f); return false; }
if (!writeVec(f, data.vertices)) { fclose(f); return false; }