Skip to content

Commit acc2841

Browse files
committed
[CRT] fix build
svn path=/trunk/; revision=72642
1 parent 2899d91 commit acc2841

File tree

1 file changed

+18
-8
lines changed

1 file changed

+18
-8
lines changed

reactos/sdk/lib/crt/string/wtoi64.c

Lines changed: 18 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ __int64 CDECL _wtoi64_l(const wchar_t *str, _locale_t locale)
99
ULONGLONG RunningTotal = 0;
1010
BOOL bMinus = FALSE;
1111

12-
while (isspaceW(*str)) {
12+
while (iswctype((int)*str, _SPACE)) {
1313
str++;
1414
} /* while */
1515

@@ -48,21 +48,23 @@ __int64 CDECL _wcstoi64_l(const wchar_t *nptr,
4848
BOOL negative = FALSE;
4949
__int64 ret = 0;
5050

51+
#ifndef _LIBCNT_
5152
TRACE("(%s %p %d %p)\n", debugstr_w(nptr), endptr, base, locale);
53+
#endif
5254

5355
if (!MSVCRT_CHECK_PMT(nptr != NULL)) return 0;
5456
if (!MSVCRT_CHECK_PMT(base == 0 || base >= 2)) return 0;
5557
if (!MSVCRT_CHECK_PMT(base <= 36)) return 0;
5658

57-
while(isspaceW(*nptr)) nptr++;
59+
while (iswctype((int)*nptr, _SPACE)) nptr++;
5860

5961
if(*nptr == '-') {
6062
negative = TRUE;
6163
nptr++;
6264
} else if(*nptr == '+')
6365
nptr++;
6466

65-
if((base==0 || base==16) && *nptr=='0' && tolowerW(*(nptr+1))=='x') {
67+
if((base==0 || base==16) && *nptr=='0' && towlower(*(nptr+1))=='x') {
6668
base = 16;
6769
nptr += 2;
6870
}
@@ -75,7 +77,7 @@ __int64 CDECL _wcstoi64_l(const wchar_t *nptr,
7577
}
7678

7779
while(*nptr) {
78-
wchar_t cur = tolowerW(*nptr);
80+
wchar_t cur = towlower(*nptr);
7981
int v;
8082

8183
if(cur>='0' && cur<='9') {
@@ -95,10 +97,14 @@ __int64 CDECL _wcstoi64_l(const wchar_t *nptr,
9597

9698
if(!negative && (ret>_I64_MAX/base || ret*base>_I64_MAX-v)) {
9799
ret = _I64_MAX;
100+
#ifndef _LIBCNT_
98101
*_errno() = ERANGE;
102+
#endif
99103
} else if(negative && (ret<_I64_MIN/base || ret*base<_I64_MIN-v)) {
100104
ret = _I64_MIN;
105+
#ifndef _LIBCNT_
101106
*_errno() = ERANGE;
107+
#endif
102108
} else
103109
ret = ret*base + v;
104110
}
@@ -129,21 +135,23 @@ unsigned __int64 CDECL _wcstoui64_l(const wchar_t *nptr,
129135
BOOL negative = FALSE;
130136
unsigned __int64 ret = 0;
131137

138+
#ifndef _LIBCNT_
132139
TRACE("(%s %p %d %p)\n", debugstr_w(nptr), endptr, base, locale);
140+
#endif
133141

134142
if (!MSVCRT_CHECK_PMT(nptr != NULL)) return 0;
135143
if (!MSVCRT_CHECK_PMT(base == 0 || base >= 2)) return 0;
136144
if (!MSVCRT_CHECK_PMT(base <= 36)) return 0;
137145

138-
while(isspaceW(*nptr)) nptr++;
146+
while (iswctype((int)*nptr, _SPACE)) nptr++;
139147

140148
if(*nptr == '-') {
141149
negative = TRUE;
142150
nptr++;
143151
} else if(*nptr == '+')
144152
nptr++;
145153

146-
if((base==0 || base==16) && *nptr=='0' && tolowerW(*(nptr+1))=='x') {
154+
if((base==0 || base==16) && *nptr=='0' && towlower(*(nptr+1))=='x') {
147155
base = 16;
148156
nptr += 2;
149157
}
@@ -156,7 +164,7 @@ unsigned __int64 CDECL _wcstoui64_l(const wchar_t *nptr,
156164
}
157165

158166
while(*nptr) {
159-
wchar_t cur = tolowerW(*nptr);
167+
wchar_t cur = towlower(*nptr);
160168
int v;
161169

162170
if(cur>='0' && cur<='9') {
@@ -173,8 +181,10 @@ unsigned __int64 CDECL _wcstoui64_l(const wchar_t *nptr,
173181

174182
if(ret>_UI64_MAX/base || ret*base>_UI64_MAX-v) {
175183
ret = _UI64_MAX;
184+
#ifndef _LIBCNT_
176185
*_errno() = ERANGE;
177-
} else
186+
#endif
187+
} else
178188
ret = ret*base + v;
179189
}
180190

0 commit comments

Comments
 (0)