This is an automated email from the ASF dual-hosted git repository.

phrocker pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/nifi-minifi-cpp.git


The following commit(s) were added to refs/heads/master by this push:
     new d9912ff  MINIFICPP-885: Minor change to remove warning
d9912ff is described below

commit d9912ff62f202cad0b6c9ca2fe44227585e8228b
Author: Marc Parisi <[email protected]>
AuthorDate: Thu May 30 12:27:10 2019 -0400

    MINIFICPP-885: Minor change to remove warning
    
    This closes #575.
    
    Signed-off-by: Marc Parisi <[email protected]>
---
 libminifi/include/utils/TimeUtil.h | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/libminifi/include/utils/TimeUtil.h 
b/libminifi/include/utils/TimeUtil.h
index cdf2194..a20059a 100644
--- a/libminifi/include/utils/TimeUtil.h
+++ b/libminifi/include/utils/TimeUtil.h
@@ -83,7 +83,8 @@ inline int64_t pareDateTimeStr(const std::string &str) {
   if (sscanf(str.c_str(), "%4u-%2hhu-%2hhuT%2hhu:%2hhu:%2hhuZ%n", &year, 
&month, &day, &hours, &minutes, &seconds, &read) != 6) {
     return -1;
   }
-  if (read != str.size()) {
+  // while it is unlikely that read will be < 0, the conditional adds little 
cost for a little defensiveness.
+  if (read < 0 || static_cast<size_t>(read) != str.size()) {
     return -1;
   }
 

Reply via email to