Skip to content

Commit

Permalink
Fixed for variable BASE entries
Browse files Browse the repository at this point in the history
  • Loading branch information
skef committed Jun 19, 2024
1 parent 8170306 commit 5a1f356
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 14 deletions.
29 changes: 16 additions & 13 deletions c/addfeatures/hotconv/BASE.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -95,28 +95,29 @@ 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()) {
seenVariable = true;
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;
}
Expand Down Expand Up @@ -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)
Expand Down
7 changes: 6 additions & 1 deletion c/addfeatures/hotconv/BASE.h
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,12 @@ class BASE {
void setAxisCount(uint16_t axisCount) { ivs.setAxisCount(axisCount); }
private:
int addBaseScript(int dfltInx, size_t nBaseTags, std::vector<VarValueRecord> &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();
Expand Down

0 comments on commit 5a1f356

Please sign in to comment.