Proposing a new function like fl_utf8len* with buffer bounds check #1590
Albrecht-S
started this conversation in
Development
Replies: 1 comment
|
No opinion, so I guess if you need it, just add it. |
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Since I've noticed the frequent problem that fl_utf8len*() calculates the expected length but cannot check whether the current buffer can hold that number of bytes, I suggest implementing another function that can do this, something like:
Function name yet to be defined, and also return values, but I think it's good as it stands:
This is just an idea, comments appreciated. We'd have to check whether and where such a function would be useful.
I proposed this function here, and @ManoloFLTK proposed the function name and a small modification in a comment which is also included in the code above. Thanks for that suggestion.
@MatthiasWM replied here:
I replied:
@erco77 proposed in another comment yet another function that also checks for valid continuation bytes. For more information please see his comment.
All mentioned functions don't check for Unicode combination characters like accents and extra code points used for emojis etc. but this should be done by the caller.
All reactions