From: Francis Deslauriers Date: Wed, 1 May 2019 18:19:05 +0000 (-0400) Subject: Fix: bt2: int-to-pointer-cast warnings in SWIG utils functions X-Git-Tag: v2.0.0-pre5~13 X-Git-Url: http://git.efficios.com/?p=babeltrace.git;a=commitdiff_plain;h=c240a5d83ac59fc4351f7f74f8fe599b1a63abf7 Fix: bt2: int-to-pointer-cast warnings in SWIG utils functions bt2/native_bt_wrap.c: In function ‘bt_py3_component_class_query’: bt2/native_bt_wrap.c:4453:12: warning: cast to pointer from integer of different size [-Wint-to-pointer-cast] *result = (void *) PyLong_AsUnsignedLongLong(py_results_addr); ^ bt2/native_bt_wrap.c: In function ‘bt_py3_component_class_message_iterator_next’: bt2/native_bt_wrap.c:4697:3: warning: cast to pointer from integer of different size [-Wint-to-pointer-cast] (const bt_message *) PyLong_AsUnsignedLongLong( ^ python-plugin-provider.c: In function ‘bt_plugin_from_python_plugin_info’: python-plugin-provider.c:341:18: warning: cast to pointer from integer of different size [-Wint-to-pointer-cast] comp_class = (bt_component_class *) Signed-off-by: Francis Deslauriers Change-Id: I44d15e5d072d993776539eddae5f3e37c6161cac Reviewed-on: https://review.lttng.org/c/babeltrace/+/1162 CI-Build: Francis Deslauriers Reviewed-by: Philippe Proulx --- diff --git a/bindings/python/bt2/bt2/native_bt_component_class.i b/bindings/python/bt2/bt2/native_bt_component_class.i index 47a446de..c71c7d4e 100644 --- a/bindings/python/bt2/bt2/native_bt_component_class.i +++ b/bindings/python/bt2/bt2/native_bt_component_class.i @@ -1276,7 +1276,7 @@ bt_py3_component_class_query( * (PyLong) containing the address of a BT value object (new * reference). */ - *result = (void *) PyLong_AsUnsignedLongLong(py_results_addr); + *result = PyLong_AsVoidPtr(py_results_addr); BT_ASSERT(!PyErr_Occurred()); BT_ASSERT(*result); goto end; @@ -1519,9 +1519,7 @@ bt_py3_component_class_message_iterator_next( * (PyLong) containing the address of a native message * object (which is now ours). */ - msgs[0] = - (const bt_message *) PyLong_AsUnsignedLongLong( - py_method_result); + msgs[0] = PyLong_AsVoidPtr(py_method_result); *count = 1; /* Clear potential overflow error; should never happen */ diff --git a/python-plugin-provider/python-plugin-provider.c b/python-plugin-provider/python-plugin-provider.c index 631a971b..d32ff829 100644 --- a/python-plugin-provider/python-plugin-provider.c +++ b/python-plugin-provider/python-plugin-provider.c @@ -338,8 +338,7 @@ bt_plugin *bt_plugin_from_python_plugin_info(PyObject *plugin_info) PyList_GetItem(py_comp_class_addrs, i); BT_ASSERT(py_comp_class_addr); if (PyLong_Check(py_comp_class_addr)) { - comp_class = (bt_component_class *) - PyLong_AsUnsignedLongLong(py_comp_class_addr); + comp_class = PyLong_AsVoidPtr(py_comp_class_addr); } else { BT_LOGW("Component class address is not an integer in Python plugin info object: " "py-plugin-info-addr=%p, index=%zu",