szaszm commented on a change in pull request #1211:
URL: https://github.com/apache/nifi-minifi-cpp/pull/1211#discussion_r748192770



##########
File path: cmake/Extensions.cmake
##########
@@ -22,10 +22,31 @@ define_property(GLOBAL PROPERTY EXTENSION-OPTIONS
 
 set_property(GLOBAL PROPERTY EXTENSION-OPTIONS "")
 
+set(extension-build-info-file 
"${CMAKE_CURRENT_BINARY_DIR}/ExtensionBuildInfo.cpp")
+file(GENERATE OUTPUT ${extension-build-info-file}
+    CONTENT "\
+    #include \"utils/Export.h\"\n\
+    #ifdef BUILD_ID_VARIABLE_NAME\n\
+    EXTENSIONAPI extern const char* const BUILD_ID_VARIABLE_NAME = 
\"__EXTENSION_BUILD_IDENTIFIER_BEGIN__${BUILD_IDENTIFIER}__EXTENSION_BUILD_IDENTIFIER_END__\";\n\

Review comment:
       I think using `extern` here is incorrect, since it only declares, but 
doesn't define a variable. That is, unless the variable is defined somewhere. 
How it ends up in the binary is not clear to me, it shouldn't be there.

##########
File path: libminifi/include/utils/file/FileView.h
##########
@@ -0,0 +1,184 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#pragma once
+
+#include <filesystem>
+#include <fstream>
+#include <string>
+#include <memory>
+
+#include "utils/gsl.h"
+#include "core/logging/LoggerConfiguration.h"
+
+#ifdef WIN32
+#include <stdio.h>
+#include <Windows.h>
+#else
+#include <sys/mman.h>
+#include <fcntl.h>
+#include <unistd.h>
+#endif
+
+namespace org::apache::nifi::minifi::utils::file {
+
+class FileView {
+  static std::string getLastError() {
+#ifdef WIN32
+    return std::system_category().message(GetLastError());
+#else
+    return std::system_category().message(errno);
+#endif
+  }
+#ifdef WIN32
+  struct FileHandle {

Review comment:
       In this file, there is a lot of unnecessary complexity just to search in 
a memory-mapped file instead of using fstream to do conventional read. If there 
is another reason for this, then could you explain it? If not, could you 
convert the verification code to normal buffered file io code and remove these 
mmap wrappers?




-- 
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.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


Reply via email to