Skip to content

Commit 47b9be2

Browse files
authored
Fix some type mismatch issues in MRT
1 parent e8d5edf commit 47b9be2

3 files changed

Lines changed: 10 additions & 15 deletions

File tree

dev/MRTCore/mrt/mrm/UnitTests/DecisionInfo.UnitTests.cpp

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -84,12 +84,7 @@ void DecisionInfoUnitTests::SimpleBuilderTests()
8484
return;
8585
}
8686

87-
// Add test data to builders
88-
// Although it is tempting to remove the '!' below to address the PREfast issue, doing that broke the build.
89-
// OTOH, 2 instances of the same code pattern are also in OS.2020, therefore, we probably would want to have
90-
// a "global" fix for all instances. Bug 50087117 has been filed for tracking the "global" fix.
91-
#pragma warning(suppress: 6215) // C6215: Cast between semantically different integer types.
92-
if (FAILED(!decisionInfo.ApplyTestData(pBuilder)))
87+
if (FAILED(decisionInfo.ApplyTestData(pBuilder)))
9388
{
9489
Log::Error(L"[ Error applying test data ]");
9590
return;

dev/MRTCore/mrt/mrm/UnitTests/testUtils.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -32,14 +32,14 @@ bool TestUtils::TryVerifyRemap(_In_ PCWSTR pVarName, _Inout_ const RemapUInt16*
3232
return false;
3333
}
3434

35-
for (UINT16 i = 0; i < expectedStrings.GetNumStrings(); i++)
35+
for (int i = 0; i < expectedStrings.GetNumStrings(); i++)
3636
{
3737
if (!expectedStrings.TryGetStringAsInt(i, &expectedValue))
3838
{
3939
Log::Warning(tmp.Format(L"[ \"%s\" malformed - value %d ignored ]", pVarName, i));
4040
continue;
4141
}
42-
pRemap->TryGetMapping(i, &gotValue);
42+
pRemap->TryGetMapping(static_cast<UINT16>(i), &gotValue);
4343
VERIFY(expectedValue == gotValue);
4444
}
4545
return true;
@@ -250,4 +250,4 @@ void TestUtils::TryGetExpectedResult(_In_ PCWSTR varName, _Out_ DEFRESULT* resul
250250
}
251251
}
252252

253-
} // namespace UnitTests
253+
} // namespace UnitTests

dev/MRTCore/mrt/mrm/mrmmin/DecisionInfoBuilder.cpp

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -315,35 +315,35 @@ HRESULT DecisionInfoBuilder::Merge(
315315
}
316316

317317
// merge qualifiers
318-
for (UINT16 i = 1; i < pMerge->GetNumQualifiers(); i++)
318+
for (int i = 1; i < pMerge->GetNumQualifiers(); i++)
319319
{
320320
RETURN_IF_FAILED(pMerge->GetQualifier(i, &qualifier));
321321
RETURN_IF_FAILED(GetOrAddQualifier(&qualifier, &index));
322-
if (!pQualifierMapUsed->TrySetMapping(i, static_cast<UINT16>(index)))
322+
if (!pQualifierMapUsed->TrySetMapping(static_cast<UINT16>(i), static_cast<UINT16>(index)))
323323
{
324324
return HRESULT_FROM_WIN32(ERROR_MRM_MAP_NOT_FOUND);
325325
}
326326
}
327327

328328
// merge qualifiersets
329329
QualifierSetResult qualifierSet;
330-
for (UINT16 i = 1; i < pMerge->GetNumQualifierSets(); i++)
330+
for (int i = 1; i < pMerge->GetNumQualifierSets(); i++)
331331
{
332332
RETURN_IF_FAILED(pMerge->GetQualifierSet(i, &qualifierSet));
333333
RETURN_IF_FAILED(GetOrAddQualifierSet(&qualifierSet, pQualifierMapUsed, &index));
334-
if (!pQualifierSetMapUsed->TrySetMapping(i, static_cast<UINT16>(index)))
334+
if (!pQualifierSetMapUsed->TrySetMapping(static_cast<UINT16>(i), static_cast<UINT16>(index)))
335335
{
336336
return HRESULT_FROM_WIN32(ERROR_MRM_MAP_NOT_FOUND);
337337
}
338338
}
339339

340340
// merge decisions
341341
DecisionResult decision;
342-
for (UINT16 i = 2; i < pMerge->GetNumDecisions(); i++)
342+
for (int i = 2; i < pMerge->GetNumDecisions(); i++)
343343
{
344344
RETURN_IF_FAILED(pMerge->GetDecision(i, &decision));
345345
RETURN_IF_FAILED(GetOrAddDecision(&decision, pQualifierSetMapUsed, &index));
346-
if (!pDecisionMapUsed->TrySetMapping(i, static_cast<UINT16>(index)))
346+
if (!pDecisionMapUsed->TrySetMapping(static_cast<UINT16>(i), static_cast<UINT16>(index)))
347347
{
348348
return HRESULT_FROM_WIN32(ERROR_MRM_MAP_NOT_FOUND);
349349
}

0 commit comments

Comments
 (0)