Skip to content

Commit

Permalink
Merge pull request #270 from gorcha/strl-write-index
Browse files Browse the repository at this point in the history
Fix off by one error in v,o indexing for string refs
  • Loading branch information
evanmiller authored Mar 8, 2022
2 parents 2d34a9c + 396d7dc commit 90250be
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/readstat_writer.c
Original file line number Diff line number Diff line change
Expand Up @@ -604,8 +604,8 @@ readstat_error_t readstat_insert_string_ref(readstat_writer_t *writer, const rea
return READSTAT_ERROR_STRING_REFS_NOT_SUPPORTED;

if (ref && ref->first_o == -1 && ref->first_v == -1) {
ref->first_o = writer->current_row;
ref->first_v = variable->index;
ref->first_o = writer->current_row + 1;
ref->first_v = variable->index + 1;
}

return writer->callbacks.write_string_ref(&writer->row[variable->offset], variable, ref);
Expand Down

0 comments on commit 90250be

Please sign in to comment.