diff --git a/TODO b/TODO index 98000ccd..971b018f 100644 --- a/TODO +++ b/TODO @@ -37,7 +37,6 @@ cmake ===== * DLL.h - * Remove DLL.h and QPDF_DLL* from all private library classes. * Change DLL_EXPORT to QPDF_EXPORT. Be sure to call attention to this in the release notes. There should be a "migrating to cmake" in the manual, and ./configure should draw attention to it. diff --git a/libqpdf/qpdf/BitStream.hh b/libqpdf/qpdf/BitStream.hh index 8be7c64d..14555c5d 100644 --- a/libqpdf/qpdf/BitStream.hh +++ b/libqpdf/qpdf/BitStream.hh @@ -3,25 +3,18 @@ #ifndef BITSTREAM_HH #define BITSTREAM_HH -#include #include class BitStream { public: - QPDF_DLL BitStream(unsigned char const* p, size_t nbytes); - QPDF_DLL void reset(); - QPDF_DLL unsigned long long getBits(size_t nbits); - QPDF_DLL long long getBitsSigned(size_t nbits); // Only call getBitsInt when requesting a number of bits that will // definitely fit in an int. - QPDF_DLL int getBitsInt(size_t nbits); - QPDF_DLL void skipToNextByte(); private: diff --git a/libqpdf/qpdf/BitWriter.hh b/libqpdf/qpdf/BitWriter.hh index 3ca91977..ca237d47 100644 --- a/libqpdf/qpdf/BitWriter.hh +++ b/libqpdf/qpdf/BitWriter.hh @@ -3,7 +3,6 @@ #ifndef BITWRITER_HH #define BITWRITER_HH -#include #include class Pipeline; @@ -13,16 +12,11 @@ class BitWriter public: // Write bits to the pipeline. It is the caller's responsibility // to eventually call finish on the pipeline. - QPDF_DLL BitWriter(Pipeline* pl); - QPDF_DLL void writeBits(unsigned long long val, size_t bits); - QPDF_DLL void writeBitsSigned(long long val, size_t bits); - QPDF_DLL void writeBitsInt(int val, size_t bits); // Force any partial byte to be written to the pipeline. - QPDF_DLL void flush(); private: diff --git a/libqpdf/qpdf/CryptoRandomDataProvider.hh b/libqpdf/qpdf/CryptoRandomDataProvider.hh index 5bea502e..006f27c2 100644 --- a/libqpdf/qpdf/CryptoRandomDataProvider.hh +++ b/libqpdf/qpdf/CryptoRandomDataProvider.hh @@ -1,21 +1,14 @@ #ifndef CRYPTORANDOMDATAPROVIDER_HH #define CRYPTORANDOMDATAPROVIDER_HH -#include #include class CryptoRandomDataProvider: public RandomDataProvider { public: - QPDF_DLL CryptoRandomDataProvider(); - QPDF_DLL virtual ~CryptoRandomDataProvider(); - - QPDF_DLL virtual void provideRandomData(unsigned char* data, size_t len); - - QPDF_DLL static RandomDataProvider* getInstance(); }; diff --git a/libqpdf/qpdf/InsecureRandomDataProvider.hh b/libqpdf/qpdf/InsecureRandomDataProvider.hh index 2504c673..5cdaabb2 100644 --- a/libqpdf/qpdf/InsecureRandomDataProvider.hh +++ b/libqpdf/qpdf/InsecureRandomDataProvider.hh @@ -1,21 +1,14 @@ #ifndef INSECURERANDOMDATAPROVIDER_HH #define INSECURERANDOMDATAPROVIDER_HH -#include #include class InsecureRandomDataProvider: public RandomDataProvider { public: - QPDF_DLL InsecureRandomDataProvider(); - QPDF_DLL virtual ~InsecureRandomDataProvider(); - - QPDF_DLL virtual void provideRandomData(unsigned char* data, size_t len); - - QPDF_DLL static RandomDataProvider* getInstance(); private: diff --git a/libqpdf/qpdf/JSONHandler.hh b/libqpdf/qpdf/JSONHandler.hh index 9be50806..80f82175 100644 --- a/libqpdf/qpdf/JSONHandler.hh +++ b/libqpdf/qpdf/JSONHandler.hh @@ -1,7 +1,6 @@ #ifndef JSONHANDLER_HH #define JSONHANDLER_HH -#include #include #include #include @@ -18,10 +17,7 @@ class JSONHandler public: // A QPDFUsage exception is thrown if there are any errors // validating the JSON object. - QPDF_DLL JSONHandler(); - - QPDF_DLL ~JSONHandler() = default; // Based on the type of handler, expect the object to be of a @@ -42,36 +38,26 @@ class JSONHandler // If an any handler is added, it will be called for any value // including null, and no other handler will be called. - QPDF_DLL void addAnyHandler(json_handler_t fn); // If any of the remaining handlers are registered, each // registered handle will be called. - QPDF_DLL void addNullHandler(void_handler_t fn); - QPDF_DLL void addStringHandler(string_handler_t fn); - QPDF_DLL void addNumberHandler(string_handler_t fn); - QPDF_DLL void addBoolHandler(bool_handler_t fn); - QPDF_DLL void addDictHandlers(json_handler_t start_fn, void_handler_t end_fn); - QPDF_DLL void addDictKeyHandler(std::string const& key, std::shared_ptr); - QPDF_DLL void addFallbackDictHandler(std::shared_ptr); - QPDF_DLL void addArrayHandlers( json_handler_t start_fn, void_handler_t end_fn, std::shared_ptr item_handlers); // Apply handlers recursively to a JSON object. - QPDF_DLL void handle(std::string const& path, JSON j); private: @@ -115,7 +101,6 @@ class JSONHandler friend class JSONHandler; public: - QPDF_DLL ~Members() = default; private: diff --git a/libqpdf/qpdf/MD5.hh b/libqpdf/qpdf/MD5.hh index 8a2f60fa..f2c2fdfe 100644 --- a/libqpdf/qpdf/MD5.hh +++ b/libqpdf/qpdf/MD5.hh @@ -1,7 +1,6 @@ #ifndef MD5_HH #define MD5_HH -#include #include #include #include @@ -12,50 +11,37 @@ class MD5 public: typedef unsigned char Digest[16]; - QPDF_DLL MD5(); - QPDF_DLL void reset(); // encodes string and finalizes - QPDF_DLL void encodeString(char const* input_string); // encodes file and finalizes; offset < 0 reads whole file - QPDF_DLL void encodeFile(char const* filename, qpdf_offset_t up_to_offset = -1); // appends string to current md5 object - QPDF_DLL void appendString(char const* input_string); // appends arbitrary data to current md5 object - QPDF_DLL void encodeDataIncrementally(char const* input_data, size_t len); // computes a raw digest - QPDF_DLL void digest(Digest); // prints the digest to stdout terminated with \r\n (primarily for // testing) - QPDF_DLL void print(); // returns the digest as a hexadecimal string - QPDF_DLL std::string unparse(); // Convenience functions - QPDF_DLL static std::string getDataChecksum(char const* buf, size_t len); - QPDF_DLL static std::string getFileChecksum(char const* filename, qpdf_offset_t up_to_offset = -1); - QPDF_DLL static bool checkDataChecksum(char const* const checksum, char const* buf, size_t len); - QPDF_DLL static bool checkFileChecksum( char const* const checksum, char const* filename, diff --git a/libqpdf/qpdf/Pl_AES_PDF.hh b/libqpdf/qpdf/Pl_AES_PDF.hh index 880d7d32..6044902e 100644 --- a/libqpdf/qpdf/Pl_AES_PDF.hh +++ b/libqpdf/qpdf/Pl_AES_PDF.hh @@ -11,7 +11,6 @@ class Pl_AES_PDF: public Pipeline { public: - QPDF_DLL // key should be a pointer to key_bytes bytes of data Pl_AES_PDF( char const* identifier, @@ -19,30 +18,22 @@ class Pl_AES_PDF: public Pipeline bool encrypt, unsigned char const* key, size_t key_bytes); - QPDF_DLL virtual ~Pl_AES_PDF(); - QPDF_DLL virtual void write(unsigned char* data, size_t len); - QPDF_DLL virtual void finish(); // Use zero initialization vector; needed for AESV3 - QPDF_DLL void useZeroIV(); // Disable padding; needed for AESV3 - QPDF_DLL void disablePadding(); // Specify an initialization vector, which will not be included in // the output. - QPDF_DLL void setIV(unsigned char const* iv, size_t bytes); // For testing only; PDF always uses CBC - QPDF_DLL void disableCBC(); // For testing only: use a fixed initialization vector for CBC - QPDF_DLL static void useStaticIV(); private: diff --git a/libqpdf/qpdf/Pl_ASCII85Decoder.hh b/libqpdf/qpdf/Pl_ASCII85Decoder.hh index cef09425..966622ad 100644 --- a/libqpdf/qpdf/Pl_ASCII85Decoder.hh +++ b/libqpdf/qpdf/Pl_ASCII85Decoder.hh @@ -6,13 +6,9 @@ class Pl_ASCII85Decoder: public Pipeline { public: - QPDF_DLL Pl_ASCII85Decoder(char const* identifier, Pipeline* next); - QPDF_DLL virtual ~Pl_ASCII85Decoder(); - QPDF_DLL virtual void write(unsigned char* buf, size_t len); - QPDF_DLL virtual void finish(); private: diff --git a/libqpdf/qpdf/Pl_ASCIIHexDecoder.hh b/libqpdf/qpdf/Pl_ASCIIHexDecoder.hh index 766fd727..2aa6a282 100644 --- a/libqpdf/qpdf/Pl_ASCIIHexDecoder.hh +++ b/libqpdf/qpdf/Pl_ASCIIHexDecoder.hh @@ -6,13 +6,9 @@ class Pl_ASCIIHexDecoder: public Pipeline { public: - QPDF_DLL Pl_ASCIIHexDecoder(char const* identifier, Pipeline* next); - QPDF_DLL virtual ~Pl_ASCIIHexDecoder(); - QPDF_DLL virtual void write(unsigned char* buf, size_t len); - QPDF_DLL virtual void finish(); private: diff --git a/libqpdf/qpdf/Pl_LZWDecoder.hh b/libqpdf/qpdf/Pl_LZWDecoder.hh index 5a9c9097..bc42220a 100644 --- a/libqpdf/qpdf/Pl_LZWDecoder.hh +++ b/libqpdf/qpdf/Pl_LZWDecoder.hh @@ -9,14 +9,10 @@ class Pl_LZWDecoder: public Pipeline { public: - QPDF_DLL Pl_LZWDecoder( char const* identifier, Pipeline* next, bool early_code_change); - QPDF_DLL virtual ~Pl_LZWDecoder(); - QPDF_DLL virtual void write(unsigned char* buf, size_t len); - QPDF_DLL virtual void finish(); private: diff --git a/libqpdf/qpdf/Pl_MD5.hh b/libqpdf/qpdf/Pl_MD5.hh index 269e84a8..18ce68c8 100644 --- a/libqpdf/qpdf/Pl_MD5.hh +++ b/libqpdf/qpdf/Pl_MD5.hh @@ -15,27 +15,20 @@ class Pl_MD5: public Pipeline { public: - QPDF_DLL Pl_MD5(char const* identifier, Pipeline* next); - QPDF_DLL virtual ~Pl_MD5(); - QPDF_DLL virtual void write(unsigned char*, size_t); - QPDF_DLL virtual void finish(); - QPDF_DLL std::string getHexDigest(); // Enable/disable. Disabling the pipeline causes it to become a // pass-through. This makes it possible to stick an MD5 pipeline // in a pipeline when it may or may not be required. Disabling it // avoids incurring the runtime overhead of doing needless // digest computation. - QPDF_DLL void enable(bool enabled); // If persistAcrossFinish is called, calls to finish do not // finalize the underlying md5 object. In this case, the object is // not finalized until getHexDigest() is called. - QPDF_DLL void persistAcrossFinish(bool); private: diff --git a/libqpdf/qpdf/Pl_PNGFilter.hh b/libqpdf/qpdf/Pl_PNGFilter.hh index e34c8631..ff4b6bd2 100644 --- a/libqpdf/qpdf/Pl_PNGFilter.hh +++ b/libqpdf/qpdf/Pl_PNGFilter.hh @@ -15,7 +15,6 @@ class Pl_PNGFilter: public Pipeline // Encoding is only partially supported enum action_e { a_encode, a_decode }; - QPDF_DLL Pl_PNGFilter( char const* identifier, Pipeline* next, @@ -23,12 +22,9 @@ class Pl_PNGFilter: public Pipeline unsigned int columns, unsigned int samples_per_pixel = 1, unsigned int bits_per_sample = 8); - QPDF_DLL virtual ~Pl_PNGFilter(); - QPDF_DLL virtual void write(unsigned char* data, size_t len); - QPDF_DLL virtual void finish(); private: diff --git a/libqpdf/qpdf/Pl_RC4.hh b/libqpdf/qpdf/Pl_RC4.hh index fe5c3d9e..df5e1587 100644 --- a/libqpdf/qpdf/Pl_RC4.hh +++ b/libqpdf/qpdf/Pl_RC4.hh @@ -11,19 +11,15 @@ class Pl_RC4: public Pipeline static size_t const def_bufsize = 65536; // key_len of -1 means treat key_data as a null-terminated string - QPDF_DLL Pl_RC4( char const* identifier, Pipeline* next, unsigned char const* key_data, int key_len = -1, size_t out_bufsize = def_bufsize); - QPDF_DLL virtual ~Pl_RC4(); - QPDF_DLL virtual void write(unsigned char* data, size_t len); - QPDF_DLL virtual void finish(); private: diff --git a/libqpdf/qpdf/Pl_SHA2.hh b/libqpdf/qpdf/Pl_SHA2.hh index dea7141a..c857ff94 100644 --- a/libqpdf/qpdf/Pl_SHA2.hh +++ b/libqpdf/qpdf/Pl_SHA2.hh @@ -20,19 +20,12 @@ class Pl_SHA2: public Pipeline { public: - QPDF_DLL Pl_SHA2(int bits = 0, Pipeline* next = 0); - QPDF_DLL virtual ~Pl_SHA2(); - QPDF_DLL virtual void write(unsigned char*, size_t); - QPDF_DLL virtual void finish(); - QPDF_DLL void resetBits(int bits); - QPDF_DLL std::string getHexDigest(); - QPDF_DLL std::string getRawDigest(); private: diff --git a/libqpdf/qpdf/Pl_TIFFPredictor.hh b/libqpdf/qpdf/Pl_TIFFPredictor.hh index f14b0f00..e0feda23 100644 --- a/libqpdf/qpdf/Pl_TIFFPredictor.hh +++ b/libqpdf/qpdf/Pl_TIFFPredictor.hh @@ -11,7 +11,6 @@ class Pl_TIFFPredictor: public Pipeline public: enum action_e { a_encode, a_decode }; - QPDF_DLL Pl_TIFFPredictor( char const* identifier, Pipeline* next, @@ -19,12 +18,9 @@ class Pl_TIFFPredictor: public Pipeline unsigned int columns, unsigned int samples_per_pixel = 1, unsigned int bits_per_sample = 8); - QPDF_DLL virtual ~Pl_TIFFPredictor(); - QPDF_DLL virtual void write(unsigned char* data, size_t len); - QPDF_DLL virtual void finish(); private: diff --git a/libqpdf/qpdf/QPDFArgParser.hh b/libqpdf/qpdf/QPDFArgParser.hh index b73146fc..89c7acc0 100644 --- a/libqpdf/qpdf/QPDFArgParser.hh +++ b/libqpdf/qpdf/QPDFArgParser.hh @@ -1,7 +1,6 @@ #ifndef QPDFARGPARSER_HH #define QPDFARGPARSER_HH -#include #include #include #include @@ -27,18 +26,15 @@ class QPDFArgParser // progname_env is used to override argv[0] when figuring out the // name of the executable for setting up completion. This may be // needed if the program is invoked by a wrapper. - QPDF_DLL QPDFArgParser(int argc, char const* const argv[], char const* progname_env); // Calls exit(0) if a help option is given or if in completion // mode. If there are argument parsing errors, QPDFUsage is // thrown. - QPDF_DLL void parseArgs(); // Return the program name as the last path element of the program // executable. - QPDF_DLL std::string getProgname(); // Methods for registering arguments. QPDFArgParser starts off @@ -52,32 +48,23 @@ class QPDFArgParser typedef std::function bare_arg_handler_t; typedef std::function param_arg_handler_t; - QPDF_DLL void selectMainOptionTable(); - QPDF_DLL void selectHelpOptionTable(); - QPDF_DLL void selectOptionTable(std::string const& name); // Register a new options table. This also selects the option table. - QPDF_DLL void registerOptionTable( std::string const& name, bare_arg_handler_t end_handler); // Add handlers for options in the current table - QPDF_DLL void addPositional(param_arg_handler_t); - QPDF_DLL void addBare(std::string const& arg, bare_arg_handler_t); - QPDF_DLL void addRequiredParameter( std::string const& arg, param_arg_handler_t, char const* parameter_name); - QPDF_DLL void addOptionalParameter(std::string const& arg, param_arg_handler_t); - QPDF_DLL void addChoices( std::string const& arg, param_arg_handler_t, @@ -88,12 +75,10 @@ class QPDFArgParser // an option that takes choices is to list all the choices. This // may not be good if there are too many choices, so you can // provide your own handler in this case. - QPDF_DLL void addInvalidChoiceHandler(std::string const& arg, param_arg_handler_t); // The final check handler is called at the very end of argument // parsing. - QPDF_DLL void addFinalCheck(bare_arg_handler_t); // Help generation methods @@ -134,18 +119,15 @@ class QPDFArgParser // If provided, this footer is appended to all help, separated by // a blank line. - QPDF_DLL void addHelpFooter(std::string const&); // Add a help topic along with the text for that topic - QPDF_DLL void addHelpTopic( std::string const& topic, std::string const& short_text, std::string const& long_text); // Add help for an option, and associate it with a topic. - QPDF_DLL void addOptionHelp( std::string const& option_name, std::string const& topic, @@ -156,7 +138,6 @@ class QPDFArgParser // pointer returns the top-level help information. Passing an // unknown value returns a string directing the user to run the // top-level --help option. - QPDF_DLL std::string getHelp(std::string const& topic_or_option); // Convenience methods for adding member functions of a class as @@ -176,23 +157,19 @@ class QPDFArgParser // When processing arguments, indicate how many arguments remain // after the one whose handler is being called. - QPDF_DLL int argsLeft() const; // Indicate whether we are in completion mode. - QPDF_DLL bool isCompleting() const; // Insert a completion during argument parsing; useful for // customizing completion in the position argument handler. Should // only be used in completion mode. - QPDF_DLL void insertCompletion(std::string const&); // Throw a Usage exception with the given message. In completion // mode, this just exits to prevent errors from partial commands // or other error messages from messing up completion. - QPDF_DLL void usage(std::string const& message); private: @@ -259,7 +236,6 @@ class QPDFArgParser friend class QPDFArgParser; public: - QPDF_DLL ~Members() = default; private: diff --git a/libqpdf/qpdf/QPDFCrypto_gnutls.hh b/libqpdf/qpdf/QPDFCrypto_gnutls.hh index 73d5a199..23259440 100644 --- a/libqpdf/qpdf/QPDFCrypto_gnutls.hh +++ b/libqpdf/qpdf/QPDFCrypto_gnutls.hh @@ -1,7 +1,6 @@ #ifndef QPDFCRYPTO_GNUTLS_HH #define QPDFCRYPTO_GNUTLS_HH -#include #include #include @@ -16,7 +15,6 @@ class QPDFCrypto_gnutls: public QPDFCryptoImpl public: QPDFCrypto_gnutls(); - QPDF_DLL virtual ~QPDFCrypto_gnutls(); virtual void provideRandomData(unsigned char* data, size_t len); diff --git a/libqpdf/qpdf/QPDFCrypto_native.hh b/libqpdf/qpdf/QPDFCrypto_native.hh index 9f5c7765..ec3cab2b 100644 --- a/libqpdf/qpdf/QPDFCrypto_native.hh +++ b/libqpdf/qpdf/QPDFCrypto_native.hh @@ -2,7 +2,6 @@ #define QPDFCRYPTO_NATIVE_HH #include -#include #include #include #include @@ -14,7 +13,6 @@ class QPDFCrypto_native: public QPDFCryptoImpl public: QPDFCrypto_native() = default; - QPDF_DLL virtual ~QPDFCrypto_native() = default; virtual void provideRandomData(unsigned char* data, size_t len); diff --git a/libqpdf/qpdf/QPDFCrypto_openssl.hh b/libqpdf/qpdf/QPDFCrypto_openssl.hh index a8fad041..9bdaaae8 100644 --- a/libqpdf/qpdf/QPDFCrypto_openssl.hh +++ b/libqpdf/qpdf/QPDFCrypto_openssl.hh @@ -26,8 +26,6 @@ class QPDFCrypto_openssl: public QPDFCryptoImpl { public: QPDFCrypto_openssl(); - - QPDF_DLL ~QPDFCrypto_openssl() override; void provideRandomData(unsigned char* data, size_t len) override; diff --git a/libqpdf/qpdf/RC4.hh b/libqpdf/qpdf/RC4.hh index 58e12e2f..43326d92 100644 --- a/libqpdf/qpdf/RC4.hh +++ b/libqpdf/qpdf/RC4.hh @@ -9,11 +9,9 @@ class RC4 { public: // key_len of -1 means treat key_data as a null-terminated string - QPDF_DLL RC4(unsigned char const* key_data, int key_len = -1); // out_data = 0 means to encrypt/decrypt in place - QPDF_DLL void process(unsigned char* in_data, size_t len, unsigned char* out_data = 0); diff --git a/libqpdf/qpdf/SecureRandomDataProvider.hh b/libqpdf/qpdf/SecureRandomDataProvider.hh index 3e7893ed..c24eeddd 100644 --- a/libqpdf/qpdf/SecureRandomDataProvider.hh +++ b/libqpdf/qpdf/SecureRandomDataProvider.hh @@ -1,21 +1,14 @@ #ifndef SECURERANDOMDATAPROVIDER_HH #define SECURERANDOMDATAPROVIDER_HH -#include #include class SecureRandomDataProvider: public RandomDataProvider { public: - QPDF_DLL SecureRandomDataProvider(); - QPDF_DLL virtual ~SecureRandomDataProvider(); - - QPDF_DLL virtual void provideRandomData(unsigned char* data, size_t len); - - QPDF_DLL static RandomDataProvider* getInstance(); }; diff --git a/libqpdf/qpdf/SparseOHArray.hh b/libqpdf/qpdf/SparseOHArray.hh index 894cf7a1..b9938b3b 100644 --- a/libqpdf/qpdf/SparseOHArray.hh +++ b/libqpdf/qpdf/SparseOHArray.hh @@ -7,30 +7,19 @@ class SparseOHArray { public: - QPDF_DLL SparseOHArray(); - QPDF_DLL size_t size() const; - QPDF_DLL void append(QPDFObjectHandle oh); - QPDF_DLL QPDFObjectHandle at(size_t idx) const; - QPDF_DLL void remove_last(); - QPDF_DLL void releaseResolved(); - QPDF_DLL void setAt(size_t idx, QPDFObjectHandle oh); - QPDF_DLL void erase(size_t idx); - QPDF_DLL void insert(size_t idx, QPDFObjectHandle oh); typedef std::unordered_map::const_iterator const_iterator; - QPDF_DLL const_iterator begin() const; - QPDF_DLL const_iterator end() const; private: diff --git a/qpdf/sizes.cc b/qpdf/sizes.cc index 691f879c..39feafea 100644 --- a/qpdf/sizes.cc +++ b/qpdf/sizes.cc @@ -50,28 +50,6 @@ #define ignore_class(cls) #define print_size(cls) std::cout << #cls << " " << sizeof(cls) << std::endl -// These classes are not really public. -// ------ -ignore_class(BitStream); -ignore_class(BitWriter); -ignore_class(CryptoRandomDataProvider); -ignore_class(InsecureRandomDataProvider); -ignore_class(JSONHandler); -ignore_class(MD5); -ignore_class(Pl_AES_PDF); -ignore_class(Pl_ASCII85Decoder); -ignore_class(Pl_ASCIIHexDecoder); -ignore_class(Pl_LZWDecoder); -ignore_class(Pl_MD5); -ignore_class(Pl_PNGFilter); -ignore_class(Pl_RC4); -ignore_class(Pl_SHA2); -ignore_class(Pl_TIFFPredictor); -ignore_class(QPDFArgParser); -ignore_class(RC4); -ignore_class(SecureRandomDataProvider); -ignore_class(SparseOHArray); - // This is public because of QPDF_DLL_CLASS on InputSource // ------- ignore_class(InputSource::Members);