Skip to content

Commit

Permalink
Merge pull request #470 from stephenegriffin/cast
Browse files Browse the repository at this point in the history
add some casts for 64 bit
  • Loading branch information
stephenegriffin authored May 7, 2021
2 parents 528ebe2 + 2a3e2b2 commit d860bc6
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 11 deletions.
2 changes: 1 addition & 1 deletion core/model/mapiRowModel.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ namespace model
auto lpTags = mapi::allocate<LPSPropTagArray>(CbNewSPropTagArray(static_cast<ULONG>(tags.size())));
if (lpTags)
{
lpTags->cValues = tags.size();
lpTags->cValues = static_cast<ULONG>(tags.size());
ULONG i = 0;
for (const auto tag : tags)
{
Expand Down
16 changes: 8 additions & 8 deletions core/propertyBag/registryProperty.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,7 @@ namespace propertybag
}
break;
case PT_BINARY:
m_prop.Value.bin.cb = m_binVal.size();
m_prop.Value.bin.cb = static_cast<ULONG>(m_binVal.size());
m_prop.Value.bin.lpb = const_cast<LPBYTE>(m_binVal.data());
break;
case PT_UNICODE:
Expand All @@ -127,7 +127,7 @@ namespace propertybag
case PT_MV_LONG:
{
const auto parser = std::make_shared<smartview::binaryParser>(m_binVal);
const auto count = parser->getSize() / sizeof(LONG);
const auto count = static_cast<ULONG>(parser->getSize() / sizeof(LONG));
m_bin = std::vector<BYTE>(sizeof(LONG) * count);
m_prop.Value.MVl.lpl = reinterpret_cast<LONG*>(m_bin.data());
m_prop.Value.MVl.cValues = count;
Expand Down Expand Up @@ -209,7 +209,7 @@ namespace propertybag
default:
// Haven't found any other property types out there so this ought never be used
m_prop.ulPropTag = PROP_TAG(PT_BINARY, PROP_ID(m_ulPropTag));
m_prop.Value.bin.cb = m_binVal.size();
m_prop.Value.bin.cb = static_cast<ULONG>(m_binVal.size());
m_prop.Value.bin.lpb = const_cast<LPBYTE>(m_binVal.data());
m_canParseMAPI = false;
break;
Expand All @@ -218,7 +218,7 @@ namespace propertybag
else
{
m_prop.ulPropTag = PROP_TAG(PT_BINARY, PROP_ID_NULL);
m_prop.Value.bin.cb = m_binVal.size();
m_prop.Value.bin.cb = static_cast<ULONG>(m_binVal.size());
m_prop.Value.bin.lpb = const_cast<LPBYTE>(m_binVal.data());
}
}
Expand Down Expand Up @@ -368,7 +368,7 @@ namespace propertybag
break;
case PT_UNICODE:
// Include null terminator
cb = (std::wstring(newValue->Value.lpszW).length() + 1) * sizeof(wchar_t);
cb = static_cast<ULONG>((std::wstring(newValue->Value.lpszW).length() + 1) * sizeof(wchar_t));
lpb = LPBYTE(newValue->Value.lpszW);
break;
case PT_MV_LONG:
Expand All @@ -394,7 +394,7 @@ namespace propertybag
// Count up our additional needs for reserve
for (ULONG iMVCount = 0; iMVCount < newValue->Value.MVbin.cValues; iMVCount++)
{
cb += memory::align(newValue->Value.MVbin.lpbin[iMVCount].cb);
cb += static_cast<ULONG>(memory::align(newValue->Value.MVbin.lpbin[iMVCount].cb));
}

// Then reserve additional space for the binary data to avoid realloc
Expand Down Expand Up @@ -433,7 +433,7 @@ namespace propertybag
for (ULONG iMVCount = 0; iMVCount < newValue->Value.MVszW.cValues; iMVCount++)
{
strings[iMVCount] = newValue->Value.MVszW.lppszW[iMVCount]; // cache for convenience
cb += (strings[iMVCount].length() + 1) * sizeof(wchar_t);
cb += static_cast<ULONG>((strings[iMVCount].length() + 1) * sizeof(wchar_t));
}

// Then reserve additional space for the string data to avoid realloc
Expand Down Expand Up @@ -465,7 +465,7 @@ namespace propertybag
for (ULONG iMVCount = 0; iMVCount < newValue->Value.MVszA.cValues; iMVCount++)
{
strings[iMVCount] = newValue->Value.MVszA.lppszA[iMVCount]; // cache for convenience
cb += strings[iMVCount].length() + 1;
cb += static_cast<ULONG>(strings[iMVCount].length()) + 1;
}

// Then reserve additional space for the string data to avoid realloc
Expand Down
2 changes: 1 addition & 1 deletion core/propertyBag/registryPropertyBag.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -137,7 +137,7 @@ namespace propertybag
}

_Check_return_ HRESULT
registryPropertyBag::SetProp(_In_ LPSPropValue lpProp, _In_ ULONG ulPropTag, const std::wstring& name)
registryPropertyBag::SetProp(_In_ LPSPropValue lpProp, _In_ ULONG /*ulPropTag*/, const std::wstring& name)
{
ensureLoaded();
for (const auto& prop : m_props)
Expand Down
2 changes: 1 addition & 1 deletion core/utility/registry.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -278,7 +278,7 @@ namespace registry
_In_ const std::vector<BYTE>& binValue,
_In_ const bool bSecure)
{
const DWORD cbValue = binValue.size();
const DWORD cbValue = static_cast<DWORD>(binValue.size());
if (bSecure)
{
auto DataIn = DATA_BLOB{cbValue, const_cast<LPBYTE>(binValue.data())};
Expand Down

0 comments on commit d860bc6

Please sign in to comment.