mirror of
https://gitee.com/zlgopen/awtk.git
synced 2024-11-29 10:38:47 +08:00
fix cppcheck warnings
This commit is contained in:
parent
3a5fc9a0c5
commit
ccf85d76d2
@ -978,7 +978,7 @@ static int text_edit_insert(STB_TEXTEDIT_STRING* str, int pos, STB_TEXTEDIT_CHAR
|
||||
uint32_t i = 0;
|
||||
|
||||
for (i = 0; i < num; i++) {
|
||||
if (i + 1 < num && TWINS_WCHAR_IS_LINE_BREAK(newtext[i], newtext[i + 1])) {
|
||||
if ((i + 1) < num && (TWINS_WCHAR_IS_LINE_BREAK(newtext[i], newtext[i + 1]))) {
|
||||
line_break_num--;
|
||||
i++;
|
||||
} else if (WCHAR_IS_LINE_BREAK(newtext[i])) {
|
||||
|
@ -1243,12 +1243,14 @@ static widget_t* widget_lookup_by_type_all(widget_t* widget, const char* type) {
|
||||
return_value_if_fail(widget != NULL && type != NULL, NULL);
|
||||
|
||||
WIDGET_FOR_EACH_CHILD_BEGIN(widget, iter, i)
|
||||
if (tk_str_eq(iter->vt->type, type)) {
|
||||
if (iter == NULL) {
|
||||
continue;
|
||||
} else if(tk_str_eq(iter->vt->type, type)) {
|
||||
return iter;
|
||||
} else {
|
||||
iter = widget_lookup_by_type_all(iter, type);
|
||||
if (iter != NULL) {
|
||||
return iter;
|
||||
widget_t* ret = widget_lookup_by_type_all(iter, type);
|
||||
if (ret != NULL) {
|
||||
return ret;
|
||||
}
|
||||
}
|
||||
WIDGET_FOR_EACH_CHILD_END();
|
||||
|
@ -386,7 +386,6 @@ static ret_t csv_file_object_exec(tk_object_t* obj, const char* name, const char
|
||||
o->is_dirty = TRUE;
|
||||
} else if (tk_str_ieq(name, TK_OBJECT_CMD_ADD)) {
|
||||
if (args != NULL) {
|
||||
return_value_if_fail(args != NULL, RET_FAIL);
|
||||
ret = csv_file_append_row(o->csv, args) == RET_OK ? RET_ITEMS_CHANGED : RET_FAIL;
|
||||
o->is_dirty = TRUE;
|
||||
} else {
|
||||
|
@ -177,7 +177,7 @@ static ret_t mutable_image_init_impl(widget_t* widget) {
|
||||
image_base_init(widget);
|
||||
mutable_image->timer_id = widget_add_timer(widget, mutable_image_invalidate, 16);
|
||||
|
||||
if (widget->parent != NULL && widget != NULL) {
|
||||
if (widget != NULL && widget->parent != NULL) {
|
||||
mutable_image_on_attach_parent(widget, widget->parent);
|
||||
}
|
||||
return RET_OK;
|
||||
|
@ -3,6 +3,6 @@ import sys
|
||||
sys.path.append("../common")
|
||||
import awtk_files as awtk;
|
||||
|
||||
CPPFLAGS = '-DHAS_STD_MALLOC -DNDEBUG --enable=warning --enable=performance -DWITH_CPPCHECK '
|
||||
CPPFLAGS = '-DHAS_STD_MALLOC -DNDEBUG --enable=warning --enable=performance -DWITH_CPPCHECK --check-level=exhaustive '
|
||||
|
||||
awtk.run('cppcheck', CPPFLAGS, awtk.getCppCheckFiles())
|
||||
|
Loading…
Reference in New Issue
Block a user