szaszm commented on a change in pull request #1028:
URL: https://github.com/apache/nifi-minifi-cpp/pull/1028#discussion_r640756106
##########
File path: libminifi/src/io/InputStream.cpp
##########
@@ -84,9 +85,9 @@ int InputStream::read(std::string &str, bool widen) {
}
std::vector<uint8_t> buffer(len);
- uint32_t bytes_read = gsl::narrow<uint32_t>(read(buffer.data(), len));
+ const auto bytes_read = gsl::narrow<uint32_t>(read(buffer.data(), len));
if (bytes_read != len) {
- return -1;
+ return static_cast<size_t>(-1);
Review comment:
changed to forward errors in 47358cb
##########
File path: libminifi/src/io/InputStream.cpp
##########
@@ -30,42 +30,43 @@ namespace nifi {
namespace minifi {
namespace io {
-int InputStream::read(std::vector<uint8_t>& buffer, int len) {
- if (buffer.size() < gsl::narrow<size_t>(len)) {
+size_t InputStream::read(std::vector<uint8_t>& buffer, size_t len) {
+ if (buffer.size() < len) {
buffer.resize(len);
}
- int ret = read(buffer.data(), len);
- buffer.resize((std::max)(ret, 0));
+ const auto ret = read(buffer.data(), len);
+ if (io::isError(ret)) return ret;
+ buffer.resize((std::max)(ret, size_t{0}));
Review comment:
no, removed in 47358cb
--
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]