Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 0e05d70

Browse files
pkgwQuLogic
andauthored
Apply suggestions from code review
Co-authored-by: Elliott Sales de Andrade <[email protected]>
1 parent c4bf0ae commit 0e05d70

File tree

2 files changed

+3
-3
lines changed

2 files changed

+3
-3
lines changed

src/_backend_agg.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ RendererAgg::RendererAgg(unsigned int width, unsigned int height, double dpi)
2929
: width(width),
3030
height(height),
3131
dpi(dpi),
32-
NUMBYTES((size_t) width * (size_t) height * 4),
32+
NUMBYTES((size_t)width * (size_t)height * 4),
3333
pixBuffer(NULL),
3434
renderingBuffer(),
3535
alphaBuffer(NULL),

src/_backend_agg_wrapper.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -95,7 +95,7 @@ int PyBufferRegion_get_buffer(PyBufferRegion *self, Py_buffer *buf, int flags)
9595
Py_INCREF(self);
9696
buf->obj = (PyObject *)self;
9797
buf->buf = self->x->get_data();
98-
buf->len = (long) self->x->get_width() * (long) self->x->get_height() * 4;
98+
buf->len = (Py_ssize_t)self->x->get_width() * (Py_ssize_t)self->x->get_height() * 4;
9999
buf->readonly = 0;
100100
buf->format = (char *)"B";
101101
buf->ndim = 3;
@@ -531,7 +531,7 @@ int PyRendererAgg_get_buffer(PyRendererAgg *self, Py_buffer *buf, int flags)
531531
Py_INCREF(self);
532532
buf->obj = (PyObject *)self;
533533
buf->buf = self->x->pixBuffer;
534-
buf->len = (long) self->x->get_width() * (long) self->x->get_height() * 4;
534+
buf->len = (Py_ssize_t)self->x->get_width() * (Py_ssize_t)self->x->get_height() * 4;
535535
buf->readonly = 0;
536536
buf->format = (char *)"B";
537537
buf->ndim = 3;

0 commit comments

Comments
 (0)