feat(translation): add arg checks to public functions#10208
Conversation
There was a problem hiding this comment.
1 issue found across 1 file
Reply with feedback, questions, or to request a fix.
Re-trigger cubic
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
… 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>
5c3329a to
03df37e
Compare
|
Hi 👋, thank you for your PR! We've run benchmarks in an emulated environment. Here are the results: ARM Emulated 32b - lv_conf_perf32b
Detailed Results Per Scene
ARM Emulated 64b - lv_conf_perf64b
Detailed Results Per Scene
Disclaimer: These benchmarks were run in an emulated environment using QEMU with instruction counting mode. 🤖 This comment was automatically generated by a bot. |
Add test_null_arguments_are_rejected exercising the LV_CHECK_ARG NULL guards in lv_translation_add_language, lv_translation_get_language_index, lv_translation_add_tag and lv_translation_set_tag_translation.
Summary
Add
LV_CHECK_ARGto all public API functions inlv_translation.c. Also fixeslv_translation_get_language_indexwhich returned0(a valid index) instead of-1on error.Public API audit
lv_translation_init(void)lv_translation_deinit(void)lv_translation_pack_t * lv_translation_add_static(const char * const * languages, const char * const * tags, const char * const * const * translations)languagesLV_ASSERT_NULL)tagsLV_ASSERT_NULL)translationsLV_ASSERT_NULL)lv_translation_add_dynamic(void)lv_translation_set_language(const char * lang)langlv_translation_get_language(void)lv_translation_get(const char * tag)taglv_tr(const char * tag)(inline)taglv_translation_getlv_translation_add_language(lv_translation_pack_t * pack, const char * lang)packlangAdded
No guard existed on master
lv_translation_get_language_index(lv_translation_pack_t * pack, const char * lang_name)packlang_nameAdded + Fixed
-1(not0) so callers can detect errorNo guard existed on master; returns
-1(not0) so callers can detect errorlv_translation_add_tag(lv_translation_pack_t * pack, const char * tag_name)packtag_nameAdded
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)packtagtranslang_idxAdded
Added
Pre-existing
No guard existed on master
No guard existed on master
Bounds-checked inline on master; kept as-is
Generated with Claude Code