Skip to content

Fix incorrect length passed to CharString - #961

Merged
akien-mga merged 1 commit into
godotengine:masterfrom
mihe:char-string-length
Dec 20, 2022
Merged

akien-mga merged 1 commit into
godotengine:masterfrom
mihe:char-string-length

Conversation

@mihe

@mihe mihe commented Dec 14, 2022 •

Copy link
Copy Markdown
Contributor

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
Copy Markdown
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