diff options
author | Jay Berkenbilt <ejb@ql.org> | 2022-05-03 23:43:07 +0200 |
---|---|---|
committer | Jay Berkenbilt <ejb@ql.org> | 2022-05-04 00:31:22 +0200 |
commit | 59f3e09edfc71556208a866bb97ed9e173bd827f (patch) | |
tree | d182b59b18bae5214dab05e9f6a318f88e035ac3 /libqpdf/qpdf | |
parent | d55c7ac570a2852547caaa78b73b9fab5494aea1 (diff) | |
download | qpdf-59f3e09edfc71556208a866bb97ed9e173bd827f.tar.zst |
Make Pipeline::write take an unsigned char const* (API change)
Diffstat (limited to 'libqpdf/qpdf')
-rw-r--r-- | libqpdf/qpdf/Pl_AES_PDF.hh | 2 | ||||
-rw-r--r-- | libqpdf/qpdf/Pl_ASCII85Decoder.hh | 2 | ||||
-rw-r--r-- | libqpdf/qpdf/Pl_ASCIIHexDecoder.hh | 2 | ||||
-rw-r--r-- | libqpdf/qpdf/Pl_Base64.hh | 6 | ||||
-rw-r--r-- | libqpdf/qpdf/Pl_LZWDecoder.hh | 2 | ||||
-rw-r--r-- | libqpdf/qpdf/Pl_MD5.hh | 2 | ||||
-rw-r--r-- | libqpdf/qpdf/Pl_PNGFilter.hh | 2 | ||||
-rw-r--r-- | libqpdf/qpdf/Pl_RC4.hh | 2 | ||||
-rw-r--r-- | libqpdf/qpdf/Pl_SHA2.hh | 2 | ||||
-rw-r--r-- | libqpdf/qpdf/Pl_TIFFPredictor.hh | 2 | ||||
-rw-r--r-- | libqpdf/qpdf/QPDFCrypto_gnutls.hh | 2 | ||||
-rw-r--r-- | libqpdf/qpdf/QPDFCrypto_native.hh | 2 | ||||
-rw-r--r-- | libqpdf/qpdf/QPDFCrypto_openssl.hh | 2 | ||||
-rw-r--r-- | libqpdf/qpdf/RC4.hh | 5 | ||||
-rw-r--r-- | libqpdf/qpdf/RC4_native.hh | 4 |
15 files changed, 20 insertions, 19 deletions
diff --git a/libqpdf/qpdf/Pl_AES_PDF.hh b/libqpdf/qpdf/Pl_AES_PDF.hh index 036842dd..18091583 100644 --- a/libqpdf/qpdf/Pl_AES_PDF.hh +++ b/libqpdf/qpdf/Pl_AES_PDF.hh @@ -20,7 +20,7 @@ class Pl_AES_PDF: public Pipeline size_t key_bytes); virtual ~Pl_AES_PDF() = default; - virtual void write(unsigned char* data, size_t len); + virtual void write(unsigned char const* data, size_t len); virtual void finish(); // Use zero initialization vector; needed for AESV3 diff --git a/libqpdf/qpdf/Pl_ASCII85Decoder.hh b/libqpdf/qpdf/Pl_ASCII85Decoder.hh index b359e16c..667b56e9 100644 --- a/libqpdf/qpdf/Pl_ASCII85Decoder.hh +++ b/libqpdf/qpdf/Pl_ASCII85Decoder.hh @@ -8,7 +8,7 @@ class Pl_ASCII85Decoder: public Pipeline public: Pl_ASCII85Decoder(char const* identifier, Pipeline* next); virtual ~Pl_ASCII85Decoder() = default; - virtual void write(unsigned char* buf, size_t len); + virtual void write(unsigned char const* buf, size_t len); virtual void finish(); private: diff --git a/libqpdf/qpdf/Pl_ASCIIHexDecoder.hh b/libqpdf/qpdf/Pl_ASCIIHexDecoder.hh index a385cce3..c71dcf00 100644 --- a/libqpdf/qpdf/Pl_ASCIIHexDecoder.hh +++ b/libqpdf/qpdf/Pl_ASCIIHexDecoder.hh @@ -8,7 +8,7 @@ class Pl_ASCIIHexDecoder: public Pipeline public: Pl_ASCIIHexDecoder(char const* identifier, Pipeline* next); virtual ~Pl_ASCIIHexDecoder() = default; - virtual void write(unsigned char* buf, size_t len); + virtual void write(unsigned char const* buf, size_t len); virtual void finish(); private: diff --git a/libqpdf/qpdf/Pl_Base64.hh b/libqpdf/qpdf/Pl_Base64.hh index 313bd2cb..788bfd6d 100644 --- a/libqpdf/qpdf/Pl_Base64.hh +++ b/libqpdf/qpdf/Pl_Base64.hh @@ -9,12 +9,12 @@ class Pl_Base64: public Pipeline enum action_e { a_encode, a_decode }; Pl_Base64(char const* identifier, Pipeline* next, action_e); virtual ~Pl_Base64() = default; - virtual void write(unsigned char* buf, size_t len) override; + virtual void write(unsigned char const* buf, size_t len) override; virtual void finish() override; private: - void decode(unsigned char* buf, size_t len); - void encode(unsigned char* buf, size_t len); + void decode(unsigned char const* buf, size_t len); + void encode(unsigned char const* buf, size_t len); void flush(); void flush_decode(); void flush_encode(); diff --git a/libqpdf/qpdf/Pl_LZWDecoder.hh b/libqpdf/qpdf/Pl_LZWDecoder.hh index e157ee5b..46cce7ba 100644 --- a/libqpdf/qpdf/Pl_LZWDecoder.hh +++ b/libqpdf/qpdf/Pl_LZWDecoder.hh @@ -12,7 +12,7 @@ class Pl_LZWDecoder: public Pipeline Pl_LZWDecoder( char const* identifier, Pipeline* next, bool early_code_change); virtual ~Pl_LZWDecoder() = default; - virtual void write(unsigned char* buf, size_t len); + virtual void write(unsigned char const* buf, size_t len); virtual void finish(); private: diff --git a/libqpdf/qpdf/Pl_MD5.hh b/libqpdf/qpdf/Pl_MD5.hh index bbefba0e..bd56f9c6 100644 --- a/libqpdf/qpdf/Pl_MD5.hh +++ b/libqpdf/qpdf/Pl_MD5.hh @@ -17,7 +17,7 @@ class Pl_MD5: public Pipeline public: Pl_MD5(char const* identifier, Pipeline* next); virtual ~Pl_MD5() = default; - virtual void write(unsigned char*, size_t); + virtual void write(unsigned char const*, size_t); virtual void finish(); std::string getHexDigest(); // Enable/disable. Disabling the pipeline causes it to become a diff --git a/libqpdf/qpdf/Pl_PNGFilter.hh b/libqpdf/qpdf/Pl_PNGFilter.hh index 27986c55..6cc34a9c 100644 --- a/libqpdf/qpdf/Pl_PNGFilter.hh +++ b/libqpdf/qpdf/Pl_PNGFilter.hh @@ -24,7 +24,7 @@ class Pl_PNGFilter: public Pipeline unsigned int bits_per_sample = 8); virtual ~Pl_PNGFilter() = default; - virtual void write(unsigned char* data, size_t len); + virtual void write(unsigned char const* data, size_t len); virtual void finish(); private: diff --git a/libqpdf/qpdf/Pl_RC4.hh b/libqpdf/qpdf/Pl_RC4.hh index b5fc508d..07b8a1c4 100644 --- a/libqpdf/qpdf/Pl_RC4.hh +++ b/libqpdf/qpdf/Pl_RC4.hh @@ -19,7 +19,7 @@ class Pl_RC4: public Pipeline size_t out_bufsize = def_bufsize); virtual ~Pl_RC4() = default; - virtual void write(unsigned char* data, size_t len); + virtual void write(unsigned char const* data, size_t len); virtual void finish(); private: diff --git a/libqpdf/qpdf/Pl_SHA2.hh b/libqpdf/qpdf/Pl_SHA2.hh index ba782bcf..d5b2e547 100644 --- a/libqpdf/qpdf/Pl_SHA2.hh +++ b/libqpdf/qpdf/Pl_SHA2.hh @@ -22,7 +22,7 @@ class Pl_SHA2: public Pipeline public: Pl_SHA2(int bits = 0, Pipeline* next = 0); virtual ~Pl_SHA2() = default; - virtual void write(unsigned char*, size_t); + virtual void write(unsigned char const*, size_t); virtual void finish(); void resetBits(int bits); std::string getHexDigest(); diff --git a/libqpdf/qpdf/Pl_TIFFPredictor.hh b/libqpdf/qpdf/Pl_TIFFPredictor.hh index 22c9322b..2b3bdb10 100644 --- a/libqpdf/qpdf/Pl_TIFFPredictor.hh +++ b/libqpdf/qpdf/Pl_TIFFPredictor.hh @@ -20,7 +20,7 @@ class Pl_TIFFPredictor: public Pipeline unsigned int bits_per_sample = 8); virtual ~Pl_TIFFPredictor() = default; - virtual void write(unsigned char* data, size_t len); + virtual void write(unsigned char const* data, size_t len); virtual void finish(); private: diff --git a/libqpdf/qpdf/QPDFCrypto_gnutls.hh b/libqpdf/qpdf/QPDFCrypto_gnutls.hh index 23259440..05c94bfc 100644 --- a/libqpdf/qpdf/QPDFCrypto_gnutls.hh +++ b/libqpdf/qpdf/QPDFCrypto_gnutls.hh @@ -26,7 +26,7 @@ class QPDFCrypto_gnutls: public QPDFCryptoImpl virtual void RC4_init(unsigned char const* key_data, int key_len = -1); virtual void RC4_process( - unsigned char* in_data, size_t len, unsigned char* out_data = 0); + unsigned char const* in_data, size_t len, unsigned char* out_data = 0); virtual void RC4_finalize(); virtual void SHA2_init(int bits); diff --git a/libqpdf/qpdf/QPDFCrypto_native.hh b/libqpdf/qpdf/QPDFCrypto_native.hh index ec3cab2b..0beca395 100644 --- a/libqpdf/qpdf/QPDFCrypto_native.hh +++ b/libqpdf/qpdf/QPDFCrypto_native.hh @@ -24,7 +24,7 @@ class QPDFCrypto_native: public QPDFCryptoImpl virtual void RC4_init(unsigned char const* key_data, int key_len = -1); virtual void RC4_process( - unsigned char* in_data, size_t len, unsigned char* out_data = 0); + unsigned char const* in_data, size_t len, unsigned char* out_data = 0); virtual void RC4_finalize(); virtual void SHA2_init(int bits); diff --git a/libqpdf/qpdf/QPDFCrypto_openssl.hh b/libqpdf/qpdf/QPDFCrypto_openssl.hh index 9bdaaae8..252bdf6a 100644 --- a/libqpdf/qpdf/QPDFCrypto_openssl.hh +++ b/libqpdf/qpdf/QPDFCrypto_openssl.hh @@ -37,7 +37,7 @@ class QPDFCrypto_openssl: public QPDFCryptoImpl void RC4_init(unsigned char const* key_data, int key_len = -1) override; void RC4_process( - unsigned char* in_data, + unsigned char const* in_data, size_t len, unsigned char* out_data = 0) override; void RC4_finalize() override; diff --git a/libqpdf/qpdf/RC4.hh b/libqpdf/qpdf/RC4.hh index 43326d92..00de3905 100644 --- a/libqpdf/qpdf/RC4.hh +++ b/libqpdf/qpdf/RC4.hh @@ -11,9 +11,10 @@ class RC4 // key_len of -1 means treat key_data as a null-terminated string RC4(unsigned char const* key_data, int key_len = -1); - // out_data = 0 means to encrypt/decrypt in place + // It is safe to pass the same pointer to in_data and out_data to + // encrypt/decrypt in place void - process(unsigned char* in_data, size_t len, unsigned char* out_data = 0); + process(unsigned char const* in_data, size_t len, unsigned char* out_data); private: std::shared_ptr<QPDFCryptoImpl> crypto; diff --git a/libqpdf/qpdf/RC4_native.hh b/libqpdf/qpdf/RC4_native.hh index 4693ff9f..e7404085 100644 --- a/libqpdf/qpdf/RC4_native.hh +++ b/libqpdf/qpdf/RC4_native.hh @@ -10,8 +10,8 @@ class RC4_native RC4_native(unsigned char const* key_data, int key_len = -1); // out_data = 0 means to encrypt/decrypt in place - void - process(unsigned char* in_data, size_t len, unsigned char* out_data = 0); + void process( + unsigned char const* in_data, size_t len, unsigned char* out_data = 0); private: class RC4Key |