Skip to content

Commit

Permalink
[Analyzers][CPP]Turn on warning 26427 (microsoft#22743)
Browse files Browse the repository at this point in the history
  • Loading branch information
sosssego authored Dec 18, 2022
1 parent 2f6d512 commit d1b55d9
Show file tree
Hide file tree
Showing 5 changed files with 9 additions and 6 deletions.
2 changes: 1 addition & 1 deletion CppRuleSet.ruleset
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
<Rule Id="C26417" Action="Info" />
<Rule Id="C26418" Action="Info" />
<Rule Id="C26426" Action="Info" />
<Rule Id="C26427" Action="Info" />
<Rule Id="C26427" Action="Error" />
<Rule Id="C26429" Action="Info" />
<Rule Id="C26430" Action="Info" />
<Rule Id="C26431" Action="Info" />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -233,7 +233,7 @@ namespace BufferValidationHelpers

// Convert app name to lower case
std::transform(appName.begin(), appName.end(), appName.begin(), towlower);
std::wstring lowercaseDefAppName = KeyboardManagerEditorStrings::DefaultAppName;
std::wstring lowercaseDefAppName = KeyboardManagerEditorStrings::DefaultAppName();
std::transform(lowercaseDefAppName.begin(), lowercaseDefAppName.end(), lowercaseDefAppName.begin(), towlower);
if (appName == lowercaseDefAppName)
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -268,7 +268,7 @@ void KeyDropDownControl::SetSelectionHandler(StackPanel& table, StackPanel row,
if (targetApp != nullptr)
{
std::wstring newText = targetApp.Text().c_str();
std::wstring lowercaseDefAppName = KeyboardManagerEditorStrings::DefaultAppName;
std::wstring lowercaseDefAppName = KeyboardManagerEditorStrings::DefaultAppName();
std::transform(newText.begin(), newText.end(), newText.begin(), towlower);
std::transform(lowercaseDefAppName.begin(), lowercaseDefAppName.end(), lowercaseDefAppName.begin(), towlower);
if (newText == lowercaseDefAppName)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,10 @@
namespace KeyboardManagerEditorStrings
{
// String constant for the default app name in Remap shortcuts
inline const std::wstring DefaultAppName = GET_RESOURCE_STRING(IDS_EDITSHORTCUTS_ALLAPPS);
inline std::wstring DefaultAppName()
{
return GET_RESOURCE_STRING(IDS_EDITSHORTCUTS_ALLAPPS);
}

// Function to return the error message
winrt::hstring GetErrorMessage(ShortcutErrorType errorType);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,7 @@ void ShortcutControl::AddNewShortcutControlRow(StackPanel& parent, std::vector<s
row.Children().Append(target);

targetAppTextBox.Width(EditorConstants::ShortcutTableDropDownWidth);
targetAppTextBox.PlaceholderText(KeyboardManagerEditorStrings::DefaultAppName);
targetAppTextBox.PlaceholderText(KeyboardManagerEditorStrings::DefaultAppName());
targetAppTextBox.Text(targetAppName);

// GotFocus handler will be called whenever the user tabs into or clicks on the textbox
Expand Down Expand Up @@ -167,7 +167,7 @@ void ShortcutControl::AddNewShortcutControlRow(StackPanel& parent, std::vector<s
shortcutRemapBuffer[rowIndex].first[1] = tempShortcut;
}
std::wstring newText = targetAppTextBox.Text().c_str();
std::wstring lowercaseDefAppName = KeyboardManagerEditorStrings::DefaultAppName;
std::wstring lowercaseDefAppName = KeyboardManagerEditorStrings::DefaultAppName();
std::transform(newText.begin(), newText.end(), newText.begin(), towlower);
std::transform(lowercaseDefAppName.begin(), lowercaseDefAppName.end(), lowercaseDefAppName.begin(), towlower);
if (newText == lowercaseDefAppName)
Expand Down

0 comments on commit d1b55d9

Please sign in to comment.