Module: wine Branch: master Commit: 285c5490a4c0ee4a92d042a3e6ab32e6bc14fb49 URL: https://source.winehq.org/git/wine.git/?a=commit;h=285c5490a4c0ee4a92d042a3e...
Author: Alexandre Julliard julliard@winehq.org Date: Tue Mar 31 11:47:47 2020 +0200
ntdll: Use wcsrchr() instead of strrchrW().
Signed-off-by: Alexandre Julliard julliard@winehq.org
---
dlls/ntdll/actctx.c | 4 ++-- dlls/ntdll/loader.c | 16 ++++++++-------- dlls/ntdll/loadorder.c | 6 +++--- dlls/ntdll/nt.c | 2 +- dlls/ntdll/ntdll_misc.h | 1 + dlls/ntdll/path.c | 4 ++-- dlls/ntdll/process.c | 2 +- dlls/ntdll/relay.c | 2 +- dlls/ntdll/version.c | 4 ++-- 9 files changed, 21 insertions(+), 20 deletions(-)
diff --git a/dlls/ntdll/actctx.c b/dlls/ntdll/actctx.c index fce6299446..4d402b5179 100644 --- a/dlls/ntdll/actctx.c +++ b/dlls/ntdll/actctx.c @@ -3235,7 +3235,7 @@ static NTSTATUS lookup_winsxs(struct actctx_loader* acl, struct assembly_identit path[path_us.Length/sizeof(WCHAR)] = '\'; wcscpy( path + path_us.Length/sizeof(WCHAR) + 1, file ); RtlInitUnicodeString( &path_us, path ); - *strrchrW(file, '.') = 0; /* remove .manifest extension */ + *wcsrchr(file, '.') = 0; /* remove .manifest extension */
if (!open_nt_file( &handle, &path_us )) { @@ -4998,7 +4998,7 @@ NTSTATUS WINAPI RtlCreateActivationContext( HANDLE *handle, const void *ptr ) else module = NtCurrentTeb()->Peb->ImageBaseAddress;
if ((status = get_module_filename( module, &dir, 0 ))) goto error; - if ((p = strrchrW( dir.Buffer, '\' ))) p[1] = 0; + if ((p = wcsrchr( dir.Buffer, '\' ))) p[1] = 0; actctx->appdir.info = dir.Buffer; }
diff --git a/dlls/ntdll/loader.c b/dlls/ntdll/loader.c index 7f2a1ac109..30608204fc 100644 --- a/dlls/ntdll/loader.c +++ b/dlls/ntdll/loader.c @@ -1186,7 +1186,7 @@ static WINE_MODREF *alloc_module( HMODULE hModule, const UNICODE_STRING *nt_name wm->ldr.LoadCount = 1;
RtlCreateUnicodeString( &wm->ldr.FullDllName, nt_name->Buffer + 4 /* ??\ prefix */ ); - if ((p = strrchrW( wm->ldr.FullDllName.Buffer, '\' ))) p++; + if ((p = wcsrchr( wm->ldr.FullDllName.Buffer, '\' ))) p++; else p = wm->ldr.FullDllName.Buffer; RtlInitUnicodeString( &wm->ldr.BaseDllName, p );
@@ -1756,7 +1756,7 @@ static BOOL get_builtin_fullname( UNICODE_STRING *nt_name, const UNICODE_STRING ascii_to_unicode( filenameW, filename, len + 1 );
/* check if path can correspond to the dll we have */ - if (path && (p = strrchrW( path->Buffer, '\' ))) + if (path && (p = wcsrchr( path->Buffer, '\' ))) { p++; if (!wcsnicmp( p, filenameW, len ) && (!p[len] || !wcsicmp( p + len, soW ))) @@ -2101,8 +2101,8 @@ static inline const WCHAR *get_module_path_end( const WCHAR *module ) const WCHAR *p; const WCHAR *mod_end = module;
- if ((p = strrchrW( mod_end, '\' ))) mod_end = p; - if ((p = strrchrW( mod_end, '/' ))) mod_end = p; + if ((p = wcsrchr( mod_end, '\' ))) mod_end = p; + if ((p = wcsrchr( mod_end, '/' ))) mod_end = p; if (mod_end == module + 2 && module[1] == ':') mod_end++; if (mod_end == module && module[0] && module[1] == ':') mod_end += 2; return mod_end; @@ -2683,8 +2683,8 @@ static NTSTATUS load_builtin_dll( LPCWSTR load_path, const UNICODE_STRING *nt_na
/* Fix the name in case we have a full path and extension */ name = nt_name->Buffer; - if ((p = strrchrW( name, '\' ))) name = p + 1; - if ((p = strrchrW( name, '/' ))) name = p + 1; + if ((p = wcsrchr( name, '\' ))) name = p + 1; + if ((p = wcsrchr( name, '/' ))) name = p + 1;
TRACE("Trying built-in %s\n", debugstr_w(name));
@@ -2761,7 +2761,7 @@ static NTSTATUS find_actctx_dll( LPCWSTR libname, LPWSTR *fullname ) goto done; }
- if ((p = strrchrW( info->lpAssemblyManifestPath, '\' ))) + if ((p = wcsrchr( info->lpAssemblyManifestPath, '\' ))) { DWORD len, dirlen = info->ulAssemblyDirectoryNameLength / sizeof(WCHAR); p++; @@ -2890,7 +2890,7 @@ static NTSTATUS find_dll_file( const WCHAR *load_path, const WCHAR *libname, con
if (default_ext) /* first append default extension */ { - if (!(ext = strrchrW( libname, '.')) || wcschr( ext, '/' ) || wcschr( ext, '\')) + if (!(ext = wcsrchr( libname, '.')) || wcschr( ext, '/' ) || wcschr( ext, '\')) { if (!(dllname = RtlAllocateHeap( GetProcessHeap(), 0, (strlenW(libname)+strlenW(default_ext)+1) * sizeof(WCHAR)))) diff --git a/dlls/ntdll/loadorder.c b/dlls/ntdll/loadorder.c index 9d3364aa28..f7da2322f7 100644 --- a/dlls/ntdll/loadorder.c +++ b/dlls/ntdll/loadorder.c @@ -79,8 +79,8 @@ static const WCHAR *get_basename( const WCHAR *name ) const WCHAR *ptr;
if (name[0] && name[1] == ':') name += 2; /* strip drive specification */ - if ((ptr = strrchrW( name, '\' ))) name = ptr + 1; - if ((ptr = strrchrW( name, '/' ))) name = ptr + 1; + if ((ptr = wcsrchr( name, '\' ))) name = ptr + 1; + if ((ptr = wcsrchr( name, '/' ))) name = ptr + 1; return name; }
@@ -92,7 +92,7 @@ static const WCHAR *get_basename( const WCHAR *name ) static inline void remove_dll_ext( WCHAR *name ) { static const WCHAR dllW[] = {'.','d','l','l',0}; - WCHAR *p = strrchrW( name, '.' ); + WCHAR *p = wcsrchr( name, '.' );
if (p && !wcsicmp( p, dllW )) *p = 0; } diff --git a/dlls/ntdll/nt.c b/dlls/ntdll/nt.c index 660d5faf54..31f7221625 100644 --- a/dlls/ntdll/nt.c +++ b/dlls/ntdll/nt.c @@ -2673,7 +2673,7 @@ NTSTATUS WINAPI NtQuerySystemInformation( procname[wine_server_reply_size(reply) / sizeof(WCHAR)] = 0;
/* Get only the executable name, not the path */ - if ((exename = strrchrW(procname, '\')) != NULL) exename++; + if ((exename = wcsrchr(procname, '\')) != NULL) exename++; else exename = procname;
wlen = (strlenW(exename) + 1) * sizeof(WCHAR); diff --git a/dlls/ntdll/ntdll_misc.h b/dlls/ntdll/ntdll_misc.h index e7df143cac..baca280587 100644 --- a/dlls/ntdll/ntdll_misc.h +++ b/dlls/ntdll/ntdll_misc.h @@ -306,6 +306,7 @@ int WINAPIV NTDLL_swprintf( WCHAR *str, const WCHAR *format, ... ); #define wcscat(d,s) NTDLL_wcscat(d,s) #define wcschr(s,c) NTDLL_wcschr(s,c) #define wcspbrk(s,a) NTDLL_wcspbrk(s,a) +#define wcsrchr(s,c) NTDLL_wcsrchr(s,c) #define wcstoul(s,e,b) NTDLL_wcstoul(s,e,b)
/* convert from straight ASCII to Unicode without depending on the current codepage */ diff --git a/dlls/ntdll/path.c b/dlls/ntdll/path.c index feb50726f4..19b0f6c065 100644 --- a/dlls/ntdll/path.c +++ b/dlls/ntdll/path.c @@ -364,7 +364,7 @@ NTSTATUS WINAPI RtlDosPathNameToNtPathName_U_WithStatus(const WCHAR *dos_path, U ntpath->Buffer[1] = '?'; /* change \?\ to ??\ */ if (file_part) { - if ((ptr = strrchrW( ntpath->Buffer, '\' )) && ptr[1]) *file_part = ptr + 1; + if ((ptr = wcsrchr( ntpath->Buffer, '\' )) && ptr[1]) *file_part = ptr + 1; else *file_part = NULL; } return STATUS_SUCCESS; @@ -855,7 +855,7 @@ DWORD WINAPI RtlGetFullPathName_U(const WCHAR* name, ULONG size, WCHAR* buffer, }
/* find file part */ - if (file_part && (ptr = strrchrW(buffer, '\')) != NULL && ptr >= buffer + 2 && *++ptr) + if (file_part && (ptr = wcsrchr(buffer, '\')) != NULL && ptr >= buffer + 2 && *++ptr) *file_part = ptr; return reqsize; } diff --git a/dlls/ntdll/process.c b/dlls/ntdll/process.c index 67e7578076..3f54402d46 100644 --- a/dlls/ntdll/process.c +++ b/dlls/ntdll/process.c @@ -1578,7 +1578,7 @@ NTSTATUS restart_process( RTL_USER_PROCESS_PARAMETERS *params, NTSTATUS status )
/* check for .com or .pif extension */ if (status == STATUS_INVALID_IMAGE_NOT_MZ && - (p = strrchrW( params->ImagePathName.Buffer, '.' )) && + (p = wcsrchr( params->ImagePathName.Buffer, '.' )) && (!wcsicmp( p, comW ) || !wcsicmp( p, pifW ))) status = STATUS_INVALID_IMAGE_WIN_16;
diff --git a/dlls/ntdll/relay.c b/dlls/ntdll/relay.c index 278e17dc21..350d96e2ef 100644 --- a/dlls/ntdll/relay.c +++ b/dlls/ntdll/relay.c @@ -223,7 +223,7 @@ static BOOL check_list( const WCHAR *module, int ordinal, const char *func, cons sprintf( ord_str, "%d", ordinal ); for(; *list; list++) { - const WCHAR *p = strrchrW( *list, '.' ); + const WCHAR *p = wcsrchr( *list, '.' ); if (p && p > *list) /* check module and function */ { int len = p - *list; diff --git a/dlls/ntdll/version.c b/dlls/ntdll/version.c index 803973c06e..3eb16a092e 100644 --- a/dlls/ntdll/version.c +++ b/dlls/ntdll/version.c @@ -501,8 +501,8 @@ void version_init(void)
/* open AppDefaults\appname key */
- if ((p = strrchrW( appname, '/' ))) appname = p + 1; - if ((p = strrchrW( appname, '\' ))) appname = p + 1; + if ((p = wcsrchr( appname, '/' ))) appname = p + 1; + if ((p = wcsrchr( appname, '\' ))) appname = p + 1;
wcscpy( appversion, appdefaultsW ); wcscat( appversion, appname );