From cb769c62e55599e9f980001830bc61d9fcaa64a9 Mon Sep 17 00:00:00 2001 From: Jay Berkenbilt Date: Tue, 8 Feb 2022 09:18:08 -0500 Subject: WHITESPACE ONLY -- expand tabs in source code This comment expands all tabs using an 8-character tab-width. You should ignore this commit when using git blame or use git blame -w. In the early days, I used to use tabs where possible for indentation, since emacs did this automatically. In recent years, I have switched to only using spaces, which means qpdf source code has been a mixture of spaces and tabs. I have avoided cleaning this up because of not wanting gratuitous whitespaces change to cloud the output of git blame, but I changed my mind after discussing with users who view qpdf source code in editors/IDEs that have other tab widths by default and in light of the fact that I am planning to start applying automatic code formatting soon. --- include/qpdf/Constants.h | 38 +-- include/qpdf/Pl_Flate.hh | 2 +- include/qpdf/QPDF.hh | 606 +++++++++++++++++++-------------------- include/qpdf/QPDFExc.hh | 14 +- include/qpdf/QPDFObject.hh | 18 +- include/qpdf/QPDFObjectHandle.hh | 128 ++++----- include/qpdf/QPDFSystemError.hh | 2 +- include/qpdf/QPDFTokenizer.hh | 102 +++---- include/qpdf/QPDFWriter.hh | 94 +++--- include/qpdf/QPDFXRefEntry.hh | 2 +- include/qpdf/qpdf-c.h | 76 ++--- 11 files changed, 541 insertions(+), 541 deletions(-) (limited to 'include') diff --git a/include/qpdf/Constants.h b/include/qpdf/Constants.h index 5c05f292..ab3ca1fe 100644 --- a/include/qpdf/Constants.h +++ b/include/qpdf/Constants.h @@ -32,11 +32,11 @@ enum qpdf_error_code_e { qpdf_e_success = 0, - qpdf_e_internal, /* logic/programming error -- indicates bug */ - qpdf_e_system, /* I/O error, memory error, etc. */ - qpdf_e_unsupported, /* PDF feature not (yet) supported by qpdf */ - qpdf_e_password, /* incorrect password for encrypted file */ - qpdf_e_damaged_pdf, /* syntax errors or other damage in PDF */ + qpdf_e_internal, /* logic/programming error -- indicates bug */ + qpdf_e_system, /* I/O error, memory error, etc. */ + qpdf_e_unsupported, /* PDF feature not (yet) supported by qpdf */ + qpdf_e_password, /* incorrect password for encrypted file */ + qpdf_e_damaged_pdf, /* syntax errors or other damage in PDF */ qpdf_e_pages, /* erroneous or unsupported pages structure */ qpdf_e_object, /* type/bounds errors accessing objects */ }; @@ -77,15 +77,15 @@ enum qpdf_object_type_e { enum qpdf_object_stream_e { - qpdf_o_disable = 0, /* disable object streams */ - qpdf_o_preserve, /* preserve object streams */ - qpdf_o_generate /* generate object streams */ + qpdf_o_disable = 0, /* disable object streams */ + qpdf_o_preserve, /* preserve object streams */ + qpdf_o_generate /* generate object streams */ }; enum qpdf_stream_data_e { - qpdf_s_uncompress = 0, /* uncompress stream data */ - qpdf_s_preserve, /* preserve stream data compression */ - qpdf_s_compress /* compress stream data */ + qpdf_s_uncompress = 0, /* uncompress stream data */ + qpdf_s_preserve, /* preserve stream data compression */ + qpdf_s_compress /* compress stream data */ }; /* Stream data flags */ @@ -109,22 +109,22 @@ enum qpdf_stream_decode_level_e enum qpdf_r3_print_e { - qpdf_r3p_full = 0, /* allow all printing */ - qpdf_r3p_low, /* allow only low-resolution printing */ - qpdf_r3p_none /* allow no printing */ + qpdf_r3p_full = 0, /* allow all printing */ + qpdf_r3p_low, /* allow only low-resolution printing */ + qpdf_r3p_none /* allow no printing */ }; /* qpdf_r3_modify_e doesn't allow the full flexibility of the spec. It * corresponds to options in Acrobat 5's menus. The new interface in * QPDFWriter offers more granularity and no longer uses this type. */ -enum qpdf_r3_modify_e /* Allowed changes: */ +enum qpdf_r3_modify_e /* Allowed changes: */ { - qpdf_r3m_all = 0, /* All editing */ + qpdf_r3m_all = 0, /* All editing */ qpdf_r3m_annotate, /* Comments, fill forms, signing, assembly */ - qpdf_r3m_form, /* Fill forms, signing, assembly */ - qpdf_r3m_assembly, /* Only document assembly */ - qpdf_r3m_none /* No modifications */ + qpdf_r3m_form, /* Fill forms, signing, assembly */ + qpdf_r3m_assembly, /* Only document assembly */ + qpdf_r3m_none /* No modifications */ }; /* Form field flags from the PDF spec */ diff --git a/include/qpdf/Pl_Flate.hh b/include/qpdf/Pl_Flate.hh index cec76ca7..188cf7fa 100644 --- a/include/qpdf/Pl_Flate.hh +++ b/include/qpdf/Pl_Flate.hh @@ -36,7 +36,7 @@ class Pl_Flate: public Pipeline QPDF_DLL Pl_Flate(char const* identifier, Pipeline* next, - action_e action, unsigned int out_bufsize = def_bufsize); + action_e action, unsigned int out_bufsize = def_bufsize); QPDF_DLL virtual ~Pl_Flate(); diff --git a/include/qpdf/QPDF.hh b/include/qpdf/QPDF.hh index 5d3fd651..998fdb8c 100644 --- a/include/qpdf/QPDF.hh +++ b/include/qpdf/QPDF.hh @@ -95,8 +95,8 @@ class QPDF // error message in place of the file name. QPDF_DLL void processMemoryFile(char const* description, - char const* buf, size_t length, - char const* password = 0); + char const* buf, size_t length, + char const* password = 0); // Parse a PDF file loaded from a custom InputSource. If you have // your own method of retrieving a PDF file, you can subclass @@ -308,7 +308,7 @@ class QPDF void swapObjects(QPDFObjGen const& og1, QPDFObjGen const& og2); QPDF_DLL void swapObjects(int objid1, int generation1, - int objid2, int generation2); + int objid2, int generation2); // Replace a reserved object. This is a wrapper around // replaceObject but it guarantees that the underlying object is a @@ -373,37 +373,37 @@ class QPDF { public: - // This class holds data read from the encryption dictionary. - EncryptionData(int V, int R, int Length_bytes, int P, - std::string const& O, std::string const& U, + // This class holds data read from the encryption dictionary. + EncryptionData(int V, int R, int Length_bytes, int P, + std::string const& O, std::string const& U, std::string const& OE, std::string const& UE, std::string const& Perms, - std::string const& id1, bool encrypt_metadata) : - V(V), - R(R), - Length_bytes(Length_bytes), - P(P), - O(O), - U(U), + std::string const& id1, bool encrypt_metadata) : + V(V), + R(R), + Length_bytes(Length_bytes), + P(P), + O(O), + U(U), OE(OE), UE(UE), Perms(Perms), - id1(id1), - encrypt_metadata(encrypt_metadata) - { - } - - int getV() const; - int getR() const; - int getLengthBytes() const; - int getP() const; - std::string const& getO() const; - std::string const& getU() const; - std::string const& getOE() const; - std::string const& getUE() const; - std::string const& getPerms() const; - std::string const& getId1() const; - bool getEncryptMetadata() const; + id1(id1), + encrypt_metadata(encrypt_metadata) + { + } + + int getV() const; + int getR() const; + int getLengthBytes() const; + int getP() const; + std::string const& getO() const; + std::string const& getU() const; + std::string const& getOE() const; + std::string const& getUE() const; + std::string const& getPerms() const; + std::string const& getId1() const; + bool getEncryptMetadata() const; void setO(std::string const&); void setU(std::string const&); @@ -417,17 +417,17 @@ class QPDF EncryptionData(EncryptionData const&) = delete; EncryptionData& operator=(EncryptionData const&) = delete; - int V; - int R; - int Length_bytes; - int P; - std::string O; - std::string U; + int V; + int R; + int Length_bytes; + int P; + std::string O; + std::string U; std::string OE; std::string UE; std::string Perms; - std::string id1; - bool encrypt_metadata; + std::string id1; + bool encrypt_metadata; }; QPDF_DLL @@ -475,25 +475,25 @@ class QPDF static void trim_user_password(std::string& user_password); QPDF_DLL static std::string compute_data_key( - std::string const& encryption_key, int objid, int generation, - bool use_aes, int encryption_V, int encryption_R); + std::string const& encryption_key, int objid, int generation, + bool use_aes, int encryption_V, int encryption_R); QPDF_DLL static std::string compute_encryption_key( - std::string const& password, EncryptionData const& data); + std::string const& password, EncryptionData const& data); QPDF_DLL static void compute_encryption_O_U( - char const* user_password, char const* owner_password, - int V, int R, int key_len, int P, bool encrypt_metadata, - std::string const& id1, - std::string& O, std::string& U); + char const* user_password, char const* owner_password, + int V, int R, int key_len, int P, bool encrypt_metadata, + std::string const& id1, + std::string& O, std::string& U); QPDF_DLL static void compute_encryption_parameters_V5( - char const* user_password, char const* owner_password, - int V, int R, int key_len, int P, bool encrypt_metadata, - std::string const& id1, + char const* user_password, char const* owner_password, + int V, int R, int key_len, int P, bool encrypt_metadata, + std::string const& id1, std::string& encryption_key, - std::string& O, std::string& U, + std::string& O, std::string& U, std::string& OE, std::string& UE, std::string& Perms); // Return the full user password as stored in the PDF file. For // files encrypted with 40-bit or 128-bit keys, the user password @@ -583,7 +583,7 @@ class QPDF // objects for stream dictionary keys it will be regenerating. QPDF_DLL void optimize(std::map const& object_stream_data, - bool allow_changes = true); + bool allow_changes = true); // ABI: make function optional and merge overloaded versions QPDF_DLL void optimize( @@ -698,13 +698,13 @@ class QPDF // it can resolve indirect references. class Resolver { - friend class QPDFObjectHandle; + friend class QPDFObjectHandle; private: - static PointerHolder resolve( - QPDF* qpdf, int objid, int generation) - { - return qpdf->resolve(objid, generation); - } + static PointerHolder resolve( + QPDF* qpdf, int objid, int generation) + { + return qpdf->resolve(objid, generation); + } static bool objectChanged( QPDF* qpdf, QPDFObjGen const& og, PointerHolder& oph) { @@ -717,14 +717,14 @@ class QPDF // copy stream data. class StreamCopier { - friend class QPDFObjectHandle; + friend class QPDFObjectHandle; private: - static void copyStreamData(QPDF* qpdf, + static void copyStreamData(QPDF* qpdf, QPDFObjectHandle const& dest, QPDFObjectHandle const& src) - { - qpdf->copyStreamData(dest, src); - } + { + qpdf->copyStreamData(dest, src); + } }; friend class Resolver; @@ -732,7 +732,7 @@ class QPDF // resolution class ParseGuard { - friend class QPDFObjectHandle; + friend class QPDFObjectHandle; private: ParseGuard(QPDF* qpdf) : qpdf(qpdf) @@ -756,19 +756,19 @@ class QPDF // Pipe class is restricted to QPDF_Stream class Pipe { - friend class QPDF_Stream; + friend class QPDF_Stream; private: - static bool pipeStreamData(QPDF* qpdf, int objid, int generation, - qpdf_offset_t offset, size_t length, - QPDFObjectHandle dict, - Pipeline* pipeline, + static bool pipeStreamData(QPDF* qpdf, int objid, int generation, + qpdf_offset_t offset, size_t length, + QPDFObjectHandle dict, + Pipeline* pipeline, bool suppress_warnings, bool will_retry) - { - return qpdf->pipeStreamData( - objid, generation, offset, length, dict, pipeline, + { + return qpdf->pipeStreamData( + objid, generation, offset, length, dict, pipeline, suppress_warnings, will_retry); - } + } }; friend class Pipe; @@ -778,23 +778,23 @@ class QPDF class ObjCache { public: - ObjCache() : - end_before_space(0), - end_after_space(0) - { - } - ObjCache(PointerHolder object, - qpdf_offset_t end_before_space, - qpdf_offset_t end_after_space) : - object(object), - end_before_space(end_before_space), - end_after_space(end_after_space) - { - } - - PointerHolder object; - qpdf_offset_t end_before_space; - qpdf_offset_t end_after_space; + ObjCache() : + end_before_space(0), + end_after_space(0) + { + } + ObjCache(PointerHolder object, + qpdf_offset_t end_before_space, + qpdf_offset_t end_after_space) : + object(object), + end_before_space(end_before_space), + end_after_space(end_after_space) + { + } + + PointerHolder object; + qpdf_offset_t end_before_space; + qpdf_offset_t end_after_space; }; class ObjCopier @@ -861,7 +861,7 @@ class QPDF virtual ~CopiedStreamDataProvider() { } - virtual bool provideStreamData( + virtual bool provideStreamData( int objid, int generation, Pipeline* pipeline, bool suppress_warnings, bool will_retry) override; void registerForeignStream(QPDFObjGen const& local_og, @@ -926,23 +926,23 @@ class QPDF qpdf_offset_t processXRefStream( qpdf_offset_t offset, QPDFObjectHandle& xref_stream); void insertXrefEntry(int obj, int f0, qpdf_offset_t f1, int f2, - bool overwrite = false); + bool overwrite = false); void setLastObjectDescription(std::string const& description, - int objid, int generation); + int objid, int generation); QPDFObjectHandle readObject( - PointerHolder, std::string const& description, - int objid, int generation, bool in_object_stream); + PointerHolder, std::string const& description, + int objid, int generation, bool in_object_stream); size_t recoverStreamLength( - PointerHolder input, int objid, int generation, - qpdf_offset_t stream_offset); + PointerHolder input, int objid, int generation, + qpdf_offset_t stream_offset); QPDFTokenizer::Token readToken(PointerHolder, size_t max_len = 0); QPDFObjectHandle readObjectAtOffset( - bool attempt_recovery, - qpdf_offset_t offset, std::string const& description, - int exp_objid, int exp_generation, - int& act_objid, int& act_generation); + bool attempt_recovery, + qpdf_offset_t offset, std::string const& description, + int exp_objid, int exp_generation, + int& act_objid, int& act_generation); bool objectChanged(QPDFObjGen const& og, PointerHolder& oph); PointerHolder resolve(int objid, int generation); void resolveObjectsInStream(int obj_stream_number); @@ -950,9 +950,9 @@ class QPDF // Calls finish() on the pipeline when done but does not delete it bool pipeStreamData(int objid, int generation, - qpdf_offset_t offset, size_t length, - QPDFObjectHandle dict, - Pipeline* pipeline, + qpdf_offset_t offset, size_t length, + QPDFObjectHandle dict, + Pipeline* pipeline, bool suppress_warnings, bool will_retry); bool pipeForeignStreamData( @@ -973,18 +973,18 @@ class QPDF // Get lists of all objects in order according to the part of a // linearized file that they belong to. void getLinearizedParts( - std::map const& object_stream_data, - std::vector& part4, - std::vector& part6, - std::vector& part7, - std::vector& part8, - std::vector& part9); + std::map const& object_stream_data, + std::vector& part4, + std::vector& part6, + std::vector& part7, + std::vector& part8, + std::vector& part9); void generateHintStream(std::map const& xref, - std::map const& lengths, - std::map const& obj_renumber, - PointerHolder& hint_stream, - int& S, int& O); + std::map const& lengths, + std::map const& obj_renumber, + PointerHolder& hint_stream, + int& S, int& O); // Map object to object stream that contains it void getObjectStreamData(std::map&); @@ -1020,12 +1020,12 @@ class QPDF std::string const& password, EncryptionData const& data, bool& perms_valid); static void decryptStream( - PointerHolder encp, + PointerHolder encp, PointerHolder file, QPDF& qpdf_for_warning, Pipeline*& pipeline, int objid, int generation, - QPDFObjectHandle& stream_dict, - std::vector>& heap); + QPDFObjectHandle& stream_dict, + std::vector>& heap); // Methods to support object copying void reserveObjects(QPDFObjectHandle foreign, ObjCopier& obj_copier, @@ -1051,118 +1051,118 @@ class QPDF // PDF 1.4: Table F.4 struct HPageOffsetEntry { - HPageOffsetEntry() : - delta_nobjects(0), - delta_page_length(0), - nshared_objects(0), - delta_content_offset(0), - delta_content_length(0) - { - } - - int delta_nobjects; // 1 - qpdf_offset_t delta_page_length; // 2 - int nshared_objects; // 3 - // vectors' sizes = nshared_objects - std::vector shared_identifiers; // 4 - std::vector shared_numerators; // 5 - qpdf_offset_t delta_content_offset; // 6 + HPageOffsetEntry() : + delta_nobjects(0), + delta_page_length(0), + nshared_objects(0), + delta_content_offset(0), + delta_content_length(0) + { + } + + int delta_nobjects; // 1 + qpdf_offset_t delta_page_length; // 2 + int nshared_objects; // 3 + // vectors' sizes = nshared_objects + std::vector shared_identifiers; // 4 + std::vector shared_numerators; // 5 + qpdf_offset_t delta_content_offset; // 6 qpdf_offset_t delta_content_length; // 7 }; // PDF 1.4: Table F.3 struct HPageOffset { - HPageOffset() : - min_nobjects(0), - first_page_offset(0), - nbits_delta_nobjects(0), - min_page_length(0), - nbits_delta_page_length(0), - min_content_offset(0), - nbits_delta_content_offset(0), - min_content_length(0), - nbits_delta_content_length(0), - nbits_nshared_objects(0), - nbits_shared_identifier(0), - nbits_shared_numerator(0), - shared_denominator(0) - { - } - - int min_nobjects; // 1 - qpdf_offset_t first_page_offset; // 2 - int nbits_delta_nobjects; // 3 - int min_page_length; // 4 - int nbits_delta_page_length; // 5 - int min_content_offset; // 6 - int nbits_delta_content_offset; // 7 - int min_content_length; // 8 - int nbits_delta_content_length; // 9 - int nbits_nshared_objects; // 10 - int nbits_shared_identifier; // 11 - int nbits_shared_numerator; // 12 - int shared_denominator; // 13 - // vector size is npages - std::vector entries; + HPageOffset() : + min_nobjects(0), + first_page_offset(0), + nbits_delta_nobjects(0), + min_page_length(0), + nbits_delta_page_length(0), + min_content_offset(0), + nbits_delta_content_offset(0), + min_content_length(0), + nbits_delta_content_length(0), + nbits_nshared_objects(0), + nbits_shared_identifier(0), + nbits_shared_numerator(0), + shared_denominator(0) + { + } + + int min_nobjects; // 1 + qpdf_offset_t first_page_offset; // 2 + int nbits_delta_nobjects; // 3 + int min_page_length; // 4 + int nbits_delta_page_length; // 5 + int min_content_offset; // 6 + int nbits_delta_content_offset; // 7 + int min_content_length; // 8 + int nbits_delta_content_length; // 9 + int nbits_nshared_objects; // 10 + int nbits_shared_identifier; // 11 + int nbits_shared_numerator; // 12 + int shared_denominator; // 13 + // vector size is npages + std::vector entries; }; // PDF 1.4: Table F.6 struct HSharedObjectEntry { - HSharedObjectEntry() : - delta_group_length(0), - signature_present(0), - nobjects_minus_one(0) - { - } - - // Item 3 is a 128-bit signature (unsupported by Acrobat) - int delta_group_length; // 1 - int signature_present; // 2 -- always 0 - int nobjects_minus_one; // 4 -- always 0 + HSharedObjectEntry() : + delta_group_length(0), + signature_present(0), + nobjects_minus_one(0) + { + } + + // Item 3 is a 128-bit signature (unsupported by Acrobat) + int delta_group_length; // 1 + int signature_present; // 2 -- always 0 + int nobjects_minus_one; // 4 -- always 0 }; // PDF 1.4: Table F.5 struct HSharedObject { - HSharedObject() : - first_shared_obj(0), - first_shared_offset(0), - nshared_first_page(0), - nshared_total(0), - nbits_nobjects(0), - min_group_length(0), - nbits_delta_group_length(0) - { - } - - int first_shared_obj; // 1 - qpdf_offset_t first_shared_offset; // 2 - int nshared_first_page; // 3 - int nshared_total; // 4 - int nbits_nobjects; // 5 - int min_group_length; // 6 - int nbits_delta_group_length; // 7 - // vector size is nshared_total - std::vector entries; + HSharedObject() : + first_shared_obj(0), + first_shared_offset(0), + nshared_first_page(0), + nshared_total(0), + nbits_nobjects(0), + min_group_length(0), + nbits_delta_group_length(0) + { + } + + int first_shared_obj; // 1 + qpdf_offset_t first_shared_offset; // 2 + int nshared_first_page; // 3 + int nshared_total; // 4 + int nbits_nobjects; // 5 + int min_group_length; // 6 + int nbits_delta_group_length; // 7 + // vector size is nshared_total + std::vector entries; }; // PDF 1.4: Table F.9 struct HGeneric { - HGeneric() : - first_object(0), - first_object_offset(0), - nobjects(0), - group_length(0) - { - } - - int first_object; // 1 - qpdf_offset_t first_object_offset; // 2 - int nobjects; // 3 - int group_length; // 4 + HGeneric() : + first_object(0), + first_object_offset(0), + nobjects(0), + group_length(0) + { + } + + int first_object; // 1 + qpdf_offset_t first_object_offset; // 2 + int nobjects; // 3 + int group_length; // 4 }; // Other linearization data structures @@ -1170,26 +1170,26 @@ class QPDF // Initialized from Linearization Parameter dictionary struct LinParameters { - LinParameters() : - file_size(0), - first_page_object(0), - first_page_end(0), - npages(0), - xref_zero_offset(0), - first_page(0), - H_offset(0), - H_length(0) - { - } - - qpdf_offset_t file_size; // /L - int first_page_object; // /O - qpdf_offset_t first_page_end; // /E - int npages; // /N - qpdf_offset_t xref_zero_offset; // /T - int first_page; // /P - qpdf_offset_t H_offset; // offset of primary hint stream - qpdf_offset_t H_length; // length of primary hint stream + LinParameters() : + file_size(0), + first_page_object(0), + first_page_end(0), + npages(0), + xref_zero_offset(0), + first_page(0), + H_offset(0), + H_length(0) + { + } + + qpdf_offset_t file_size; // /L + int first_page_object; // /O + qpdf_offset_t first_page_end; // /E + int npages; // /N + qpdf_offset_t xref_zero_offset; // /T + int first_page; // /P + qpdf_offset_t H_offset; // offset of primary hint stream + qpdf_offset_t H_length; // length of primary hint stream }; // Computed hint table value data structures. These tables @@ -1209,49 +1209,49 @@ class QPDF struct CHPageOffsetEntry { - CHPageOffsetEntry() : - nobjects(0), - nshared_objects(0) - { - } - - int nobjects; - int nshared_objects; - // vectors' sizes = nshared_objects - std::vector shared_identifiers; + CHPageOffsetEntry() : + nobjects(0), + nshared_objects(0) + { + } + + int nobjects; + int nshared_objects; + // vectors' sizes = nshared_objects + std::vector shared_identifiers; }; struct CHPageOffset { - // vector size is npages - std::vector entries; + // vector size is npages + std::vector entries; }; struct CHSharedObjectEntry { - CHSharedObjectEntry(int object) : - object(object) - { - } + CHSharedObjectEntry(int object) : + object(object) + { + } - int object; + int object; }; // PDF 1.4: Table F.5 struct CHSharedObject { - CHSharedObject() : - first_shared_obj(0), - nshared_first_page(0), - nshared_total(0) - { - } - - int first_shared_obj; - int nshared_first_page; - int nshared_total; - // vector size is nshared_total - std::vector entries; + CHSharedObject() : + first_shared_obj(0), + nshared_first_page(0), + nshared_total(0) + { + } + + int first_shared_obj; + int nshared_first_page; + int nshared_total; + // vector size is nshared_total + std::vector entries; }; // No need for CHGeneric -- HGeneric is fine as is. @@ -1263,33 +1263,33 @@ class QPDF class ObjUser { public: - enum user_e - { - ou_bad, - ou_page, - ou_thumb, - ou_trailer_key, - ou_root_key, - ou_root - }; + enum user_e + { + ou_bad, + ou_page, + ou_thumb, + ou_trailer_key, + ou_root_key, + ou_root + }; - // type is set to ou_bad - ObjUser(); + // type is set to ou_bad + ObjUser(); - // type must be ou_root - ObjUser(user_e type); + // type must be ou_root + ObjUser(user_e type); - // type must be one of ou_page or ou_thumb - ObjUser(user_e type, int pageno); + // type must be one of ou_page or ou_thumb + ObjUser(user_e type, int pageno); - // type must be one of ou_trailer_key or ou_root_key - ObjUser(user_e type, std::string const& key); + // type must be one of ou_trailer_key or ou_root_key + ObjUser(user_e type, std::string const& key); - bool operator<(ObjUser const&) const; + bool operator<(ObjUser const&) const; - user_e ou_type; - int pageno; // if ou_page; - std::string key; // if ou_trailer_key or ou_root_key + user_e ou_type; + int pageno; // if ou_page; + std::string key; // if ou_trailer_key or ou_root_key }; class PatternFinder: public InputSource::Finder @@ -1331,17 +1331,17 @@ class QPDF qpdf_offset_t maxEnd(ObjUser const& ou); qpdf_offset_t getLinearizationOffset(QPDFObjGen const&); QPDFObjectHandle getUncompressedObject( - QPDFObjectHandle&, std::map const& object_stream_data); + QPDFObjectHandle&, std::map const& object_stream_data); int lengthNextN(int first_object, int n, - std::list& errors); + std::list& errors); void checkHPageOffset(std::list& errors, - std::list& warnings, - std::vector const& pages, - std::map& idx_to_obj); + std::list& warnings, + std::vector const& pages, + std::map& idx_to_obj); void checkHSharedObject(std::list& warnings, - std::list& errors, - std::vector const& pages, - std::map& idx_to_obj); + std::list& errors, + std::vector const& pages, + std::map& idx_to_obj); void checkHOutlines(std::list& warnings); void dumpHPageOffset(); void dumpHSharedObject(); @@ -1349,27 +1349,27 @@ class QPDF qpdf_offset_t adjusted_offset(qpdf_offset_t offset); QPDFObjectHandle objGenToIndirect(QPDFObjGen const&); void calculateLinearizationData( - std::map const& object_stream_data); + std::map const& object_stream_data); void pushOutlinesToPart( - std::vector& part, - std::set& lc_outlines, - std::map const& object_stream_data); + std::vector& part, + std::set& lc_outlines, + std::map const& object_stream_data); int outputLengthNextN( - int in_object, int n, - std::map const& lengths, - std::map const& obj_renumber); + int in_object, int n, + std::map const& lengths, + std::map const& obj_renumber); void calculateHPageOffset( - std::map const& xref, - std::map const& lengths, - std::map const& obj_renumber); + std::map const& xref, + std::map const& lengths, + std::map const& obj_renumber); void calculateHSharedObject( - std::map const& xref, - std::map const& lengths, - std::map const& obj_renumber); + std::map const& xref, + std::map const& lengths, + std::map const& obj_renumber); void calculateHOutline( - std::map const& xref, - std::map const& lengths, - std::map const& obj_renumber); + std::map const& xref, + std::map const& lengths, + std::map const& obj_renumber); void writeHPageOffset(BitWriter&); void writeHSharedObject(BitWriter&); void writeHGeneric(BitWriter&, HGeneric&); @@ -1380,10 +1380,10 @@ class QPDF void pushInheritedAttributesToPage(bool allow_changes, bool warn_skipped_keys); void pushInheritedAttributesToPageInternal( - QPDFObjectHandle, - std::map >&, - std::vector& all_pages, - bool allow_changes, bool warn_skipped_keys, + QPDFObjectHandle, + std::map >&, + std::vector& all_pages, + bool allow_changes, bool warn_skipped_keys, std::set& visited); void updateObjectMaps( ObjUser const& ou, QPDFObjectHandle oh, diff --git a/include/qpdf/QPDFExc.hh b/include/qpdf/QPDFExc.hh index 24d4a321..6a46aff8 100644 --- a/include/qpdf/QPDFExc.hh +++ b/include/qpdf/QPDFExc.hh @@ -34,10 +34,10 @@ class QPDF_DLL_CLASS QPDFExc: public std::runtime_error public: QPDF_DLL QPDFExc(qpdf_error_code_e error_code, - std::string const& filename, - std::string const& object, - qpdf_offset_t offset, - std::string const& message); + std::string const& filename, + std::string const& object, + qpdf_offset_t offset, + std::string const& message); QPDF_DLL virtual ~QPDFExc() noexcept { @@ -66,9 +66,9 @@ class QPDF_DLL_CLASS QPDFExc: public std::runtime_error private: static std::string createWhat(std::string const& filename, - std::string const& object, - qpdf_offset_t offset, - std::string const& message); + std::string const& object, + qpdf_offset_t offset, + std::string const& message); // This class does not use the Members pattern to avoid needless // memory allocations during exception handling. diff --git a/include/qpdf/QPDFObject.hh b/include/qpdf/QPDFObject.hh index 4e84dbb2..d01ea8ed 100644 --- a/include/qpdf/QPDFObject.hh +++ b/include/qpdf/QPDFObject.hh @@ -76,16 +76,16 @@ class QPDF_DLL_CLASS QPDFObject // Accessor to give specific access to non-public methods class ObjAccessor { - friend class QPDF; - friend class QPDFObjectHandle; + friend class QPDF; + friend class QPDFObjectHandle; private: - static void releaseResolved(QPDFObject* o) - { - if (o) - { - o->releaseResolved(); - } - } + static void releaseResolved(QPDFObject* o) + { + if (o) + { + o->releaseResolved(); + } + } }; friend class ObjAccessor; diff --git a/include/qpdf/QPDFObjectHandle.hh b/include/qpdf/QPDFObjectHandle.hh index 22258159..73b8cf7c 100644 --- a/include/qpdf/QPDFObjectHandle.hh +++ b/include/qpdf/QPDFObjectHandle.hh @@ -63,27 +63,27 @@ class QPDFObjectHandle QPDF_DLL StreamDataProvider(bool supports_retry = false); - QPDF_DLL - virtual ~StreamDataProvider() - { - } - // The implementation of this function must write stream data - // to the given pipeline. The stream data must conform to - // whatever filters are explicitly associated with the stream. - // QPDFWriter may, in some cases, add compression, but if it - // does, it will update the filters as needed. Every call to - // provideStreamData for a given stream must write the same - // data. Note that, when writing linearized files, qpdf will - // call your provideStreamData twice, and if it generates - // different output, you risk generating invalid output or - // having qpdf throw an exception. The object ID and - // generation passed to this method are those that belong to - // the stream on behalf of which the provider is called. They - // may be ignored or used by the implementation for indexing - // or other purposes. This information is made available just - // to make it more convenient to use a single - // StreamDataProvider object to provide data for multiple - // streams. + QPDF_DLL + virtual ~StreamDataProvider() + { + } + // The implementation of this function must write stream data + // to the given pipeline. The stream data must conform to + // whatever filters are explicitly associated with the stream. + // QPDFWriter may, in some cases, add compression, but if it + // does, it will update the filters as needed. Every call to + // provideStreamData for a given stream must write the same + // data. Note that, when writing linearized files, qpdf will + // call your provideStreamData twice, and if it generates + // different output, you risk generating invalid output or + // having qpdf throw an exception. The object ID and + // generation passed to this method are those that belong to + // the stream on behalf of which the provider is called. They + // may be ignored or used by the implementation for indexing + // or other purposes. This information is made available just + // to make it more convenient to use a single + // StreamDataProvider object to provide data for multiple + // streams. // A few things to keep in mind: // @@ -117,14 +117,14 @@ class QPDFObjectHandle // version of the method, which should also return a boolean // indicating whether it ran without errors. QPDF_DLL - virtual void provideStreamData(int objid, int generation, - Pipeline* pipeline); + virtual void provideStreamData(int objid, int generation, + Pipeline* pipeline); QPDF_DLL - virtual bool provideStreamData( + virtual bool provideStreamData( int objid, int generation, Pipeline* pipeline, bool suppress_warnings, bool will_retry); QPDF_DLL - bool supportsRetry(); + bool supportsRetry(); private: bool supports_retry; @@ -563,7 +563,7 @@ class QPDFObjectHandle static QPDFObjectHandle newArray(); QPDF_DLL static QPDFObjectHandle newArray( - std::vector const& items); + std::vector const& items); QPDF_DLL static QPDFObjectHandle newArray(Rectangle const&); QPDF_DLL @@ -574,7 +574,7 @@ class QPDFObjectHandle static QPDFObjectHandle newDictionary(); QPDF_DLL static QPDFObjectHandle newDictionary( - std::map const& items); + std::map const& items); // Create an array from a rectangle. Equivalent to the rectangle // form of newArray. @@ -1159,7 +1159,7 @@ class QPDFObjectHandle // Return value is whether filtering was attempted. QPDF_DLL bool pipeStreamData(Pipeline*, bool filter, - bool normalize, bool compress); + bool normalize, bool compress); // Replace a stream's dictionary. The new dictionary must be // consistent with the stream's data. This is most appropriately @@ -1179,8 +1179,8 @@ class QPDFObjectHandle // decryption filters have been applied, is as presented. QPDF_DLL void replaceStreamData(PointerHolder data, - QPDFObjectHandle const& filter, - QPDFObjectHandle const& decode_parms); + QPDFObjectHandle const& filter, + QPDFObjectHandle const& decode_parms); // Replace the stream's stream data with the given string. // This method will create a copy of the data rather than using @@ -1188,8 +1188,8 @@ class QPDFObjectHandle // of replaceStreamData. QPDF_DLL void replaceStreamData(std::string const& data, - QPDFObjectHandle const& filter, - QPDFObjectHandle const& decode_parms); + QPDFObjectHandle const& filter, + QPDFObjectHandle const& decode_parms); // As above, replace this stream's stream data. Instead of // directly providing a buffer with the stream data, call the @@ -1218,8 +1218,8 @@ class QPDFObjectHandle // compute the length in advance. QPDF_DLL void replaceStreamData(PointerHolder provider, - QPDFObjectHandle const& filter, - QPDFObjectHandle const& decode_parms); + QPDFObjectHandle const& filter, + QPDFObjectHandle const& decode_parms); // Starting in qpdf 10.2, you can use C++-11 function objects // instead of StreamDataProvider. @@ -1229,8 +1229,8 @@ class QPDFObjectHandle // pass QUtil::file_provider(filename) as provider. QPDF_DLL void replaceStreamData(std::function provider, - QPDFObjectHandle const& filter, - QPDFObjectHandle const& decode_parms); + QPDFObjectHandle const& filter, + QPDFObjectHandle const& decode_parms); // The provider should write the stream data to the pipeline, // returning true if it succeeded without errors. QPDF_DLL @@ -1317,21 +1317,21 @@ class QPDFObjectHandle // making it a friend of the whole QPDFObjectHandle class. class Factory { - friend class QPDF; + friend class QPDF; private: - static QPDFObjectHandle newIndirect(QPDF* qpdf, - int objid, int generation) - { - return QPDFObjectHandle::newIndirect(qpdf, objid, generation); - } - // object must be dictionary object - static QPDFObjectHandle newStream( - QPDF* qpdf, int objid, int generation, - QPDFObjectHandle stream_dict, qpdf_offset_t offset, size_t length) - { - return QPDFObjectHandle::newStream( - qpdf, objid, generation, stream_dict, offset, length); - } + static QPDFObjectHandle newIndirect(QPDF* qpdf, + int objid, int generation) + { + return QPDFObjectHandle::newIndirect(qpdf, objid, generation); + } + // object must be dictionary object + static QPDFObjectHandle newStream( + QPDF* qpdf, int objid, int generation, + QPDFObjectHandle stream_dict, qpdf_offset_t offset, size_t length) + { + return QPDFObjectHandle::newStream( + qpdf, objid, generation, stream_dict, offset, length); + } }; friend class Factory; @@ -1339,13 +1339,13 @@ class QPDFObjectHandle // call this. class ObjAccessor { - friend class QPDF; + friend class QPDF; private: - static PointerHolder getObject(QPDFObjectHandle& o) - { - o.dereference(); - return o.obj; - } + static PointerHolder getObject(QPDFObjectHandle& o) + { + o.dereference(); + return o.obj; + } }; friend class ObjAccessor; @@ -1353,14 +1353,14 @@ class QPDFObjectHandle // releaseResolved(). class ReleaseResolver { - friend class QPDF_Dictionary; + friend class QPDF_Dictionary; friend class QPDF_Stream; friend class SparseOHArray; private: - static void releaseResolved(QPDFObjectHandle& o) - { - o.releaseResolved(); - } + static void releaseResolved(QPDFObjectHandle& o) + { + o.releaseResolved(); + } }; friend class ReleaseResolver; @@ -1440,8 +1440,8 @@ class QPDFObjectHandle // Private object factory methods static QPDFObjectHandle newIndirect(QPDF*, int objid, int generation); static QPDFObjectHandle newStream( - QPDF* qpdf, int objid, int generation, - QPDFObjectHandle stream_dict, qpdf_offset_t offset, size_t length); + QPDF* qpdf, int objid, int generation, + QPDFObjectHandle stream_dict, qpdf_offset_t offset, size_t length); void typeWarning(char const* expected_type, std::string const& warning); @@ -1481,7 +1481,7 @@ class QPDFObjectHandle // a substantial performance penalty since QPDFObjectHandle // objects are copied around so frequently. QPDF* qpdf; - int objid; // 0 for direct object + int objid; // 0 for direct object int generation; PointerHolder obj; bool reserved; diff --git a/include/qpdf/QPDFSystemError.hh b/include/qpdf/QPDFSystemError.hh index c9531336..92c88329 100644 --- a/include/qpdf/QPDFSystemError.hh +++ b/include/qpdf/QPDFSystemError.hh @@ -49,7 +49,7 @@ class QPDF_DLL_CLASS QPDFSystemError: public std::runtime_error private: static std::string createWhat(std::string const& description, - int system_errno); + int system_errno); // This class does not use the Members pattern to avoid needless // memory allocations during exception handling. diff --git a/include/qpdf/QPDFTokenizer.hh b/include/qpdf/QPDFTokenizer.hh index 45224259..0202d43f 100644 --- a/include/qpdf/QPDFTokenizer.hh +++ b/include/qpdf/QPDFTokenizer.hh @@ -40,20 +40,20 @@ class QPDFTokenizer // version 8. enum token_type_e { - tt_bad, - tt_array_close, - tt_array_open, - tt_brace_close, - tt_brace_open, - tt_dict_close, - tt_dict_open, - tt_integer, - tt_name, - tt_real, - tt_string, - tt_null, - tt_bool, - tt_word, + tt_bad, + tt_array_close, + tt_array_open, + tt_brace_close, + tt_brace_open, + tt_dict_close, + tt_dict_open, + tt_integer, + tt_name, + tt_real, + tt_string, + tt_null, + tt_bool, + tt_word, tt_eof, tt_space, tt_comment, @@ -63,46 +63,46 @@ class QPDFTokenizer class Token { public: - Token() : type(tt_bad) {} + Token() : type(tt_bad) {} QPDF_DLL - Token(token_type_e type, std::string const& value); - Token(token_type_e type, std::string const& value, - std::string raw_value, std::string error_message) : - type(type), - value(value), - raw_value(raw_value), - error_message(error_message) - { - } - token_type_e getType() const - { - return this->type; - } - std::string const& getValue() const - { - return this->value; - } - std::string const& getRawValue() const - { - return this->raw_value; - } - std::string const& getErrorMessage() const - { - return this->error_message; - } - bool operator==(Token const& rhs) const - { - // Ignore fields other than type and value - return ((this->type != tt_bad) && - (this->type == rhs.type) && - (this->value == rhs.value)); - } + Token(token_type_e type, std::string const& value); + Token(token_type_e type, std::string const& value, + std::string raw_value, std::string error_message) : + type(type), + value(value), + raw_value(raw_value), + error_message(error_message) + { + } + token_type_e getType() const + { + return this->type; + } + std::string const& getValue() const + { + return this->value; + } + std::string const& getRawValue() const + { + return this->raw_value; + } + std::string const& getErrorMessage() const + { + return this->error_message; + } + bool operator==(Token const& rhs) const + { + // Ignore fields other than type and value + return ((this->type != tt_bad) && + (this->type == rhs.type) && + (this->value == rhs.value)); + } private: - token_type_e type; - std::string value; - std::string raw_value; - std::string error_message; + token_type_e type; + std::string value; + std::string raw_value; + std::string error_message; }; QPDF_DLL diff --git a/include/qpdf/QPDFWriter.hh b/include/qpdf/QPDFWriter.hh index cb6585f0..97d190a7 100644 --- a/include/qpdf/QPDFWriter.hh +++ b/include/qpdf/QPDFWriter.hh @@ -370,73 +370,73 @@ class QPDFWriter // it unless you have to. QPDF_DLL void setR2EncryptionParameters( - char const* user_password, char const* owner_password, - bool allow_print, bool allow_modify, - bool allow_extract, bool allow_annotate); + char const* user_password, char const* owner_password, + bool allow_print, bool allow_modify, + bool allow_extract, bool allow_annotate); // R3 uses RC4, which is a weak cryptographic algorithm. Don't use // it unless you have to. QPDF_DLL void setR3EncryptionParameters( - char const* user_password, char const* owner_password, - bool allow_accessibility, bool allow_extract, + char const* user_password, char const* owner_password, + bool allow_accessibility, bool allow_extract, bool allow_assemble, bool allow_annotate_and_form, bool allow_form_filling, bool allow_modify_other, - qpdf_r3_print_e print); + qpdf_r3_print_e print); // R4 uses RC4, which is a weak cryptographic algorithm, when // use_aes=false. Don't use it unless you have to. QPDF_DLL void setR4EncryptionParameters( - char const* user_password, char const* owner_password, - bool allow_accessibility, bool allow_extract, + char const* user_password, char const* owner_password, + bool allow_accessibility, bool allow_extract, bool allow_assemble, bool allow_annotate_and_form, bool allow_form_filling, bool allow_modify_other, - qpdf_r3_print_e print, bool encrypt_metadata, bool use_aes); + qpdf_r3_print_e print, bool encrypt_metadata, bool use_aes); // R5 is deprecated. Do not use it for production use. Writing // R5 is supported by qpdf primarily to generate test files for // applications that may need to test R5 support. QPDF_DLL void setR5EncryptionParameters( - char const* user_password, char const* owner_password, - bool allow_accessibility, bool allow_extract, + char const* user_password, char const* owner_password, + bool allow_accessibility, bool allow_extract, bool allow_assemble, bool allow_annotate_and_form, bool allow_form_filling, bool allow_modify_other, - qpdf_r3_print_e print, bool encrypt_metadata); + qpdf_r3_print_e print, bool encrypt_metadata); QPDF_DLL void setR6EncryptionParameters( - char const* user_password, char const* owner_password, - bool allow_accessibility, bool allow_extract, + char const* user_password, char const* owner_password, + bool allow_accessibility, bool allow_extract, bool allow_assemble, bool allow_annotate_and_form, bool allow_form_filling, bool allow_modify_other, - qpdf_r3_print_e print, bool encrypt_metadata_aes); + qpdf_r3_print_e print, bool encrypt_metadata_aes); // Pre qpdf 8.4.0 API [[deprecated("see newer API above")]] QPDF_DLL void setR3EncryptionParameters( - char const* user_password, char const* owner_password, - bool allow_accessibility, bool allow_extract, - qpdf_r3_print_e print, qpdf_r3_modify_e modify); + char const* user_password, char const* owner_password, + bool allow_accessibility, bool allow_extract, + qpdf_r3_print_e print, qpdf_r3_modify_e modify); [[deprecated("see newer API above")]] QPDF_DLL void setR4EncryptionParameters( - char const* user_password, char const* owner_password, - bool allow_accessibility, bool allow_extract, - qpdf_r3_print_e print, qpdf_r3_modify_e modify, - bool encrypt_metadata, bool use_aes); + char const* user_password, char const* owner_password, + bool allow_accessibility, bool allow_extract, + qpdf_r3_print_e print, qpdf_r3_modify_e modify, + bool encrypt_metadata, bool use_aes); [[deprecated("see newer API above")]] QPDF_DLL void setR5EncryptionParameters( - char const* user_password, char const* owner_password, - bool allow_accessibility, bool allow_extract, - qpdf_r3_print_e print, qpdf_r3_modify_e modify, - bool encrypt_metadata); + char const* user_password, char const* owner_password, + bool allow_accessibility, bool allow_extract, + qpdf_r3_print_e print, qpdf_r3_modify_e modify, + bool encrypt_metadata); [[deprecated("see newer API above")]] QPDF_DLL void setR6EncryptionParameters( - char const* user_password, char const* owner_password, - bool allow_accessibility, bool allow_extract, - qpdf_r3_print_e print, qpdf_r3_modify_e modify, - bool encrypt_metadata_aes); + char const* user_password, char const* owner_password, + bool allow_accessibility, bool allow_extract, + qpdf_r3_print_e print, qpdf_r3_modify_e modify, + bool encrypt_metadata_aes); // Create linearized output. Disables qdf mode, content // normalization, and stream prefiltering. @@ -494,8 +494,8 @@ class QPDFWriter private: // flags used by unparseObject - static int const f_stream = 1 << 0; - static int const f_filtered = 1 << 1; + static int const f_stream = 1 << 0; + static int const f_filtered = 1 << 1; static int const f_in_ostream = 1 << 2; static int const f_hex_string = 1 << 3; static int const f_no_encryption = 1 << 4; @@ -544,14 +544,14 @@ class QPDFWriter void writeObjectStream(QPDFObjectHandle object); void writeObject(QPDFObjectHandle object, int object_stream_index = -1); void writeTrailer(trailer_e which, int size, - bool xref_stream, qpdf_offset_t prev, + bool xref_stream, qpdf_offset_t prev, int linearization_pass); bool willFilterStream(QPDFObjectHandle stream, bool& compress_stream, bool& is_metadata, PointerHolder* stream_data); void unparseObject(QPDFObjectHandle object, int level, int flags, - // for stream dictionaries - size_t stream_length = 0, bool compress = false); + // for stream dictionaries + size_t stream_length = 0, bool compress = false); void unparseChild(QPDFObjectHandle child, int level, int flags); void initializeSpecialStreams(); void preserveObjectStreams(); @@ -559,24 +559,24 @@ class QPDFWriter std::string getOriginalID1(); void generateID(); void interpretR3EncryptionParameters( - std::set& bits_to_clear, - char const* user_password, char const* owner_password, - bool allow_accessibility, bool allow_extract, + std::set& bits_to_clear, + char const* user_password, char const* owner_password, + bool allow_accessibility, bool allow_extract, bool allow_assemble, bool allow_annotate_and_form, bool allow_form_filling, bool allow_modify_other, - qpdf_r3_print_e print, qpdf_r3_modify_e modify); + qpdf_r3_print_e print, qpdf_r3_modify_e modify); void disableIncompatibleEncryption(int major, int minor, int extension_level); void parseVersion(std::string const& version, int& major, int& minor) const; int compareVersions(int major1, int minor1, int major2, int minor2) const; void setEncryptionParameters( - char const* user_password, char const* owner_password, - int V, int R, int key_len, std::set& bits_to_clear); + char const* user_password, char const* owner_password, + int V, int R, int key_len, std::set& bits_to_clear); void setEncryptionParametersInternal( - int V, int R, int key_len, int P, - std::string const& O, std::string const& U, - std::string const& OE, std::string const& UE, std::string const& Perms, - std::string const& id1, std::string const& user_password, + int V, int R, int key_len, int P, + std::string const& O, std::string const& U, + std::string const& OE, std::string const& UE, std::string const& Perms, + std::string const& id1, std::string const& user_password, std::string const& encryption_key); void setDataKey(int objid); int openObject(int objid = 0); @@ -679,8 +679,8 @@ class QPDFWriter int encryption_V; int encryption_R; - std::string id1; // for /ID key of - std::string id2; // trailer dictionary + std::string id1; // for /ID key of + std::string id2; // trailer dictionary std::string final_pdf_version; int final_extension_level; std::string min_pdf_version; diff --git a/include/qpdf/QPDFXRefEntry.hh b/include/qpdf/QPDFXRefEntry.hh index ad05c559..78056312 100644 --- a/include/qpdf/QPDFXRefEntry.hh +++ b/include/qpdf/QPDFXRefEntry.hh @@ -46,7 +46,7 @@ class QPDFXRefEntry QPDF_DLL int getObjStreamNumber() const; // only for type 2 QPDF_DLL - int getObjStreamIndex() const; // only for type 2 + int getObjStreamIndex() const; // only for type 2 private: // This class does not use the Members pattern to avoid a memory diff --git a/include/qpdf/qpdf-c.h b/include/qpdf/qpdf-c.h index e5962da9..af7e83f8 100644 --- a/include/qpdf/qpdf-c.h +++ b/include/qpdf/qpdf-c.h @@ -274,7 +274,7 @@ extern "C" { */ QPDF_DLL QPDF_ERROR_CODE qpdf_read(qpdf_data qpdf, char const* filename, - char const* password); + char const* password); /* Calling qpdf_read_memory causes processMemoryFile to be called * in the C++ API. Otherwise, it behaves in the same way as @@ -284,10 +284,10 @@ extern "C" { */ QPDF_DLL QPDF_ERROR_CODE qpdf_read_memory(qpdf_data qpdf, - char const* description, - char const* buffer, - unsigned long long size, - char const* password); + char const* description, + char const* buffer, + unsigned long long size, + char const* password); /* Calling qpdf_empty_pdf initializes this qpdf object with an * empty PDF, making it possible to create a PDF from scratch @@ -410,11 +410,11 @@ extern "C" { QPDF_DLL void qpdf_set_object_stream_mode(qpdf_data qpdf, - enum qpdf_object_stream_e mode); + enum qpdf_object_stream_e mode); QPDF_DLL void qpdf_set_stream_data_mode(qpdf_data qpdf, - enum qpdf_stream_data_e mode); + enum qpdf_stream_data_e mode); QPDF_DLL void qpdf_set_compress_streams(qpdf_data qpdf, QPDF_BOOL value); @@ -454,77 +454,77 @@ extern "C" { QPDF_DLL void qpdf_set_suppress_original_object_IDs( - qpdf_data qpdf, QPDF_BOOL value); + qpdf_data qpdf, QPDF_BOOL value); QPDF_DLL void qpdf_set_preserve_encryption(qpdf_data qpdf, QPDF_BOOL value); QPDF_DLL void qpdf_set_r2_encryption_parameters( - qpdf_data qpdf, char const* user_password, char const* owner_password, - QPDF_BOOL allow_print, QPDF_BOOL allow_modify, - QPDF_BOOL allow_extract, QPDF_BOOL allow_annotate); + qpdf_data qpdf, char const* user_password, char const* owner_password, + QPDF_BOOL allow_print, QPDF_BOOL allow_modify, + QPDF_BOOL allow_extract, QPDF_BOOL allow_annotate); QPDF_DLL void qpdf_set_r3_encryption_parameters2( - qpdf_data qpdf, char const* user_password, char const* owner_password, - QPDF_BOOL allow_accessibility, QPDF_BOOL allow_extract, + qpdf_data qpdf, char const* user_password, char const* owner_password, + QPDF_BOOL allow_accessibility, QPDF_BOOL allow_extract, QPDF_BOOL allow_assemble, QPDF_BOOL allow_annotate_and_form, QPDF_BOOL allow_form_filling, QPDF_BOOL allow_modify_other, - enum qpdf_r3_print_e print); + enum qpdf_r3_print_e print); QPDF_DLL void qpdf_set_r4_encryption_parameters2( - qpdf_data qpdf, char const* user_password, char const* owner_password, - QPDF_BOOL allow_accessibility, QPDF_BOOL allow_extract, + qpdf_data qpdf, char const* user_password, char const* owner_password, + QPDF_BOOL allow_accessibility, QPDF_BOOL allow_extract, QPDF_BOOL allow_assemble, QPDF_BOOL allow_annotate_and_form, QPDF_BOOL allow_form_filling, QPDF_BOOL allow_modify_other, - enum qpdf_r3_print_e print, + enum qpdf_r3_print_e print, QPDF_BOOL encrypt_metadata, QPDF_BOOL use_aes); QPDF_DLL void qpdf_set_r5_encryption_parameters2( - qpdf_data qpdf, char const* user_password, char const* owner_password, - QPDF_BOOL allow_accessibility, QPDF_BOOL allow_extract, + qpdf_data qpdf, char const* user_password, char const* owner_password, + QPDF_BOOL allow_accessibility, QPDF_BOOL allow_extract, QPDF_BOOL allow_assemble, QPDF_BOOL allow_annotate_and_form, QPDF_BOOL allow_form_filling, QPDF_BOOL allow_modify_other, - enum qpdf_r3_print_e print, QPDF_BOOL encrypt_metadata); + enum qpdf_r3_print_e print, QPDF_BOOL encrypt_metadata); QPDF_DLL void qpdf_set_r6_encryption_parameters2( - qpdf_data qpdf, char const* user_password, char const* owner_password, - QPDF_BOOL allow_accessibility, QPDF_BOOL allow_extract, + qpdf_data qpdf, char const* user_password, char const* owner_password, + QPDF_BOOL allow_accessibility, QPDF_BOOL allow_extract, QPDF_BOOL allow_assemble, QPDF_BOOL allow_annotate_and_form, QPDF_BOOL allow_form_filling, QPDF_BOOL allow_modify_other, - enum qpdf_r3_print_e print, QPDF_BOOL encrypt_metadata); + enum qpdf_r3_print_e print, QPDF_BOOL encrypt_metadata); /* Pre 8.4.0 encryption API */ QPDF_DLL void qpdf_set_r3_encryption_parameters( - qpdf_data qpdf, char const* user_password, char const* owner_password, - QPDF_BOOL allow_accessibility, QPDF_BOOL allow_extract, - enum qpdf_r3_print_e print, enum qpdf_r3_modify_e modify); + qpdf_data qpdf, char const* user_password, char const* owner_password, + QPDF_BOOL allow_accessibility, QPDF_BOOL allow_extract, + enum qpdf_r3_print_e print, enum qpdf_r3_modify_e modify); QPDF_DLL void qpdf_set_r4_encryption_parameters( - qpdf_data qpdf, char const* user_password, char const* owner_password, - QPDF_BOOL allow_accessibility, QPDF_BOOL allow_extract, - enum qpdf_r3_print_e print, enum qpdf_r3_modify_e modify, - QPDF_BOOL encrypt_metadata, QPDF_BOOL use_aes); + qpdf_data qpdf, char const* user_password, char const* owner_password, + QPDF_BOOL allow_accessibility, QPDF_BOOL allow_extract, + enum qpdf_r3_print_e print, enum qpdf_r3_modify_e modify, + QPDF_BOOL encrypt_metadata, QPDF_BOOL use_aes); QPDF_DLL void qpdf_set_r5_encryption_parameters( - qpdf_data qpdf, char const* user_password, char const* owner_password, - QPDF_BOOL allow_accessibility, QPDF_BOOL allow_extract, - enum qpdf_r3_print_e print, enum qpdf_r3_modify_e modify, - QPDF_BOOL encrypt_metadata); + qpdf_data qpdf, char const* user_password, char const* owner_password, + QPDF_BOOL allow_accessibility, QPDF_BOOL allow_extract, + enum qpdf_r3_print_e print, enum qpdf_r3_modify_e modify, + QPDF_BOOL encrypt_metadata); QPDF_DLL void qpdf_set_r6_encryption_parameters( - qpdf_data qpdf, char const* user_password, char const* owner_password, - QPDF_BOOL allow_accessibility, QPDF_BOOL allow_extract, - enum qpdf_r3_print_e print, enum qpdf_r3_modify_e modify, - QPDF_BOOL encrypt_metadata); + qpdf_data qpdf, char const* user_password, char const* owner_password, + QPDF_BOOL allow_accessibility, QPDF_BOOL allow_extract, + enum qpdf_r3_print_e print, enum qpdf_r3_modify_e modify, + QPDF_BOOL encrypt_metadata); QPDF_DLL void qpdf_set_linearization(qpdf_data qpdf, QPDF_BOOL value); -- cgit v1.2.3-54-g00ecf