Skip to content

[cxx-interop] Handle std::strings with \0 character #61420

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
Oct 4, 2022

Conversation

egorzhdan
Copy link
Contributor

Previously the conversion mechanism called std::string::c_str and passed it to String(cString:) which accepts a null-terminated string. If the string contains a \0 character, this failed to initialize the entire string properly.

Previously the conversion mechanism called `std::string::c_str` and passed it to `String(cString:)` which accepts a null-terminated string. If the string contains a `\0` character, this failed to initialize the entire string properly.
@egorzhdan egorzhdan added the c++ interop Feature: Interoperability with C++ label Oct 3, 2022
@egorzhdan egorzhdan requested review from hyp and zoecarver October 3, 2022 19:17
@egorzhdan
Copy link
Contributor Author

@swift-ci please smoke test

@egorzhdan
Copy link
Contributor Author

@swift-ci please smoke test Linux

@egorzhdan
Copy link
Contributor Author

@swift-ci please smoke test macOS

Copy link
Contributor

@hyp hyp left a comment

Choose a reason for hiding this comment

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

Great!

@egorzhdan egorzhdan merged commit f49bab2 into main Oct 4, 2022
@egorzhdan egorzhdan deleted the egorzhdan/cxx-string-null branch October 4, 2022 10:25
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
c++ interop Feature: Interoperability with C++
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants