fix(wwlib): address CODEX review findings for PR #105 (SDL3 backends)#107
Closed
Dadud wants to merge 15 commits intow3dhub:mainfrom
Closed
fix(wwlib): address CODEX review findings for PR #105 (SDL3 backends)#107Dadud wants to merge 15 commits intow3dhub:mainfrom
Dadud wants to merge 15 commits intow3dhub:mainfrom
Conversation
NOTE: This class is not used by the main game, and can be removed there.
This partially reverts bab59cf9d4238a9821592e9a74dcedd1fc31a229
This fixes a bug introduced by 60aa437
High: rawfile.cpp READ|WRITE path no longer truncates existing files.
- Changed SDL3 path from 'r+' fallback to 'r+b' then 'w+b', matching
OPEN_ALWAYS semantics (preserve existing file, create if absent).
Medium: verchk.cpp FAT date month field decode corrected.
- Mask was 0xf (4 bits), should be 0x1f (5 bits) for FAT month field.
Medium: rcfile.cpp static init order fix (cross-TU).
- Replaced 'extern std::unordered_map Static_Resources' with an inline
function GetStaticResources() using a function-local static (Meyers
singleton), guaranteeing construction on first use.
- cmake/embed.py generator updated.
Dadud
pushed a commit
to Dadud/OpenW3D
that referenced
this pull request
Apr 23, 2026
Resolves 4 merge conflicts: - buildnum.cpp/h: replaced old BuildNumber[char] post-build stamping with git-embedded info - dlgmainmenu.cpp: updated Update_Version_Number to use git info format - ConsoleMode.cpp: removed Get_Version_Number call (no longer needed) PR w3dhub#107 fixes applied on top: - rawfile.cpp: READ|WRITE data loss fix (r+b then w+b) - verchk.cpp: FAT date month decode (0xf → 0x1f) - rcfile: static init order fix (Meyers singleton)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes three CODEX review findings that block PR #105 (Add non-Windows backends to a few classes).
Fixes
High — rawfile.cpp READ|WRITE data loss
The SDL3 READ|WRITE path used 'r+' fallback to 'w+', which truncates existing files (silent data loss for callers like tagblock.cpp that open READ|WRITE then read back a header). Fixed by using 'r+b' then 'w+b', matching OPEN_ALWAYS semantics.
Medium — verchk.cpp FAT date month decode wrong
Month field mask was
0xf(4 bits) but FAT month is 5 bits (bits 5-8 of FAT date). Corrected to0x1f.Medium — rcfile.cpp static init order (cross-TU)
The
extern std::unordered_map Static_Resourcesdeclared in rcfile.h and defined in a CMake-generated TU had undefined static init order. Replaced with a function-local static (Meyers singleton) via inlineGetStaticResources(), guaranteeing construction on first use.Files changed
Code/wwlib/rawfile.cpp— READ|WRITE SDL3 fixCode/wwlib/verchk.cpp— FAT date decode fixCode/wwlib/rcfile.h— extern → lazy-init accessorCode/wwlib/rcfile.cpp— use GetStaticResources()Code/Commando/renegade_resources.cpp— generated file updatedcmake/embed.py— generator updated for future runs