mirror of
https://github.com/qpdf/qpdf.git
synced 2025-02-02 11:58:25 +00:00
Remove methods of private classes from ABI
Prior to the cmake conversion, several private classes had methods that were exported into the shared library so they could be tested with libtests. With cmake, we build libtests using an object library, so this is no longer necessary. The methods that are disappearing from the ABI were never exposed through public headers, so no code should be using them. Removal had to wait until the window for ABI-breaking changes was open.
This commit is contained in:
parent
b6d1dffaaa
commit
07edf96440
1
TODO
1
TODO
@ -37,7 +37,6 @@ cmake
|
|||||||
=====
|
=====
|
||||||
|
|
||||||
* DLL.h
|
* 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
|
* Change DLL_EXPORT to QPDF_EXPORT. Be sure to call attention to
|
||||||
this in the release notes. There should be a "migrating to cmake"
|
this in the release notes. There should be a "migrating to cmake"
|
||||||
in the manual, and ./configure should draw attention to it.
|
in the manual, and ./configure should draw attention to it.
|
||||||
|
@ -3,25 +3,18 @@
|
|||||||
#ifndef BITSTREAM_HH
|
#ifndef BITSTREAM_HH
|
||||||
#define BITSTREAM_HH
|
#define BITSTREAM_HH
|
||||||
|
|
||||||
#include <qpdf/DLL.h>
|
|
||||||
#include <stddef.h>
|
#include <stddef.h>
|
||||||
|
|
||||||
class BitStream
|
class BitStream
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
QPDF_DLL
|
|
||||||
BitStream(unsigned char const* p, size_t nbytes);
|
BitStream(unsigned char const* p, size_t nbytes);
|
||||||
QPDF_DLL
|
|
||||||
void reset();
|
void reset();
|
||||||
QPDF_DLL
|
|
||||||
unsigned long long getBits(size_t nbits);
|
unsigned long long getBits(size_t nbits);
|
||||||
QPDF_DLL
|
|
||||||
long long getBitsSigned(size_t nbits);
|
long long getBitsSigned(size_t nbits);
|
||||||
// Only call getBitsInt when requesting a number of bits that will
|
// Only call getBitsInt when requesting a number of bits that will
|
||||||
// definitely fit in an int.
|
// definitely fit in an int.
|
||||||
QPDF_DLL
|
|
||||||
int getBitsInt(size_t nbits);
|
int getBitsInt(size_t nbits);
|
||||||
QPDF_DLL
|
|
||||||
void skipToNextByte();
|
void skipToNextByte();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
@ -3,7 +3,6 @@
|
|||||||
#ifndef BITWRITER_HH
|
#ifndef BITWRITER_HH
|
||||||
#define BITWRITER_HH
|
#define BITWRITER_HH
|
||||||
|
|
||||||
#include <qpdf/DLL.h>
|
|
||||||
#include <stddef.h>
|
#include <stddef.h>
|
||||||
|
|
||||||
class Pipeline;
|
class Pipeline;
|
||||||
@ -13,16 +12,11 @@ class BitWriter
|
|||||||
public:
|
public:
|
||||||
// Write bits to the pipeline. It is the caller's responsibility
|
// Write bits to the pipeline. It is the caller's responsibility
|
||||||
// to eventually call finish on the pipeline.
|
// to eventually call finish on the pipeline.
|
||||||
QPDF_DLL
|
|
||||||
BitWriter(Pipeline* pl);
|
BitWriter(Pipeline* pl);
|
||||||
QPDF_DLL
|
|
||||||
void writeBits(unsigned long long val, size_t bits);
|
void writeBits(unsigned long long val, size_t bits);
|
||||||
QPDF_DLL
|
|
||||||
void writeBitsSigned(long long val, size_t bits);
|
void writeBitsSigned(long long val, size_t bits);
|
||||||
QPDF_DLL
|
|
||||||
void writeBitsInt(int val, size_t bits);
|
void writeBitsInt(int val, size_t bits);
|
||||||
// Force any partial byte to be written to the pipeline.
|
// Force any partial byte to be written to the pipeline.
|
||||||
QPDF_DLL
|
|
||||||
void flush();
|
void flush();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
@ -1,21 +1,14 @@
|
|||||||
#ifndef CRYPTORANDOMDATAPROVIDER_HH
|
#ifndef CRYPTORANDOMDATAPROVIDER_HH
|
||||||
#define CRYPTORANDOMDATAPROVIDER_HH
|
#define CRYPTORANDOMDATAPROVIDER_HH
|
||||||
|
|
||||||
#include <qpdf/DLL.h>
|
|
||||||
#include <qpdf/RandomDataProvider.hh>
|
#include <qpdf/RandomDataProvider.hh>
|
||||||
|
|
||||||
class CryptoRandomDataProvider: public RandomDataProvider
|
class CryptoRandomDataProvider: public RandomDataProvider
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
QPDF_DLL
|
|
||||||
CryptoRandomDataProvider();
|
CryptoRandomDataProvider();
|
||||||
QPDF_DLL
|
|
||||||
virtual ~CryptoRandomDataProvider();
|
virtual ~CryptoRandomDataProvider();
|
||||||
|
|
||||||
QPDF_DLL
|
|
||||||
virtual void provideRandomData(unsigned char* data, size_t len);
|
virtual void provideRandomData(unsigned char* data, size_t len);
|
||||||
|
|
||||||
QPDF_DLL
|
|
||||||
static RandomDataProvider* getInstance();
|
static RandomDataProvider* getInstance();
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -1,21 +1,14 @@
|
|||||||
#ifndef INSECURERANDOMDATAPROVIDER_HH
|
#ifndef INSECURERANDOMDATAPROVIDER_HH
|
||||||
#define INSECURERANDOMDATAPROVIDER_HH
|
#define INSECURERANDOMDATAPROVIDER_HH
|
||||||
|
|
||||||
#include <qpdf/DLL.h>
|
|
||||||
#include <qpdf/RandomDataProvider.hh>
|
#include <qpdf/RandomDataProvider.hh>
|
||||||
|
|
||||||
class InsecureRandomDataProvider: public RandomDataProvider
|
class InsecureRandomDataProvider: public RandomDataProvider
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
QPDF_DLL
|
|
||||||
InsecureRandomDataProvider();
|
InsecureRandomDataProvider();
|
||||||
QPDF_DLL
|
|
||||||
virtual ~InsecureRandomDataProvider();
|
virtual ~InsecureRandomDataProvider();
|
||||||
|
|
||||||
QPDF_DLL
|
|
||||||
virtual void provideRandomData(unsigned char* data, size_t len);
|
virtual void provideRandomData(unsigned char* data, size_t len);
|
||||||
|
|
||||||
QPDF_DLL
|
|
||||||
static RandomDataProvider* getInstance();
|
static RandomDataProvider* getInstance();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
@ -1,7 +1,6 @@
|
|||||||
#ifndef JSONHANDLER_HH
|
#ifndef JSONHANDLER_HH
|
||||||
#define JSONHANDLER_HH
|
#define JSONHANDLER_HH
|
||||||
|
|
||||||
#include <qpdf/DLL.h>
|
|
||||||
#include <qpdf/JSON.hh>
|
#include <qpdf/JSON.hh>
|
||||||
#include <functional>
|
#include <functional>
|
||||||
#include <map>
|
#include <map>
|
||||||
@ -18,10 +17,7 @@ class JSONHandler
|
|||||||
public:
|
public:
|
||||||
// A QPDFUsage exception is thrown if there are any errors
|
// A QPDFUsage exception is thrown if there are any errors
|
||||||
// validating the JSON object.
|
// validating the JSON object.
|
||||||
QPDF_DLL
|
|
||||||
JSONHandler();
|
JSONHandler();
|
||||||
|
|
||||||
QPDF_DLL
|
|
||||||
~JSONHandler() = default;
|
~JSONHandler() = default;
|
||||||
|
|
||||||
// Based on the type of handler, expect the object to be of a
|
// 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
|
// If an any handler is added, it will be called for any value
|
||||||
// including null, and no other handler will be called.
|
// including null, and no other handler will be called.
|
||||||
QPDF_DLL
|
|
||||||
void addAnyHandler(json_handler_t fn);
|
void addAnyHandler(json_handler_t fn);
|
||||||
|
|
||||||
// If any of the remaining handlers are registered, each
|
// If any of the remaining handlers are registered, each
|
||||||
// registered handle will be called.
|
// registered handle will be called.
|
||||||
QPDF_DLL
|
|
||||||
void addNullHandler(void_handler_t fn);
|
void addNullHandler(void_handler_t fn);
|
||||||
QPDF_DLL
|
|
||||||
void addStringHandler(string_handler_t fn);
|
void addStringHandler(string_handler_t fn);
|
||||||
QPDF_DLL
|
|
||||||
void addNumberHandler(string_handler_t fn);
|
void addNumberHandler(string_handler_t fn);
|
||||||
QPDF_DLL
|
|
||||||
void addBoolHandler(bool_handler_t fn);
|
void addBoolHandler(bool_handler_t fn);
|
||||||
|
|
||||||
QPDF_DLL
|
|
||||||
void addDictHandlers(json_handler_t start_fn, void_handler_t end_fn);
|
void addDictHandlers(json_handler_t start_fn, void_handler_t end_fn);
|
||||||
QPDF_DLL
|
|
||||||
void
|
void
|
||||||
addDictKeyHandler(std::string const& key, std::shared_ptr<JSONHandler>);
|
addDictKeyHandler(std::string const& key, std::shared_ptr<JSONHandler>);
|
||||||
QPDF_DLL
|
|
||||||
void addFallbackDictHandler(std::shared_ptr<JSONHandler>);
|
void addFallbackDictHandler(std::shared_ptr<JSONHandler>);
|
||||||
|
|
||||||
QPDF_DLL
|
|
||||||
void addArrayHandlers(
|
void addArrayHandlers(
|
||||||
json_handler_t start_fn,
|
json_handler_t start_fn,
|
||||||
void_handler_t end_fn,
|
void_handler_t end_fn,
|
||||||
std::shared_ptr<JSONHandler> item_handlers);
|
std::shared_ptr<JSONHandler> item_handlers);
|
||||||
|
|
||||||
// Apply handlers recursively to a JSON object.
|
// Apply handlers recursively to a JSON object.
|
||||||
QPDF_DLL
|
|
||||||
void handle(std::string const& path, JSON j);
|
void handle(std::string const& path, JSON j);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
@ -115,7 +101,6 @@ class JSONHandler
|
|||||||
friend class JSONHandler;
|
friend class JSONHandler;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
QPDF_DLL
|
|
||||||
~Members() = default;
|
~Members() = default;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
@ -1,7 +1,6 @@
|
|||||||
#ifndef MD5_HH
|
#ifndef MD5_HH
|
||||||
#define MD5_HH
|
#define MD5_HH
|
||||||
|
|
||||||
#include <qpdf/DLL.h>
|
|
||||||
#include <qpdf/QPDFCryptoImpl.hh>
|
#include <qpdf/QPDFCryptoImpl.hh>
|
||||||
#include <qpdf/Types.h>
|
#include <qpdf/Types.h>
|
||||||
#include <memory>
|
#include <memory>
|
||||||
@ -12,50 +11,37 @@ class MD5
|
|||||||
public:
|
public:
|
||||||
typedef unsigned char Digest[16];
|
typedef unsigned char Digest[16];
|
||||||
|
|
||||||
QPDF_DLL
|
|
||||||
MD5();
|
MD5();
|
||||||
QPDF_DLL
|
|
||||||
void reset();
|
void reset();
|
||||||
|
|
||||||
// encodes string and finalizes
|
// encodes string and finalizes
|
||||||
QPDF_DLL
|
|
||||||
void encodeString(char const* input_string);
|
void encodeString(char const* input_string);
|
||||||
|
|
||||||
// encodes file and finalizes; offset < 0 reads whole file
|
// encodes file and finalizes; offset < 0 reads whole file
|
||||||
QPDF_DLL
|
|
||||||
void encodeFile(char const* filename, qpdf_offset_t up_to_offset = -1);
|
void encodeFile(char const* filename, qpdf_offset_t up_to_offset = -1);
|
||||||
|
|
||||||
// appends string to current md5 object
|
// appends string to current md5 object
|
||||||
QPDF_DLL
|
|
||||||
void appendString(char const* input_string);
|
void appendString(char const* input_string);
|
||||||
|
|
||||||
// appends arbitrary data to current md5 object
|
// appends arbitrary data to current md5 object
|
||||||
QPDF_DLL
|
|
||||||
void encodeDataIncrementally(char const* input_data, size_t len);
|
void encodeDataIncrementally(char const* input_data, size_t len);
|
||||||
|
|
||||||
// computes a raw digest
|
// computes a raw digest
|
||||||
QPDF_DLL
|
|
||||||
void digest(Digest);
|
void digest(Digest);
|
||||||
|
|
||||||
// prints the digest to stdout terminated with \r\n (primarily for
|
// prints the digest to stdout terminated with \r\n (primarily for
|
||||||
// testing)
|
// testing)
|
||||||
QPDF_DLL
|
|
||||||
void print();
|
void print();
|
||||||
|
|
||||||
// returns the digest as a hexadecimal string
|
// returns the digest as a hexadecimal string
|
||||||
QPDF_DLL
|
|
||||||
std::string unparse();
|
std::string unparse();
|
||||||
|
|
||||||
// Convenience functions
|
// Convenience functions
|
||||||
QPDF_DLL
|
|
||||||
static std::string getDataChecksum(char const* buf, size_t len);
|
static std::string getDataChecksum(char const* buf, size_t len);
|
||||||
QPDF_DLL
|
|
||||||
static std::string
|
static std::string
|
||||||
getFileChecksum(char const* filename, qpdf_offset_t up_to_offset = -1);
|
getFileChecksum(char const* filename, qpdf_offset_t up_to_offset = -1);
|
||||||
QPDF_DLL
|
|
||||||
static bool
|
static bool
|
||||||
checkDataChecksum(char const* const checksum, char const* buf, size_t len);
|
checkDataChecksum(char const* const checksum, char const* buf, size_t len);
|
||||||
QPDF_DLL
|
|
||||||
static bool checkFileChecksum(
|
static bool checkFileChecksum(
|
||||||
char const* const checksum,
|
char const* const checksum,
|
||||||
char const* filename,
|
char const* filename,
|
||||||
|
@ -11,7 +11,6 @@
|
|||||||
class Pl_AES_PDF: public Pipeline
|
class Pl_AES_PDF: public Pipeline
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
QPDF_DLL
|
|
||||||
// key should be a pointer to key_bytes bytes of data
|
// key should be a pointer to key_bytes bytes of data
|
||||||
Pl_AES_PDF(
|
Pl_AES_PDF(
|
||||||
char const* identifier,
|
char const* identifier,
|
||||||
@ -19,30 +18,22 @@ class Pl_AES_PDF: public Pipeline
|
|||||||
bool encrypt,
|
bool encrypt,
|
||||||
unsigned char const* key,
|
unsigned char const* key,
|
||||||
size_t key_bytes);
|
size_t key_bytes);
|
||||||
QPDF_DLL
|
|
||||||
virtual ~Pl_AES_PDF();
|
virtual ~Pl_AES_PDF();
|
||||||
|
|
||||||
QPDF_DLL
|
|
||||||
virtual void write(unsigned char* data, size_t len);
|
virtual void write(unsigned char* data, size_t len);
|
||||||
QPDF_DLL
|
|
||||||
virtual void finish();
|
virtual void finish();
|
||||||
|
|
||||||
// Use zero initialization vector; needed for AESV3
|
// Use zero initialization vector; needed for AESV3
|
||||||
QPDF_DLL
|
|
||||||
void useZeroIV();
|
void useZeroIV();
|
||||||
// Disable padding; needed for AESV3
|
// Disable padding; needed for AESV3
|
||||||
QPDF_DLL
|
|
||||||
void disablePadding();
|
void disablePadding();
|
||||||
// Specify an initialization vector, which will not be included in
|
// Specify an initialization vector, which will not be included in
|
||||||
// the output.
|
// the output.
|
||||||
QPDF_DLL
|
|
||||||
void setIV(unsigned char const* iv, size_t bytes);
|
void setIV(unsigned char const* iv, size_t bytes);
|
||||||
|
|
||||||
// For testing only; PDF always uses CBC
|
// For testing only; PDF always uses CBC
|
||||||
QPDF_DLL
|
|
||||||
void disableCBC();
|
void disableCBC();
|
||||||
// For testing only: use a fixed initialization vector for CBC
|
// For testing only: use a fixed initialization vector for CBC
|
||||||
QPDF_DLL
|
|
||||||
static void useStaticIV();
|
static void useStaticIV();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
@ -6,13 +6,9 @@
|
|||||||
class Pl_ASCII85Decoder: public Pipeline
|
class Pl_ASCII85Decoder: public Pipeline
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
QPDF_DLL
|
|
||||||
Pl_ASCII85Decoder(char const* identifier, Pipeline* next);
|
Pl_ASCII85Decoder(char const* identifier, Pipeline* next);
|
||||||
QPDF_DLL
|
|
||||||
virtual ~Pl_ASCII85Decoder();
|
virtual ~Pl_ASCII85Decoder();
|
||||||
QPDF_DLL
|
|
||||||
virtual void write(unsigned char* buf, size_t len);
|
virtual void write(unsigned char* buf, size_t len);
|
||||||
QPDF_DLL
|
|
||||||
virtual void finish();
|
virtual void finish();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
@ -6,13 +6,9 @@
|
|||||||
class Pl_ASCIIHexDecoder: public Pipeline
|
class Pl_ASCIIHexDecoder: public Pipeline
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
QPDF_DLL
|
|
||||||
Pl_ASCIIHexDecoder(char const* identifier, Pipeline* next);
|
Pl_ASCIIHexDecoder(char const* identifier, Pipeline* next);
|
||||||
QPDF_DLL
|
|
||||||
virtual ~Pl_ASCIIHexDecoder();
|
virtual ~Pl_ASCIIHexDecoder();
|
||||||
QPDF_DLL
|
|
||||||
virtual void write(unsigned char* buf, size_t len);
|
virtual void write(unsigned char* buf, size_t len);
|
||||||
QPDF_DLL
|
|
||||||
virtual void finish();
|
virtual void finish();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
@ -9,14 +9,10 @@
|
|||||||
class Pl_LZWDecoder: public Pipeline
|
class Pl_LZWDecoder: public Pipeline
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
QPDF_DLL
|
|
||||||
Pl_LZWDecoder(
|
Pl_LZWDecoder(
|
||||||
char const* identifier, Pipeline* next, bool early_code_change);
|
char const* identifier, Pipeline* next, bool early_code_change);
|
||||||
QPDF_DLL
|
|
||||||
virtual ~Pl_LZWDecoder();
|
virtual ~Pl_LZWDecoder();
|
||||||
QPDF_DLL
|
|
||||||
virtual void write(unsigned char* buf, size_t len);
|
virtual void write(unsigned char* buf, size_t len);
|
||||||
QPDF_DLL
|
|
||||||
virtual void finish();
|
virtual void finish();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
@ -15,27 +15,20 @@
|
|||||||
class Pl_MD5: public Pipeline
|
class Pl_MD5: public Pipeline
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
QPDF_DLL
|
|
||||||
Pl_MD5(char const* identifier, Pipeline* next);
|
Pl_MD5(char const* identifier, Pipeline* next);
|
||||||
QPDF_DLL
|
|
||||||
virtual ~Pl_MD5();
|
virtual ~Pl_MD5();
|
||||||
QPDF_DLL
|
|
||||||
virtual void write(unsigned char*, size_t);
|
virtual void write(unsigned char*, size_t);
|
||||||
QPDF_DLL
|
|
||||||
virtual void finish();
|
virtual void finish();
|
||||||
QPDF_DLL
|
|
||||||
std::string getHexDigest();
|
std::string getHexDigest();
|
||||||
// Enable/disable. Disabling the pipeline causes it to become a
|
// Enable/disable. Disabling the pipeline causes it to become a
|
||||||
// pass-through. This makes it possible to stick an MD5 pipeline
|
// pass-through. This makes it possible to stick an MD5 pipeline
|
||||||
// in a pipeline when it may or may not be required. Disabling it
|
// in a pipeline when it may or may not be required. Disabling it
|
||||||
// avoids incurring the runtime overhead of doing needless
|
// avoids incurring the runtime overhead of doing needless
|
||||||
// digest computation.
|
// digest computation.
|
||||||
QPDF_DLL
|
|
||||||
void enable(bool enabled);
|
void enable(bool enabled);
|
||||||
// If persistAcrossFinish is called, calls to finish do not
|
// If persistAcrossFinish is called, calls to finish do not
|
||||||
// finalize the underlying md5 object. In this case, the object is
|
// finalize the underlying md5 object. In this case, the object is
|
||||||
// not finalized until getHexDigest() is called.
|
// not finalized until getHexDigest() is called.
|
||||||
QPDF_DLL
|
|
||||||
void persistAcrossFinish(bool);
|
void persistAcrossFinish(bool);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
@ -15,7 +15,6 @@ class Pl_PNGFilter: public Pipeline
|
|||||||
// Encoding is only partially supported
|
// Encoding is only partially supported
|
||||||
enum action_e { a_encode, a_decode };
|
enum action_e { a_encode, a_decode };
|
||||||
|
|
||||||
QPDF_DLL
|
|
||||||
Pl_PNGFilter(
|
Pl_PNGFilter(
|
||||||
char const* identifier,
|
char const* identifier,
|
||||||
Pipeline* next,
|
Pipeline* next,
|
||||||
@ -23,12 +22,9 @@ class Pl_PNGFilter: public Pipeline
|
|||||||
unsigned int columns,
|
unsigned int columns,
|
||||||
unsigned int samples_per_pixel = 1,
|
unsigned int samples_per_pixel = 1,
|
||||||
unsigned int bits_per_sample = 8);
|
unsigned int bits_per_sample = 8);
|
||||||
QPDF_DLL
|
|
||||||
virtual ~Pl_PNGFilter();
|
virtual ~Pl_PNGFilter();
|
||||||
|
|
||||||
QPDF_DLL
|
|
||||||
virtual void write(unsigned char* data, size_t len);
|
virtual void write(unsigned char* data, size_t len);
|
||||||
QPDF_DLL
|
|
||||||
virtual void finish();
|
virtual void finish();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
@ -11,19 +11,15 @@ class Pl_RC4: public Pipeline
|
|||||||
static size_t const def_bufsize = 65536;
|
static size_t const def_bufsize = 65536;
|
||||||
|
|
||||||
// key_len of -1 means treat key_data as a null-terminated string
|
// key_len of -1 means treat key_data as a null-terminated string
|
||||||
QPDF_DLL
|
|
||||||
Pl_RC4(
|
Pl_RC4(
|
||||||
char const* identifier,
|
char const* identifier,
|
||||||
Pipeline* next,
|
Pipeline* next,
|
||||||
unsigned char const* key_data,
|
unsigned char const* key_data,
|
||||||
int key_len = -1,
|
int key_len = -1,
|
||||||
size_t out_bufsize = def_bufsize);
|
size_t out_bufsize = def_bufsize);
|
||||||
QPDF_DLL
|
|
||||||
virtual ~Pl_RC4();
|
virtual ~Pl_RC4();
|
||||||
|
|
||||||
QPDF_DLL
|
|
||||||
virtual void write(unsigned char* data, size_t len);
|
virtual void write(unsigned char* data, size_t len);
|
||||||
QPDF_DLL
|
|
||||||
virtual void finish();
|
virtual void finish();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
@ -20,19 +20,12 @@
|
|||||||
class Pl_SHA2: public Pipeline
|
class Pl_SHA2: public Pipeline
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
QPDF_DLL
|
|
||||||
Pl_SHA2(int bits = 0, Pipeline* next = 0);
|
Pl_SHA2(int bits = 0, Pipeline* next = 0);
|
||||||
QPDF_DLL
|
|
||||||
virtual ~Pl_SHA2();
|
virtual ~Pl_SHA2();
|
||||||
QPDF_DLL
|
|
||||||
virtual void write(unsigned char*, size_t);
|
virtual void write(unsigned char*, size_t);
|
||||||
QPDF_DLL
|
|
||||||
virtual void finish();
|
virtual void finish();
|
||||||
QPDF_DLL
|
|
||||||
void resetBits(int bits);
|
void resetBits(int bits);
|
||||||
QPDF_DLL
|
|
||||||
std::string getHexDigest();
|
std::string getHexDigest();
|
||||||
QPDF_DLL
|
|
||||||
std::string getRawDigest();
|
std::string getRawDigest();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
@ -11,7 +11,6 @@ class Pl_TIFFPredictor: public Pipeline
|
|||||||
public:
|
public:
|
||||||
enum action_e { a_encode, a_decode };
|
enum action_e { a_encode, a_decode };
|
||||||
|
|
||||||
QPDF_DLL
|
|
||||||
Pl_TIFFPredictor(
|
Pl_TIFFPredictor(
|
||||||
char const* identifier,
|
char const* identifier,
|
||||||
Pipeline* next,
|
Pipeline* next,
|
||||||
@ -19,12 +18,9 @@ class Pl_TIFFPredictor: public Pipeline
|
|||||||
unsigned int columns,
|
unsigned int columns,
|
||||||
unsigned int samples_per_pixel = 1,
|
unsigned int samples_per_pixel = 1,
|
||||||
unsigned int bits_per_sample = 8);
|
unsigned int bits_per_sample = 8);
|
||||||
QPDF_DLL
|
|
||||||
virtual ~Pl_TIFFPredictor();
|
virtual ~Pl_TIFFPredictor();
|
||||||
|
|
||||||
QPDF_DLL
|
|
||||||
virtual void write(unsigned char* data, size_t len);
|
virtual void write(unsigned char* data, size_t len);
|
||||||
QPDF_DLL
|
|
||||||
virtual void finish();
|
virtual void finish();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
@ -1,7 +1,6 @@
|
|||||||
#ifndef QPDFARGPARSER_HH
|
#ifndef QPDFARGPARSER_HH
|
||||||
#define QPDFARGPARSER_HH
|
#define QPDFARGPARSER_HH
|
||||||
|
|
||||||
#include <qpdf/DLL.h>
|
|
||||||
#include <functional>
|
#include <functional>
|
||||||
#include <map>
|
#include <map>
|
||||||
#include <memory>
|
#include <memory>
|
||||||
@ -27,18 +26,15 @@ class QPDFArgParser
|
|||||||
// progname_env is used to override argv[0] when figuring out the
|
// progname_env is used to override argv[0] when figuring out the
|
||||||
// name of the executable for setting up completion. This may be
|
// name of the executable for setting up completion. This may be
|
||||||
// needed if the program is invoked by a wrapper.
|
// needed if the program is invoked by a wrapper.
|
||||||
QPDF_DLL
|
|
||||||
QPDFArgParser(int argc, char const* const argv[], char const* progname_env);
|
QPDFArgParser(int argc, char const* const argv[], char const* progname_env);
|
||||||
|
|
||||||
// Calls exit(0) if a help option is given or if in completion
|
// Calls exit(0) if a help option is given or if in completion
|
||||||
// mode. If there are argument parsing errors, QPDFUsage is
|
// mode. If there are argument parsing errors, QPDFUsage is
|
||||||
// thrown.
|
// thrown.
|
||||||
QPDF_DLL
|
|
||||||
void parseArgs();
|
void parseArgs();
|
||||||
|
|
||||||
// Return the program name as the last path element of the program
|
// Return the program name as the last path element of the program
|
||||||
// executable.
|
// executable.
|
||||||
QPDF_DLL
|
|
||||||
std::string getProgname();
|
std::string getProgname();
|
||||||
|
|
||||||
// Methods for registering arguments. QPDFArgParser starts off
|
// Methods for registering arguments. QPDFArgParser starts off
|
||||||
@ -52,32 +48,23 @@ class QPDFArgParser
|
|||||||
typedef std::function<void()> bare_arg_handler_t;
|
typedef std::function<void()> bare_arg_handler_t;
|
||||||
typedef std::function<void(std::string const&)> param_arg_handler_t;
|
typedef std::function<void(std::string const&)> param_arg_handler_t;
|
||||||
|
|
||||||
QPDF_DLL
|
|
||||||
void selectMainOptionTable();
|
void selectMainOptionTable();
|
||||||
QPDF_DLL
|
|
||||||
void selectHelpOptionTable();
|
void selectHelpOptionTable();
|
||||||
QPDF_DLL
|
|
||||||
void selectOptionTable(std::string const& name);
|
void selectOptionTable(std::string const& name);
|
||||||
|
|
||||||
// Register a new options table. This also selects the option table.
|
// Register a new options table. This also selects the option table.
|
||||||
QPDF_DLL
|
|
||||||
void registerOptionTable(
|
void registerOptionTable(
|
||||||
std::string const& name, bare_arg_handler_t end_handler);
|
std::string const& name, bare_arg_handler_t end_handler);
|
||||||
|
|
||||||
// Add handlers for options in the current table
|
// Add handlers for options in the current table
|
||||||
|
|
||||||
QPDF_DLL
|
|
||||||
void addPositional(param_arg_handler_t);
|
void addPositional(param_arg_handler_t);
|
||||||
QPDF_DLL
|
|
||||||
void addBare(std::string const& arg, bare_arg_handler_t);
|
void addBare(std::string const& arg, bare_arg_handler_t);
|
||||||
QPDF_DLL
|
|
||||||
void addRequiredParameter(
|
void addRequiredParameter(
|
||||||
std::string const& arg,
|
std::string const& arg,
|
||||||
param_arg_handler_t,
|
param_arg_handler_t,
|
||||||
char const* parameter_name);
|
char const* parameter_name);
|
||||||
QPDF_DLL
|
|
||||||
void addOptionalParameter(std::string const& arg, param_arg_handler_t);
|
void addOptionalParameter(std::string const& arg, param_arg_handler_t);
|
||||||
QPDF_DLL
|
|
||||||
void addChoices(
|
void addChoices(
|
||||||
std::string const& arg,
|
std::string const& arg,
|
||||||
param_arg_handler_t,
|
param_arg_handler_t,
|
||||||
@ -88,12 +75,10 @@ class QPDFArgParser
|
|||||||
// an option that takes choices is to list all the choices. This
|
// 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
|
// may not be good if there are too many choices, so you can
|
||||||
// provide your own handler in this case.
|
// provide your own handler in this case.
|
||||||
QPDF_DLL
|
|
||||||
void addInvalidChoiceHandler(std::string const& arg, param_arg_handler_t);
|
void addInvalidChoiceHandler(std::string const& arg, param_arg_handler_t);
|
||||||
|
|
||||||
// The final check handler is called at the very end of argument
|
// The final check handler is called at the very end of argument
|
||||||
// parsing.
|
// parsing.
|
||||||
QPDF_DLL
|
|
||||||
void addFinalCheck(bare_arg_handler_t);
|
void addFinalCheck(bare_arg_handler_t);
|
||||||
|
|
||||||
// Help generation methods
|
// Help generation methods
|
||||||
@ -134,18 +119,15 @@ class QPDFArgParser
|
|||||||
|
|
||||||
// If provided, this footer is appended to all help, separated by
|
// If provided, this footer is appended to all help, separated by
|
||||||
// a blank line.
|
// a blank line.
|
||||||
QPDF_DLL
|
|
||||||
void addHelpFooter(std::string const&);
|
void addHelpFooter(std::string const&);
|
||||||
|
|
||||||
// Add a help topic along with the text for that topic
|
// Add a help topic along with the text for that topic
|
||||||
QPDF_DLL
|
|
||||||
void addHelpTopic(
|
void addHelpTopic(
|
||||||
std::string const& topic,
|
std::string const& topic,
|
||||||
std::string const& short_text,
|
std::string const& short_text,
|
||||||
std::string const& long_text);
|
std::string const& long_text);
|
||||||
|
|
||||||
// Add help for an option, and associate it with a topic.
|
// Add help for an option, and associate it with a topic.
|
||||||
QPDF_DLL
|
|
||||||
void addOptionHelp(
|
void addOptionHelp(
|
||||||
std::string const& option_name,
|
std::string const& option_name,
|
||||||
std::string const& topic,
|
std::string const& topic,
|
||||||
@ -156,7 +138,6 @@ class QPDFArgParser
|
|||||||
// pointer returns the top-level help information. Passing an
|
// pointer returns the top-level help information. Passing an
|
||||||
// unknown value returns a string directing the user to run the
|
// unknown value returns a string directing the user to run the
|
||||||
// top-level --help option.
|
// top-level --help option.
|
||||||
QPDF_DLL
|
|
||||||
std::string getHelp(std::string const& topic_or_option);
|
std::string getHelp(std::string const& topic_or_option);
|
||||||
|
|
||||||
// Convenience methods for adding member functions of a class as
|
// Convenience methods for adding member functions of a class as
|
||||||
@ -176,23 +157,19 @@ class QPDFArgParser
|
|||||||
|
|
||||||
// When processing arguments, indicate how many arguments remain
|
// When processing arguments, indicate how many arguments remain
|
||||||
// after the one whose handler is being called.
|
// after the one whose handler is being called.
|
||||||
QPDF_DLL
|
|
||||||
int argsLeft() const;
|
int argsLeft() const;
|
||||||
|
|
||||||
// Indicate whether we are in completion mode.
|
// Indicate whether we are in completion mode.
|
||||||
QPDF_DLL
|
|
||||||
bool isCompleting() const;
|
bool isCompleting() const;
|
||||||
|
|
||||||
// Insert a completion during argument parsing; useful for
|
// Insert a completion during argument parsing; useful for
|
||||||
// customizing completion in the position argument handler. Should
|
// customizing completion in the position argument handler. Should
|
||||||
// only be used in completion mode.
|
// only be used in completion mode.
|
||||||
QPDF_DLL
|
|
||||||
void insertCompletion(std::string const&);
|
void insertCompletion(std::string const&);
|
||||||
|
|
||||||
// Throw a Usage exception with the given message. In completion
|
// Throw a Usage exception with the given message. In completion
|
||||||
// mode, this just exits to prevent errors from partial commands
|
// mode, this just exits to prevent errors from partial commands
|
||||||
// or other error messages from messing up completion.
|
// or other error messages from messing up completion.
|
||||||
QPDF_DLL
|
|
||||||
void usage(std::string const& message);
|
void usage(std::string const& message);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
@ -259,7 +236,6 @@ class QPDFArgParser
|
|||||||
friend class QPDFArgParser;
|
friend class QPDFArgParser;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
QPDF_DLL
|
|
||||||
~Members() = default;
|
~Members() = default;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
@ -1,7 +1,6 @@
|
|||||||
#ifndef QPDFCRYPTO_GNUTLS_HH
|
#ifndef QPDFCRYPTO_GNUTLS_HH
|
||||||
#define QPDFCRYPTO_GNUTLS_HH
|
#define QPDFCRYPTO_GNUTLS_HH
|
||||||
|
|
||||||
#include <qpdf/DLL.h>
|
|
||||||
#include <qpdf/QPDFCryptoImpl.hh>
|
#include <qpdf/QPDFCryptoImpl.hh>
|
||||||
#include <memory>
|
#include <memory>
|
||||||
|
|
||||||
@ -16,7 +15,6 @@ class QPDFCrypto_gnutls: public QPDFCryptoImpl
|
|||||||
public:
|
public:
|
||||||
QPDFCrypto_gnutls();
|
QPDFCrypto_gnutls();
|
||||||
|
|
||||||
QPDF_DLL
|
|
||||||
virtual ~QPDFCrypto_gnutls();
|
virtual ~QPDFCrypto_gnutls();
|
||||||
|
|
||||||
virtual void provideRandomData(unsigned char* data, size_t len);
|
virtual void provideRandomData(unsigned char* data, size_t len);
|
||||||
|
@ -2,7 +2,6 @@
|
|||||||
#define QPDFCRYPTO_NATIVE_HH
|
#define QPDFCRYPTO_NATIVE_HH
|
||||||
|
|
||||||
#include <qpdf/AES_PDF_native.hh>
|
#include <qpdf/AES_PDF_native.hh>
|
||||||
#include <qpdf/DLL.h>
|
|
||||||
#include <qpdf/MD5_native.hh>
|
#include <qpdf/MD5_native.hh>
|
||||||
#include <qpdf/QPDFCryptoImpl.hh>
|
#include <qpdf/QPDFCryptoImpl.hh>
|
||||||
#include <qpdf/RC4_native.hh>
|
#include <qpdf/RC4_native.hh>
|
||||||
@ -14,7 +13,6 @@ class QPDFCrypto_native: public QPDFCryptoImpl
|
|||||||
public:
|
public:
|
||||||
QPDFCrypto_native() = default;
|
QPDFCrypto_native() = default;
|
||||||
|
|
||||||
QPDF_DLL
|
|
||||||
virtual ~QPDFCrypto_native() = default;
|
virtual ~QPDFCrypto_native() = default;
|
||||||
|
|
||||||
virtual void provideRandomData(unsigned char* data, size_t len);
|
virtual void provideRandomData(unsigned char* data, size_t len);
|
||||||
|
@ -26,8 +26,6 @@ class QPDFCrypto_openssl: public QPDFCryptoImpl
|
|||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
QPDFCrypto_openssl();
|
QPDFCrypto_openssl();
|
||||||
|
|
||||||
QPDF_DLL
|
|
||||||
~QPDFCrypto_openssl() override;
|
~QPDFCrypto_openssl() override;
|
||||||
|
|
||||||
void provideRandomData(unsigned char* data, size_t len) override;
|
void provideRandomData(unsigned char* data, size_t len) override;
|
||||||
|
@ -9,11 +9,9 @@ class RC4
|
|||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
// key_len of -1 means treat key_data as a null-terminated string
|
// 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);
|
RC4(unsigned char const* key_data, int key_len = -1);
|
||||||
|
|
||||||
// out_data = 0 means to encrypt/decrypt in place
|
// out_data = 0 means to encrypt/decrypt in place
|
||||||
QPDF_DLL
|
|
||||||
void
|
void
|
||||||
process(unsigned char* in_data, size_t len, unsigned char* out_data = 0);
|
process(unsigned char* in_data, size_t len, unsigned char* out_data = 0);
|
||||||
|
|
||||||
|
@ -1,21 +1,14 @@
|
|||||||
#ifndef SECURERANDOMDATAPROVIDER_HH
|
#ifndef SECURERANDOMDATAPROVIDER_HH
|
||||||
#define SECURERANDOMDATAPROVIDER_HH
|
#define SECURERANDOMDATAPROVIDER_HH
|
||||||
|
|
||||||
#include <qpdf/DLL.h>
|
|
||||||
#include <qpdf/RandomDataProvider.hh>
|
#include <qpdf/RandomDataProvider.hh>
|
||||||
|
|
||||||
class SecureRandomDataProvider: public RandomDataProvider
|
class SecureRandomDataProvider: public RandomDataProvider
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
QPDF_DLL
|
|
||||||
SecureRandomDataProvider();
|
SecureRandomDataProvider();
|
||||||
QPDF_DLL
|
|
||||||
virtual ~SecureRandomDataProvider();
|
virtual ~SecureRandomDataProvider();
|
||||||
|
|
||||||
QPDF_DLL
|
|
||||||
virtual void provideRandomData(unsigned char* data, size_t len);
|
virtual void provideRandomData(unsigned char* data, size_t len);
|
||||||
|
|
||||||
QPDF_DLL
|
|
||||||
static RandomDataProvider* getInstance();
|
static RandomDataProvider* getInstance();
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -7,30 +7,19 @@
|
|||||||
class SparseOHArray
|
class SparseOHArray
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
QPDF_DLL
|
|
||||||
SparseOHArray();
|
SparseOHArray();
|
||||||
QPDF_DLL
|
|
||||||
size_t size() const;
|
size_t size() const;
|
||||||
QPDF_DLL
|
|
||||||
void append(QPDFObjectHandle oh);
|
void append(QPDFObjectHandle oh);
|
||||||
QPDF_DLL
|
|
||||||
QPDFObjectHandle at(size_t idx) const;
|
QPDFObjectHandle at(size_t idx) const;
|
||||||
QPDF_DLL
|
|
||||||
void remove_last();
|
void remove_last();
|
||||||
QPDF_DLL
|
|
||||||
void releaseResolved();
|
void releaseResolved();
|
||||||
QPDF_DLL
|
|
||||||
void setAt(size_t idx, QPDFObjectHandle oh);
|
void setAt(size_t idx, QPDFObjectHandle oh);
|
||||||
QPDF_DLL
|
|
||||||
void erase(size_t idx);
|
void erase(size_t idx);
|
||||||
QPDF_DLL
|
|
||||||
void insert(size_t idx, QPDFObjectHandle oh);
|
void insert(size_t idx, QPDFObjectHandle oh);
|
||||||
|
|
||||||
typedef std::unordered_map<size_t, QPDFObjectHandle>::const_iterator
|
typedef std::unordered_map<size_t, QPDFObjectHandle>::const_iterator
|
||||||
const_iterator;
|
const_iterator;
|
||||||
QPDF_DLL
|
|
||||||
const_iterator begin() const;
|
const_iterator begin() const;
|
||||||
QPDF_DLL
|
|
||||||
const_iterator end() const;
|
const_iterator end() const;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
@ -50,28 +50,6 @@
|
|||||||
#define ignore_class(cls)
|
#define ignore_class(cls)
|
||||||
#define print_size(cls) std::cout << #cls << " " << sizeof(cls) << std::endl
|
#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
|
// This is public because of QPDF_DLL_CLASS on InputSource
|
||||||
// -------
|
// -------
|
||||||
ignore_class(InputSource::Members);
|
ignore_class(InputSource::Members);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user