Skip to content

Fix wide string marshalling #1198

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

Merged
merged 1 commit into from
Jan 4, 2023
Merged

Fix wide string marshalling #1198

merged 1 commit into from
Jan 4, 2023

Conversation

Perksey
Copy link
Member

@Perksey Perksey commented Jan 4, 2023

No description provided.

@Perksey Perksey added bug Something isn't working area-Core/Infrastructure/Codegen labels Jan 4, 2023
@Perksey Perksey added this to the 2.X milestone Jan 4, 2023
@Perksey Perksey requested a review from a team as a code owner January 4, 2023 18:08
Copy link
Contributor

@Beyley Beyley left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

bro WHAT A⹳坒祂整摁牤獥䉳晵敦獲㜮

@Perksey Perksey enabled auto-merge (squash) January 4, 2023 18:15
@Perksey Perksey merged commit f2f84aa into main Jan 4, 2023
@Perksey Perksey deleted the hotfix/lpcwstr branch January 4, 2023 19:47
@HurricanKai
Copy link
Member

Random that I saw this, but this doesn't seem like it'd work?
Won't this just write a 0 in the middle of the array?
Iirc it should null terminate (which is why the +1 existed) so it should be allocating input.Length * 2 + 1 and write to input.Length * 2?

@Beyley
Copy link
Contributor

Beyley commented Jan 4, 2023

Random that I saw this, but this doesn't seem like it'd work? Won't this just write a 0 in the middle of the array? Iirc it should null terminate (which is why the +1 existed) so it should be allocating input.Length * 2 + 1 and write to input.Length * 2?

theres a second line of code writing the null terminator
image

@Beyley
Copy link
Contributor

Beyley commented Jan 4, 2023

oh snap, u rite
nvm its a char* so 16bit

@Perksey
Copy link
Member Author

Perksey commented Jan 4, 2023

We cast to a two byte pointer (char*), so the * 2 isn't needed. And arrays in C# have zero-based indices, so the + 1 isn't needed.

@Perksey
Copy link
Member Author

Perksey commented Jan 4, 2023

@Beyley Can you please be careful with language on GitHub? Appreciate the team is quite colloquial on Discord, but GitHub tends to be more formal :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants