Alistair Leslie-Hughes : hhctrl.ocx: Simplify extracting the help filename (Coverity).
Alexandre Julliard
julliard at winehq.org
Thu Sep 5 16:54:01 CDT 2019
Module: wine
Branch: master
Commit: ec83f0c53c8630dcbbf917337c82495aaf0946fb
URL: https://source.winehq.org/git/wine.git/?a=commit;h=ec83f0c53c8630dcbbf917337c82495aaf0946fb
Author: Alistair Leslie-Hughes <leslie_alistair at hotmail.com>
Date: Thu Sep 5 00:18:17 2019 +0000
hhctrl.ocx: Simplify extracting the help filename (Coverity).
Signed-off-by: Alistair Leslie-Hughes <leslie_alistair at hotmail.com>
Signed-off-by: Alexandre Julliard <julliard at winehq.org>
---
dlls/hhctrl.ocx/hhctrl.c | 14 +++-----------
1 file changed, 3 insertions(+), 11 deletions(-)
diff --git a/dlls/hhctrl.ocx/hhctrl.c b/dlls/hhctrl.ocx/hhctrl.c
index 6a98ae4..893cdde 100644
--- a/dlls/hhctrl.ocx/hhctrl.c
+++ b/dlls/hhctrl.ocx/hhctrl.c
@@ -99,15 +99,12 @@ static const char *command_to_string(UINT command)
static BOOL resolve_filename(const WCHAR *env_filename, WCHAR *fullname, DWORD buflen, WCHAR **index, WCHAR **window)
{
- const WCHAR *extra;
- WCHAR chm_file[MAX_PATH];
-
static const WCHAR helpW[] = {'\\','h','e','l','p','\\',0};
static const WCHAR delimW[] = {':',':',0};
static const WCHAR delim2W[] = {'>',0};
DWORD env_len;
- WCHAR *filename;
+ WCHAR *filename, *extra;
env_filename = skip_schema(env_filename);
@@ -128,9 +125,7 @@ static BOOL resolve_filename(const WCHAR *env_filename, WCHAR *fullname, DWORD b
extra = wcsstr(filename, delim2W);
if (extra)
{
- memcpy(chm_file, filename, (extra-filename)*sizeof(WCHAR));
- chm_file[extra-filename] = 0;
- filename = chm_file;
+ *extra = 0;
if (window)
*window = strdupW(extra+1);
}
@@ -138,10 +133,7 @@ static BOOL resolve_filename(const WCHAR *env_filename, WCHAR *fullname, DWORD b
extra = wcsstr(filename, delimW);
if (extra)
{
- if (filename != chm_file)
- memcpy(chm_file, filename, (extra-filename)*sizeof(WCHAR));
- chm_file[extra-filename] = 0;
- filename = chm_file;
+ *extra = 0;
if (index)
*index = strdupW(extra+2);
}
More information about the wine-cvs
mailing list