From 4a64df2c2a38a2f7dc9be2c2732b82a6f38496e8 Mon Sep 17 00:00:00 2001 From: Julien Lamy Date: Sun, 14 Apr 2024 08:56:06 +0200 Subject: [PATCH] Fix type in wrappers --- wrappers/python/Element.cpp | 4 ++-- wrappers/python/Value.cpp | 8 ++++---- wrappers/python/Value.h | 2 +- wrappers/python/Value.txx | 4 ++-- 4 files changed, 9 insertions(+), 9 deletions(-) diff --git a/wrappers/python/Element.cpp b/wrappers/python/Element.cpp index 3da89dd5..09feaf04 100644 --- a/wrappers/python/Element.cpp +++ b/wrappers/python/Element.cpp @@ -67,7 +67,7 @@ void wrap_Element(pybind11::module & m) .def("__len__", &Element::size) .def("clear", &Element::clear) .def( - "__getitem__", [](Element const & self, ssize_t index) { + "__getitem__", [](Element const & self, pybind11::ssize_t index) { if(index < 0) { index += self.size(); @@ -86,7 +86,7 @@ void wrap_Element(pybind11::module & m) GetSlice(self.size(), slice_), self.get_value()); }) .def( - "__setitem__", [](Element & self, ssize_t index, object item) { + "__setitem__", [](Element & self, pybind11::ssize_t index, object item) { if(index < 0) { index += self.size(); diff --git a/wrappers/python/Value.cpp b/wrappers/python/Value.cpp index 7a44c8e1..803f495b 100644 --- a/wrappers/python/Value.cpp +++ b/wrappers/python/Value.cpp @@ -55,7 +55,7 @@ ::operator()(odil::Value::Strings const & value) const { result_type result(this->slice_length); std::size_t d = 0; - for(ssize_t s = this->start; s != this->stop; s += this->step) + for(pybind11::size_t s = this->start; s != this->stop; s += this->step) { result[d++] = pybind11::bytes(value[s]); } @@ -139,7 +139,7 @@ void wrap_Value(pybind11::module & m) .def("clear", &Value::clear) .def("__len__", &Value::size) .def( - "__getitem__", [](Value const & self, ssize_t index) { + "__getitem__", [](Value const & self, pybind11::ssize_t index) { if(index < 0) { index += self.size(); @@ -157,7 +157,7 @@ void wrap_Value(pybind11::module & m) return apply_visitor(GetSlice(self.size(), slice_), self); }) .def( - "__setitem__", [](Value & self, ssize_t index, object item) { + "__setitem__", [](Value & self, pybind11::size_t index, object item) { if(index < 0) { index += self.size(); @@ -359,7 +359,7 @@ void wrap_Value(pybind11::module & m) }, [](tuple pickled) { char * buffer; - ssize_t length; + pybind11::ssize_t length; PYBIND11_BYTES_AS_STRING_AND_SIZE( pickled[0].ptr(), &buffer, &length); diff --git a/wrappers/python/Value.h b/wrappers/python/Value.h index dfe47144..a97f26ce 100644 --- a/wrappers/python/Value.h +++ b/wrappers/python/Value.h @@ -39,7 +39,7 @@ struct GetSlice { using result_type = pybind11::list; - ssize_t start, stop, step, slice_length; + pybind11::ssize_t start, stop, step, slice_length; GetSlice(std::size_t size, pybind11::slice slice); diff --git a/wrappers/python/Value.txx b/wrappers/python/Value.txx index 07b99174..7e7b00fb 100644 --- a/wrappers/python/Value.txx +++ b/wrappers/python/Value.txx @@ -37,7 +37,7 @@ GetSlice { result_type result(this->slice_length); std::size_t d = 0; - for(ssize_t s = this->start; s != this->stop; s += this->step) + for(pybind11::ssize_t s = this->start; s != this->stop; s += this->step) { result[d++] = value[s]; } @@ -89,7 +89,7 @@ template T unpickle_pod_container(pybind11::tuple pickled) { char * raw_buffer; - ssize_t length; + pybind11::ssize_t length; PYBIND11_BYTES_AS_STRING_AND_SIZE( pickled[0].cast().ptr(), &raw_buffer, &length);