Module: wine Branch: master Commit: 8f3d869d784753d814a3493d01c3650f45389eda URL: https://source.winehq.org/git/wine.git/?a=commit;h=8f3d869d784753d814a3493d0...
Author: Alexandre Julliard julliard@winehq.org Date: Mon Mar 30 12:09:49 2020 +0200
ntdll: Avoid using atoiW().
Signed-off-by: Alexandre Julliard julliard@winehq.org
---
dlls/ntdll/actctx.c | 4 ++-- dlls/ntdll/ntdll_misc.h | 1 + dlls/ntdll/version.c | 12 ++++++------ 3 files changed, 9 insertions(+), 8 deletions(-)
diff --git a/dlls/ntdll/actctx.c b/dlls/ntdll/actctx.c index cd17c6c135..d53ddf8694 100644 --- a/dlls/ntdll/actctx.c +++ b/dlls/ntdll/actctx.c @@ -3141,10 +3141,10 @@ static WCHAR *lookup_manifest_file( HANDLE dir, struct assembly_identity *ai ) else data_pos = data_len;
tmp = dir_info->FileName + (strchrW(lookup, '*') - lookup); - build = atoiW(tmp); + build = wcstoul( tmp, NULL, 10 ); if (build < min_build) continue; tmp = strchrW(tmp, '.') + 1; - revision = atoiW(tmp); + revision = wcstoul( tmp, NULL, 10 ); if (build == min_build && revision < min_revision) continue; tmp = strchrW(tmp, '_') + 1; tmp = strchrW(tmp, '_') + 1; diff --git a/dlls/ntdll/ntdll_misc.h b/dlls/ntdll/ntdll_misc.h index fe0d1755d0..ccb2e76c20 100644 --- a/dlls/ntdll/ntdll_misc.h +++ b/dlls/ntdll/ntdll_misc.h @@ -301,6 +301,7 @@ ULONG __cdecl NTDLL_wcstoul( LPCWSTR s, LPWSTR *end, INT base ); #define towupper(c) NTDLL_towupper(c) #define wcslwr(s) NTDLL__wcslwr(s) #define wcsupr(s) NTDLL__wcsupr(s) +#define wcstoul(s,e,b) NTDLL_wcstoul(s,e,b)
/* convert from straight ASCII to Unicode without depending on the current codepage */ static inline void ascii_to_unicode( WCHAR *dst, const char *src, size_t len ) diff --git a/dlls/ntdll/version.c b/dlls/ntdll/version.c index 4994dbbb5e..e5fb63e778 100644 --- a/dlls/ntdll/version.c +++ b/dlls/ntdll/version.c @@ -285,9 +285,9 @@ static BOOL get_nt_registry_version( RTL_OSVERSIONINFOEXW *version ) if (p) { *p++ = 0; - version->dwMinorVersion = atoiW( p ); + version->dwMinorVersion = wcstoul( p, NULL, 10 ); } - version->dwMajorVersion = atoiW( str ); + version->dwMajorVersion = wcstoul( str, NULL, 10 ); }
if (version->dwMajorVersion) /* we got the main version, now fetch the other fields */ @@ -302,7 +302,7 @@ static BOOL get_nt_registry_version( RTL_OSVERSIONINFOEXW *version ) { WCHAR *str = (WCHAR *)info->Data; str[info->DataLength / sizeof(WCHAR)] = 0; - version->dwBuildNumber = atoiW( str ); + version->dwBuildNumber = wcstoul( str, NULL, 10 ); }
/* get version description */ @@ -400,7 +400,7 @@ static BOOL get_win9x_registry_version( RTL_OSVERSIONINFOEXW *version ) str[info->DataLength / sizeof(WCHAR)] = 0; p = strchrW( str, '.' ); if (p) *p++ = 0; - version->dwMajorVersion = atoiW( str ); + version->dwMajorVersion = wcstoul( str, NULL, 10 ); if (p) { str = p; @@ -408,9 +408,9 @@ static BOOL get_win9x_registry_version( RTL_OSVERSIONINFOEXW *version ) if (p) { *p++ = 0; - version->dwBuildNumber = atoiW( p ); + version->dwBuildNumber = wcstoul( p, NULL, 10 ); } - version->dwMinorVersion = atoiW( str ); + version->dwMinorVersion = wcstoul( str, NULL, 10 ); } /* build number contains version too on Win9x */ version->dwBuildNumber |= MAKEWORD( version->dwMinorVersion, version->dwMajorVersion ) << 16;