Skip to content

Commit

Permalink
refactor: clear compiler warnings
Browse files Browse the repository at this point in the history
  • Loading branch information
lc-soft committed Dec 10, 2023
1 parent a1f45b7 commit 53044f2
Show file tree
Hide file tree
Showing 8 changed files with 374 additions and 363 deletions.
8 changes: 5 additions & 3 deletions .github/workflows/ccpp.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,9 @@ jobs:

- name: Install tools
if: runner.os == 'Linux'
run: sudo apt install debhelper lcov valgrind -yy
run: |
sudo apt-get update --fix-missing
sudo apt-get install debhelper lcov valgrind -yy
- name: Configure for coverage mode
if: runner.os == 'Linux'
Expand Down Expand Up @@ -98,7 +100,7 @@ jobs:
xmake package
xmake install -o dist/lcui-package
- name: Package exmaples
- name: Package examples
run: |
cd examples
xmake -P . -v -y
Expand All @@ -122,7 +124,7 @@ jobs:
uses: actions/cache@v3
with:
path: ~/.xmake/.cache/packages
key: ${{ runner.os }}-xmake-pacages
key: ${{ runner.os }}-xmake-packages

release:
if: startsWith(github.ref, 'refs/tags/v')
Expand Down
2 changes: 1 addition & 1 deletion examples/fabric/xmake.lua
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
add_requires("cairo 1.17.6")
add_requires("cairo")

target("fabric")
set_kind("binary")
Expand Down
11 changes: 9 additions & 2 deletions lib/css/src/library.c
Original file line number Diff line number Diff line change
Expand Up @@ -254,7 +254,7 @@ static css_style_group_t *css_style_group_create(void)
static css_style_decl_t *css_find_style_store(css_selector_t *selector,
const char *space)
{
int i, right;
int i, right, len;
css_style_link_t *link;
css_style_rule_t *snode;
css_style_link_group_t *slg;
Expand Down Expand Up @@ -296,8 +296,15 @@ static css_style_decl_t *css_find_style_store(css_selector_t *selector,
strcpy(fullname, buf);
} else {
strcpy(fullname, buf);
snprintf(buf, CSS_SELECTOR_MAX_LEN, "%s %s",
len = snprintf(buf, CSS_SELECTOR_MAX_LEN, "%s %s",
sn->fullname, fullname);
if (len < 0) {
logger_error("[css-library] %s: "
"selector(%s...) too long\n",
space, fullname);
return NULL;
}
buf[len] = 0;
}
/* 如果有上一级的父链接记录,则将当前链接添加进去 */
if (parents) {
Expand Down
2 changes: 1 addition & 1 deletion lib/css/tests/test_css_computed.c
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ static void check_length(const char *str, css_numeric_value_t actual,
ctest_equal_int(str, (int)actual, (int)expected);
}

static test_button_focus_style(void)
static void test_button_focus_style(void)
{
css_selector_t *selector;
css_style_decl_t *result;
Expand Down
16 changes: 8 additions & 8 deletions lib/i18n/tests/test.c
Original file line number Diff line number Diff line change
Expand Up @@ -22,29 +22,29 @@ void test_i18n(void)

i18n_change_language(L"en");

ctest_equal_bool("i18n_translate(L\"name\") == L\"English\")",
ctest_equal_bool("en: i18n_translate(L\"name\") == L\"English\")",
wcscmp(i18n_translate(L"name"), L"English") == 0,
true);

ctest_equal_bool("i18n_translate(L\"button.ok\") == L\"Ok\")",
ctest_equal_bool("en: i18n_translate(L\"button.ok\") == L\"Ok\")",
wcscmp(i18n_translate(L"button.ok"), L"Ok") == 0,
true);

ctest_equal_bool("i18n_translate(L\"button.notfound\") == NULL)",
ctest_equal_bool("en: i18n_translate(L\"button.notfound\") == NULL)",
i18n_translate(L"button.notfound")== NULL,
true);

i18n_change_language(L"zh-CN");

ctest_equal_bool("i18n_translate(L\"name\") == L\"中文\")",
wcscmp(i18n_translate(L"name"), L"中文") == 0,
ctest_equal_bool("zh-CN: i18n_translate(L\"name\")",
wcscmp(i18n_translate(L"name"), L"\u4E2D\u6587") == 0,
true);

ctest_equal_bool("i18n_translate(L\"button.ok\") == L\"确定\")",
wcscmp(i18n_translate(L"button.ok"), L"确定") == 0,
ctest_equal_bool("zh-CN: i18n_translate(L\"button.ok\")",
wcscmp(i18n_translate(L"button.ok"), L"\u786E\u5B9A") == 0,
true);

ctest_equal_bool("i18n_translate(L\"button.notfound\") == NULL)",
ctest_equal_bool("zh-CN: i18n_translate(L\"button.notfound\") == NULL",
i18n_translate(L"button.notfound")== NULL,
true);
i18n_clear();
Expand Down
Loading

0 comments on commit 53044f2

Please sign in to comment.