s3:pylibsmb: remove compiler warnings
authorStefan Metzmacher <metze@samba.org>
Fri, 9 Aug 2013 08:15:48 +0000 (10:15 +0200)
committerAndrew Bartlett <abartlet@samba.org>
Mon, 12 Aug 2013 05:25:43 +0000 (17:25 +1200)
Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
source3/libsmb/pylibsmb.c

index ae0d6943d0f1529f265462557af98463ac1221e5..533df67ebb4a13b81291da6980847cdfe98b2b69 100644 (file)
@@ -51,19 +51,20 @@ static PyTypeObject *get_pytype(const char *module, const char *type)
 }
 
 /*
- * We're using "const char **" for keywords,
+ * We're using "const char * const *" for keywords,
  * PyArg_ParseTupleAndKeywords expects a "char **". Confine the
  * inevitable warnings to just one place.
  */
 static int ParseTupleAndKeywords(PyObject *args, PyObject *kw,
-                                const char *format, const char **keywords,
+                                const char *format, const char * const *keywords,
                                 ...)
 {
+       char **_keywords = discard_const_p(char *, keywords);
        va_list a;
        int ret;
        va_start(a, keywords);
        ret = PyArg_VaParseTupleAndKeywords(args, kw, format,
-                                           (char **)keywords, a);
+                                           _keywords, a);
        va_end(a);
        return ret;
 }
@@ -448,7 +449,7 @@ static int py_cli_state_init(struct py_cli_state *self, PyObject *args,
                cli_credentials_get_password(cli_creds),
                0, 0);
        if (!py_tevent_req_wait_exc(self->ev, req)) {
-               return NULL;
+               return -1;
        }
        status = cli_full_connection_recv(req, &self->cli);
        TALLOC_FREE(req);