Make parse_csv_float locale-independent (replace strtof with istringstream + C locale)#30
Merged
lmangani merged 2 commits intoMay 16, 2026
Conversation
… C locale Agent-Logs-Url: https://github.com/audiohacking/acestep.cpp/sessions/2329eeb3-4e21-4d6b-8232-3e78627581e0 Co-authored-by: lmangani <1423657+lmangani@users.noreply.github.com>
…tion with ss.eof() Agent-Logs-Url: https://github.com/audiohacking/acestep.cpp/sessions/2329eeb3-4e21-4d6b-8232-3e78627581e0 Co-authored-by: lmangani <1423657+lmangani@users.noreply.github.com>
Copilot created this pull request from a session on behalf of
lmangani
May 16, 2026 12:24
View session
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.
parse_csv_floatusedstd::strtof, which isLC_NUMERIC-dependent and can misparse decimal separators in non-C locales.Changes
std::strtofwithstd::istringstreamimbued withstd::locale::classic(), ensuring.is always the decimal separator regardless of the process localeistringstreamand the tokenstd::stringare hoisted outside the loop; reused viass.clear()+ss.str()+token.assign()to avoid per-iteration reconstruction!ss.eof()check after extraction — tokens like3.14abcnow break the loop rather than silently accepting the numeric prefix<cerrno>and<cstdlib>(no longer needed); added<locale>and<sstream>