oasis.cpp / oasis_write_repetition function - typo?
philstopford opened this issue · 1 comments
philstopford commented
I'm picking through this code to learn more about OASIS and the below in the repetition writing code looks wrong to my eye:
case RepetitionType::Explicit:
if (repetition.offsets.count > 0) {
oasis_putc(10, out);
oasis_write_unsigned_integer(out, repetition.offsets.count - 1);
Vec2* v0 = repetition.offsets.items;
Vec2* v1 = v0 + 1;
oasis_write_gdelta(out, (int64_t)llround(v0->x * scaling),
(int64_t)llround(v0->y * scaling));
for (uint64_t i = repetition.coords.count - 1; i > 0; --i, ++v0, ++v1) {
oasis_write_gdelta(out, (int64_t)llround((v1->x - v0->x) * scaling),
(int64_t)llround((v1->y - v0->y) * scaling));
}
}
break;
We're writing repetition.offsets, but this loop seems to be based on repetition.coords.count. Is this a misunderstanding on my side, or a typo?
heitzmann commented
That's correct. coords
and offsets
are part of an union in the repetition structure. Explicit
types use the offset
member, not coords
.