Skip to content

Commit

Permalink
Fix type in wrappers
Browse files Browse the repository at this point in the history
  • Loading branch information
lamyj committed Apr 14, 2024
1 parent f8cef7c commit 4a64df2
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 9 deletions.
4 changes: 2 additions & 2 deletions wrappers/python/Element.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand All @@ -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();
Expand Down
8 changes: 4 additions & 4 deletions wrappers/python/Value.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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]);
}
Expand Down Expand Up @@ -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();
Expand All @@ -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();
Expand Down Expand Up @@ -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);

Expand Down
2 changes: 1 addition & 1 deletion wrappers/python/Value.h
Original file line number Diff line number Diff line change
Expand Up @@ -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);

Expand Down
4 changes: 2 additions & 2 deletions wrappers/python/Value.txx
Original file line number Diff line number Diff line change
Expand Up @@ -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];
}
Expand Down Expand Up @@ -89,7 +89,7 @@ template<typename T>
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<pybind11::bytes>().ptr(), &raw_buffer, &length);

Expand Down

0 comments on commit 4a64df2

Please sign in to comment.