]> git.ipfire.org Git - thirdparty/samba.git/commitdiff
pylibsmb: fix cast warnings in Python method definitions
authorDmitry Antipov <dantipov@cloudlinux.com>
Wed, 8 Feb 2023 09:03:16 +0000 (12:03 +0300)
committerDouglas Bagnall <dbagnall@samba.org>
Wed, 12 Mar 2025 03:38:34 +0000 (03:38 +0000)
Fix the following cast warnings in Python method definitions:

../../source3/libsmb/pylibsmb.c:1867:28: warning: cast between incompatible
function types from ‘PyObject * (*)(struct py_cli_notify_state *, PyObject *,
PyObject *)’ {aka ‘struct _object * (*)(struct py_cli_notify_state *, struct
_object *, struct _object *)’} to ‘PyObject * (*)(PyObject *, PyObject *)’
{aka ‘struct _object * (*)(struct _object *, struct _object *)’}
[-Wcast-function-type]
 1867 |                 .ml_meth = (PyCFunction)py_cli_notify_get_changes,
      |                            ^

../../source3/libsmb/pylibsmb.c:2661:11: warning: cast between incompatible
function types from ‘PyObject * (*)(struct py_cli_state *, PyObject *,
PyObject *)’ {aka ‘struct _object * (*)(struct py_cli_state *, struct
_object *, struct _object *)’} to ‘PyObject * (*)(PyObject *, PyObject *)’
{aka ‘struct _object * (*)(struct _object *, struct _object *)’}
[-Wcast-function-type]
 2661 |           (PyCFunction)py_cli_fsctl,
      |           ^

Signed-off-by: Dmitry Antipov <dantipov@cloudlinux.com>
Reviewed-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
source3/libsmb/pylibsmb.c

index 97ae69ef50e779989c26b588de6746adafa20792..19e6f4e717f7a8f54aeb0a47f798dc18478bf601 100644 (file)
@@ -2111,7 +2111,8 @@ static PyObject *py_cli_notify_get_changes(struct py_cli_notify_state *self,
 static PyMethodDef py_cli_notify_state_methods[] = {
        {
                .ml_name = "get_changes",
-               .ml_meth = (PyCFunction)py_cli_notify_get_changes,
+               .ml_meth = (PY_DISCARD_FUNC_SIG(PyCFunction,
+                           py_cli_notify_get_changes)),
                .ml_flags = METH_VARARGS|METH_KEYWORDS,
                .ml_doc  = "Wait for change notifications: \n"
                           "N.get_changes(wait=BOOLEAN) -> "
@@ -3122,7 +3123,7 @@ static PyMethodDef py_cli_state_methods[] = {
          "smb1_stat(path) -> stat info",
        },
        { "fsctl",
-         (PyCFunction)py_cli_fsctl,
+         PY_DISCARD_FUNC_SIG(PyCFunction, py_cli_fsctl),
          METH_VARARGS|METH_KEYWORDS,
          "fsctl(fnum, ctl_code, in_bytes, max_out) -> out_bytes",
        },