From: Arnaud Giersch Date: Fri, 27 Dec 2019 21:52:03 +0000 (+0100) Subject: [sonar] Constify pointer and reference parameters in src/bindings/. X-Git-Tag: v3.25~204 X-Git-Url: http://bilbo.iut-bm.univ-fcomte.fr/pub/gitweb/simgrid.git/commitdiff_plain/1fe6b9bc2572a0f781ff46643270e13ff5003d42 [sonar] Constify pointer and reference parameters in src/bindings/. --- diff --git a/src/bindings/java/jmsg_process.cpp b/src/bindings/java/jmsg_process.cpp index d5fc013cad..cfb82d645a 100644 --- a/src/bindings/java/jmsg_process.cpp +++ b/src/bindings/java/jmsg_process.cpp @@ -22,7 +22,7 @@ jfieldID jprocess_field_Process_name; jfieldID jprocess_field_Process_pid; jfieldID jprocess_field_Process_ppid; -jobject jprocess_from_native(msg_process_t process) +jobject jprocess_from_native(const simgrid::s4u::Actor* process) { const simgrid::kernel::context::JavaContext* context = static_cast(process->get_impl()->context_.get()); diff --git a/src/bindings/java/jmsg_process.h b/src/bindings/java/jmsg_process.h index 06b38dcc46..174cb087fa 100644 --- a/src/bindings/java/jmsg_process.h +++ b/src/bindings/java/jmsg_process.h @@ -36,7 +36,7 @@ void jprocess_unref(jobject jprocess, JNIEnv* env); void jprocess_bind(jobject jprocess, msg_process_t process, JNIEnv* env); /** Extract the java instance from the native one */ -jobject jprocess_from_native(msg_process_t process); +jobject jprocess_from_native(const simgrid::s4u::Actor* process); /** Extract the native instance from the java one */ msg_process_t jprocess_to_native(jobject jprocess, JNIEnv* env); diff --git a/src/bindings/python/simgrid_python.cpp b/src/bindings/python/simgrid_python.cpp index 533d61f465..1f3acfd8b4 100644 --- a/src/bindings/python/simgrid_python.cpp +++ b/src/bindings/python/simgrid_python.cpp @@ -161,7 +161,7 @@ PYBIND11_MODULE(simgrid, m) .def_property("pstate", &Host::get_pstate, &Host::set_pstate, "The current pstate") .def("current", &Host::current, "Retrieves the host on which the running actor is located, see :cpp:func:`simgrid::s4u::Host::current()`") - .def_property_readonly("name", [](Host* self) -> const std::string { + .def_property_readonly("name", [](const Host* self) -> const std::string { return std::string(self->get_name().c_str()); // Convert from xbt::string because of MC }, "The name of this host") .def_property_readonly("load", &Host::get_load, @@ -171,11 +171,11 @@ PYBIND11_MODULE(simgrid, m) /* Class Mailbox */ py::class_>(m, "Mailbox", "Mailbox, see :ref:`class s4u::Mailbox `") - .def("__str__", [](Mailbox* self) -> const std::string { + .def("__str__", [](const Mailbox* self) -> const std::string { return std::string("Mailbox(") + self->get_cname() + ")"; }, "Textual representation of the Mailbox`") .def("by_name", &Mailbox::by_name, "Retrieve a Mailbox from its name, see :cpp:func:`simgrid::s4u::Mailbox::by_name()`") - .def_property_readonly("name", [](Mailbox* self) -> const std::string { + .def_property_readonly("name", [](const Mailbox* self) -> const std::string { return std::string(self->get_name().c_str()); // Convert from xbt::string because of MC }, "The name of that mailbox, see :cpp:func:`simgrid::s4u::Mailbox::get_name()`") .def("put", [](Mailbox* self, py::object data, int size) {