Skip to content
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

Fix incorrect length passed to CharString #961

Merged
merged 1 commit into from
Dec 20, 2022

Conversation

mihe
Copy link
Contributor

@mihe mihe commented Dec 14, 2022

This PR changes the CharString-producing methods of String to pass the correct length, which should be the size without null-terminator included, to line up with what String::length() returns.

This PR also addresses a (harmless) bug of these functions passing size with null-terminator included to string_to_*_chars when it should have been passing size without null-terminator included, since it ends up getting clamped anyway, as seen here.

I commented about this in #633, but I figured this leans more towards being a bug, so I decided to make a PR for it, so it doesn't fall through the cracks.

This behavior also lines up with how String/CharString behaves in the engine itself.

@mihe mihe requested a review from a team as a code owner December 14, 2022 14:17
@akien-mga akien-mga requested a review from bruvzg December 14, 2022 14:28
@akien-mga akien-mga added the bug This has been identified as a bug label Dec 14, 2022
@akien-mga akien-mga merged commit 104997e into godotengine:master Dec 20, 2022
@akien-mga
Copy link
Member

Thanks!

@mihe mihe deleted the char-string-length branch December 23, 2022 13:01
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug This has been identified as a bug
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants