Skip to content

Commit d860bc6

Browse files
Merge pull request #470 from stephenegriffin/cast
add some casts for 64 bit
2 parents 528ebe2 + 2a3e2b2 commit d860bc6

File tree

4 files changed

+11
-11
lines changed

4 files changed

+11
-11
lines changed

Diff for: core/model/mapiRowModel.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,7 @@ namespace model
8383
auto lpTags = mapi::allocate<LPSPropTagArray>(CbNewSPropTagArray(static_cast<ULONG>(tags.size())));
8484
if (lpTags)
8585
{
86-
lpTags->cValues = tags.size();
86+
lpTags->cValues = static_cast<ULONG>(tags.size());
8787
ULONG i = 0;
8888
for (const auto tag : tags)
8989
{

Diff for: core/propertyBag/registryProperty.cpp

+8-8
Original file line numberDiff line numberDiff line change
@@ -115,7 +115,7 @@ namespace propertybag
115115
}
116116
break;
117117
case PT_BINARY:
118-
m_prop.Value.bin.cb = m_binVal.size();
118+
m_prop.Value.bin.cb = static_cast<ULONG>(m_binVal.size());
119119
m_prop.Value.bin.lpb = const_cast<LPBYTE>(m_binVal.data());
120120
break;
121121
case PT_UNICODE:
@@ -127,7 +127,7 @@ namespace propertybag
127127
case PT_MV_LONG:
128128
{
129129
const auto parser = std::make_shared<smartview::binaryParser>(m_binVal);
130-
const auto count = parser->getSize() / sizeof(LONG);
130+
const auto count = static_cast<ULONG>(parser->getSize() / sizeof(LONG));
131131
m_bin = std::vector<BYTE>(sizeof(LONG) * count);
132132
m_prop.Value.MVl.lpl = reinterpret_cast<LONG*>(m_bin.data());
133133
m_prop.Value.MVl.cValues = count;
@@ -209,7 +209,7 @@ namespace propertybag
209209
default:
210210
// Haven't found any other property types out there so this ought never be used
211211
m_prop.ulPropTag = PROP_TAG(PT_BINARY, PROP_ID(m_ulPropTag));
212-
m_prop.Value.bin.cb = m_binVal.size();
212+
m_prop.Value.bin.cb = static_cast<ULONG>(m_binVal.size());
213213
m_prop.Value.bin.lpb = const_cast<LPBYTE>(m_binVal.data());
214214
m_canParseMAPI = false;
215215
break;
@@ -218,7 +218,7 @@ namespace propertybag
218218
else
219219
{
220220
m_prop.ulPropTag = PROP_TAG(PT_BINARY, PROP_ID_NULL);
221-
m_prop.Value.bin.cb = m_binVal.size();
221+
m_prop.Value.bin.cb = static_cast<ULONG>(m_binVal.size());
222222
m_prop.Value.bin.lpb = const_cast<LPBYTE>(m_binVal.data());
223223
}
224224
}
@@ -368,7 +368,7 @@ namespace propertybag
368368
break;
369369
case PT_UNICODE:
370370
// Include null terminator
371-
cb = (std::wstring(newValue->Value.lpszW).length() + 1) * sizeof(wchar_t);
371+
cb = static_cast<ULONG>((std::wstring(newValue->Value.lpszW).length() + 1) * sizeof(wchar_t));
372372
lpb = LPBYTE(newValue->Value.lpszW);
373373
break;
374374
case PT_MV_LONG:
@@ -394,7 +394,7 @@ namespace propertybag
394394
// Count up our additional needs for reserve
395395
for (ULONG iMVCount = 0; iMVCount < newValue->Value.MVbin.cValues; iMVCount++)
396396
{
397-
cb += memory::align(newValue->Value.MVbin.lpbin[iMVCount].cb);
397+
cb += static_cast<ULONG>(memory::align(newValue->Value.MVbin.lpbin[iMVCount].cb));
398398
}
399399

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

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

471471
// Then reserve additional space for the string data to avoid realloc

Diff for: core/propertyBag/registryPropertyBag.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -137,7 +137,7 @@ namespace propertybag
137137
}
138138

139139
_Check_return_ HRESULT
140-
registryPropertyBag::SetProp(_In_ LPSPropValue lpProp, _In_ ULONG ulPropTag, const std::wstring& name)
140+
registryPropertyBag::SetProp(_In_ LPSPropValue lpProp, _In_ ULONG /*ulPropTag*/, const std::wstring& name)
141141
{
142142
ensureLoaded();
143143
for (const auto& prop : m_props)

Diff for: core/utility/registry.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -278,7 +278,7 @@ namespace registry
278278
_In_ const std::vector<BYTE>& binValue,
279279
_In_ const bool bSecure)
280280
{
281-
const DWORD cbValue = binValue.size();
281+
const DWORD cbValue = static_cast<DWORD>(binValue.size());
282282
if (bSecure)
283283
{
284284
auto DataIn = DATA_BLOB{cbValue, const_cast<LPBYTE>(binValue.data())};

0 commit comments

Comments
 (0)