fgerlits commented on a change in pull request #869:
URL: https://github.com/apache/nifi-minifi-cpp/pull/869#discussion_r469238782
##########
File path: libminifi/src/io/FileStream.cpp
##########
@@ -101,13 +96,12 @@ int FileStream::writeData(std::vector<uint8_t> &buf, int
buflen) {
int FileStream::writeData(uint8_t *value, int size) {
if (!IsNullOrEmpty(value)) {
- std::lock_guard<std::recursive_mutex> lock(file_lock_);
+ std::lock_guard<std::mutex> lock(file_lock_);
if (file_stream_->write(reinterpret_cast<const char*>(value), size)) {
offset_ += size;
if (offset_ > length_) {
length_ = offset_;
}
- file_stream_->seekg(offset_);
Review comment:
I guess the `tellg` and `tellp` pointers could in theory be different,
but they have never been, and if the standard library changes this, that will
break almost all programs in existence, so I don't think they will. :)
edit: @szaszm yeah, but that's `stringstream` -- I'm pretty sure `tellg` and
`tellp` are the same in `fstream`
edit2: I found this comment in (a version of) the libstdc++ source
https://gcc.gnu.org/git/?p=gcc.git;a=blob;f=libstdc%2B%2B-v3/include/bits/fstream.tcc;h=ef51a8409fc7a62820a950aaf12e5cfef12f2a30;hb=HEAD#l795
According to 27.8.1.4 p11 - 13, seekoff should ignore the last argument
(of type openmode).
this third argument (in or out) is the difference between tellg and tellp
----------------------------------------------------------------
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]