Module: wine Branch: master Commit: ce30db504bb61e026736ac0b24ce00ba587044de URL: https://source.winehq.org/git/wine.git/?a=commit;h=ce30db504bb61e026736ac0b2...
Author: Alexandre Julliard julliard@winehq.org Date: Wed Apr 1 10:28:57 2020 +0200
kernel32: Avoid using memrchrW().
Signed-off-by: Alexandre Julliard julliard@winehq.org
---
dlls/kernel32/profile.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/dlls/kernel32/profile.c b/dlls/kernel32/profile.c index e4bd861b14..c7382fd7b3 100644 --- a/dlls/kernel32/profile.c +++ b/dlls/kernel32/profile.c @@ -418,8 +418,8 @@ static PROFILESECTION *PROFILE_Load(HANDLE hFile, ENCODING * pEncoding)
if (*szLineStart == '[') /* section start */ { - const WCHAR * szSectionEnd; - if (!(szSectionEnd = memrchrW( szLineStart, ']', szLineEnd - szLineStart ))) + for (len = szLineEnd - szLineStart; len > 0; len--) if (szLineStart[len - 1] == ']') break; + if (!len) { WARN("Invalid section header at line %d: %s\n", line, debugstr_wn(szLineStart, (int)(szLineEnd - szLineStart)) ); @@ -427,7 +427,7 @@ static PROFILESECTION *PROFILE_Load(HANDLE hFile, ENCODING * pEncoding) else { szLineStart++; - len = (int)(szSectionEnd - szLineStart); + len -= 2; /* no need to allocate +1 for NULL terminating character as * already included in structure */ if (!(section = HeapAlloc( GetProcessHeap(), 0, sizeof(*section) + len * sizeof(WCHAR) )))