Zebediah Figura : kernel32/tests: Correctly check for failure from FindFirstFile().

Alexandre Julliard julliard at winehq.org
Wed Feb 3 15:39:27 CST 2021


Module: wine
Branch: master
Commit: f349e567ea5ea6428de3ed49d07d3021cebcfb68
URL:    https://source.winehq.org/git/wine.git/?a=commit;h=f349e567ea5ea6428de3ed49d07d3021cebcfb68

Author: Zebediah Figura <zfigura at codeweavers.com>
Date:   Tue Feb  2 18:17:11 2021 -0600

kernel32/tests: Correctly check for failure from FindFirstFile().

Signed-off-by: Zebediah Figura <z.figura12 at gmail.com>
Signed-off-by: Alexandre Julliard <julliard at winehq.org>

---

 dlls/kernel32/tests/file.c | 35 +++++++++++++++++++----------------
 1 file changed, 19 insertions(+), 16 deletions(-)

diff --git a/dlls/kernel32/tests/file.c b/dlls/kernel32/tests/file.c
index 2814ab194b2..6d2a216e39c 100644
--- a/dlls/kernel32/tests/file.c
+++ b/dlls/kernel32/tests/file.c
@@ -2928,7 +2928,7 @@ static void test_FindFirstFile_wildcards(void)
         {0, "*.. ", ", '.', '..', '..a', '..a.a', '.a', '.a..a', '.a.a', '.aaa', 'a', 'a..a', 'a.a', 'a.a.a', 'aa', 'aaa', 'aaaa'"},
         {1, "*. .", ", '.', '..', 'a', '.a', '..a', 'aa', 'aaa', 'aaaa', '.aaa'"},
         {1, "* ..", ", '.', '..', 'a', '.a', '..a', 'aa', 'aaa', 'aaaa', '.aaa'"},
-        {1, " *..", ", '.aaa'"},
+        {0, " *..", ""},
         {0, "..* ", ", '.', '..', '..a', '..a.a'"},
         {1, "?", ", '.', '..', 'a'"},
         {1, "?.", ", '.', '..', 'a'"},
@@ -2954,23 +2954,26 @@ static void test_FindFirstFile_wildcards(void)
         correct[0] = incorrect[0] = 0;
 
         handle = FindFirstFileA(tests[i].pattern, &find_data);
-        if (handle) do {
-            char* ptr;
-            char quoted[16];
+        if (handle != INVALID_HANDLE_VALUE)
+        {
+            do {
+                char *ptr;
+                char quoted[16];
 
-            sprintf( quoted, ", '%.10s'", find_data.cFileName );
+                sprintf(quoted, ", '%.10s'", find_data.cFileName);
 
-            if ((ptr = strstr(missing, quoted)))
-            {
-                int len = strlen(quoted);
-                while ((ptr[0] = ptr[len]) != 0)
-                    ++ptr;
-                strcat(correct, quoted);
-            }
-            else
-                strcat(incorrect, quoted);
-        } while (FindNextFileA(handle, &find_data));
-        FindClose(handle);
+                if ((ptr = strstr(missing, quoted)))
+                {
+                    int len = strlen(quoted);
+                    while ((ptr[0] = ptr[len]) != 0)
+                        ++ptr;
+                    strcat(correct, quoted);
+                }
+                else
+                    strcat(incorrect, quoted);
+            } while (FindNextFileA(handle, &find_data));
+            FindClose(handle);
+        }
 
         todo_wine_if (tests[i].todo)
         ok(missing[0] == 0 && incorrect[0] == 0,




More information about the wine-cvs mailing list