fix(ini): Support plus sign character prefix in INI integer parse#2576
fix(ini): Support plus sign character prefix in INI integer parse#2576xezon wants to merge 4 commits intoTheSuperHackers:mainfrom
Conversation
|
| Filename | Overview |
|---|---|
| Core/GameEngine/Source/Common/INI/INI.cpp | Adds leading + stripping and a debug assertion to scanType<>, and generalises the non-integral result type from Real to Type — all changes are correct and safe. |
Flowchart
%%{init: {'theme': 'neutral'}}%%
flowchart TD
A["scanType(token)"] --> B{"token empty?"}
B -->|"debug assert"| B2["DEBUG_ASSERTCRASH"]
B -->|"not empty"| C{"token[0] == plus?"}
C -->|"yes"| D["token.remove_prefix(1)"]
C -->|"no"| E["from_chars(token, result)"]
D --> E
E --> F{"ec == errc{}?"}
F -->|"error"| G["throw INI_INVALID_DATA"]
F -->|"success"| H["return static_cast(result)"]
Reviews (4): Last reviewed commit: "Add extra comment" | Re-trigger Greptile
What's this based on? Did you check all call sites? |
I launched the game and it did not hit the assert condition. |
This PR exists because I did the same thing in the previous PR, and that wasn't enough because I only tested the standard INI files. I just checked all call sites, though, and it looks safe. |
Alternative fix to #2548
Omits empty test because a token is implicitly not empty.
This change was not required for the original INI files.
Tested and worked.