2
1
mirror of https://github.com/qpdf/qpdf.git synced 2024-12-22 10:58:58 +00:00

Mark non-ABI symbols in exported class with QPDF_DLL_PRIVATE

This commit is contained in:
Jay Berkenbilt 2022-04-10 13:29:10 -04:00
parent 5525c93124
commit 5f4675bb24
12 changed files with 25 additions and 31 deletions

24
TODO
View File

@ -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

View File

@ -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

View File

@ -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;

View File

@ -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 };

View File

@ -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<void(char const*, int)> 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;

View File

@ -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 };

View File

@ -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,

View File

@ -32,7 +32,7 @@
class QPDF;
class QPDFObjectHandle;
class QPDF_DLL_CLASS QPDFObject
class QPDFObject
{
public:
QPDFObject();

View File

@ -204,6 +204,7 @@ class QPDFObjectHandle
void writeToken(QPDFTokenizer::Token const&);
private:
QPDF_DLL_PRIVATE
void setPipeline(Pipeline*);
Pipeline* pipeline;

View File

@ -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);

View File

@ -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;

View File

@ -33,7 +33,6 @@
#include <qpdf/QPDFNameTreeObjectHelper.hh>
#include <qpdf/QPDFNumberTreeObjectHelper.hh>
#include <qpdf/QPDFObjGen.hh>
#include <qpdf/QPDFObject.hh>
#include <qpdf/QPDFObjectHandle.hh>
#include <qpdf/QPDFOutlineDocumentHelper.hh>
#include <qpdf/QPDFOutlineObjectHelper.hh>
@ -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);