s4:pyregistry: PyArg_ParseTuple("z#") requires an 'int' argument instead of 'size_t'
authorStefan Metzmacher <metze@samba.org>
Mon, 8 Aug 2011 12:30:00 +0000 (14:30 +0200)
committerStefan Metzmacher <metze@samba.org>
Mon, 8 Aug 2011 14:45:27 +0000 (16:45 +0200)
If we pass variables by reference we don't get implicit type casting.

metze

source4/lib/registry/pyregistry.c

index 5719bbd11516b53882f90b9dadcc267e82538a1f..a3317c73badf89bb8cd528791a409e9d09b32158 100644 (file)
@@ -212,11 +212,14 @@ static PyObject *py_hive_key_set_value(PyObject *self, PyObject *args)
        char *name;
        uint32_t type;
        DATA_BLOB value;
+       int value_length = 0;
        WERROR result;
        struct hive_key *key = PyHiveKey_AsHiveKey(self);
 
-       if (!PyArg_ParseTuple(args, "siz#", &name, &type, &value.data, &value.length))
+       if (!PyArg_ParseTuple(args, "siz#", &name, &type, &value.data, &value_length)) {
                return NULL;
+       }
+       value.length = value_length;
 
        if (value.data != NULL)
                result = hive_key_set_value(key, name, type, value);