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

Prefer zero terminated string array over length based arrays. #962

Merged
merged 1 commit into from
Oct 13, 2023

Conversation

badcel
Copy link
Member

@badcel badcel commented Oct 12, 2023

As zero terminated string arrays require a certain memory layout (NULL at the end) there could be a problem if a method has an array parameter which is zero terminated and length based at the same time. Preferring zero terminated rendering ensures that the memory layout fulfills the requirements.

Additionally this fixes a bug that the zero terminated flag was never actively set as bool.TryParse can't parse "0" or "1" but the serializer does.

  • I agree that my contribution may be licensed either under MIT or any version of LGPL license.

As zero terminated string arrays require a certain memory layout (NULL at the end) there could be a problem if a method has an array parameter which is zero terminated and length based at the same time. Preferring zero terminated rendering ensures that the memory layout fulfills the requirements.

Additionally this fixes a bug that the zero terminated flag was never actively set as bool.TryParse can't parse "0" or "1" but the serializer does.
@badcel badcel force-pushed the prefer-zero-terminated-string-array branch from 1269117 to a973ca8 Compare October 13, 2023 17:50
@badcel badcel merged commit 2bbcf4c into main Oct 13, 2023
3 checks passed
@badcel badcel deleted the prefer-zero-terminated-string-array branch October 13, 2023 18:02
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant