perl: Fix $h->value_type and $h->value_value methods.
authorRichard Jones <rjones@redhat.com>
Thu, 25 Mar 2010 11:57:35 +0000 (11:57 +0000)
committerRichard Jones <rjones@redhat.com>
Thu, 25 Mar 2010 11:59:06 +0000 (11:59 +0000)
These were passing the type & len arguments the wrong way round
to the C function, resulting in data corruption in the returned
values.

generator/generator.ml

index d7b9875..230b66b 100755 (executable)
@@ -2415,7 +2415,7 @@ DESTROY (h)
             pr "      size_t len;\n";
             pr "      hive_type type;\n";
             pr " PPCODE:\n";
             pr "      size_t len;\n";
             pr "      hive_type type;\n";
             pr " PPCODE:\n";
-             pr "      r = hivex_%s (%s, &len, &type);\n"
+             pr "      r = hivex_%s (%s, &type, &len);\n"
               name (String.concat ", " c_params);
             free_args ();
              pr "      if (r == -1)\n";
               name (String.concat ", " c_params);
             free_args ();
              pr "      if (r == -1)\n";
@@ -2431,7 +2431,7 @@ DESTROY (h)
             pr "      size_t len;\n";
             pr "      hive_type type;\n";
             pr " PPCODE:\n";
             pr "      size_t len;\n";
             pr "      hive_type type;\n";
             pr " PPCODE:\n";
-             pr "      r = hivex_%s (%s, &len, &type);\n"
+             pr "      r = hivex_%s (%s, &type, &len);\n"
               name (String.concat ", " c_params);
             free_args ();
              pr "      if (r == NULL)\n";
               name (String.concat ", " c_params);
             free_args ();
              pr "      if (r == NULL)\n";