fix warnings

This commit is contained in:
lixianjing 2021-09-16 16:10:54 +08:00
parent e88a9e3892
commit 79dc535dfe
14 changed files with 16 additions and 17 deletions

View File

@ -8,6 +8,7 @@
* 新demoui增加渐变色按钮示例感谢兆坤提供补丁 * 新demoui增加渐变色按钮示例感谢兆坤提供补丁
* 补充新demoui键盘中文翻译修改kb\_foo样式感谢兆坤提供补丁 * 补充新demoui键盘中文翻译修改kb\_foo样式感谢兆坤提供补丁
* 修复gtest编译警告感谢智明提供补丁 * 修复gtest编译警告感谢智明提供补丁
* 修复编译警告(感谢智明和兆坤提供补丁)
2021/09/14 2021/09/14
* 根据新增接口,完善 object\_array 以及 object\_default感谢雨欣提供补丁 * 根据新增接口,完善 object\_array 以及 object\_default感谢雨欣提供补丁

View File

@ -475,7 +475,7 @@ ret_t csv_file_load_buff(csv_file_t* csv, const char* buff, uint32_t size) {
ret = csv_file_load_input(csv, input) != NULL ? RET_OK : RET_FAIL; ret = csv_file_load_input(csv, input) != NULL ? RET_OK : RET_FAIL;
OBJECT_UNREF(input); OBJECT_UNREF(input);
return RET_OK; return ret;
} }
csv_file_t* csv_file_create_with_buff(const char* buff, uint32_t size, char sep) { csv_file_t* csv_file_create_with_buff(const char* buff, uint32_t size, char sep) {

View File

@ -69,7 +69,7 @@ static ret_t func_iostream_serial_create(fscript_t* fscript, fscript_args_t* arg
value_set_object(result, obj); value_set_object(result, obj);
result->free_handle = TRUE; result->free_handle = TRUE;
tk_iostream_serial_config(obj, baudrate, bytesize, parity, stopbits, flowcontrol); tk_iostream_serial_config(TK_IOSTREAM(obj), baudrate, bytesize, parity, stopbits, flowcontrol);
return RET_OK; return RET_OK;
} }

View File

@ -170,7 +170,7 @@ static inline ret_t fragment_frame_buffer_image_copy(fragment_frame_buffer_t* ff
data = (pixel_t*)bitmap_lock_buffer_for_read(img); data = (pixel_t*)bitmap_lock_buffer_for_read(img);
src_p = data + img->w * src->y + src->x; src_p = data + img->w * src->y + src->x;
for (i = 0; i < dst->h; i++) { for (i = 0; i < (uint32_t)dst->h; i++) {
fragment_frame_buffer_copy_pixel(ffb, x, y + i, img->w, src_p); fragment_frame_buffer_copy_pixel(ffb, x, y + i, img->w, src_p);
src_p += img->w; src_p += img->w;
} }
@ -192,7 +192,7 @@ static inline ret_t fragment_frame_buffer_write_data_fill(fragment_frame_buffer_
uint32_t x = ffb->win.x + ffb->cursor_x; uint32_t x = ffb->win.x + ffb->cursor_x;
uint32_t y = ffb->win.y + ffb->cursor_y; uint32_t y = ffb->win.y + ffb->cursor_y;
for (i = 0; i < ffb->win.h; i++) { for (i = 0; i < (uint32_t)ffb->win.h; i++) {
fragment_frame_buffer_set_pixel_fill(ffb, x, y + i, ffb->win.w, pixel); fragment_frame_buffer_set_pixel_fill(ffb, x, y + i, ffb->win.w, pixel);
} }

View File

@ -74,7 +74,6 @@ static ret_t native_window_raw_set_orientation(native_window_t* win,
lcd_orientation_t old_orientation, lcd_orientation_t old_orientation,
lcd_orientation_t new_orientation) { lcd_orientation_t new_orientation) {
wh_t w, h; wh_t w, h;
ret_t ret = RET_OK;
native_window_info_t info; native_window_info_t info;
native_window_get_info(win, &info); native_window_get_info(win, &info);

View File

@ -41,7 +41,7 @@ static ret_t fs_stat_info_from_stat(fs_stat_info_t* fst, struct _stat64i32* st)
#else #else
static ret_t fs_stat_info_from_stat(fs_stat_info_t* fst, struct stat* st) { static ret_t fs_stat_info_from_stat(fs_stat_info_t* fst, struct stat* st) {
#endif /*WIN32*/ #endif /*WIN32*/
return_value_if_fail(fst != NULL && &st != NULL, RET_BAD_PARAMS); return_value_if_fail(fst != NULL && st != NULL, RET_BAD_PARAMS);
memset(fst, 0x00, sizeof(fs_stat_info_t)); memset(fst, 0x00, sizeof(fs_stat_info_t));
fst->dev = st->st_dev; fst->dev = st->st_dev;

View File

@ -25,5 +25,5 @@ int main(int argc, char* argv[]) {
mbedtls_server_destroy(server); mbedtls_server_destroy(server);
} }
return 0; return ret;
} }

View File

@ -42,7 +42,7 @@ typedef struct _bsvg_header_t {
} bsvg_header_t; } bsvg_header_t;
#pragma pack(pop) #pragma pack(pop)
#define BSVG_MAGIC 0x20181115 #define BSVG_MAGIC 0x20181115u
#define BSVG_MIN_SIZE (sizeof(bsvg_header_t) + sizeof(svg_shape_t)) #define BSVG_MIN_SIZE (sizeof(bsvg_header_t) + sizeof(svg_shape_t))
END_C_DECLS END_C_DECLS

View File

@ -45,7 +45,7 @@ static mem_allocator_lock_t s_lock;
#endif /*ENABLE_MEM_LEAK_CHECK*/ #endif /*ENABLE_MEM_LEAK_CHECK*/
bool_t tk_mem_is_valid_addr(void* addr) { bool_t tk_mem_is_valid_addr(void* addr) {
return ((uint64_t)addr > 0x10000); return ((uintptr_t)addr > 0x10000);
} }
static mem_allocator_t* mem_allocator_get(void) { static mem_allocator_t* mem_allocator_get(void) {

View File

@ -770,12 +770,11 @@ uint64_t object_get_prop_uint64(object_t* obj, const char* name, uint64_t defval
} }
object_t* object_get_child_object(object_t* obj, const char* path, const char** next_path) { object_t* object_get_child_object(object_t* obj, const char* path, const char** next_path) {
return_value_if_fail(obj != NULL && path != NULL && next_path != NULL, RET_BAD_PARAMS); return_value_if_fail(obj != NULL && path != NULL && next_path != NULL, NULL);
const char* p = strchr(path, '.'); const char* p = strchr(path, '.');
if (p != NULL) { if (p != NULL) {
value_t v; value_t v;
int32_t index;
char subname[MAX_PATH + 1]; char subname[MAX_PATH + 1];
tk_strncpy_s(subname, MAX_PATH, path, p - path); tk_strncpy_s(subname, MAX_PATH, path, p - path);

View File

@ -187,7 +187,7 @@ ret_t typed_array_extend(typed_array_t* typed_array, uint32_t capacity) {
uint32_t data_size = typed_array->element_size * typed_array->size; uint32_t data_size = typed_array->element_size * typed_array->size;
uint8_t* data = (uint8_t*)TKMEM_REALLOC(typed_array->data, mem_size); uint8_t* data = (uint8_t*)TKMEM_REALLOC(typed_array->data, mem_size);
return_value_if_fail(data != NULL, RET_OOM); return_value_if_fail(data != NULL, RET_OOM);
ENSURE(((uint64_t)data % 8) == 0); ENSURE(((uintptr_t)data % 8) == 0);
typed_array->data = data; typed_array->data = data;
typed_array->capacity = capacity; typed_array->capacity = capacity;

View File

@ -360,9 +360,9 @@ enum { TK_NAME_LEN = 31, TK_FUNC_NAME_LEN = 63 };
#define M_PI 3.1415926f #define M_PI 3.1415926f
#endif /*M_PI*/ #endif /*M_PI*/
#define TK_INVALID_ID 0 #define TK_INVALID_ID 0u
#define TK_NUM_MAX_LEN 31 #define TK_NUM_MAX_LEN 31u
#define TK_UINT32_MAX 0xffffffff #define TK_UINT32_MAX 0xffffffffu
#define TK_LOCALE_MAGIC "$locale$" #define TK_LOCALE_MAGIC "$locale$"
#define TK_D2R(d) (((d)*M_PI) / 180) #define TK_D2R(d) (((d)*M_PI) / 180)

View File

@ -148,7 +148,7 @@ static bool_t edit_pattern_is_valid_char(widget_t* widget, wchar_t c, wchar_t se
len = pe - ps; len = pe - ps;
/*part 字符超长*/ /*part 字符超长*/
if (len >= get_part_max_len(index)) { if (len >= (int)get_part_max_len(index)) {
if (text->str[cursor] == 0) { if (text->str[cursor] == 0) {
return FALSE; return FALSE;
} else if (text->str[cursor] == sep) { } else if (text->str[cursor] == sep) {

View File

@ -317,7 +317,7 @@ wchar_t** argvw_create(int argc, char* argv[]) {
for (i = 0; i < argc; i++) { for (i = 0; i < argc; i++) {
wstr_set_utf8(&str, argv[i]); wstr_set_utf8(&str, argv[i]);
argvw[i] = wcsdup(str.str); argvw[i] = wcs_dup(str.str);
} }
argvw[i] = NULL; argvw[i] = NULL;