Skip to content

Various Selafin fixes - #535

Open
nicogodet wants to merge 3 commits into
lutraconsulting:masterfrom
nicogodet:selafin-fixes
Open

nicogodet wants to merge 3 commits into
lutraconsulting:masterfrom
nicogodet:selafin-fixes

Conversation

@nicogodet

Copy link
Copy Markdown
Contributor

Various safety fixes when reading and writing selafin from/to disk

Fixes done by Claude (Flable or Opus) while working on other branches.

readInt only looked at the stream state when the read had succeeded, so a
failed read returned whatever the uninitialised buffer held instead of
reporting the problem. The check now runs on the result of the read itself.
A Selafin mesh reads its frame and its values lazily, so a file truncated or
rewritten by another program while MDAL holds it open fails in the middle of
a read that happens under the C API, which has no exception handling of its
own. The four lazy readers now catch the failure, log it and return 0.
Saving a Selafin mesh onto the file it was loaded from truncated that file
while the driver was still reading its frame from it. The mesh frame is now
collected before any output is opened, written to a temporary file, and that
file put in place of the target only once it has been written in full.
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.

1 participant