New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat(stdlib): strncpy consistency and add strlcpy #6204
Conversation
I feel like our behavior for So I would rather make RT-Thread's (ad the others') implementation like ours because this way we need to make this only a few places instead of in the whole code base where contributors might forget adding the closing zero. |
You are looking for
|
I didn't know |
I agree. I'll add |
Updated. So it looks like the FYI |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you!
I'm not sure we need to keep lv_strncpy
but let's leave it for backward compatibility.
I think this is the one that broke the MicroPython CI. The rest relies on loading fonts from the file system and this change specifically alters the file system drivers... |
That CI was run before this got merged. |
There are only 2 things that got merged in that time frame and this is the only one that would effect the micropython CI Maybe something got changed over in the micropython binding? |
nothing changed over there either. Gonna have to turn on debugging for the test to see what is happening. |
Description of the feature or fix
Following up with the discussion about
strncpy
in #5927Make
lv_strncpy
consistent with the standard spec.The standard spec of
strncpy
isn't necessarily better than the one that's implemented in LVGLlv_string_builtin.c
. The concern is that the behavior oflv_strncpy
changes depending on the configuredLV_USE_STDLIB_STRING
. We wrap the libcstrncpy
with the modified behavior to match the unique builtin behavior, however we don't wrap the rt-thread implementation and the rt-thread implementation matches the standard spec, i.e. the libc behavior.I updated the uses of
lv_strncpy
where it's called to ensure a null terminator is added where it's expected.See the manpage for strncpy.
Notes
lv_conf_template.h
run lv_conf_internal_gen.py and update Kconfig.scripts/code-format.py
(astyle version v3.4.12 needs to be installed) and follow the Code Conventions.