pool-buffer: Fix type conversion issues - wmenu - 🔧 fork of wmenu
(HTM) git clone git@git.drkhsh.at/wmenu.git
(DIR) Log
(DIR) Files
(DIR) Refs
(DIR) README
(DIR) LICENSE
---
(DIR) commit d139ebae8fd3d545f586470ff04008f311e47c12
(DIR) parent 69a7078e019261b26c31b61724a0f3bc517ab624
(HTM) Author: adnano <me@adnano.co>
Date: Thu, 28 Dec 2023 11:59:02 -0500
pool-buffer: Fix type conversion issues
Diffstat:
M pool-buffer.c | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)
---
(DIR) diff --git a/pool-buffer.c b/pool-buffer.c
@@ -68,19 +68,19 @@ static const struct wl_buffer_listener buffer_listener = {
static struct pool_buffer *create_buffer(struct wl_shm *shm,
struct pool_buffer *buf, int32_t width, int32_t height,
int32_t scale, uint32_t format) {
- uint32_t stride = width * scale * 4;
- size_t size = stride * height * scale;
+ int32_t stride = width * scale * 4;
+ int32_t size = stride * height * scale;
int fd = create_shm_file(size);
assert(fd != -1);
- void *data = mmap(NULL, size, PROT_READ | PROT_WRITE, MAP_SHARED, fd, 0);
+ void *data = mmap(NULL, (size_t)size, PROT_READ | PROT_WRITE, MAP_SHARED, fd, 0);
struct wl_shm_pool *pool = wl_shm_create_pool(shm, fd, size);
buf->buffer = wl_shm_pool_create_buffer(pool, 0,
width * scale, height * scale, stride, format);
wl_shm_pool_destroy(pool);
close(fd);
- buf->size = size;
+ buf->size = (size_t)size;
buf->width = width;
buf->height = height;
buf->scale = scale;