aboutsummaryrefslogtreecommitdiffstats
path: root/libqpdf/Pl_StdioFile.cc
diff options
context:
space:
mode:
authorJay Berkenbilt <ejb@ql.org>2019-06-22 03:32:47 +0200
committerJay Berkenbilt <ejb@ql.org>2019-06-22 16:13:27 +0200
commit79f6b4823b95b65290a045a59fdd4a8d9b302708 (patch)
treeb94d273dd51e64a7144b669cf5ed91d826cc1387 /libqpdf/Pl_StdioFile.cc
parent864a546af6e1c17e0de2dc2be6da105f454b6e54 (diff)
downloadqpdf-79f6b4823b95b65290a045a59fdd4a8d9b302708.tar.zst
Convert remaining public classes to use Members pattern
Have classes contain only a single private member of type PointerHolder<Members>. This makes it safe to change the structure of the Members class without breaking binary compatibility. Many of the classes already follow this pattern quite successfully. This brings in the rest of the class that are part of the public API.
Diffstat (limited to 'libqpdf/Pl_StdioFile.cc')
-rw-r--r--libqpdf/Pl_StdioFile.cc15
1 files changed, 12 insertions, 3 deletions
diff --git a/libqpdf/Pl_StdioFile.cc b/libqpdf/Pl_StdioFile.cc
index 4d3cba60..253e36a1 100644
--- a/libqpdf/Pl_StdioFile.cc
+++ b/libqpdf/Pl_StdioFile.cc
@@ -4,9 +4,18 @@
#include <stdexcept>
#include <errno.h>
+Pl_StdioFile::Members::Members(FILE* f) :
+ file(f)
+{
+}
+
+Pl_StdioFile::Members::~Members()
+{
+}
+
Pl_StdioFile::Pl_StdioFile(char const* identifier, FILE* f) :
Pipeline(identifier, 0),
- file(f)
+ m(new Members(f))
{
}
@@ -20,7 +29,7 @@ Pl_StdioFile::write(unsigned char* buf, size_t len)
size_t so_far = 0;
while (len > 0)
{
- so_far = fwrite(buf, 1, len, this->file);
+ so_far = fwrite(buf, 1, len, this->m->file);
if (so_far == 0)
{
QUtil::throw_system_error(
@@ -37,7 +46,7 @@ Pl_StdioFile::write(unsigned char* buf, size_t len)
void
Pl_StdioFile::finish()
{
- if ((fflush(this->file) == -1) &&
+ if ((fflush(this->m->file) == -1) &&
(errno == EBADF))
{
throw std::logic_error(