Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Fix test prefast issues
  • Loading branch information
tydunkel committed Sep 28, 2021
commit f1aa75e46fe2fc3537907b52c288fec1fdf8c799
6 changes: 3 additions & 3 deletions test/vswhere.test/TestEnumInstances.h
Original file line number Diff line number Diff line change
Expand Up @@ -66,16 +66,16 @@ class TestEnumInstances :
STDMETHODIMP Next(
_In_ ULONG celt,
_Out_writes_to_(celt, *pceltFetched) ISetupInstance** rgelt,
_Out_opt_ _Deref_out_range_(0, celt) ULONG* pceltFetched
_Out_ _Deref_out_range_(0, celt) ULONG* pceltFetched
)
{
*pceltFetched = 0;
auto remaining = m_instances.size() - m_i;
if (0 == remaining)
{
return S_FALSE;
}

*pceltFetched = 0;

for (unsigned long i = 0; i < celt && m_i < m_instances.size(); ++i, ++m_i, ++*pceltFetched)
{
rgelt[i] = m_instances[m_i];
Expand Down
6 changes: 5 additions & 1 deletion test/vswhere.test/TestInstance.h
Original file line number Diff line number Diff line change
Expand Up @@ -112,10 +112,14 @@ class TestInstance :
const int num_fields = 6;
SYSTEMTIME st = {};

if (num_fields == ::swscanf_s(value.c_str(), L"%hd-%hd-%hdT%hd:%hd:%hd", &st.wYear, &st.wMonth, &st.wDay, &st.wHour, &st.wMinute, &st.wSecond))
if (num_fields == ::swscanf_s(value.c_str(), L"%hu-%hu-%huT%hu:%hu:%hu", &st.wYear, &st.wMonth, &st.wDay, &st.wHour, &st.wMinute, &st.wSecond))
{
::SystemTimeToFileTime(&st, pInstallDate);
}
else
{
hr = E_FAIL;
}
}

return hr;
Expand Down
1 change: 1 addition & 0 deletions test/vswhere.test/TestModule.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -37,5 +37,6 @@ wstring __cdecl format(_In_ LPCWSTR fmt, ...)

TEST_MODULE_INITIALIZE(ModuleInitialize)
{
#pragma warning(suppress: 6387) // Ignore potential failure when getting module handle
ResourceManager::SetInstance(::GetModuleHandleW(L"vswhere.test.dll"));
}
2 changes: 1 addition & 1 deletion test/vswhere.test/TestPropertyStore.h
Original file line number Diff line number Diff line change
Expand Up @@ -147,7 +147,7 @@ class TestPropertyStore :
}

static ci_equal equals;
VARENUM vt;
VARENUM vt = VT_EMPTY;
std::wstring value;

auto hr = TryGet(wszName, vt, value);
Expand Down
6 changes: 6 additions & 0 deletions test/vswhere.test/VersionRangeTests.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ TEST_CLASS(VersionRangeTests)
auto pHelper = new VersionRange;
ISetupHelperPtr sut(pHelper, false);

#pragma warning(suppress: 6387) // Expected to pass invalid arg
Assert::AreEqual(E_INVALIDARG, sut->ParseVersion(NULL, NULL));
}

Expand All @@ -25,6 +26,7 @@ TEST_CLASS(VersionRangeTests)
auto pHelper = new VersionRange;
ISetupHelperPtr sut(pHelper, false);

#pragma warning(suppress: 6387) // Expected to pass invalid arg
Assert::AreEqual(E_POINTER, sut->ParseVersion(L"1.0", NULL));
}

Expand Down Expand Up @@ -130,6 +132,7 @@ TEST_CLASS(VersionRangeTests)
auto pHelper = new VersionRange;
ISetupHelperPtr sut(pHelper, false);

#pragma warning(suppress: 6387) // Expected to pass invalid arg
Assert::AreEqual(E_INVALIDARG, sut->ParseVersionRange(NULL, NULL, NULL));
}

Expand All @@ -138,6 +141,7 @@ TEST_CLASS(VersionRangeTests)
auto pHelper = new VersionRange;
ISetupHelperPtr sut(pHelper, false);

#pragma warning(suppress: 6387) // Expected to pass invalid arg
Assert::AreEqual(E_POINTER, sut->ParseVersionRange(L"[1.0,)", NULL, NULL));
}

Expand All @@ -147,6 +151,8 @@ TEST_CLASS(VersionRangeTests)
ISetupHelperPtr sut(pHelper, false);

ULONGLONG ullMinVersion = 0;

#pragma warning(suppress: 6387) // Expected to pass invalid arg
Assert::AreEqual(E_POINTER, sut->ParseVersionRange(L"[1.0,)", &ullMinVersion, NULL));
}

Expand Down