diff --git a/TODO b/TODO index ef34096c..a5a10858 100644 --- a/TODO +++ b/TODO @@ -30,31 +30,17 @@ Misc encryption dictionary normally. * Have a warn in QPDF that passes its variable arguments onto QPDFExc so you don't have to do warn(QPDFExc(...)) +* Nice to have: + * Split qpdf.test into multiple tests + * Rework tests so that nothing is written into the source directory. + * Ideally then the entire build could be done with a read-only + source tree. Soon: Break ground on "Document-level work" cmake ===== -* DLL.h - * The effect of QPDF_DLL_CLASS is to export everything in the class, - not just the vtable. On MSVC, we don't need this as the vtable - gets exported automatically when needed. With gcc, we need it to - export typeinfo and vtable. Whenever QPDF_DLL_CLASS is defined, - also define QPDF_DLL_LOCAL to __attribute__ - ((visibility("hidden"))). Then add QPDF_DLL_LOCAL to everything in - QPDF_DLL_CLASS that is not marked with QPDF_DLL. The effect is - that, with MSVC, only methods are marked QPDF_DLL are public - because QPDF_DLL_CLASS is empty. For gcc, only methods marked - QPDF_DLL are public because QPDF_DLL_LOCAL makes the other things - private. See https://gcc.gnu.org/wiki/Visibility. Make sure this - is documented. - * Update "CODING RULES" in "README-maintainer" - search for QPDF_DLL -* Nice to have: - * Split qpdf.test into multiple tests - * Rework tests so that nothing is written into the source directory. - * Ideally then the entire build could be done with a read-only - source tree. * pikepdf * https://github.com/pikepdf/pikepdf/pull/315 -- setup.py + docs * https://github.com/pikepdf/pikepdf/pull/316 -- setup.py only diff --git a/include/qpdf/ClosedFileInputSource.hh b/include/qpdf/ClosedFileInputSource.hh index e5142bc1..e82c4410 100644 --- a/include/qpdf/ClosedFileInputSource.hh +++ b/include/qpdf/ClosedFileInputSource.hh @@ -68,7 +68,9 @@ class QPDF_DLL_CLASS ClosedFileInputSource: public InputSource ClosedFileInputSource(ClosedFileInputSource const&) = delete; ClosedFileInputSource& operator=(ClosedFileInputSource const&) = delete; + QPDF_DLL_PRIVATE void before(); + QPDF_DLL_PRIVATE void after(); class QPDF_DLL_PRIVATE Members diff --git a/include/qpdf/InputSource.hh b/include/qpdf/InputSource.hh index 8d46895d..94dec500 100644 --- a/include/qpdf/InputSource.hh +++ b/include/qpdf/InputSource.hh @@ -104,7 +104,7 @@ class QPDF_DLL_CLASS InputSource qpdf_offset_t last_offset; private: - class Members + class QPDF_DLL_PRIVATE Members { friend class InputSource; diff --git a/include/qpdf/Pl_DCT.hh b/include/qpdf/Pl_DCT.hh index 0339afb7..0bbf302b 100644 --- a/include/qpdf/Pl_DCT.hh +++ b/include/qpdf/Pl_DCT.hh @@ -70,7 +70,9 @@ class QPDF_DLL_CLASS Pl_DCT: public Pipeline virtual void finish(); private: + QPDF_DLL_PRIVATE void compress(void* cinfo, Buffer*); + QPDF_DLL_PRIVATE void decompress(void* cinfo, Buffer*); enum action_e { a_compress, a_decompress }; diff --git a/include/qpdf/Pl_Flate.hh b/include/qpdf/Pl_Flate.hh index 503c2db8..5cfe17f4 100644 --- a/include/qpdf/Pl_Flate.hh +++ b/include/qpdf/Pl_Flate.hh @@ -30,7 +30,6 @@ class QPDF_DLL_CLASS Pl_Flate: public Pipeline { public: static unsigned int const def_bufsize = 65536; - static int compression_level; enum action_e { a_inflate, a_deflate }; @@ -61,10 +60,16 @@ class QPDF_DLL_CLASS Pl_Flate: public Pipeline void setWarnCallback(std::function callback); private: + QPDF_DLL_PRIVATE void handleData(unsigned char* data, size_t len, int flush); + QPDF_DLL_PRIVATE void checkError(char const* prefix, int error_code); + QPDF_DLL_PRIVATE void warn(char const*, int error_code); + QPDF_DLL_PRIVATE + static int compression_level; + class QPDF_DLL_PRIVATE Members { friend class Pl_Flate; diff --git a/include/qpdf/Pl_RunLength.hh b/include/qpdf/Pl_RunLength.hh index 5becd198..ce2b0e90 100644 --- a/include/qpdf/Pl_RunLength.hh +++ b/include/qpdf/Pl_RunLength.hh @@ -40,8 +40,11 @@ class QPDF_DLL_CLASS Pl_RunLength: public Pipeline virtual void finish(); private: + QPDF_DLL_PRIVATE void encode(unsigned char* data, size_t len); + QPDF_DLL_PRIVATE void decode(unsigned char* data, size_t len); + QPDF_DLL_PRIVATE void flush_encode(); enum state_e { st_top, st_copying, st_run }; diff --git a/include/qpdf/QPDFExc.hh b/include/qpdf/QPDFExc.hh index 1d88bcf9..d9d7312b 100644 --- a/include/qpdf/QPDFExc.hh +++ b/include/qpdf/QPDFExc.hh @@ -66,6 +66,7 @@ class QPDF_DLL_CLASS QPDFExc: public std::runtime_error std::string const& getMessageDetail() const; private: + QPDF_DLL_PRIVATE static std::string createWhat( std::string const& filename, std::string const& object, diff --git a/include/qpdf/QPDFObject.hh b/include/qpdf/QPDFObject.hh index 9487e8f5..897a61dd 100644 --- a/include/qpdf/QPDFObject.hh +++ b/include/qpdf/QPDFObject.hh @@ -32,7 +32,7 @@ class QPDF; class QPDFObjectHandle; -class QPDF_DLL_CLASS QPDFObject +class QPDFObject { public: QPDFObject(); diff --git a/include/qpdf/QPDFObjectHandle.hh b/include/qpdf/QPDFObjectHandle.hh index 7437d494..b8b95f47 100644 --- a/include/qpdf/QPDFObjectHandle.hh +++ b/include/qpdf/QPDFObjectHandle.hh @@ -204,6 +204,7 @@ class QPDFObjectHandle void writeToken(QPDFTokenizer::Token const&); private: + QPDF_DLL_PRIVATE void setPipeline(Pipeline*); Pipeline* pipeline; diff --git a/include/qpdf/QPDFSystemError.hh b/include/qpdf/QPDFSystemError.hh index b8595e09..f6c62224 100644 --- a/include/qpdf/QPDFSystemError.hh +++ b/include/qpdf/QPDFSystemError.hh @@ -47,6 +47,7 @@ class QPDF_DLL_CLASS QPDFSystemError: public std::runtime_error int getErrno() const; private: + QPDF_DLL_PRIVATE static std::string createWhat(std::string const& description, int system_errno); diff --git a/include/qpdf/RandomDataProvider.hh b/include/qpdf/RandomDataProvider.hh index ffedfb2b..6b316ee1 100644 --- a/include/qpdf/RandomDataProvider.hh +++ b/include/qpdf/RandomDataProvider.hh @@ -34,9 +34,8 @@ class QPDF_DLL_CLASS RandomDataProvider virtual void provideRandomData(unsigned char* data, size_t len) = 0; protected: - RandomDataProvider() - { - } + QPDF_DLL_PRIVATE + RandomDataProvider() = default; private: RandomDataProvider(RandomDataProvider const&) = delete; diff --git a/qpdf/sizes.cc b/qpdf/sizes.cc index 39feafea..10a25fac 100644 --- a/qpdf/sizes.cc +++ b/qpdf/sizes.cc @@ -33,7 +33,6 @@ #include #include #include -#include #include #include #include @@ -50,10 +49,6 @@ #define ignore_class(cls) #define print_size(cls) std::cout << #cls << " " << sizeof(cls) << std::endl -// This is public because of QPDF_DLL_CLASS on InputSource -// ------- -ignore_class(InputSource::Members); - // These are not classes // ------- ignore_class(QUtil); @@ -105,7 +100,6 @@ main() print_size(QPDFNumberTreeObjectHelper); print_size(QPDFNumberTreeObjectHelper::iterator); print_size(QPDFObjGen); - print_size(QPDFObject); print_size(QPDFObjectHandle); print_size(QPDFObjectHandle::ParserCallbacks); print_size(QPDFObjectHandle::QPDFArrayItems);