lc-soft / LCUI

C library for building user interfaces
https://lcui-dev.github.io
MIT License
4.12k stars 356 forks source link

util: replace util by yutil #264

Closed yidianyiko closed 2 years ago

yidianyiko commented 2 years ago

待办:

commit-lint[bot] commented 2 years ago

generate by www.commit-lint.com

Commit-Lint commands
You can trigger Commit-Lint actions by commenting on this PR: - `@Commit-Lint merge patch` will merge dependabot PR on "patch" versions (X.X.Y - Y change) - `@Commit-Lint merge minor` will merge dependabot PR on "minor" versions (X.Y.Y - Y change) - `@Commit-Lint merge major` will merge dependabot PR on "major" versions (Y.Y.Y - Y change) - `@Commit-Lint merge disable` will desactivate merge dependabot PR - `@Commit-Lint review` will approve dependabot PR - `@Commit-Lint stop review` will stop approve dependabot PR
yidianyiko commented 2 years ago

目前可以在 win 和 linux 上编译 lcui 、run-tests、helloworld,但执行存在问题。 (以下问题同时在两个平台上存在) 存在问题及进度:

  1. 替换完所有函数后进行编译存在问题如下:

    • LCUI_Color RGB() 与 系统 RGB存在冲突,编译时总是编译为系统库函数 RGB,问题可能出在 <LCUI/graph.h> 下的
      /* 解除RGB宏 */
      #ifdef YUTIL_TEST_RGB
      #undef YUTIL_TEST_RGB
      #endif

      并未按照顺序编译。 解决方案: 先暂时使用 YUTIL_TEST_RGB 替代 RGB ,可以顺利编译。

  2. 执行 xmake run run-tests 后会在 test settings 处中断: 经过定位,发现

    // LCUI/lib/ui/src/widget_style.c
    static size_t LCUI_LoadCSSBlock(LCUI_CSSParserContext ctx, const char *str)
    {
    size_t size = 0;
    ctx->cur = str;
    while (*ctx->cur && size < ctx->buffer_size) {
        ctx->parsers[ctx->target].parse(ctx);
        ++ctx->cur;
        ++size;
    }
    return size;
    }

    每次执行这个循环时,当 *ctx->cur = 0x20 后程序就会中断。 解决方案: 目前还没有头绪,因为该文件并未涉及到函数替换,我将重新查看替换的文件和编译顺序是否存在问题。

lc-soft commented 2 years ago

每次执行这个循环时,当 *ctx->cur = 0x20 后程序就会中断。

你需要先处理内存访问越界问题,因为它容易导致其它正常代码块执行异常。

yidianyiko commented 2 years ago

进度 已完成:已解决 rbtree_delete 报错。 strpool 中的 dict_add 引起的内存泄漏,更新为最新的代码后问题解决。 rbtree_delelte 问题并未解决,还需继续研究。 image image Linux 上可以正常运行,我将进一步完善代码再上传提交。

codecov[bot] commented 2 years ago

Codecov Report

Merging #264 (56cfe48) into v3.0-dev (35aedb2) will decrease coverage by 1.11%. The diff coverage is 60.89%.

:exclamation: Current head 56cfe48 differs from pull request most recent head 0e51f6c. Consider uploading reports for the commit 0e51f6c to get more accurate results Impacted file tree graph

@@             Coverage Diff              @@
##           v3.0-dev     #264      +/-   ##
============================================
- Coverage     56.20%   55.08%   -1.12%     
============================================
  Files            90       80      -10     
  Lines         16153    14889    -1264     
============================================
- Hits           9078     8201     -877     
+ Misses         7075     6688     -387     
Impacted Files Coverage Δ
lib/css/src/css_rule_font_face.c 78.57% <ø> (ø)
lib/font/src/freetype.c 33.33% <ø> (ø)
lib/font/src/in_core_font.c 96.00% <ø> (ø)
lib/image/src/jpeg.c 68.42% <0.00%> (ø)
lib/image/src/png.c 40.60% <0.00%> (ø)
lib/paint/src/background.c 39.47% <0.00%> (ø)
lib/paint/src/graph.c 35.42% <0.00%> (ø)
lib/platform/src/linux/linux_keyboard.c 13.55% <0.00%> (ø)
lib/platform/src/linux/linux_x11display.c 2.64% <0.00%> (ø)
lib/ui-anchor/src/anchor.c 4.85% <0.00%> (ø)
... and 52 more

Continue to review full report at Codecov.

Legend - Click here to learn more Δ = absolute <relative> (impact), ø = not affected, ? = missing data Powered by Codecov. Last update 35aedb2...0e51f6c. Read the comment docs.