Alexandre Julliard : msvcrt: Use the msvcrt ctype functions internally.
Alexandre Julliard
julliard at winehq.org
Wed Nov 18 15:48:00 CST 2020
Module: wine
Branch: master
Commit: b7fe06d0fa6dbad7d2c3ae380557adcaa10b89f8
URL: https://source.winehq.org/git/wine.git/?a=commit;h=b7fe06d0fa6dbad7d2c3ae380557adcaa10b89f8
Author: Alexandre Julliard <julliard at winehq.org>
Date: Wed Nov 18 16:03:27 2020 +0100
msvcrt: Use the msvcrt ctype functions internally.
Signed-off-by: Alexandre Julliard <julliard at winehq.org>
---
dlls/msvcrt/ctype.c | 6 +++---
dlls/msvcrt/file.c | 2 +-
dlls/msvcrt/msvcrt.h | 3 +++
dlls/msvcrt/printf.h | 6 +++---
dlls/msvcrt/scanf.h | 7 ++-----
dlls/msvcrt/undname.c | 2 +-
6 files changed, 13 insertions(+), 13 deletions(-)
diff --git a/dlls/msvcrt/ctype.c b/dlls/msvcrt/ctype.c
index 772357826eb..1334a514788 100644
--- a/dlls/msvcrt/ctype.c
+++ b/dlls/msvcrt/ctype.c
@@ -396,7 +396,7 @@ int CDECL MSVCRT_isblank(int c)
*/
int CDECL MSVCRT___isascii(int c)
{
- return isascii((unsigned)c);
+ return ((unsigned)c < 0x80);
}
/*********************************************************************
@@ -421,7 +421,7 @@ int CDECL MSVCRT_iswascii(MSVCRT_wchar_t c)
*/
int CDECL MSVCRT___iscsym(int c)
{
- return (c < 127 && (isalnum(c) || c == '_'));
+ return (c < 127 && (MSVCRT_isalnum(c) || c == '_'));
}
/*********************************************************************
@@ -429,7 +429,7 @@ int CDECL MSVCRT___iscsym(int c)
*/
int CDECL MSVCRT___iscsymf(int c)
{
- return (c < 127 && (isalpha(c) || c == '_'));
+ return (c < 127 && (MSVCRT_isalpha(c) || c == '_'));
}
/*********************************************************************
diff --git a/dlls/msvcrt/file.c b/dlls/msvcrt/file.c
index 9d5f19cfbc0..090aa913589 100644
--- a/dlls/msvcrt/file.c
+++ b/dlls/msvcrt/file.c
@@ -3013,7 +3013,7 @@ int CDECL MSVCRT_stat64(const char* path, struct MSVCRT__stat64 * buf)
Also a letter as first char isn't enough to be classified
as a drive letter
*/
- if (isalpha(*path)&& (*(path+1)==':'))
+ if (MSVCRT_isalpha(*path)&& (*(path+1)==':'))
buf->st_dev = buf->st_rdev = MSVCRT__toupper_l(*path, NULL) - 'A'; /* drive num */
else
buf->st_dev = buf->st_rdev = MSVCRT__getdrive() - 1;
diff --git a/dlls/msvcrt/msvcrt.h b/dlls/msvcrt/msvcrt.h
index 65956c9b2e5..ab5b4c13f85 100644
--- a/dlls/msvcrt/msvcrt.h
+++ b/dlls/msvcrt/msvcrt.h
@@ -1072,6 +1072,9 @@ void* __cdecl MSVCRT_malloc(MSVCRT_size_t);
void* __cdecl MSVCRT_calloc(MSVCRT_size_t,MSVCRT_size_t);
void* __cdecl MSVCRT_realloc(void*,MSVCRT_size_t);
+int __cdecl MSVCRT_isalpha(int c);
+int __cdecl MSVCRT_isdigit(int c);
+int __cdecl MSVCRT_isspace(int c);
int __cdecl MSVCRT_iswalpha(MSVCRT_wint_t);
int __cdecl MSVCRT_iswspace(MSVCRT_wint_t);
int __cdecl MSVCRT_iswdigit(MSVCRT_wint_t);
diff --git a/dlls/msvcrt/printf.h b/dlls/msvcrt/printf.h
index cb83c05ff9f..f8b200c7e54 100644
--- a/dlls/msvcrt/printf.h
+++ b/dlls/msvcrt/printf.h
@@ -57,7 +57,7 @@ static inline const APICHAR* FUNC_NAME(pf_parse_int)(const APICHAR *fmt, int *va
{
*val = 0;
- while(isdigit(*fmt)) {
+ while (*fmt >= '0' && *fmt <= '9') {
*val *= 10;
*val += *fmt++ - '0';
}
@@ -1041,7 +1041,7 @@ int FUNC_NAME(pf_printf)(FUNC_NAME(puts_clbk) pf_puts, void *puts_ctx, const API
flags.LeftAlign = TRUE;
flags.FieldLength = -flags.FieldLength;
}
- } else while(isdigit(*p)) {
+ } else while (*p >= '0' && *p <= '9') {
flags.FieldLength *= 10;
flags.FieldLength += *p++ - '0';
}
@@ -1059,7 +1059,7 @@ int FUNC_NAME(pf_printf)(FUNC_NAME(puts_clbk) pf_puts, void *puts_ctx, const API
i = -1;
flags.Precision = pf_args(args_ctx, i, VT_INT, valist).get_int;
- } else while(isdigit(*p)) {
+ } else while (*p >= '0' && *p <= '9') {
flags.Precision *= 10;
flags.Precision += *p++ - '0';
}
diff --git a/dlls/msvcrt/scanf.h b/dlls/msvcrt/scanf.h
index e1a194e39fa..4750fae0f4a 100644
--- a/dlls/msvcrt/scanf.h
+++ b/dlls/msvcrt/scanf.h
@@ -28,7 +28,6 @@
#define _EOF_ MSVCRT_WEOF
#define _EOF_RET (short)MSVCRT_WEOF
#define _ISSPACE_(c) MSVCRT_iswspace(c)
-#define _ISDIGIT_(c) MSVCRT_iswdigit(c)
#define _WIDE2SUPPORTED_(c) c /* No conversion needed (wide to wide) */
#define _CHAR2SUPPORTED_(c) c /* FIXME: convert char to wide char */
#define _CHAR2DIGIT_(c, base) wchar2digit((c), (base))
@@ -37,8 +36,7 @@
#define _CHAR_ char
#define _EOF_ MSVCRT_EOF
#define _EOF_RET MSVCRT_EOF
-#define _ISSPACE_(c) isspace(c)
-#define _ISDIGIT_(c) isdigit(c)
+#define _ISSPACE_(c) MSVCRT_isspace(c)
#define _WIDE2SUPPORTED_(c) c /* FIXME: convert wide char to char */
#define _CHAR2SUPPORTED_(c) c /* No conversion needed (char to char) */
#define _CHAR2DIGIT_(c, base) char2digit((c), (base))
@@ -260,7 +258,7 @@ _FUNCTION_ {
/* read prefix (if any) */
while (!prefix_finished) {
/* look for width specification */
- while (_ISDIGIT_(*format)) {
+ while (*format >= '0' && *format <= '9') {
width *= 10;
width += *format++ - '0';
}
@@ -721,7 +719,6 @@ _FUNCTION_ {
#undef _EOF_
#undef _EOF_RET
#undef _ISSPACE_
-#undef _ISDIGIT_
#undef _CHAR2SUPPORTED_
#undef _WIDE2SUPPORTED_
#undef _CHAR2DIGIT_
diff --git a/dlls/msvcrt/undname.c b/dlls/msvcrt/undname.c
index 69eef44654e..23317f49605 100644
--- a/dlls/msvcrt/undname.c
+++ b/dlls/msvcrt/undname.c
@@ -857,7 +857,7 @@ static BOOL demangle_datatype(struct parsed_symbol* sym, struct datatype_t* ct,
if (!get_modified_type(ct, sym, pmt_ref, in_args ? dt : 'P', in_args)) goto done;
break;
case 'P': /* Pointer */
- if (isdigit(*sym->current))
+ if (MSVCRT_isdigit(*sym->current))
{
/* FIXME:
* P6 = Function pointer
More information about the wine-cvs
mailing list