DeckManager: fix LoadLFListSingle, LoadDeck (std::istringstream) #2699
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.
LoadLFListSingle
C99
7.19.6.2 The fscanf function
10
Except in the case of a % specifier, the input item (or, in the case of a %n directive, the count of input characters) is converted to a type appropriate to the conversion specifier.
If the input item is not a matching sequence, the execution of the directive fails: this condition is a matching failure.
Unless assignment suppression was indicated by a *, the result of the conversion is placed in the object pointed to by the first argument following the format argument that has not already received a conversion result.
If this object does not have an appropriate type, or if the result of the conversion cannot be represented in the object, the behavior is undefined.
If there is a line in
lflist.conf
The behavior is undefined.
Now we only accept
LoadDeck (std::istringstream)
https://en.cppreference.com/w/cpp/string/basic_string/stol
Exceptions
123.ydk
The process will terminate when loading
123.ydk
.Now we use
std::strtol(linebuf.c_str(), nullptr, 10);
and check
errno
.@mercury233
@purerosefallen
@Wind2009-Louse
@fallenstardust