Re: Updated profile test

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



"Joshua Thielen" <thielen@netprince.net> wrote:

> Right now wine crashes on some of the NULL parameter cases. Should I go 
> ahead and fix the bugs found by this test, or would someone else like to 
> do this?

Attached patches should fix crashes and slightly improve test error reporting.
Joshua, your test is so comprehensive, that fixing all the bugs it revealed
will require substantial efforts. But except the "Thank you!" I have nothing
to say :-)

-- 
Dmitry.
--- cvs/hq/wine/files/profile.c	Wed Jul  3 15:55:16 2002
+++ wine/files/profile.c	Sat Jul  6 20:41:12 2002
@@ -432,6 +432,9 @@
 void PROFILE_DeleteAllKeys( LPCSTR section_name)
 {
     PROFILESECTION **section= &CurProfile->section;
+
+    if (!section_name) return;
+
     while (*section)
     {
         if ((*section)->name[0] && !strcasecmp( (*section)->name, section_name ))
@@ -606,6 +609,8 @@
     struct stat buf;
     PROFILE *tempProfile;
 
+    if (!filename) return FALSE;
+
     /* First time around */
 
     if(!CurProfile)
@@ -732,7 +737,7 @@
 {
     PROFILEKEY *key;
 
-    if(!buffer) return 0;
+    if (!buffer || !section_name) return 0;
 
     while (section)
     {
@@ -844,6 +849,7 @@
     PROFILEKEY *key = NULL;
 
     if(!buffer) return 0;
+    if (!section) goto out;
 
     if (!def_val) def_val = "";
     if (key_name)
@@ -869,6 +875,7 @@
         }
         return ret;
     }
+out:
     buffer[0] = '\0';
     return 0;
 }
--- cvs/hq/wine/dlls/kernel/tests/profile.c	Sat Jul  6 21:03:52 2002
+++ wine/dlls/kernel/tests/profile.c	Sat Jul  6 21:00:50 2002
@@ -281,7 +281,7 @@
 
         if(!ret) {
             ok(!strcmp(buf, lpszReturnBuffer[i]),
-                "buffer '%s' should be '%s'", buf, lpszReturnBuffer[i]);
+                "case %d: buffer '%s' should be '%s'", i + 1, buf, lpszReturnBuffer[i]);
         } else {
             for(j = 0; j < ret; j++) {
                 if(buf[j] != lpszReturnBuffer[i][j]) {
@@ -290,7 +290,7 @@
                 }
             }
             /* Make sure there is a double null terminator */
-            ok(!buf[j], "case %d: missing double null termination\n", i + 1);
+            ok(!buf[j], "case %d: missing double null termination", i + 1);
          }
     }
     
@@ -434,11 +434,11 @@
                                       params[i].lpFileName);
 
         ok(ret == params[i].ret, 
-            "case %d: ret %ld should be %ld\n", i + 1, ret, params[i].ret);
+            "case %d: ret %ld should be %ld", i + 1, ret, params[i].ret);
 
         if(!ret || ret == -1) {
             ok(!strcmp(buf, lpReturnedString[i]),
-                "buffer '%s' should be '%s'\n", buf, lpReturnedString[i]); 
+                "case %d: buffer '%s' should be '%s'", i + 1, buf, lpReturnedString[i]); 
         } else {
             for(j = 0; j < ret; j++) {
                 if(buf[j] != lpReturnedString[i][j]) {

[Index of Archives]     [Gimp for Windows]     [Red Hat]     [Samba]     [Yosemite Camping]     [Graphics Cards]     [Wine Home]

  Powered by Linux