Alexandre Julliard : shell32:
Fixed handling of null-terminated file list in SHFileOperation.
Alexandre Julliard
julliard at wine.codeweavers.com
Mon Mar 6 12:54:53 CST 2006
Module: wine
Branch: refs/heads/master
Commit: b222001defc8d9db67232aae68f2d3a83c4ecd5d
URL: http://source.winehq.org/git/?p=wine.git;a=commit;h=b222001defc8d9db67232aae68f2d3a83c4ecd5d
Author: Alexandre Julliard <julliard at winehq.org>
Date: Mon Mar 6 16:42:34 2006 +0100
shell32: Fixed handling of null-terminated file list in SHFileOperation.
---
dlls/shell32/shlfileop.c | 28 +++++++++-------------------
1 files changed, 9 insertions(+), 19 deletions(-)
diff --git a/dlls/shell32/shlfileop.c b/dlls/shell32/shlfileop.c
index 18d1133..d6c9159 100644
--- a/dlls/shell32/shlfileop.c
+++ b/dlls/shell32/shlfileop.c
@@ -791,29 +791,19 @@ static DWORD count_wildcard_files(LPCWST
static DWORD count_files(LPCWSTR szFileList)
{
DWORD dwCount = 0;
- LPCWSTR p = szFileList;
- LPCWSTR q = p + 1;
- LPCWSTR str = p;
+ LPCWSTR str = szFileList;
/* test empty list */
- if (!szFileList[0] && !szFileList[1])
- return -1;
-
- /* p,q search: stop when we reach double null terminator */
- while (*p || *q)
- {
- if (!*q)
- {
- if (StrPBrkW(str, wWildcardChars))
- dwCount += count_wildcard_files(str);
- else
- dwCount++;
+ if (!szFileList[0]) return -1;
- str = q + 1;
- }
+ while (*str)
+ {
+ if (StrPBrkW(str, wWildcardChars))
+ dwCount += count_wildcard_files(str);
+ else
+ dwCount++;
- p++;
- q++;
+ str += lstrlenW(str) + 1;
}
return dwCount;
More information about the wine-cvs
mailing list