Commit 5f4675bb24dcffa616d6ae3bd38e532510522615

Authored by Jay Berkenbilt
1 parent 5525c931

Mark non-ABI symbols in exported class with QPDF_DLL_PRIVATE

... ... @@ -30,31 +30,17 @@ Misc
30 30 encryption dictionary normally.
31 31 * Have a warn in QPDF that passes its variable arguments onto QPDFExc
32 32 so you don't have to do warn(QPDFExc(...))
  33 +* Nice to have:
  34 + * Split qpdf.test into multiple tests
  35 + * Rework tests so that nothing is written into the source directory.
  36 + * Ideally then the entire build could be done with a read-only
  37 + source tree.
33 38  
34 39 Soon: Break ground on "Document-level work"
35 40  
36 41 cmake
37 42 =====
38 43  
39   -* DLL.h
40   - * The effect of QPDF_DLL_CLASS is to export everything in the class,
41   - not just the vtable. On MSVC, we don't need this as the vtable
42   - gets exported automatically when needed. With gcc, we need it to
43   - export typeinfo and vtable. Whenever QPDF_DLL_CLASS is defined,
44   - also define QPDF_DLL_LOCAL to __attribute__
45   - ((visibility("hidden"))). Then add QPDF_DLL_LOCAL to everything in
46   - QPDF_DLL_CLASS that is not marked with QPDF_DLL. The effect is
47   - that, with MSVC, only methods are marked QPDF_DLL are public
48   - because QPDF_DLL_CLASS is empty. For gcc, only methods marked
49   - QPDF_DLL are public because QPDF_DLL_LOCAL makes the other things
50   - private. See https://gcc.gnu.org/wiki/Visibility. Make sure this
51   - is documented.
52   - * Update "CODING RULES" in "README-maintainer" - search for QPDF_DLL
53   -* Nice to have:
54   - * Split qpdf.test into multiple tests
55   - * Rework tests so that nothing is written into the source directory.
56   - * Ideally then the entire build could be done with a read-only
57   - source tree.
58 44 * pikepdf
59 45 * https://github.com/pikepdf/pikepdf/pull/315 -- setup.py + docs
60 46 * https://github.com/pikepdf/pikepdf/pull/316 -- setup.py only
... ...
include/qpdf/ClosedFileInputSource.hh
... ... @@ -68,7 +68,9 @@ class QPDF_DLL_CLASS ClosedFileInputSource: public InputSource
68 68 ClosedFileInputSource(ClosedFileInputSource const&) = delete;
69 69 ClosedFileInputSource& operator=(ClosedFileInputSource const&) = delete;
70 70  
  71 + QPDF_DLL_PRIVATE
71 72 void before();
  73 + QPDF_DLL_PRIVATE
72 74 void after();
73 75  
74 76 class QPDF_DLL_PRIVATE Members
... ...
include/qpdf/InputSource.hh
... ... @@ -104,7 +104,7 @@ class QPDF_DLL_CLASS InputSource
104 104 qpdf_offset_t last_offset;
105 105  
106 106 private:
107   - class Members
  107 + class QPDF_DLL_PRIVATE Members
