Fix almost all compiler warnings

lcd_api: isalpha expects type in so I cast char to int
lcd_api: uint32 in printf where %d instead of %lu
llfs: filter_ok was set but unused so I removed it
tftp: wrong casting char to uint8_t but needed to be cast to const char* instead
This commit is contained in:
2023-12-01 11:31:53 +01:00
parent b06ec97075
commit 97783c69c5
3 changed files with 6 additions and 8 deletions

View File

@@ -100,7 +100,7 @@ void lcd_display_text(const char* text, uint16_t x_pos, uint16_t y_pos, uint32_t
if (tot_length > BSP_LCD_GetXSize()) {
for (unsigned int i = 0; i < (unsigned int)strlen(text); i++) {
if ((x_pos) > BSP_LCD_GetXSize() - (font->Width) * 2) {
if (isalpha(text[i - 1]) && isalpha(text[i])) {
if (isalpha((int)text[i - 1]) && isalpha((int)text[i])) {
BSP_LCD_DisplayChar(x_pos, y_pos, (uint8_t)'-');
} else {
BSP_LCD_DisplayChar(x_pos, y_pos, (uint8_t)text[i]);
@@ -118,7 +118,7 @@ void lcd_display_text(const char* text, uint16_t x_pos, uint16_t y_pos, uint32_t
}
void lcd_draw_raw_img(const void* p_src, uint32_t x_pos, uint32_t y_pos, uint32_t x_size, uint32_t y_size, uint32_t color_mode) {
LOG_INFO(TAG, "Displaying raw image: @x=%d, @y=%d, width=%d, height=%d", x_pos, y_pos, x_size, y_size);
LOG_INFO(TAG, "Displaying raw image: @x=%lu, @y=%lu, width=%lu, height=%lu", x_pos, y_pos, x_size, y_size);
BSP_LCD_SelectLayer(0);
uint32_t address = hLtdcHandler.LayerCfg[1].FBStartAdress + (((BSP_LCD_GetXSize() * y_pos) + x_pos) * (4));
void* p_dst = (void*)address;
@@ -153,13 +153,13 @@ void lcd_draw_raw_img(const void* p_src, uint32_t x_pos, uint32_t y_pos, uint32_
}
void lcd_draw_bmp_img(uint8_t* bmp_buff, uint32_t x_pos, uint32_t y_pos) {
LOG_INFO(TAG, "Displaying BMP image: @x=%d, @y=%d", x_pos, y_pos);
LOG_INFO(TAG, "Displaying BMP image: @x=%lu, @y=%lu", x_pos, y_pos);
BSP_LCD_SelectLayer(0);
BSP_LCD_DrawBitmap(x_pos, y_pos, bmp_buff);
}
void lcd_draw_img_from_fs(const char* name, uint32_t x_pos, uint32_t y_pos) {
LOG_INFO(TAG, "Displaying BMP image %s: @x=%d, @y=%d", name, x_pos, y_pos);
LOG_INFO(TAG, "Displaying BMP image %s: @x=%lu, @y=%lu", name, x_pos, y_pos);
BSP_LCD_SelectLayer(0);
llfs_file_t* file = llfs_file_open(name);
if (file != NULL) {
@@ -212,7 +212,7 @@ lcd_gif_t* lcd_draw_gif(uint8_t* src, size_t size, uint32_t x_pos, uint32_t y_po
// Open the GIF and reset slot values
GIF_begin(&(gif->gif), GIF_PALETTE_RGB888);
if (GIF_openRAM(&(gif->gif), src, (int)size, gif_draw_cb)) {
LOG_INFO(TAG, "Draw GIF: @x=%d, @y=%d with size: %d", x_pos, y_pos, size);
LOG_INFO(TAG, "Draw GIF: @x=%lu, @y=%lu with size: %u", x_pos, y_pos, size);
gif->src = src;
gif->x_pos = x_pos;
gif->y_pos = y_pos;

View File

@@ -109,7 +109,6 @@ llfs_file_t* llfs_file_open(const char* name) {
llfs_file_t* llfs_next_file(void** mem, char* filter) {
struct llfs_data_file* prev_file = (struct llfs_data_file*)*mem;
uint8_t filter_ok = 0;
if (prev_file == NULL) {
prev_file = llfs_root;
@@ -128,7 +127,6 @@ llfs_file_t* llfs_next_file(void** mem, char* filter) {
while (prev_file != NULL) {
if (file_ext_cmp(prev_file->name, filter)) {
filter_ok = 1;
break;
}
prev_file = (struct llfs_data_file*)prev_file->next;

View File

@@ -170,7 +170,7 @@ void tftp_close(void* handle) {
if (handle == &virt_file[VIRT_TEXT_TXT]) {
lcd_clear_images();
lcd_clear_text();
lcd_display_text((uint8_t*)virt_file[VIRT_TEXT_TXT].data, 0, 0, LCD_COLOR_WHITE, LCD_TRANSPARENT, LCD_FONT16);
lcd_display_text((const char*)virt_file[VIRT_TEXT_TXT].data, 0, 0, LCD_COLOR_WHITE, LCD_TRANSPARENT, LCD_FONT16);
}
if (handle == &virt_file[VIRT_INDEX_TXT] || handle == &virt_file[VIRT_IMAGE_BMP]