warnings as errors for cppwinrt projects, then fix the warnings (#2660)
Fixes #1155.
This commit is contained in:
parent
ce3028e12f
commit
886d018bb4
|
@ -756,7 +756,7 @@ void CascadiaSettings::_ValidateNoDuplicateProfiles()
|
|||
|
||||
// Try collecting all the unique guids. If we ever encounter a guid that's
|
||||
// already in the set, then we need to delete that profile.
|
||||
for (int i = 0; i < _profiles.size(); i++)
|
||||
for (size_t i = 0; i < _profiles.size(); i++)
|
||||
{
|
||||
if (!uniqueGuids.insert(_profiles.at(i).GetGuid()).second)
|
||||
{
|
||||
|
|
|
@ -574,37 +574,41 @@ namespace winrt::Microsoft::Terminal::TerminalConnection::implementation
|
|||
// - S_OK otherwise
|
||||
HRESULT AzureConnection::_TenantChoiceHelper()
|
||||
{
|
||||
const auto tenantListAsArray = _tenantList.as_array();
|
||||
_maxSize = tenantListAsArray.size();
|
||||
for (int i = 0; i < _maxSize; i++)
|
||||
try
|
||||
{
|
||||
const auto& tenant = tenantListAsArray.at(i);
|
||||
const auto [tenantId, tenantDisplayName] = _crackTenant(tenant);
|
||||
_outputHandlers(_StrFormatHelper(ithTenant, i, tenantDisplayName.c_str(), tenantId.c_str()));
|
||||
const auto tenantListAsArray = _tenantList.as_array();
|
||||
_maxSize = gsl::narrow<int>(tenantListAsArray.size());
|
||||
for (int i = 0; i < _maxSize; i++)
|
||||
{
|
||||
const auto& tenant = tenantListAsArray.at(i);
|
||||
const auto [tenantId, tenantDisplayName] = _crackTenant(tenant);
|
||||
_outputHandlers(_StrFormatHelper(ithTenant, i, tenantDisplayName.c_str(), tenantId.c_str()));
|
||||
}
|
||||
_outputHandlers(winrt::to_hstring(enterTenant));
|
||||
// Use a lock to wait for the user to input a valid number
|
||||
std::unique_lock<std::mutex> tenantNumberLock{ _commonMutex };
|
||||
_canProceed.wait(tenantNumberLock, [=]() {
|
||||
return (_tenantNumber >= 0 && _tenantNumber < _maxSize) || _closing.load();
|
||||
});
|
||||
// User might have closed the tab while we waited for input
|
||||
if (_closing.load())
|
||||
{
|
||||
return E_FAIL;
|
||||
}
|
||||
|
||||
const auto& chosenTenant = tenantListAsArray.at(_tenantNumber);
|
||||
std::tie(_tenantID, _displayName) = _crackTenant(chosenTenant);
|
||||
|
||||
// We have to refresh now that we have the tenantID
|
||||
const auto refreshResponse = _RefreshTokens();
|
||||
_accessToken = refreshResponse.at(L"access_token").as_string();
|
||||
_refreshToken = refreshResponse.at(L"refresh_token").as_string();
|
||||
_expiry = std::stoi(refreshResponse.at(L"expires_on").as_string());
|
||||
|
||||
_state = State::StoreTokens;
|
||||
return S_OK;
|
||||
}
|
||||
_outputHandlers(winrt::to_hstring(enterTenant));
|
||||
// Use a lock to wait for the user to input a valid number
|
||||
std::unique_lock<std::mutex> tenantNumberLock{ _commonMutex };
|
||||
_canProceed.wait(tenantNumberLock, [=]() {
|
||||
return (_tenantNumber >= 0 && _tenantNumber < _maxSize) || _closing.load();
|
||||
});
|
||||
// User might have closed the tab while we waited for input
|
||||
if (_closing.load())
|
||||
{
|
||||
return E_FAIL;
|
||||
}
|
||||
|
||||
const auto& chosenTenant = tenantListAsArray.at(_tenantNumber);
|
||||
std::tie(_tenantID, _displayName) = _crackTenant(chosenTenant);
|
||||
|
||||
// We have to refresh now that we have the tenantID
|
||||
const auto refreshResponse = _RefreshTokens();
|
||||
_accessToken = refreshResponse.at(L"access_token").as_string();
|
||||
_refreshToken = refreshResponse.at(L"refresh_token").as_string();
|
||||
_expiry = std::stoi(refreshResponse.at(L"expires_on").as_string());
|
||||
|
||||
_state = State::StoreTokens;
|
||||
return S_OK;
|
||||
CATCH_RETURN();
|
||||
}
|
||||
|
||||
// Method description:
|
||||
|
|
|
@ -1443,7 +1443,7 @@ namespace winrt::Microsoft::Terminal::TerminalControl::implementation
|
|||
}
|
||||
|
||||
// send data up for clipboard
|
||||
auto copyArgs = winrt::make_self<CopyToClipboardEventArgs>(winrt::hstring(textData.data(), textData.size()), winrt::to_hstring(htmlData));
|
||||
auto copyArgs = winrt::make_self<CopyToClipboardEventArgs>(winrt::hstring(textData.data(), gsl::narrow<winrt::hstring::size_type>(textData.size())), winrt::to_hstring(htmlData));
|
||||
_clipboardCopyHandlers(*this, *copyArgs);
|
||||
return true;
|
||||
}
|
||||
|
|
|
@ -136,7 +136,7 @@ namespace winrt::Microsoft::Terminal::TerminalControl::implementation
|
|||
{
|
||||
// transfer ownership of UiaTextRanges to this new vector
|
||||
auto providers = SafeArrayToOwningVector<::Microsoft::Terminal::UiaTextRange>(textRanges);
|
||||
int count = providers.size();
|
||||
int count = gsl::narrow<int>(providers.size());
|
||||
|
||||
std::vector<XamlAutomation::ITextRangeProvider> vec;
|
||||
vec.reserve(count);
|
||||
|
|
|
@ -97,7 +97,7 @@ void AppHost::Initialize()
|
|||
// - newTitle: the string to use as the new window title
|
||||
// Return Value:
|
||||
// - <none>
|
||||
void AppHost::AppTitleChanged(const winrt::Windows::Foundation::IInspectable& sender, winrt::hstring newTitle)
|
||||
void AppHost::AppTitleChanged(const winrt::Windows::Foundation::IInspectable& /*sender*/, winrt::hstring newTitle)
|
||||
{
|
||||
_window->UpdateTitle(newTitle.c_str());
|
||||
}
|
||||
|
@ -109,7 +109,7 @@ void AppHost::AppTitleChanged(const winrt::Windows::Foundation::IInspectable& se
|
|||
// - LastTabClosedEventArgs: unused
|
||||
// Return Value:
|
||||
// - <none>
|
||||
void AppHost::LastTabClosed(const winrt::Windows::Foundation::IInspectable& sender, const winrt::TerminalApp::LastTabClosedEventArgs& args)
|
||||
void AppHost::LastTabClosed(const winrt::Windows::Foundation::IInspectable& /*sender*/, const winrt::TerminalApp::LastTabClosedEventArgs& /*args*/)
|
||||
{
|
||||
_window->Close();
|
||||
}
|
||||
|
|
|
@ -36,7 +36,7 @@ public:
|
|||
void UpdateTheme(const winrt::Windows::UI::Xaml::ElementTheme& requestedTheme);
|
||||
|
||||
#pragma region IUiaWindow
|
||||
void ChangeViewport(const SMALL_RECT NewWindow)
|
||||
void ChangeViewport(const SMALL_RECT /*NewWindow*/)
|
||||
{
|
||||
// TODO GitHub #1352: Hook up ScreenInfoUiaProvider to WindowUiaProvider
|
||||
// Relevant comment from zadjii-msft:
|
||||
|
@ -57,7 +57,7 @@ public:
|
|||
return BaseWindow::GetHandle();
|
||||
};
|
||||
|
||||
[[nodiscard]] HRESULT SignalUia(_In_ EVENTID id) override { return E_NOTIMPL; };
|
||||
[[nodiscard]] HRESULT SignalUia(_In_ EVENTID /*id*/) override { return E_NOTIMPL; };
|
||||
[[nodiscard]] HRESULT UiaSetTextAreaFocus() override { return E_NOTIMPL; };
|
||||
|
||||
RECT GetWindowRect() const noexcept override
|
||||
|
|
|
@ -107,7 +107,7 @@ WindowUiaProvider* WindowUiaProvider::Create(Microsoft::Console::Types::IUiaWind
|
|||
|
||||
#pragma region IRawElementProviderFragment
|
||||
|
||||
IFACEMETHODIMP WindowUiaProvider::Navigate(_In_ NavigateDirection direction, _COM_Outptr_result_maybenull_ IRawElementProviderFragment** ppProvider)
|
||||
IFACEMETHODIMP WindowUiaProvider::Navigate(_In_ NavigateDirection /*direction*/, _COM_Outptr_result_maybenull_ IRawElementProviderFragment** ppProvider)
|
||||
{
|
||||
RETURN_IF_FAILED(_EnsureValidHwnd());
|
||||
*ppProvider = nullptr;
|
||||
|
@ -139,7 +139,7 @@ IFACEMETHODIMP WindowUiaProvider::SetFocus()
|
|||
|
||||
IFACEMETHODIMP WindowUiaProvider::ElementProviderFromPoint(_In_ double /*x*/,
|
||||
_In_ double /*y*/,
|
||||
_COM_Outptr_result_maybenull_ IRawElementProviderFragment** ppProvider)
|
||||
_COM_Outptr_result_maybenull_ IRawElementProviderFragment** /*ppProvider*/)
|
||||
{
|
||||
RETURN_IF_FAILED(_EnsureValidHwnd());
|
||||
|
||||
|
@ -151,7 +151,7 @@ IFACEMETHODIMP WindowUiaProvider::ElementProviderFromPoint(_In_ double /*x*/,
|
|||
return S_OK;
|
||||
}
|
||||
|
||||
IFACEMETHODIMP WindowUiaProvider::GetFocus(_COM_Outptr_result_maybenull_ IRawElementProviderFragment** ppProvider)
|
||||
IFACEMETHODIMP WindowUiaProvider::GetFocus(_COM_Outptr_result_maybenull_ IRawElementProviderFragment** /*ppProvider*/)
|
||||
{
|
||||
RETURN_IF_FAILED(_EnsureValidHwnd());
|
||||
// TODO GitHub #2447: Hook up ScreenInfoUiaProvider to WindowUiaProvider
|
||||
|
|
|
@ -94,6 +94,7 @@
|
|||
<PrecompiledHeaderFile>pch.h</PrecompiledHeaderFile>
|
||||
<PrecompiledHeaderOutputFile>$(IntDir)pch.pch</PrecompiledHeaderOutputFile>
|
||||
<WarningLevel>Level4</WarningLevel>
|
||||
<TreatWarningAsError>true</TreatWarningAsError>
|
||||
<AdditionalOptions>%(AdditionalOptions) /permissive- /bigobj /Zc:twoPhase- /std:c++17 </AdditionalOptions>
|
||||
<DisableSpecificWarnings>28204</DisableSpecificWarnings>
|
||||
<PreprocessorDefinitions Condition="'$(ConfigurationType)'=='DynamicLibrary'">_WINRT_DLL;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
|
|
Loading…
Reference in a new issue