Skip to content

Commit 94c0924

Browse files
committed
ft2font: Explicitly cast dimensions when creating Python buffer
On WASM, which is wholly 32-bit, casting unsigned int to signed long is a narrowing conversion, which it seems to treat as an error. The Agg buffer cannot be over `(1<<23)` in width or height, so this cast is safe even with the smaller sizes.
1 parent 522c318 commit 94c0924

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

src/_backend_agg_wrapper.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -250,12 +250,12 @@ PYBIND11_MODULE(_backend_agg, m, py::mod_gil_not_used())
250250

251251
.def_buffer([](RendererAgg *renderer) -> py::buffer_info {
252252
std::vector<py::ssize_t> shape {
253-
renderer->get_height(),
254-
renderer->get_width(),
253+
static_cast<py::ssize_t>(renderer->get_height()),
254+
static_cast<py::ssize_t>(renderer->get_width()),
255255
4
256256
};
257257
std::vector<py::ssize_t> strides {
258-
renderer->get_width() * 4,
258+
static_cast<py::ssize_t>(renderer->get_width() * 4),
259259
4,
260260
1
261261
};

0 commit comments

Comments
 (0)