diff --git a/c/addfeatures/hotconv/BASE.cpp b/c/addfeatures/hotconv/BASE.cpp index 65c22a14d..36d36a4c6 100644 --- a/c/addfeatures/hotconv/BASE.cpp +++ b/c/addfeatures/hotconv/BASE.cpp @@ -95,15 +95,6 @@ int BASE::Fill() { HorizAxis.prep(g); VertAxis.prep(g); - - offset.curr = hdr_size(); - - offset.curr += HorizAxis.fill(offset.curr); - offset.curr += VertAxis.fill(offset.curr); - - offset.shared = offset.curr; // Indicates start of shared area - offset.curr += fillSharedData(); - bool seenVariable = false; for (auto &bc : baseCoords) { if (bc.vvr.isVariable()) { @@ -111,12 +102,22 @@ int BASE::Fill() { bc.pair = ivs.addValue(*(g->ctx.locMap), bc.vvr, g->logger); } } - if (seenVariable) { + + if (seenVariable) version = VERSION(1, 1); - ivsOffset = offset.curr; - } else { + else version = VERSION(1, 0); - } + + offset.curr = hdr_size(seenVariable); + + offset.curr += HorizAxis.fill(offset.curr); + offset.curr += VertAxis.fill(offset.curr); + + offset.shared = offset.curr; // Indicates start of shared area + offset.curr += fillSharedData(); + + if (seenVariable) + ivsOffset = offset.curr; return 1; } @@ -169,6 +170,8 @@ void BASE::Write() { OUT4(version); OUT2(HorizAxis.o); OUT2(VertAxis.o); + if (ivsOffset != 0) + OUT4(ivsOffset); if (HorizAxis.baseTagList.size() > 0) HorizAxis.write(offset.shared, this); if (VertAxis.baseTagList.size() > 0) diff --git a/c/addfeatures/hotconv/BASE.h b/c/addfeatures/hotconv/BASE.h index e4206292c..28089033d 100644 --- a/c/addfeatures/hotconv/BASE.h +++ b/c/addfeatures/hotconv/BASE.h @@ -112,7 +112,12 @@ class BASE { void setAxisCount(uint16_t axisCount) { ivs.setAxisCount(axisCount); } private: int addBaseScript(int dfltInx, size_t nBaseTags, std::vector &coords); - static Offset hdr_size() { return sizeof(int32_t) + sizeof(uint16_t) * 2; } + static Offset hdr_size(bool seenVariable) { + Offset r = sizeof(int32_t) + sizeof(uint16_t) * 2; + if (seenVariable) + r += sizeof(uint32); + return r; + } Offset fillAxis(bool doVert); Offset fillSharedData(); void writeSharedData();