Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Compare the _W_decimal_point of the localeconv, not the decimal_point of said localeconv #3085

Merged
merged 9 commits into from
Sep 13, 2022
10 changes: 5 additions & 5 deletions stl/src/xwstoxfl.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -22,13 +22,13 @@ _In_range_(0, maxsig) int _WStoxflt(const wchar_t* s0, const wchar_t* s, wchar_t
char buf[_Maxsig + 1]; // worst case, with room for rounding digit
int nsig = 0; // number of significant digits seen
int seen = 0; // any valid field characters seen
int word = 0; // current long word to fill
int word; // current long word to fill
StephanTLavavej marked this conversation as resolved.
Show resolved Hide resolved
StephanTLavavej marked this conversation as resolved.
Show resolved Hide resolved

const wchar_t* pd;
static const wchar_t digits[] = {// hex digits in both cases
static constexpr wchar_t digits[] = {// hex digits in both cases
L'0', L'1', L'2', L'3', L'4', L'5', L'6', L'7', L'8', L'9', L'a', L'b', L'c', L'd', L'e', L'f', L'A', L'B',
L'C', L'D', L'E', L'F', L'\0'};
static const char vals[] = {// values of hex digits
static const char vals[] = {// values of hex digits
StephanTLavavej marked this conversation as resolved.
Show resolved Hide resolved
0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 10, 11, 12, 13, 14, 15};

maxsig *= _Ndig; // convert word count to digit count
Expand All @@ -55,7 +55,7 @@ _In_range_(0, maxsig) int _WStoxflt(const wchar_t* s0, const wchar_t* s, wchar_t
seen = 1;
}

if (*s == localeconv()->decimal_point[0]) {
if (*s == localeconv()->_W_decimal_point[0]) {
AZero13 marked this conversation as resolved.
Show resolved Hide resolved
++s;
}

Expand Down Expand Up @@ -129,7 +129,7 @@ _In_range_(0, maxsig) int _WStoxflt(const wchar_t* s0, const wchar_t* s, wchar_t
}
}

if (!seen) {
else {
StephanTLavavej marked this conversation as resolved.
Show resolved Hide resolved
word = 0; // return zero if bad parse
}

Expand Down