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_r408205004
##########
File path: libminifi/src/core/ProcessSession.cpp
##########
@@ -568,7 +567,11 @@ void ProcessSession::import(const std::string& source,
std::vector<std::shared_p
while (true) {
startTime = getTimeMillis();
uint8_t* delimiterPos = std::find(begin, end,
static_cast<uint8_t>(inputDelimiter));
- int len = delimiterPos - begin;
+ const ptrdiff_t zlen{ delimiterPos - begin };
+ if (zlen < std::numeric_limits<int>::min() || zlen >
std::numeric_limits<int>::max()) {
+ logger_->log_error("narrowing conversion failed");
+ }
+ const int len = zlen;
Review comment:
Unlikely narrowing conversion. I chose not to modify behavior except for
logging in case of data loss.
----------------------------------------------------------------
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