Skip to content

Fix counting problem with list_dump_filedescriptor#12

Open
dangarbri wants to merge 1 commit into
mij:masterfrom
dangarbri:master
Open

Fix counting problem with list_dump_filedescriptor#12
dangarbri wants to merge 1 commit into
mij:masterfrom
dangarbri:master

Conversation

@dangarbri

Copy link
Copy Markdown

list_dump_filedescriptor doesn't return the right length in the output when elements are variable size.

There were 3 things contributing to the counting error:

  1. When elements are variable size, the elements length is written to the dump buffer.
  2. The rndterm value at the end wasn't being counted.
  3. the output length used sizeof(header) but the header isn't "packed" so sizeof(header) == 32 on some systems (i.e. mine) instead of 30. That uint16_t actually takes up 4 bytes so the memory accesses are on dword lines.

I added a new variable extra_bytes which counts 1 and 2, and I changed sizeof(header) to SIMCLIST_DUMPFORMAT_HEADERLEN to fix 3.

This patch is compatible with existing list dumps, it just fixes the number that list_dumpfiledescriptor returns.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants