Kelson has submitted this change and it was merged.
Change subject: Invalidate internal streambuf buffer when we change it.
......................................................................
Invalidate internal streambuf buffer when we change it.
It may be not necessary as it never fails before, but let's be cautious.
Change-Id: Ie54f95e08e2683c43ef7b0fdc70bd9f74fb1fbe9
---
M zimlib/include/zim/fstream.h
M zimlib/src/fstream.cpp
2 files changed, 2 insertions(+), 1 deletion(-)
Approvals:
Kelson: Verified; Looks good to me, approved
diff --git a/zimlib/include/zim/fstream.h b/zimlib/include/zim/fstream.h
index 970920e..4b99814 100644
--- a/zimlib/include/zim/fstream.h
+++ b/zimlib/include/zim/fstream.h
@@ -75,7 +75,7 @@
void seekg(zim::offset_type off);
void setBufsize(unsigned s)
- { buffer.resize(s); }
+ { buffer.resize(s); setg(0, 0, 0);}
zim::offset_type fsize() const;
time_t getMTime() const;
};
diff --git a/zimlib/src/fstream.cpp b/zimlib/src/fstream.cpp
index b925fc5..ef91b57 100644
--- a/zimlib/src/fstream.cpp
+++ b/zimlib/src/fstream.cpp
@@ -258,6 +258,7 @@
throw std::runtime_error(msg.str());
}
}
+ setg(0, 0, 0);
}
void streambuf::seekg(zim::offset_type off)
--
To view, visit https://gerrit.wikimedia.org/r/314720
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings
Gerrit-MessageType: merged
Gerrit-Change-Id: Ie54f95e08e2683c43ef7b0fdc70bd9f74fb1fbe9
Gerrit-PatchSet: 2
Gerrit-Project: openzim
Gerrit-Branch: master
Gerrit-Owner: Mgautierfr <[email protected]>
Gerrit-Reviewer: Kelson <[email protected]>
_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits