Fix: bt2: int-to-pointer-cast warnings in SWIG utils functions
authorFrancis Deslauriers <francis.deslauriers@efficios.com>
Wed, 1 May 2019 18:19:05 +0000 (14:19 -0400)
committerJérémie Galarneau <jeremie.galarneau@efficios.com>
Fri, 3 May 2019 22:19:40 +0000 (18:19 -0400)
  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 <francis.deslauriers@efficios.com>
Change-Id: I44d15e5d072d993776539eddae5f3e37c6161cac
Reviewed-on: https://review.lttng.org/c/babeltrace/+/1162
CI-Build: Francis Deslauriers <francis.deslauriers@efficios.com>
Reviewed-by: Philippe Proulx <eeppeliteloop@gmail.com>
bindings/python/bt2/bt2/native_bt_component_class.i
python-plugin-provider/python-plugin-provider.c

index 47a446dec93324157e5b14a092104eade4dd36c0..c71c7d4e79f992fcd76535d90656f7197b6479ce 100644 (file)
@@ -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 */
index 631a971b1287eeade67e59d63be665c6098dfdb1..d32ff8290e929fbe6f066e4d28b2d31a94599092 100644 (file)
@@ -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",
This page took 0.02657 seconds and 4 git commands to generate.