allocator/shm: Cast int to size_t to avoid warning 53/280253/1
authorSeunghun Lee <shiin.lee@samsung.com>
Thu, 25 Aug 2022 09:08:32 +0000 (18:08 +0900)
committerTizen Window System <tizen.windowsystem@gmail.com>
Fri, 26 Aug 2022 01:19:20 +0000 (10:19 +0900)
Change-Id: I1b5f9fefb99222d7f150743acd5c03b8a1e9e12c

src/allocator/shm.c

index 3fad474..96a0210 100644 (file)
@@ -128,7 +128,7 @@ shm_allocator_create_buffer(struct ds_allocator *ds_allocator,
         int width, int height, uint32_t format)
 {
     struct ds_shm_buffer *buffer;
-    int bytes_per_pixel, stride;
+    size_t bytes_per_pixel, stride;
 
     buffer = calloc(1, sizeof *buffer);
     if (!buffer)
@@ -138,8 +138,8 @@ shm_allocator_create_buffer(struct ds_allocator *ds_allocator,
 
     // FIXME
     bytes_per_pixel = 4;
-    stride = width * bytes_per_pixel;
-    buffer->size = stride * height;
+    stride = (size_t)width * bytes_per_pixel;
+    buffer->size = stride * (size_t)height;
     buffer->shm.fd = allocate_shm_file(buffer->size);
     if (buffer->shm.fd < 0) {
         free(buffer);