You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@nifi.apache.org by GitBox <gi...@apache.org> on 2021/02/25 07:59:47 UTC

[GitHub] [nifi-minifi-cpp] hunyadi-dev commented on a change in pull request #1015: MINIFICPP-1509 - Use _stat64 on windows to handle large files

hunyadi-dev commented on a change in pull request #1015:
URL: https://github.com/apache/nifi-minifi-cpp/pull/1015#discussion_r582616439



##########
File path: extensions/standard-processors/processors/GetFile.cpp
##########
@@ -228,42 +228,49 @@ void GetFile::pollListing(std::queue<std::string> &list, const GetFileRequest &r
 bool GetFile::acceptFile(std::string fullName, std::string name, const GetFileRequest &request) {
   logger_->log_trace("Checking file: %s", fullName);
 
+#ifdef WIN32
+  struct _stat64 statbuf;
+  if (_stat64(fullName.c_str(), &statbuf) != 0) {
+    return false;
+  }
+#else
   struct stat statbuf;
+  if (stat(fullName.c_str(), &statbuf) != 0) {
+    return false;
+  }
+#endif
+  uint64_t file_size = gsl::narrow<uint64_t>(statbuf.st_size);
+  uint64_t modifiedTime = gsl::narrow<uint64_t>(statbuf.st_mtime) * 1000;

Review comment:
       Is this safe (both for the narrowing before scaling and the type usage)? Shouldn't we use `std::difftime`?




----------------------------------------------------------------
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:
users@infra.apache.org