Skip to content

feat(others): add lv_check_arg to public functions in lv_translation#10208

Open
axos88 wants to merge 2 commits into
masterfrom
feat-add-lv-check-arg-to-core-lv_translation
Open

feat(others): add lv_check_arg to public functions in lv_translation#10208
axos88 wants to merge 2 commits into
masterfrom
feat-add-lv-check-arg-to-core-lv_translation

Conversation

@axos88
Copy link
Copy Markdown
Contributor

@axos88 axos88 commented May 28, 2026

Summary

Add LV_CHECK_ARG to all public API functions in lv_translation.c. Also fixes lv_translation_get_language_index which returned 0 (a valid index) instead of -1 on error.

Public API audit

Function Parameters Action Reason
lv_translation_init(void) No check needed No pointer/numeric params
lv_translation_deinit(void) No check needed No pointer/numeric params
lv_translation_pack_t * lv_translation_add_static(const char * const * languages, const char * const * tags, const char * const * const * translations) languages Added (replaced LV_ASSERT_NULL) Converts crash to graceful return
tags Added (replaced LV_ASSERT_NULL) Converts crash to graceful return
translations Added (replaced LV_ASSERT_NULL) Converts crash to graceful return
lv_translation_add_dynamic(void) No check needed No pointer/numeric params
lv_translation_set_language(const char * lang) lang Added No guard existed on master
lv_translation_get_language(void) No check needed No pointer/numeric params
lv_translation_get(const char * tag) tag Added No guard existed on master
lv_tr(const char * tag) (inline) tag Delegates to lv_translation_get Inline wrapper; check covered by callee
lv_translation_add_language(lv_translation_pack_t * pack, const char * lang) pack
lang
Added
Added
No guard existed on master
No guard existed on master
lv_translation_get_language_index(lv_translation_pack_t * pack, const char * lang_name) pack
lang_name
Added + Fixed
Added + Fixed
No guard existed on master; returns -1 (not 0) so callers can detect error
No guard existed on master; returns -1 (not 0) so callers can detect error
lv_translation_add_tag(lv_translation_pack_t * pack, const char * tag_name) pack
tag_name
Added
Added
No guard existed on master
No guard existed on master
lv_translation_set_tag_translation(lv_translation_pack_t * pack, lv_translation_tag_dsc_t * tag, uint32_t lang_idx, const char * trans) pack
tag
trans
lang_idx
Added
Added
Added
Pre-existing
No guard existed on master
No guard existed on master
No guard existed on master
Bounds-checked inline on master; kept as-is

Generated with Claude Code

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Copilot AI review requested due to automatic review settings May 28, 2026 19:38
Copy link
Copy Markdown
Contributor

@cubic-dev-ai cubic-dev-ai Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

1 issue found across 1 file

Reply with feedback, questions, or to request a fix.

Re-trigger cubic

Comment thread src/others/translation/lv_translation.c Outdated
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot encountered an error and was unable to review this pull request. You can try again by re-requesting a review.

… NULL args

The previous LV_CHECK_ARG guards returned 0 on NULL pack or lang_name,
but 0 is a valid language index. The documented "not found" sentinel for
this function is -1, so use that consistently.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@axos88 axos88 changed the title feat(core): add lv_check_arg to public functions in lv_translation feat(others): add lv_check_arg to public functions in lv_translation May 29, 2026
@axos88 axos88 marked this pull request as draft May 29, 2026 10:04
@axos88 axos88 marked this pull request as ready for review June 3, 2026 14:49
Copy link
Copy Markdown
Contributor

@cubic-dev-ai cubic-dev-ai Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No issues found across 1 file

Re-trigger cubic

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants