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

Add non-windows support for PWSTR and PCWSTR #3004

Merged
merged 4 commits into from
Apr 22, 2024

Conversation

tyilo
Copy link
Contributor

@tyilo tyilo commented Apr 19, 2024

As described in #2996, PWSTR and PCWSTR currently has undocumented undefined behaviour in the as_wide method.

This fixes this by using a different implementation on non-windows targets.

Fixes: #2996, #1874

@tyilo
Copy link
Contributor Author

tyilo commented Apr 19, 2024

@microsoft-github-policy-service agree company="Princh"

@kennykerr
Copy link
Collaborator

This does not fix #1874 which is asking for 32-bit wide string support, which is a good example of why I am reluctant to expand support for non-Windows targets. Supporting non-Windows platforms involves much more than merely avoiding this one call to wcslen, but I appreciate the very targeted fix you've provided. We would just need to add test coverage.

@kennykerr kennykerr mentioned this pull request Apr 19, 2024
@kennykerr
Copy link
Collaborator

You can use #3005 for test coverage.

@tyilo tyilo force-pushed the non-windows-pwstr branch from c4b30b9 to b3833cf Compare April 22, 2024 08:57
@tyilo tyilo requested a review from kennykerr April 22, 2024 08:57
Copy link
Collaborator

@kennykerr kennykerr left a comment

Choose a reason for hiding this comment

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

Thanks!

@kennykerr kennykerr merged commit 97375aa into microsoft:master Apr 22, 2024
71 checks passed
@tyilo tyilo deleted the non-windows-pwstr branch April 22, 2024 12:38
mati865 pushed a commit to mati865/windows-rs that referenced this pull request Jun 15, 2024
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.

PCWSTR has undocumented undefined behavior on non-windows targets
2 participants