108 108 {
109 109 friend class InputSource;
110 110  
... ...
include/qpdf/Pl_DCT.hh
... ... @@ -70,7 +70,9 @@ class QPDF_DLL_CLASS Pl_DCT: public Pipeline
70 70 virtual void finish();
71 71  
72 72 private:
  73 + QPDF_DLL_PRIVATE
73 74 void compress(void* cinfo, Buffer*);
  75 + QPDF_DLL_PRIVATE
74 76 void decompress(void* cinfo, Buffer*);
75 77  
76 78 enum action_e { a_compress, a_decompress };
... ...
include/qpdf/Pl_Flate.hh
... ... @@ -30,7 +30,6 @@ class QPDF_DLL_CLASS Pl_Flate: public Pipeline
30 30 {
31 31 public:
32 32 static unsigned int const def_bufsize = 65536;
33   - static int compression_level;
34 33  
35 34 enum action_e { a_inflate, a_deflate };
36 35  
... ... @@ -61,10 +60,16 @@ class QPDF_DLL_CLASS Pl_Flate: public Pipeline
61 60 void setWarnCallback(std::function<void(char const*, int)> callback);
62 61  
63 62 private:
  63 + QPDF_DLL_PRIVATE
64 64 void handleData(unsigned char* data, size_t len, int flush);
  65 + QPDF_DLL_PRIVATE
65 66 void checkError(char const* prefix, int error_code);
  67 + QPDF_DLL_PRIVATE
66 68 void warn(char const*, int error_code);
67 69  
  70 + QPDF_DLL_PRIVATE
  71 + static int compression_level;
  72 +
68 73 class QPDF_DLL_PRIVATE Members
69 74 {
70 75 friend class Pl_Flate;
... ...
include/qpdf/Pl_RunLength.hh
... ... @@ -40,8 +40,11 @@ class QPDF_DLL_CLASS Pl_RunLength: public Pipeline
40 40 virtual void finish();
41 41  
42 42 private:
  43 + QPDF_DLL_PRIVATE
43 44 void encode(unsigned char* data, size_t len);
  45 + QPDF_DLL_PRIVATE
44 46 void decode(unsigned char* data, size_t len);
  47 + QPDF_DLL_PRIVATE
45 48 void flush_encode();
46 49  
47 50 enum state_e { st_top, st_copying, st_run };
... ...
include/qpdf/QPDFExc.hh
... ... @@ -66,6 +66,7 @@ class QPDF_DLL_CLASS QPDFExc: public std::runtime_error
66 66 std::string const& getMessageDetail() const;
67 67  
68 68 private:
  69 + QPDF_DLL_PRIVATE
69 70 static std::string createWhat(
70 71 std::string const& filename,
71 72 std::string const& object,
... ...
include/qpdf/QPDFObject.hh
... ... @@ -32,7 +32,7 @@
32 32 class QPDF;
33 33 class QPDFObjectHandle;
34 34  
35   -class QPDF_DLL_CLASS QPDFObject
  35 +class QPDFObject
36 36 {
37 37 public:
38 38 QPDFObject();
... ...
include/qpdf/QPDFObjectHandle.hh
... ... @@ -204,6 +204,7 @@ class QPDFObjectHandle
204 204 void writeToken(QPDFTokenizer::Token const&);
205 205  
206 206 private:
  207 + QPDF_DLL_PRIVATE
207 208 void setPipeline(Pipeline*);
208 209  
209 210 Pipeline* pipeline;
... ...
include/qpdf/QPDFSystemError.hh
... ... @@ -47,6 +47,7 @@ class QPDF_DLL_CLASS QPDFSystemError: public std::runtime_error
47 47 int getErrno() const;
48 48  
49 49 private:
  50 + QPDF_DLL_PRIVATE
50 51 static std::string
51 52 createWhat(std::string const& description, int system_errno);
52 53  
... ...
include/qpdf/RandomDataProvider.hh
... ... @@ -34,9 +34,8 @@ class QPDF_DLL_CLASS RandomDataProvider
34 34 virtual void provideRandomData(unsigned char* data, size_t len) = 0;
35 35  
36 36 protected:
37   - RandomDataProvider()
38   - {
39   - }
  37 + QPDF_DLL_PRIVATE
  38 + RandomDataProvider() = default;
40 39  
41 40 private:
42 41 RandomDataProvider(RandomDataProvider const&) = delete;
... ...
qpdf/sizes.cc
... ... @@ -33,7 +33,6 @@
33 33 #include <qpdf/QPDFNameTreeObjectHelper.hh>
34 34 #include <qpdf/QPDFNumberTreeObjectHelper.hh>
35 35 #include <qpdf/QPDFObjGen.hh>
36   -#include <qpdf/QPDFObject.hh>
37 36 #include <qpdf/QPDFObjectHandle.hh>
38 37 #include <qpdf/QPDFOutlineDocumentHelper.hh>
39 38 #include <qpdf/QPDFOutlineObjectHelper.hh>
... ... @@ -50,10 +49,6 @@
50 49 #define ignore_class(cls)
51 50 #define print_size(cls) std::cout << #cls << " " << sizeof(cls) << std::endl
52 51  
53   -// This is public because of QPDF_DLL_CLASS on InputSource
54   -// -------
55   -ignore_class(InputSource::Members);
56   -
57 52 // These are not classes
58 53 // -------
59 54 ignore_class(QUtil);
... ... @@ -105,7 +100,6 @@ main()
105 100 print_size(QPDFNumberTreeObjectHelper);
106 101 print_size(QPDFNumberTreeObjectHelper::iterator);
107 102 print_size(QPDFObjGen);
108   - print_size(QPDFObject);
109 103 print_size(QPDFObjectHandle);
110 104 print_size(QPDFObjectHandle::ParserCallbacks);
111 105 print_size(QPDFObjectHandle::QPDFArrayItems);
... ...