Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Harden operator wstring_view#546

Merged
kennykerr merged 2 commits intomastermicrosoft/cppwinrt:masterfrom
kennykerr-datamicrosoft/cppwinrt:kennykerr-dataCopy head branch name to clipboard
Mar 3, 2020
Merged

Harden operator wstring_view#546
kennykerr merged 2 commits intomastermicrosoft/cppwinrt:masterfrom
kennykerr-datamicrosoft/cppwinrt:kennykerr-dataCopy head branch name to clipboard

Conversation

@kennykerr
Copy link
Collaborator

Some existing code relies on data returning a valid string even when the view is empty.

else
{
return {};
return { L"", 0 };
Copy link
Collaborator Author

@kennykerr kennykerr Mar 3, 2020

Choose a reason for hiding this comment

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

When the hstring is empty, the wstring_view's default constructor causes the data member to return a nullptr as per the spec:

https://en.cppreference.com/w/cpp/string/basic_string_view/basic_string_view

Now instead, data will return an empty null-terminated string.

Copy link
Member

Choose a reason for hiding this comment

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

Specs? who needs em!

@kennykerr kennykerr merged commit 4b77215 into master Mar 3, 2020
@kennykerr kennykerr deleted the kennykerr-data branch March 3, 2020 16:33
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.

2 participants

Morty Proxy This is a proxified and sanitized view of the page, visit original site.