szaszm commented on a change in pull request #754: MINIFICPP-1151 fix most 1st
party compiler warnings
URL: https://github.com/apache/nifi-minifi-cpp/pull/754#discussion_r408199492
##########
File path: extensions/windows-event-log/CollectorInitiatedSubscription.cpp
##########
@@ -577,7 +577,7 @@ bool CollectorInitiatedSubscription::subscribe(const
std::shared_ptr<core::Proce
auto& logger = pCollectorInitiatedSubscription->logger_;
if (action == EvtSubscribeActionError) {
- if (ERROR_EVT_QUERY_RESULT_STALE == reinterpret_cast<DWORD>(hEvent))
{
+ if (ERROR_EVT_QUERY_RESULT_STALE ==
reinterpret_cast<intptr_t>(hEvent)) {
Review comment:
`hEvent` is of type `HANDLE`, which is a pointer type. The winapi docs
suggest comparing this pointer value to the `DWORD` (signed integer) on the
left, but the line produces a warnings since `sizeof(void*) == sizeof(DWORD)`
may not hold true.
In the new version, we convert to `intptr_t` for which `sizeof(void*) ==
sizeof(intptr_t)` always hold true and if any the conversion happens to happen
on integers of different sizes, the smaller one will be implicitly promoted.
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
[email protected]
With regards,
Apache Git Services