From 171cd5391533a34994efeae590f53183bb2cf510 Mon Sep 17 00:00:00 2001 From: chenghongyao <1253146300@qq.com> Date: Sun, 15 Aug 2021 12:52:34 +0800 Subject: [PATCH] fix data length overflow --- lvgl_tft/st7789.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/lvgl_tft/st7789.c b/lvgl_tft/st7789.c index 962eb44..3e47a59 100644 --- a/lvgl_tft/st7789.c +++ b/lvgl_tft/st7789.c @@ -35,7 +35,7 @@ typedef struct { **********************/ static void st7789_set_orientation(uint8_t orientation); -static void st7789_send_color(void *data, uint16_t length); +static void st7789_send_color(void *data, size_t length); /********************** * STATIC VARIABLES @@ -167,7 +167,7 @@ void st7789_flush(lv_disp_drv_t * drv, const lv_area_t * area, lv_color_t * colo /*Memory write*/ st7789_send_cmd(ST7789_RAMWR); - uint32_t size = lv_area_get_width(area) * lv_area_get_height(area); + size_t size = (size_t)lv_area_get_width(area) * (size_t)lv_area_get_height(area); st7789_send_color((void*)color_map, size * 2); @@ -190,7 +190,7 @@ void st7789_send_data(void * data, uint16_t length) disp_spi_send_data(data, length); } -static void st7789_send_color(void * data, uint16_t length) +static void st7789_send_color(void * data, size_t length) { disp_wait_for_pending_transactions(); gpio_set_level(ST7789_DC, 1);