Merged PR 4316726: [Git2Git] Merged PR 4314209: Fix some TVS warnings in Console UIA

[Git2Git] Merged PR 4314209: Fix some TVS warnings in Console UIA

1. We were doing `FAILED(X || FAILED(Y))` instead of `FAILED(X) || FAILED(Y)`.
   Fixes MSFT:24904151. Fixes MSFT:24904224.
2. You cannot SAL-annotate a `gsl::not_null`.
   Fixes MSFT:24904221

Related work items: #24904151, #24904221, #24904224 Retrieved from https://microsoft.visualstudio.com os OS official/rs_onecore_dep_uxp 46167d4415c888d4d6a52ea7d3e3cc57a0f5a78d

Related work items: #24904151, #24904221, #24904224
This commit is contained in:
Michael Niksa 2020-03-09 18:09:25 +00:00 committed by Dustin Howett
parent bb4cd6488c
commit 8c37708bc4
2 changed files with 18 additions and 18 deletions

View file

@ -18,8 +18,8 @@ SAFEARRAY* BuildIntSafeArray(std::basic_string_view<int> data)
for (size_t i = 0; i < data.size(); i++)
{
LONG lIndex = 0;
if (FAILED(SizeTToLong(i, &lIndex) ||
FAILED(SafeArrayPutElement(psa, &lIndex, (void*)&(data.at(i))))))
if (FAILED(SizeTToLong(i, &lIndex)) ||
FAILED(SafeArrayPutElement(psa, &lIndex, (void*)&(data.at(i)))))
{
SafeArrayDestroy(psa);
psa = nullptr;

View file

@ -337,66 +337,66 @@ namespace Microsoft::Console::Types
static std::pair<Endpoint, Endpoint> _moveByCharacter(gsl::not_null<IUiaData*> pData,
const int moveCount,
const MoveState moveState,
_Out_ gsl::not_null<int*> const pAmountMoved);
gsl::not_null<int*> const pAmountMoved);
static std::pair<Endpoint, Endpoint> _moveByCharacterForward(gsl::not_null<IUiaData*> pData,
const int moveCount,
const MoveState moveState,
_Out_ gsl::not_null<int*> const pAmountMoved);
gsl::not_null<int*> const pAmountMoved);
static std::pair<Endpoint, Endpoint> _moveByCharacterBackward(gsl::not_null<IUiaData*> pData,
const int moveCount,
const MoveState moveState,
_Out_ gsl::not_null<int*> const pAmountMoved);
gsl::not_null<int*> const pAmountMoved);
static std::pair<Endpoint, Endpoint> _moveByWord(gsl::not_null<IUiaData*> pData,
const int moveCount,
const MoveState moveState,
const std::wstring_view wordDelimiters,
_Out_ gsl::not_null<int*> const pAmountMoved);
gsl::not_null<int*> const pAmountMoved);
static std::pair<Endpoint, Endpoint> _moveByWordForward(gsl::not_null<IUiaData*> pData,
const int moveCount,
const MoveState moveState,
const std::wstring_view wordDelimiters,
_Out_ gsl::not_null<int*> const pAmountMoved);
gsl::not_null<int*> const pAmountMoved);
static std::pair<Endpoint, Endpoint> _moveByWordBackward(gsl::not_null<IUiaData*> pData,
const int moveCount,
const MoveState moveState,
const std::wstring_view wordDelimiters,
_Out_ gsl::not_null<int*> const pAmountMoved);
gsl::not_null<int*> const pAmountMoved);
static std::pair<Endpoint, Endpoint> _moveByLine(gsl::not_null<IUiaData*> pData,
const int moveCount,
const MoveState moveState,
_Out_ gsl::not_null<int*> const pAmountMoved);
gsl::not_null<int*> const pAmountMoved);
static std::pair<Endpoint, Endpoint> _moveByDocument(gsl::not_null<IUiaData*> pData,
const int moveCount,
const MoveState moveState,
_Out_ gsl::not_null<int*> const pAmountMoved);
gsl::not_null<int*> const pAmountMoved);
static std::tuple<Endpoint, Endpoint, bool>
_moveEndpointByUnitCharacter(gsl::not_null<IUiaData*> pData,
const int moveCount,
const TextPatternRangeEndpoint endpoint,
const MoveState moveState,
_Out_ gsl::not_null<int*> const pAmountMoved);
gsl::not_null<int*> const pAmountMoved);
static std::tuple<Endpoint, Endpoint, bool>
_moveEndpointByUnitCharacterForward(gsl::not_null<IUiaData*> pData,
const int moveCount,
const TextPatternRangeEndpoint endpoint,
const MoveState moveState,
_Out_ gsl::not_null<int*> const pAmountMoved);
gsl::not_null<int*> const pAmountMoved);
static std::tuple<Endpoint, Endpoint, bool>
_moveEndpointByUnitCharacterBackward(gsl::not_null<IUiaData*> pData,
const int moveCount,
const TextPatternRangeEndpoint endpoint,
const MoveState moveState,
_Out_ gsl::not_null<int*> const pAmountMoved);
gsl::not_null<int*> const pAmountMoved);
static std::tuple<Endpoint, Endpoint, bool>
_moveEndpointByUnitWord(gsl::not_null<IUiaData*> pData,
@ -404,7 +404,7 @@ namespace Microsoft::Console::Types
const TextPatternRangeEndpoint endpoint,
const MoveState moveState,
const std::wstring_view wordDelimiters,
_Out_ gsl::not_null<int*> const pAmountMoved);
gsl::not_null<int*> const pAmountMoved);
static std::tuple<Endpoint, Endpoint, bool>
_moveEndpointByUnitWordForward(gsl::not_null<IUiaData*> pData,
@ -412,7 +412,7 @@ namespace Microsoft::Console::Types
const TextPatternRangeEndpoint endpoint,
const MoveState moveState,
const std::wstring_view wordDelimiters,
_Out_ gsl::not_null<int*> const pAmountMoved);
gsl::not_null<int*> const pAmountMoved);
static std::tuple<Endpoint, Endpoint, bool>
_moveEndpointByUnitWordBackward(gsl::not_null<IUiaData*> pData,
@ -420,21 +420,21 @@ namespace Microsoft::Console::Types
const TextPatternRangeEndpoint endpoint,
const MoveState moveState,
const std::wstring_view wordDelimiters,
_Out_ gsl::not_null<int*> const pAmountMoved);
gsl::not_null<int*> const pAmountMoved);
static std::tuple<Endpoint, Endpoint, bool>
_moveEndpointByUnitLine(gsl::not_null<IUiaData*> pData,
const int moveCount,
const TextPatternRangeEndpoint endpoint,
const MoveState moveState,
_Out_ gsl::not_null<int*> const pAmountMoved);
gsl::not_null<int*> const pAmountMoved);
static std::tuple<Endpoint, Endpoint, bool>
_moveEndpointByUnitDocument(gsl::not_null<IUiaData*> pData,
const int moveCount,
const TextPatternRangeEndpoint endpoint,
const MoveState moveState,
_Out_ gsl::not_null<int*> const pAmountMoved);
gsl::not_null<int*> const pAmountMoved);
#ifdef UNIT_TESTING
friend class ::UiaTextRangeTests;