[78952] branches/gsoc11-rev-upgrade/base/src/registry2.0/file.c

cal at macports.org cal at macports.org
Fri May 27 16:10:57 PDT 2011


Revision: 78952
          http://trac.macports.org/changeset/78952
Author:   cal at macports.org
Date:     2011-05-27 16:10:57 -0700 (Fri, 27 May 2011)
Log Message:
-----------
rev-upgrade: Fixed a SIGSEGV and further potential errors

Modified Paths:
--------------
    branches/gsoc11-rev-upgrade/base/src/registry2.0/file.c

Modified: branches/gsoc11-rev-upgrade/base/src/registry2.0/file.c
===================================================================
--- branches/gsoc11-rev-upgrade/base/src/registry2.0/file.c	2011-05-27 23:06:35 UTC (rev 78951)
+++ branches/gsoc11-rev-upgrade/base/src/registry2.0/file.c	2011-05-27 23:10:57 UTC (rev 78952)
@@ -177,7 +177,6 @@
 
                 if (strategies[strat_index].strategy != reg_strategy_null) {
                     /* this key must also have a value */
-                    i++;
 
                     if (Tcl_GetStringFromObj(objv[i], &val_length) == NULL
                             || val_length == 0) {
@@ -185,10 +184,11 @@
                                 "search ?key ?options? value ...?");
                         return TCL_ERROR;
                     }
+
+                    i++;
                 }
             } else {
                 /* this key must also have a value */
-                i++;
 
                 if (Tcl_GetStringFromObj(objv[i], &val_length) == NULL
                         || val_length == 0) {
@@ -196,6 +196,8 @@
                             "search ?key ?options? value ...?");
                     return TCL_ERROR;
                 }
+
+                i++;
             }
 
             key_count++;
@@ -226,7 +228,11 @@
                 strats[j] = reg_strategy_exact;
             }
 
-            vals[j] = Tcl_GetString(objv[i++]);
+            if (strats[j] != reg_strategy_null) {
+                vals[j] = Tcl_GetString(objv[i++]);
+            } else {
+                vals[j] = NULL;
+            }
         }
         file_count = reg_file_search(reg, keys, vals, strats, key_count,
                 &files, &error);
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.macosforge.org/pipermail/macports-changes/attachments/20110527/15459a87/attachment-0001.html>


More information about the macports-changes mailing list