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/06/01 14:07:53 UTC

[GitHub] [nifi-minifi-cpp] szaszm commented on a change in pull request #1083: MINIFICPP-1507 convert OutputStream::write to size_t

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



##########
File path: extensions/standard-processors/processors/GenerateFlowFile.h
##########
@@ -67,16 +67,14 @@ class GenerateFlowFile : public core::Processor {
   // Nest Callback Class for write stream
   class WriteCallback : public OutputStreamCallback {
    public:
-    WriteCallback(std::vector<char> && data) : data_(std::move(data)) { // NOLINT
-    }
-    WriteCallback(const std::vector<char>& data) : data_(data) { // NOLINT
-    }
-    std::vector<char> data_;
-    int64_t process(const std::shared_ptr<io::BaseStream>& stream) {
-      int64_t ret = 0;
-      if (data_.size() > 0)
-        ret = stream->write(reinterpret_cast<uint8_t*>(&data_[0]), gsl::narrow<int>(data_.size()));
-      return ret;
+    explicit WriteCallback(std::vector<char>& data)
+        :data_(&data)
+    { }
+    gsl::not_null<std::vector<char>*> data_;

Review comment:
       Because I consider reference members (and other `const` non-`static` data members) a bad practice in most cases.




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