From 3b73bc8bce5a5d7e913e24bf83d0b989ed92c031 Mon Sep 17 00:00:00 2001 From: Andrew Cassidy Date: Sun, 10 Apr 2022 01:06:25 -0700 Subject: [PATCH] use Py_ssize_t to make msvc happy --- quicktex/_bindings.h | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/quicktex/_bindings.h b/quicktex/_bindings.h index ad160fc..11ca831 100644 --- a/quicktex/_bindings.h +++ b/quicktex/_bindings.h @@ -96,9 +96,9 @@ template T BufferToTexture(py::buffer buf, int width, int height) { auto dst_size = output.NBytes(); if (info.format != py::format_descriptor::format()) throw std::runtime_error("Incompatible format in python buffer: expected a byte array."); - if (info.size < (ssize_t)dst_size) std::runtime_error("Incompatible format in python buffer: Input data is smaller than texture size."); + if (info.size < (Py_ssize_t)dst_size) std::runtime_error("Incompatible format in python buffer: Input data is smaller than texture size."); if (info.ndim == 1) { - if (info.shape[0] < (ssize_t)dst_size) throw std::runtime_error("Incompatible format in python buffer: 1-D buffer has incorrect length."); + if (info.shape[0] < (Py_ssize_t)dst_size) throw std::runtime_error("Incompatible format in python buffer: 1-D buffer has incorrect length."); if (info.strides[0] != 1) throw std::runtime_error("Incompatible format in python buffer: 1-D buffer is not contiguous."); } else { throw std::runtime_error("Incompatible format in python buffer: Incorrect number of dimensions."); @@ -115,9 +115,9 @@ template T BufferToPOD(py::buffer buf) { auto info = buf.request(false); if (info.format != py::format_descriptor::format()) throw std::runtime_error("Incompatible format in python buffer: expected a byte array."); - if (info.size < (ssize_t)sizeof(T)) std::runtime_error("Incompatible format in python buffer: Input data is smaller than texture size."); + if (info.size < (Py_ssize_t)sizeof(T)) std::runtime_error("Incompatible format in python buffer: Input data is smaller than texture size."); if (info.ndim == 1) { - if (info.shape[0] < (ssize_t)sizeof(T)) throw std::runtime_error("Incompatible format in python buffer: 1-D buffer has incorrect length."); + if (info.shape[0] < (Py_ssize_t)sizeof(T)) throw std::runtime_error("Incompatible format in python buffer: 1-D buffer has incorrect length."); if (info.strides[0] != 1) throw std::runtime_error("Incompatible format in python buffer: 1-D buffer is not contiguous."); } else { throw std::runtime_error("Incompatible format in python buffer: Incorrect number of dimensions.");