From 60965d5f4d608bdccc2ffd4e8753e12cbbbd71d2 Mon Sep 17 00:00:00 2001 From: Jay Berkenbilt Date: Sun, 21 May 2023 13:35:09 -0400 Subject: Rerun clang-format --- include/qpdf/BufferInputSource.hh | 6 +- include/qpdf/Constants.h | 5 +- include/qpdf/InputSource.hh | 15 +-- include/qpdf/JSON.hh | 25 ++-- include/qpdf/Pl_Function.hh | 9 +- include/qpdf/Pl_QPDFTokenizer.hh | 4 +- include/qpdf/QIntC.hh | 41 +++--- include/qpdf/QPDF.hh | 168 ++++++++----------------- include/qpdf/QPDFAcroFormDocumentHelper.hh | 23 ++-- include/qpdf/QPDFAnnotationObjectHelper.hh | 3 +- include/qpdf/QPDFCryptoImpl.hh | 9 +- include/qpdf/QPDFCryptoProvider.hh | 3 +- include/qpdf/QPDFEFStreamObjectHelper.hh | 6 +- include/qpdf/QPDFEmbeddedFileDocumentHelper.hh | 9 +- include/qpdf/QPDFFileSpecObjectHelper.hh | 12 +- include/qpdf/QPDFFormFieldObjectHelper.hh | 6 +- include/qpdf/QPDFJob.hh | 45 +++---- include/qpdf/QPDFLogger.hh | 3 +- include/qpdf/QPDFMatrix.hh | 3 +- include/qpdf/QPDFNameTreeObjectHelper.hh | 3 +- include/qpdf/QPDFNumberTreeObjectHelper.hh | 6 +- include/qpdf/QPDFObjectHandle.hh | 81 ++++-------- include/qpdf/QPDFPageDocumentHelper.hh | 8 +- include/qpdf/QPDFPageObjectHelper.hh | 40 ++---- include/qpdf/QPDFSystemError.hh | 3 +- include/qpdf/QPDFTokenizer.hh | 9 +- include/qpdf/QPDFWriter.hh | 18 +-- include/qpdf/QUtil.hh | 68 +++------- include/qpdf/qpdf-c.h | 91 +++++--------- include/qpdf/qpdfjob-c.h | 10 +- include/qpdf/qpdflogger-c.h | 18 +-- 31 files changed, 237 insertions(+), 513 deletions(-) (limited to 'include') diff --git a/include/qpdf/BufferInputSource.hh b/include/qpdf/BufferInputSource.hh index c5a2eae5..8e1ea484 100644 --- a/include/qpdf/BufferInputSource.hh +++ b/include/qpdf/BufferInputSource.hh @@ -31,11 +31,9 @@ class QPDF_DLL_CLASS BufferInputSource: public InputSource // If own_memory is true, BufferInputSource will delete the buffer // when finished with it. Otherwise, the caller owns the memory. QPDF_DLL - BufferInputSource( - std::string const& description, Buffer* buf, bool own_memory = false); + BufferInputSource(std::string const& description, Buffer* buf, bool own_memory = false); QPDF_DLL - BufferInputSource( - std::string const& description, std::string const& contents); + BufferInputSource(std::string const& description, std::string const& contents); QPDF_DLL virtual ~BufferInputSource(); QPDF_DLL diff --git a/include/qpdf/Constants.h b/include/qpdf/Constants.h index 995857ab..74c9aeac 100644 --- a/include/qpdf/Constants.h +++ b/include/qpdf/Constants.h @@ -230,9 +230,6 @@ enum pdf_annotation_flag_e { }; /* Encryption/password status for QPDFJob */ -enum qpdf_encryption_status_e { - qpdf_es_encrypted = 1 << 0, - qpdf_es_password_incorrect = 1 << 1 -}; +enum qpdf_encryption_status_e { qpdf_es_encrypted = 1 << 0, qpdf_es_password_incorrect = 1 << 1 }; #endif /* QPDFCONSTANTS_H */ diff --git a/include/qpdf/InputSource.hh b/include/qpdf/InputSource.hh index 631ab75f..91a5c6e5 100644 --- a/include/qpdf/InputSource.hh +++ b/include/qpdf/InputSource.hh @@ -69,17 +69,9 @@ class QPDF_DLL_CLASS InputSource // methods return true and leave the input source positioned // wherever check() left it at the end of the matching pattern. QPDF_DLL - bool findFirst( - char const* start_chars, - qpdf_offset_t offset, - size_t len, - Finder& finder); + bool findFirst(char const* start_chars, qpdf_offset_t offset, size_t len, Finder& finder); QPDF_DLL - bool findLast( - char const* start_chars, - qpdf_offset_t offset, - size_t len, - Finder& finder); + bool findLast(char const* start_chars, qpdf_offset_t offset, size_t len, Finder& finder); virtual qpdf_offset_t findAndSkipNextEOL() = 0; virtual std::string const& getName() const = 0; @@ -144,8 +136,7 @@ InputSource::fastTell() loadBuffer(); } else { auto curr = tell(); - if (curr < this->buf_start || - curr >= (this->buf_start + this->buf_len)) { + if (curr < this->buf_start || curr >= (this->buf_start + this->buf_len)) { loadBuffer(); } else { this->last_offset = curr; diff --git a/include/qpdf/JSON.hh b/include/qpdf/JSON.hh index ef820b66..00f78112 100644 --- a/include/qpdf/JSON.hh +++ b/include/qpdf/JSON.hh @@ -104,19 +104,14 @@ class JSON // the first item and always set it to false. QPDF_DLL static void writeDictionaryItem( - Pipeline*, - bool& first, - std::string const& key, - JSON const& value, - size_t depth = 0); + Pipeline*, bool& first, std::string const& key, JSON const& value, size_t depth = 0); // Write just the key of a new dictionary item, useful if writing // nested structures. Calls writeNext. QPDF_DLL - static void writeDictionaryKey( - Pipeline* p, bool& first, std::string const& key, size_t depth = 0); + static void + writeDictionaryKey(Pipeline* p, bool& first, std::string const& key, size_t depth = 0); QPDF_DLL - static void writeArrayItem( - Pipeline*, bool& first, JSON const& element, size_t depth = 0); + static void writeArrayItem(Pipeline*, bool& first, JSON const& element, size_t depth = 0); // If writing nested structures incrementally, call writeNext // before opening a new array or container in the midst of an // existing one. The `first` you pass to writeNext should be the @@ -188,8 +183,7 @@ class JSON QPDF_DLL bool isNull() const; QPDF_DLL - bool forEachDictItem( - std::function fn) const; + bool forEachDictItem(std::function fn) const; QPDF_DLL bool forEachArrayItem(std::function fn) const; @@ -239,8 +233,7 @@ class JSON f_optional = 1 << 0, }; QPDF_DLL - bool checkSchema( - JSON schema, unsigned long flags, std::list& errors); + bool checkSchema(JSON schema, unsigned long flags, std::list& errors); // Same as passing 0 for flags QPDF_DLL @@ -311,8 +304,7 @@ class JSON // methods and decrementing on end methods. QPDF_DLL - virtual bool - dictionaryItem(std::string const& key, JSON const& value) = 0; + virtual bool dictionaryItem(std::string const& key, JSON const& value) = 0; QPDF_DLL virtual bool arrayItem(JSON const& value) = 0; }; @@ -339,8 +331,7 @@ class JSON private: static std::string encode_string(std::string const& utf8); - static void - writeClose(Pipeline* p, bool first, size_t depth, char const* delimeter); + static void writeClose(Pipeline* p, bool first, size_t depth, char const* delimeter); enum value_type_e { vt_none, diff --git a/include/qpdf/Pl_Function.hh b/include/qpdf/Pl_Function.hh index 7df164d1..e31d497d 100644 --- a/include/qpdf/Pl_Function.hh +++ b/include/qpdf/Pl_Function.hh @@ -54,15 +54,10 @@ class QPDF_DLL_CLASS Pl_Function: public Pipeline // is thrown. typedef int (*writer_c_t)(unsigned char const*, size_t, void*); QPDF_DLL - Pl_Function( - char const* identifier, Pipeline* next, writer_c_t fn, void* udata); + Pl_Function(char const* identifier, Pipeline* next, writer_c_t fn, void* udata); typedef int (*writer_c_char_t)(char const*, size_t, void*); QPDF_DLL - Pl_Function( - char const* identifier, - Pipeline* next, - writer_c_char_t fn, - void* udata); + Pl_Function(char const* identifier, Pipeline* next, writer_c_char_t fn, void* udata); QPDF_DLL virtual ~Pl_Function(); diff --git a/include/qpdf/Pl_QPDFTokenizer.hh b/include/qpdf/Pl_QPDFTokenizer.hh index 0b8cafc2..37e87b4d 100644 --- a/include/qpdf/Pl_QPDFTokenizer.hh +++ b/include/qpdf/Pl_QPDFTokenizer.hh @@ -49,9 +49,7 @@ class QPDF_DLL_CLASS Pl_QPDFTokenizer: public Pipeline // provided, any output written by the filter will be discarded. QPDF_DLL Pl_QPDFTokenizer( - char const* identifier, - QPDFObjectHandle::TokenFilter* filter, - Pipeline* next = nullptr); + char const* identifier, QPDFObjectHandle::TokenFilter* filter, Pipeline* next = nullptr); QPDF_DLL virtual ~Pl_QPDFTokenizer(); QPDF_DLL diff --git a/include/qpdf/QIntC.hh b/include/qpdf/QIntC.hh index 4f224560..e6c337c2 100644 --- a/include/qpdf/QIntC.hh +++ b/include/qpdf/QIntC.hh @@ -78,9 +78,8 @@ namespace QIntC // QIntC = qpdf Integer Conversion { std::ostringstream msg; msg.imbue(std::locale::classic()); - msg << "integer out of range converting " << i << " from a " - << sizeof(From) << "-byte unsigned type to a " << sizeof(To) - << "-byte unsigned type"; + msg << "integer out of range converting " << i << " from a " << sizeof(From) + << "-byte unsigned type to a " << sizeof(To) << "-byte unsigned type"; throw std::range_error(msg.str()); } }; @@ -93,8 +92,7 @@ namespace QIntC // QIntC = qpdf Integer Conversion convert(From const& i) { // From and To are both signed. - if ((i < std::numeric_limits::min()) || - (i > std::numeric_limits::max())) { + if ((i < std::numeric_limits::min()) || (i > std::numeric_limits::max())) { error(i); } return static_cast(i); @@ -105,9 +103,8 @@ namespace QIntC // QIntC = qpdf Integer Conversion { std::ostringstream msg; msg.imbue(std::locale::classic()); - msg << "integer out of range converting " << i << " from a " - << sizeof(From) << "-byte signed type to a " << sizeof(To) - << "-byte signed type"; + msg << "integer out of range converting " << i << " from a " << sizeof(From) + << "-byte signed type to a " << sizeof(To) << "-byte signed type"; throw std::range_error(msg.str()); } }; @@ -134,9 +131,8 @@ namespace QIntC // QIntC = qpdf Integer Conversion { std::ostringstream msg; msg.imbue(std::locale::classic()); - msg << "integer out of range converting " << i << " from a " - << sizeof(From) << "-byte signed type to a " << sizeof(To) - << "-byte unsigned type"; + msg << "integer out of range converting " << i << " from a " << sizeof(From) + << "-byte signed type to a " << sizeof(To) << "-byte unsigned type"; throw std::range_error(msg.str()); } }; @@ -150,8 +146,7 @@ namespace QIntC // QIntC = qpdf Integer Conversion { // From is unsigned, and to is signed. Convert To's max to the // unsigned version of To and compare i against that. - auto maxval = static_cast::type>( - std::numeric_limits::max()); + auto maxval = static_cast::type>(std::numeric_limits::max()); if (i > maxval) { error(i); } @@ -163,9 +158,8 @@ namespace QIntC // QIntC = qpdf Integer Conversion { std::ostringstream msg; msg.imbue(std::locale::classic()); - msg << "integer out of range converting " << i << " from a " - << sizeof(From) << "-byte unsigned type to a " << sizeof(To) - << "-byte signed type"; + msg << "integer out of range converting " << i << " from a " << sizeof(From) + << "-byte unsigned type to a " << sizeof(To) << "-byte signed type"; throw std::range_error(msg.str()); } }; @@ -263,15 +257,12 @@ namespace QIntC // QIntC = qpdf Integer Conversion if ((delta > 0) && ((std::numeric_limits::max() - cur) < delta)) { std::ostringstream msg; msg.imbue(std::locale::classic()); - msg << "adding " << delta << " to " << cur - << " would cause an integer overflow"; + msg << "adding " << delta << " to " << cur << " would cause an integer overflow"; throw std::range_error(msg.str()); - } else if ( - (delta < 0) && ((std::numeric_limits::min() - cur) > delta)) { + } else if ((delta < 0) && ((std::numeric_limits::min() - cur) > delta)) { std::ostringstream msg; msg.imbue(std::locale::classic()); - msg << "adding " << delta << " to " << cur - << " would cause an integer underflow"; + msg << "adding " << delta << " to " << cur << " would cause an integer underflow"; throw std::range_error(msg.str()); } } @@ -296,12 +287,10 @@ namespace QIntC // QIntC = qpdf Integer Conversion msg << "subtracting " << delta << " from " << cur << " would cause an integer underflow"; throw std::range_error(msg.str()); - } else if ( - (delta < 0) && ((std::numeric_limits::max() + delta) < cur)) { + } else if ((delta < 0) && ((std::numeric_limits::max() + delta) < cur)) { std::ostringstream msg; msg.imbue(std::locale::classic()); - msg << "subtracting " << delta << " from " << cur - << " would cause an integer overflow"; + msg << "subtracting " << delta << " from " << cur << " would cause an integer overflow"; throw std::range_error(msg.str()); } } diff --git a/include/qpdf/QPDF.hh b/include/qpdf/QPDF.hh index 905c4b05..87849dbd 100644 --- a/include/qpdf/QPDF.hh +++ b/include/qpdf/QPDF.hh @@ -93,10 +93,7 @@ class QPDF // responsible for closing the file. QPDF_DLL void processFile( - char const* description, - FILE* file, - bool close_file, - char const* password = nullptr); + char const* description, FILE* file, bool close_file, char const* password = nullptr); // Parse a PDF file loaded into a memory buffer. This works // exactly like processFile except that the PDF file is in memory @@ -104,17 +101,13 @@ 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 = nullptr); + char const* description, char const* buf, size_t length, char const* password = nullptr); // Parse a PDF file loaded from a custom InputSource. If you have // your own method of retrieving a PDF file, you can subclass // InputSource and use this method. QPDF_DLL - void processInputSource( - std::shared_ptr, char const* password = nullptr); + void processInputSource(std::shared_ptr, char const* password = nullptr); // Create a PDF from an input source that contains JSON as written // by writeJSON (or qpdf --json-output, version 2 or higher). The @@ -234,8 +227,7 @@ class QPDF // QPDFStreamFilter classes. QPDF_DLL static void registerStreamFilter( - std::string const& filter_name, - std::function()> factory); + std::string const& filter_name, std::function()> factory); // Parameter settings @@ -260,8 +252,7 @@ class QPDF // configures a private logger, separating this object from the // default logger, and calls setOutputStreams on that logger. See // QPDFLogger.hh for additional details. - [[deprecated( - "configure logger from getLogger() or call setLogger()")]] QPDF_DLL void + [[deprecated("configure logger from getLogger() or call setLogger()")]] QPDF_DLL void setOutputStreams(std::ostream* out_stream, std::ostream* err_stream); // If true, ignore any cross-reference streams in a hybrid file @@ -481,8 +472,7 @@ class QPDF // reserved object. After this call, reserved will be a reference // to replacement. QPDF_DLL - void - replaceReserved(QPDFObjectHandle reserved, QPDFObjectHandle replacement); + void replaceReserved(QPDFObjectHandle reserved, QPDFObjectHandle replacement); // Copy an object from another QPDF to this one. Starting with // qpdf version 8.3.0, it is no longer necessary to keep the @@ -657,8 +647,8 @@ class QPDF int encryption_V, int encryption_R); QPDF_DLL - static std::string compute_encryption_key( - std::string const& password, EncryptionData const& data); + static std::string + compute_encryption_key(std::string const& password, EncryptionData const& data); QPDF_DLL static void compute_encryption_O_U( @@ -843,8 +833,7 @@ class QPDF QPDF_DLL void addPage(QPDFObjectHandle newpage, bool first); QPDF_DLL - void - addPageAt(QPDFObjectHandle newpage, bool before, QPDFObjectHandle refpage); + void addPageAt(QPDFObjectHandle newpage, bool before, QPDFObjectHandle refpage); QPDF_DLL void removePage(QPDFObjectHandle page); // End legacy page helpers @@ -866,8 +855,7 @@ class QPDF std::vector& part8, std::vector& part9) { - qpdf.getLinearizedParts( - object_stream_data, part4, part6, part7, part8, part9); + qpdf.getLinearizedParts(object_stream_data, part4, part6, part7, part8, part9); } static void @@ -880,8 +868,7 @@ class QPDF int& S, int& O) { - return qpdf.generateHintStream( - xref, lengths, obj_renumber, hint_stream, S, O); + return qpdf.generateHintStream(xref, lengths, obj_renumber, hint_stream, S, O); } static void @@ -919,10 +906,7 @@ class QPDF private: static void - copyStreamData( - QPDF* qpdf, - QPDFObjectHandle const& dest, - QPDFObjectHandle const& src) + copyStreamData(QPDF* qpdf, QPDFObjectHandle const& dest, QPDFObjectHandle const& src) { qpdf->copyStreamData(dest, src); } @@ -968,13 +952,7 @@ class QPDF bool will_retry) { return qpdf->pipeStreamData( - og, - offset, - length, - dict, - pipeline, - suppress_warnings, - will_retry); + og, offset, length, dict, pipeline, suppress_warnings, will_retry); } }; @@ -1096,16 +1074,13 @@ class QPDF Pipeline* pipeline, bool suppress_warnings, bool will_retry) override; - void registerForeignStream( - QPDFObjGen const& local_og, QPDFObjectHandle foreign_stream); - void registerForeignStream( - QPDFObjGen const& local_og, std::shared_ptr); + void registerForeignStream(QPDFObjGen const& local_og, QPDFObjectHandle foreign_stream); + void registerForeignStream(QPDFObjGen const& local_og, std::shared_ptr); private: QPDF& destination_qpdf; std::map foreign_streams; - std::map> - foreign_stream_data; + std::map> foreign_stream_data; }; class StringDecrypter: public QPDFObjectHandle::StringDecrypter @@ -1148,29 +1123,21 @@ class QPDF void read_xref(qpdf_offset_t offset); bool resolveXRefTable(); void reconstruct_xref(QPDFExc& e); - bool - parse_xrefFirst(std::string const& line, int& obj, int& num, int& bytes); - bool parse_xrefEntry( - std::string const& line, qpdf_offset_t& f1, int& f2, char& type); + bool parse_xrefFirst(std::string const& line, int& obj, int& num, int& bytes); + bool parse_xrefEntry(std::string const& line, qpdf_offset_t& f1, int& f2, char& type); qpdf_offset_t read_xrefTable(qpdf_offset_t offset); qpdf_offset_t read_xrefStream(qpdf_offset_t offset); - 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); - void setLastObjectDescription( - std::string const& description, QPDFObjGen const& og); + 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); + void setLastObjectDescription(std::string const& description, QPDFObjGen const& og); QPDFObjectHandle readObject( std::shared_ptr, std::string const& description, QPDFObjGen const& og, bool in_object_stream); size_t recoverStreamLength( - std::shared_ptr input, - QPDFObjGen const& og, - qpdf_offset_t stream_offset); - QPDFTokenizer::Token - readToken(std::shared_ptr, size_t max_len = 0); + std::shared_ptr input, QPDFObjGen const& og, qpdf_offset_t stream_offset); + QPDFTokenizer::Token readToken(std::shared_ptr, size_t max_len = 0); QPDFObjectHandle readObjectAtOffset( bool attempt_recovery, @@ -1185,10 +1152,8 @@ class QPDF QPDFObjectHandle reserveObjectIfNotExists(QPDFObjGen const& og); QPDFObjectHandle reserveStream(QPDFObjGen const& og); QPDFObjGen nextObjGen(); - QPDFObjectHandle - newIndirect(QPDFObjGen const&, std::shared_ptr const&); - QPDFObjectHandle - makeIndirectFromQPDFObject(std::shared_ptr const& obj); + QPDFObjectHandle newIndirect(QPDFObjGen const&, std::shared_ptr const&); + QPDFObjectHandle makeIndirectFromQPDFObject(std::shared_ptr const& obj); bool isCached(QPDFObjGen const& og); bool isUnresolved(QPDFObjGen const& og); void updateCache( @@ -1205,10 +1170,7 @@ class QPDF std::shared_ptr const& input, qpdf_offset_t offset, std::string const& message); - QPDFExc damagedPDF( - std::string const& object, - qpdf_offset_t offset, - std::string const& message); + QPDFExc damagedPDF(std::string const& object, qpdf_offset_t offset, std::string const& message); QPDFExc damagedPDF(std::string const& object, std::string const& message); QPDFExc damagedPDF(qpdf_offset_t offset, std::string const& message); QPDFExc damagedPDF(std::string const& message); @@ -1223,10 +1185,7 @@ class QPDF bool suppress_warnings, bool will_retry); bool pipeForeignStreamData( - std::shared_ptr, - Pipeline*, - bool suppress_warnings, - bool will_retry); + std::shared_ptr, Pipeline*, bool suppress_warnings, bool will_retry); static bool pipeStreamData( std::shared_ptr encp, std::shared_ptr file, @@ -1269,31 +1228,24 @@ class QPDF // methods to support page handling void getAllPagesInternal( - QPDFObjectHandle cur_pages, - QPDFObjGen::set& visited, - QPDFObjGen::set& seen); + QPDFObjectHandle cur_pages, QPDFObjGen::set& visited, QPDFObjGen::set& seen); void insertPage(QPDFObjectHandle newpage, int pos); void flattenPagesTree(); - void insertPageobjToPage( - QPDFObjectHandle const& obj, int pos, bool check_duplicate); + void insertPageobjToPage(QPDFObjectHandle const& obj, int pos, bool check_duplicate); // methods to support encryption -- implemented in QPDF_encryption.cc static encryption_method_e interpretCF(std::shared_ptr encp, QPDFObjectHandle); void initializeEncryption(); - static std::string getKeyForObject( - std::shared_ptr encp, - QPDFObjGen const& og, - bool use_aes); + static std::string + getKeyForObject(std::shared_ptr encp, QPDFObjGen const& og, bool use_aes); void decryptString(std::string&, QPDFObjGen const& og); - static std::string compute_encryption_key_from_password( - std::string const& password, EncryptionData const& data); - static std::string recover_encryption_key_with_password( - std::string const& password, EncryptionData const& data); + static std::string + compute_encryption_key_from_password(std::string const& password, EncryptionData const& data); + static std::string + recover_encryption_key_with_password(std::string const& password, EncryptionData const& data); static std::string recover_encryption_key_with_password( - std::string const& password, - EncryptionData const& data, - bool& perms_valid); + std::string const& password, EncryptionData const& data, bool& perms_valid); static void decryptStream( std::shared_ptr encp, std::shared_ptr file, @@ -1304,12 +1256,10 @@ class QPDF std::vector>& heap); // Methods to support object copying - void - reserveObjects(QPDFObjectHandle foreign, ObjCopier& obj_copier, bool top); - QPDFObjectHandle replaceForeignIndirectObjects( - QPDFObjectHandle foreign, ObjCopier& obj_copier, bool top); - void - copyStreamData(QPDFObjectHandle dest_stream, QPDFObjectHandle src_stream); + void reserveObjects(QPDFObjectHandle foreign, ObjCopier& obj_copier, bool top); + QPDFObjectHandle + replaceForeignIndirectObjects(QPDFObjectHandle foreign, ObjCopier& obj_copier, bool top); + void copyStreamData(QPDFObjectHandle dest_stream, QPDFObjectHandle src_stream); // Linearization Hint table structures. // Naming conventions: @@ -1538,14 +1488,7 @@ 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(); @@ -1598,29 +1541,25 @@ class QPDF bool checkLinearizationInternal(); void dumpLinearizationDataInternal(); void linearizationWarning(std::string_view); - QPDFObjectHandle - readHintStream(Pipeline&, qpdf_offset_t offset, size_t length); + QPDFObjectHandle readHintStream(Pipeline&, qpdf_offset_t offset, size_t length); void readHPageOffset(BitStream); void readHSharedObject(BitStream); void readHGeneric(BitStream, HGeneric&); qpdf_offset_t maxEnd(ObjUser const& ou); qpdf_offset_t getLinearizationOffset(QPDFObjGen const&); - QPDFObjectHandle getUncompressedObject( - QPDFObjectHandle&, std::map const& object_stream_data); + QPDFObjectHandle + getUncompressedObject(QPDFObjectHandle&, std::map const& object_stream_data); int lengthNextN(int first_object, int n); - void checkHPageOffset( - std::vector const& pages, - std::map& idx_to_obj); - void checkHSharedObject( - std::vector const& pages, - std::map& idx_to_obj); + void + checkHPageOffset(std::vector const& pages, std::map& idx_to_obj); + void + checkHSharedObject(std::vector const& pages, std::map& idx_to_obj); void checkHOutlines(); void dumpHPageOffset(); void dumpHSharedObject(); void dumpHGeneric(HGeneric&); qpdf_offset_t adjusted_offset(qpdf_offset_t offset); - void - calculateLinearizationData(std::map const& object_stream_data); + void calculateLinearizationData(std::map const& object_stream_data); void pushOutlinesToPart( std::vector& part, std::set& lc_outlines, @@ -1648,8 +1587,7 @@ class QPDF // Methods to support optimization - void - pushInheritedAttributesToPage(bool allow_changes, bool warn_skipped_keys); + void pushInheritedAttributesToPage(bool allow_changes, bool warn_skipped_keys); void pushInheritedAttributesToPageInternal( QPDFObjectHandle, std::map>&, @@ -1681,11 +1619,7 @@ class QPDF qpdf_json_stream_data_e, std::string const& file_prefix); void writeJSONObject( - int version, - Pipeline* p, - bool& first, - std::string const& key, - QPDFObjectHandle&); + int version, Pipeline* p, bool& first, std::string const& key, QPDFObjectHandle&); // Type conversion helper methods template diff --git a/include/qpdf/QPDFAcroFormDocumentHelper.hh b/include/qpdf/QPDFAcroFormDocumentHelper.hh index d1ac6253..1ae593af 100644 --- a/include/qpdf/QPDFAcroFormDocumentHelper.hh +++ b/include/qpdf/QPDFAcroFormDocumentHelper.hh @@ -148,18 +148,15 @@ class QPDFAcroFormDocumentHelper: public QPDFDocumentHelper // underlying object will typically be the same as the underlying // object for the field. QPDF_DLL - std::vector - getAnnotationsForField(QPDFFormFieldObjectHelper); + std::vector getAnnotationsForField(QPDFFormFieldObjectHelper); // Return annotations of subtype /Widget for a page. QPDF_DLL - std::vector - getWidgetAnnotationsForPage(QPDFPageObjectHelper); + std::vector getWidgetAnnotationsForPage(QPDFPageObjectHelper); // Return top-level form fields for a page. QPDF_DLL - std::vector - getFormFieldsForPage(QPDFPageObjectHelper); + std::vector getFormFieldsForPage(QPDFPageObjectHelper); // Return the terminal field that is associated with this // annotation. If the annotation dictionary is merged with the @@ -251,10 +248,7 @@ class QPDFAcroFormDocumentHelper: public QPDFDocumentHelper private: void analyze(); void traverseField( - QPDFObjectHandle field, - QPDFObjectHandle parent, - int depth, - QPDFObjGen::set& visited); + QPDFObjectHandle field, QPDFObjectHandle parent, int depth, QPDFObjGen::set& visited); QPDFObjectHandle getOrCreateAcroForm(); void adjustInheritedFields( QPDFObjectHandle obj, @@ -264,11 +258,9 @@ class QPDFAcroFormDocumentHelper: public QPDFDocumentHelper int from_default_q); void adjustDefaultAppearances( QPDFObjectHandle obj, - std::map> const& - dr_map); + std::map> const& dr_map); void adjustAppearanceStream( - QPDFObjectHandle stream, - std::map> dr_map); + QPDFObjectHandle stream, std::map> dr_map); class Members { @@ -283,8 +275,7 @@ class QPDFAcroFormDocumentHelper: public QPDFDocumentHelper Members(Members const&) = delete; bool cache_valid; - std::map> - field_to_annotations; + std::map> field_to_annotations; std::map annotation_to_field; std::map field_to_name; std::map> name_to_fields; diff --git a/include/qpdf/QPDFAnnotationObjectHelper.hh b/include/qpdf/QPDFAnnotationObjectHelper.hh index a28bf495..b3d57092 100644 --- a/include/qpdf/QPDFAnnotationObjectHelper.hh +++ b/include/qpdf/QPDFAnnotationObjectHelper.hh @@ -76,8 +76,7 @@ class QPDFAnnotationObjectHelper: public QPDFObjectHelper // which appearance stream is desired. If not specified, the // appearance state in "/AS" will used. QPDF_DLL - QPDFObjectHandle getAppearanceStream( - std::string const& which, std::string const& state = ""); + QPDFObjectHandle getAppearanceStream(std::string const& which, std::string const& state = ""); // Generate text suitable for addition to the containing page's // content stream that draws this annotation's appearance stream diff --git a/include/qpdf/QPDFCryptoImpl.hh b/include/qpdf/QPDFCryptoImpl.hh index 3fd64d3a..522b72aa 100644 --- a/include/qpdf/QPDFCryptoImpl.hh +++ b/include/qpdf/QPDFCryptoImpl.hh @@ -77,10 +77,8 @@ class QPDF_DLL_CLASS QPDFCryptoImpl virtual void RC4_init(unsigned char const* key_data, int key_len = -1) = 0; // out_data = 0 means to encrypt/decrypt in place QPDF_DLL - virtual void RC4_process( - unsigned char const* in_data, - size_t len, - unsigned char* out_data = nullptr) = 0; + virtual void + RC4_process(unsigned char const* in_data, size_t len, unsigned char* out_data = nullptr) = 0; QPDF_DLL virtual void RC4_finalize() = 0; @@ -93,8 +91,7 @@ class QPDF_DLL_CLASS QPDFCryptoImpl bool cbc_mode, unsigned char* cbc_block) = 0; QPDF_DLL - virtual void - rijndael_process(unsigned char* in_data, unsigned char* out_data) = 0; + virtual void rijndael_process(unsigned char* in_data, unsigned char* out_data) = 0; QPDF_DLL virtual void rijndael_finalize() = 0; }; diff --git a/include/qpdf/QPDFCryptoProvider.hh b/include/qpdf/QPDFCryptoProvider.hh index 122cb882..46a9379d 100644 --- a/include/qpdf/QPDFCryptoProvider.hh +++ b/include/qpdf/QPDFCryptoProvider.hh @@ -78,8 +78,7 @@ class QPDFCryptoProvider static QPDFCryptoProvider& getInstance(); - std::shared_ptr - getImpl_internal(std::string const& name) const; + std::shared_ptr getImpl_internal(std::string const& name) const; template void registerImpl_internal(std::string const& name); void setDefaultProvider_internal(std::string const& name); diff --git a/include/qpdf/QPDFEFStreamObjectHelper.hh b/include/qpdf/QPDFEFStreamObjectHelper.hh index 2a24c0c3..b164dbe3 100644 --- a/include/qpdf/QPDFEFStreamObjectHelper.hh +++ b/include/qpdf/QPDFEFStreamObjectHelper.hh @@ -75,11 +75,9 @@ class QPDFEFStreamObjectHelper: public QPDFObjectHelper // checksum and size are computed automatically and stored. Other // parameters may be supplied using setters defined below. QPDF_DLL - static QPDFEFStreamObjectHelper - createEFStream(QPDF& qpdf, std::shared_ptr data); + static QPDFEFStreamObjectHelper createEFStream(QPDF& qpdf, std::shared_ptr data); QPDF_DLL - static QPDFEFStreamObjectHelper - createEFStream(QPDF& qpdf, std::string const& data); + static QPDFEFStreamObjectHelper createEFStream(QPDF& qpdf, std::string const& data); // The provider function must write the data to the given // pipeline. The function may be called multiple times by the qpdf // library. You can pass QUtil::file_provider(filename) as the diff --git a/include/qpdf/QPDFEmbeddedFileDocumentHelper.hh b/include/qpdf/QPDFEmbeddedFileDocumentHelper.hh index 9bab725a..5ee608bd 100644 --- a/include/qpdf/QPDFEmbeddedFileDocumentHelper.hh +++ b/include/qpdf/QPDFEmbeddedFileDocumentHelper.hh @@ -48,19 +48,16 @@ class QPDFEmbeddedFileDocumentHelper: public QPDFDocumentHelper bool hasEmbeddedFiles() const; QPDF_DLL - std::map> - getEmbeddedFiles(); + std::map> getEmbeddedFiles(); // If an embedded file with the given name exists, return a // (shared) pointer to it. Otherwise, return nullptr. QPDF_DLL - std::shared_ptr - getEmbeddedFile(std::string const& name); + std::shared_ptr getEmbeddedFile(std::string const& name); // Add or replace an attachment QPDF_DLL - void replaceEmbeddedFile( - std::string const& name, QPDFFileSpecObjectHelper const&); + void replaceEmbeddedFile(std::string const& name, QPDFFileSpecObjectHelper const&); // Remove an embedded file if present. Return value is true if the // file was present and was removed. This method not only removes diff --git a/include/qpdf/QPDFFileSpecObjectHelper.hh b/include/qpdf/QPDFFileSpecObjectHelper.hh index fa70c035..040399bc 100644 --- a/include/qpdf/QPDFFileSpecObjectHelper.hh +++ b/include/qpdf/QPDFFileSpecObjectHelper.hh @@ -77,16 +77,16 @@ class QPDFFileSpecObjectHelper: public QPDFObjectHelper // filename, and attach the contents of the specified file as data // in an embedded file stream. QPDF_DLL - static QPDFFileSpecObjectHelper createFileSpec( - QPDF& qpdf, std::string const& filename, std::string const& fullpath); + static QPDFFileSpecObjectHelper + createFileSpec(QPDF& qpdf, std::string const& filename, std::string const& fullpath); // Create a new filespec as an indirect object with the given // unicode filename and embedded file stream. The file name will // be used as both /UF and /F. If you need to override, call // setFilename. QPDF_DLL - static QPDFFileSpecObjectHelper createFileSpec( - QPDF& qpdf, std::string const& filename, QPDFEFStreamObjectHelper); + static QPDFFileSpecObjectHelper + createFileSpec(QPDF& qpdf, std::string const& filename, QPDFEFStreamObjectHelper); QPDF_DLL QPDFFileSpecObjectHelper& setDescription(std::string const&); @@ -96,8 +96,8 @@ class QPDFFileSpecObjectHelper: public QPDFObjectHelper // QPDFObjectHandle literally, preserving whatever encoding it // might happen to have. QPDF_DLL - QPDFFileSpecObjectHelper& setFilename( - std::string const& unicode_name, std::string const& compat_name = ""); + QPDFFileSpecObjectHelper& + setFilename(std::string const& unicode_name, std::string const& compat_name = ""); private: class Members diff --git a/include/qpdf/QPDFFormFieldObjectHelper.hh b/include/qpdf/QPDFFormFieldObjectHelper.hh index 1d8317b3..2221684a 100644 --- a/include/qpdf/QPDFFormFieldObjectHelper.hh +++ b/include/qpdf/QPDFFormFieldObjectHelper.hh @@ -183,8 +183,7 @@ class QPDFFormFieldObjectHelper: public QPDFObjectHelper // of a field, use QPDFAcroFormDocumentHelper::setFormFieldName // instead. QPDF_DLL - void - setFieldAttribute(std::string const& key, std::string const& utf8_value); + void setFieldAttribute(std::string const& key, std::string const& utf8_value); // Set /V (field value) to the given value. If need_appearances is // true and the field type is either /Tx (text) or /Ch (choice), @@ -218,8 +217,7 @@ class QPDFFormFieldObjectHelper: public QPDFObjectHelper void setRadioButtonValue(QPDFObjectHandle name); void setCheckBoxValue(bool value); void generateTextAppearance(QPDFAnnotationObjectHelper&); - QPDFObjectHandle getFontFromResource( - QPDFObjectHandle resources, std::string const& font_name); + QPDFObjectHandle getFontFromResource(QPDFObjectHandle resources, std::string const& font_name); class Members { diff --git a/include/qpdf/QPDFJob.hh b/include/qpdf/QPDFJob.hh index 27ab96d3..4f90990f 100644 --- a/include/qpdf/QPDFJob.hh +++ b/include/qpdf/QPDFJob.hh @@ -83,8 +83,7 @@ class QPDFJob // about converting arguments to UTF-8. This method will mutate // arguments that are passed to it. QPDF_DLL - void initializeFromArgv( - char const* const argv[], char const* progname_env = nullptr); + void initializeFromArgv(char const* const argv[], char const* progname_env = nullptr); // Initialize a QPDFJob from json. Passing partial = true prevents // this method from doing the final checks (calling @@ -132,8 +131,7 @@ class QPDFJob // configures a private logger, separating this object from the // default logger, and calls setOutputStreams on that logger. See // QPDFLogger.hh for additional details. - [[deprecated( - "configure logger from getLogger() or call setLogger()")]] QPDF_DLL void + [[deprecated("configure logger from getLogger() or call setLogger()")]] QPDF_DLL void setOutputStreams(std::ostream* out_stream, std::ostream* err_stream); // You can register a custom progress reporter to be called by @@ -187,10 +185,7 @@ class QPDFJob struct PageSpec { - PageSpec( - std::string const& filename, - char const* password, - std::string const& range); + PageSpec(std::string const& filename, char const* password, std::string const& range); std::string filename; std::shared_ptr password; @@ -284,9 +279,7 @@ class QPDFJob Config* endPages(); QPDF_DLL PagesConfig* pageSpec( - std::string const& filename, - std::string const& range, - char const* password = nullptr); + std::string const& filename, std::string const& range, char const* password = nullptr); #include @@ -366,10 +359,8 @@ class QPDFJob QPDF_DLL std::shared_ptr underlay(); QPDF_DLL - std::shared_ptr encrypt( - int keylen, - std::string const& user_password, - std::string const& owner_password); + std::shared_ptr + encrypt(int keylen, std::string const& user_password, std::string const& owner_password); #include @@ -438,8 +429,7 @@ class QPDFJob // If in verbose mode, call the given function, passing in the // output stream and message prefix. QPDF_DLL - void - doIfVerbose(std::function fn); + void doIfVerbose(std::function fn); // Provide a string that is the help information ("schema" for the // qpdf-specific JSON object) for the specified version of JSON @@ -447,16 +437,14 @@ class QPDFJob QPDF_DLL static std::string json_out_schema(int version); - [[deprecated("use json_out_schema(version)")]] static std::string QPDF_DLL - json_out_schema_v1(); + [[deprecated("use json_out_schema(version)")]] static std::string QPDF_DLL json_out_schema_v1(); // Provide a string that is the help information for specified // version of JSON format for QPDFJob. QPDF_DLL static std::string job_json_schema(int version); - [[deprecated("use job_json_schema(version)")]] static std::string QPDF_DLL - job_json_schema_v1(); + [[deprecated("use job_json_schema(version)")]] static std::string QPDF_DLL job_json_schema_v1(); private: struct RotationSpec @@ -497,10 +485,8 @@ class QPDFJob // Helper functions static void usage(std::string const& msg); - static JSON - json_schema(int json_version, std::set* keys = nullptr); - static void parse_object_id( - std::string const& objspec, bool& trailer, int& obj, int& gen); + static JSON json_schema(int json_version, std::set* keys = nullptr); + static void parse_object_id(std::string const& objspec, bool& trailer, int& obj, int& gen); void parseRotationParameter(std::string const&); std::vector parseNumrange(char const* range, int max); @@ -533,12 +519,10 @@ class QPDFJob // Transformations void setQPDFOptions(QPDF& pdf); - void - handlePageSpecs(QPDF& pdf, std::vector>& page_heap); + void handlePageSpecs(QPDF& pdf, std::vector>& page_heap); bool shouldRemoveUnreferencedResources(QPDF& pdf); void handleRotations(QPDF& pdf); - void - getUOPagenos(UnderOverlay& uo, std::map>& pagenos); + void getUOPagenos(UnderOverlay& uo, std::map>& pagenos); void handleUnderOverlay(QPDF& pdf); std::string doUnderOverlayForPage( QPDF& pdf, @@ -573,8 +557,7 @@ class QPDFJob // JSON void doJSON(QPDF& pdf, Pipeline*); QPDFObjGen::set getWantedJSONObjects(); - void doJSONObject( - Pipeline* p, bool& first, std::string const& key, QPDFObjectHandle&); + void doJSONObject(Pipeline* p, bool& first, std::string const& key, QPDFObjectHandle&); void doJSONObjects(Pipeline* p, bool& first, QPDF& pdf); void doJSONObjectinfo(Pipeline* p, bool& first, QPDF& pdf); void doJSONPages(Pipeline* p, bool& first, QPDF& pdf); diff --git a/include/qpdf/QPDFLogger.hh b/include/qpdf/QPDFLogger.hh index 6875721f..2b7c7a9b 100644 --- a/include/qpdf/QPDFLogger.hh +++ b/include/qpdf/QPDFLogger.hh @@ -153,8 +153,7 @@ class QPDFLogger private: QPDFLogger(); - std::shared_ptr - throwIfNull(std::shared_ptr, bool null_okay); + std::shared_ptr throwIfNull(std::shared_ptr, bool null_okay); class Members { diff --git a/include/qpdf/QPDFMatrix.hh b/include/qpdf/QPDFMatrix.hh index 0756921a..fb005e50 100644 --- a/include/qpdf/QPDFMatrix.hh +++ b/include/qpdf/QPDFMatrix.hh @@ -79,8 +79,7 @@ class QPDFMatrix // bounds the polygon resulting from transforming the four // corners. QPDF_DLL - QPDFObjectHandle::Rectangle - transformRectangle(QPDFObjectHandle::Rectangle r) const; + QPDFObjectHandle::Rectangle transformRectangle(QPDFObjectHandle::Rectangle r) const; // operator== tests for exact equality, not considering deltas for // floating point. diff --git a/include/qpdf/QPDFNameTreeObjectHelper.hh b/include/qpdf/QPDFNameTreeObjectHelper.hh index 8dbe4191..e0023013 100644 --- a/include/qpdf/QPDFNameTreeObjectHelper.hh +++ b/include/qpdf/QPDFNameTreeObjectHelper.hh @@ -156,8 +156,7 @@ class QPDF_DLL_CLASS QPDFNameTreeObjectHelper: public QPDFObjectHelper // Find the entry with the given key. If return_prev_if_not_found // is true and the item is not found, return the next lower item. QPDF_DLL - iterator - find(std::string const& key, bool return_prev_if_not_found = false); + iterator find(std::string const& key, bool return_prev_if_not_found = false); // Insert a new item. If the key already exists, it is replaced. QPDF_DLL diff --git a/include/qpdf/QPDFNumberTreeObjectHelper.hh b/include/qpdf/QPDFNumberTreeObjectHelper.hh index f88f185a..82933b21 100644 --- a/include/qpdf/QPDFNumberTreeObjectHelper.hh +++ b/include/qpdf/QPDFNumberTreeObjectHelper.hh @@ -45,8 +45,7 @@ class QPDF_DLL_CLASS QPDFNumberTreeObjectHelper: public QPDFObjectHelper // The qpdf object is required so that this class can issue // warnings, attempt repairs, and add indirect objects. QPDF_DLL - QPDFNumberTreeObjectHelper( - QPDFObjectHandle, QPDF&, bool auto_repair = true); + QPDFNumberTreeObjectHelper(QPDFObjectHandle, QPDF&, bool auto_repair = true); QPDF_DLL virtual ~QPDFNumberTreeObjectHelper(); @@ -82,8 +81,7 @@ class QPDF_DLL_CLASS QPDFNumberTreeObjectHelper: public QPDFObjectHelper // oh to the value with index 3, and set offset to 2 (5 - 3). See // also find(). QPDF_DLL - bool findObjectAtOrBelow( - numtree_number idx, QPDFObjectHandle& oh, numtree_number& offset); + bool findObjectAtOrBelow(numtree_number idx, QPDFObjectHandle& oh, numtree_number& offset); class QPDF_DLL_PRIVATE iterator { diff --git a/include/qpdf/QPDFObjectHandle.hh b/include/qpdf/QPDFObjectHandle.hh index aeca4bf6..358f0465 100644 --- a/include/qpdf/QPDFObjectHandle.hh +++ b/include/qpdf/QPDFObjectHandle.hh @@ -128,22 +128,13 @@ class QPDFObjectHandle // version of the method, which should also return a boolean // indicating whether it ran without errors. QPDF_DLL - virtual void - provideStreamData(QPDFObjGen const& og, Pipeline* pipeline); + virtual void provideStreamData(QPDFObjGen const& og, Pipeline* pipeline); QPDF_DLL virtual bool provideStreamData( - QPDFObjGen const& og, - Pipeline* pipeline, - bool suppress_warnings, - bool will_retry); - QPDF_DLL virtual void - provideStreamData(int objid, int generation, Pipeline* pipeline); + QPDFObjGen const& og, Pipeline* pipeline, bool suppress_warnings, bool will_retry); + QPDF_DLL virtual void provideStreamData(int objid, int generation, Pipeline* pipeline); QPDF_DLL virtual bool provideStreamData( - int objid, - int generation, - Pipeline* pipeline, - bool suppress_warnings, - bool will_retry); + int objid, int generation, Pipeline* pipeline, bool suppress_warnings, bool will_retry); QPDF_DLL bool supportsRetry(); @@ -246,8 +237,7 @@ class QPDFObjectHandle QPDF_DLL virtual void handleObject(QPDFObjectHandle); QPDF_DLL - virtual void - handleObject(QPDFObjectHandle, size_t offset, size_t length); + virtual void handleObject(QPDFObjectHandle, size_t offset, size_t length); virtual void handleEOF() = 0; @@ -408,14 +398,12 @@ class QPDFObjectHandle // True if the object is a dictionary of the specified type and // subtype, if any. QPDF_DLL - bool isDictionaryOfType( - std::string const& type, std::string const& subtype = ""); + bool isDictionaryOfType(std::string const& type, std::string const& subtype = ""); // True if the object is a stream of the specified type and // subtype, if any. QPDF_DLL - bool - isStreamOfType(std::string const& type, std::string const& subtype = ""); + bool isStreamOfType(std::string const& type, std::string const& subtype = ""); // Public factory methods @@ -433,9 +421,8 @@ class QPDFObjectHandle // in the message of any QPDFExc exception thrown for invalid // syntax. See also the global `operator ""_qpdf` defined below. QPDF_DLL - static QPDFObjectHandle parse( - std::string const& object_str, - std::string const& object_description = ""); + static QPDFObjectHandle + parse(std::string const& object_str, std::string const& object_description = ""); // Construct an object of any type from a string representation of // the object. Indirect object syntax (obj gen R) is allowed and @@ -447,10 +434,8 @@ class QPDFObjectHandle // object, which will just be the first number and will report // that there is trailing data at the end of the string. QPDF_DLL - static QPDFObjectHandle parse( - QPDF* context, - std::string const& object_str, - std::string const& object_description = ""); + static QPDFObjectHandle + parse(QPDF* context, std::string const& object_str, std::string const& object_description = ""); // Construct an object as above by reading from the given // InputSource at its current position and using the tokenizer you @@ -480,8 +465,7 @@ class QPDFObjectHandle // error messages will also be more useful because the page object // information will be known. QPDF_DLL - static void parseContentStream( - QPDFObjectHandle stream_or_array, ParserCallbacks* callbacks); + static void parseContentStream(QPDFObjectHandle stream_or_array, ParserCallbacks* callbacks); // When called on a stream or stream array that is some page's // content streams, do the same as pipePageContents. This method @@ -500,10 +484,8 @@ class QPDFObjectHandle // Pl_Concatenate and then call manualFinish() on the // Pl_Concatenate pipeline at the end. QPDF_DLL - void pipeContentStreams( - Pipeline* p, - std::string const& description, - std::string& all_description); + void + pipeContentStreams(Pipeline* p, std::string const& description, std::string& all_description); // As of qpdf 8, it is possible to add custom token filters to a // stream. The tokenized stream data is passed through the token @@ -554,8 +536,8 @@ class QPDFObjectHandle QPDF_DLL static QPDFObjectHandle newReal(std::string const& value); QPDF_DLL - static QPDFObjectHandle newReal( - double value, int decimal_places = 0, bool trim_trailing_zeroes = true); + static QPDFObjectHandle + newReal(double value, int decimal_places = 0, bool trim_trailing_zeroes = true); // Note about name objects: qpdf's internal representation of a // PDF name is a sequence of bytes, excluding the NUL character, // and starting with a slash. Name objects as represented in the @@ -591,8 +573,7 @@ class QPDFObjectHandle QPDF_DLL static QPDFObjectHandle newArray(); QPDF_DLL - static QPDFObjectHandle - newArray(std::vector const& items); + static QPDFObjectHandle newArray(std::vector const& items); QPDF_DLL static QPDFObjectHandle newArray(Rectangle const&); QPDF_DLL @@ -602,8 +583,7 @@ class QPDFObjectHandle QPDF_DLL static QPDFObjectHandle newDictionary(); QPDF_DLL - static QPDFObjectHandle - newDictionary(std::map const& items); + static QPDFObjectHandle newDictionary(std::map const& items); // Create an array from a rectangle. Equivalent to the rectangle // form of newArray. @@ -686,8 +666,7 @@ class QPDFObjectHandle // else. To add objects from another qpdf, use copyForeignObject // instead. QPDF_DLL - void setObjectDescription( - QPDF* owning_qpdf, std::string const& object_description); + void setObjectDescription(QPDF* owning_qpdf, std::string const& object_description); QPDF_DLL bool hasObjectDescription(); @@ -964,8 +943,7 @@ class QPDFObjectHandle QPDF_DLL void mergeResources( QPDFObjectHandle other, - std::map>* conflicts = - nullptr); + std::map>* conflicts = nullptr); // Get all resource names from a resource dictionary. If this // object is a dictionary, this method returns a set of all the @@ -1118,13 +1096,11 @@ class QPDFObjectHandle void replaceKey(std::string const& key, QPDFObjectHandle const& value); // Replace value of key and return the value. QPDF_DLL - QPDFObjectHandle - replaceKeyAndGetNew(std::string const& key, QPDFObjectHandle const& value); + QPDFObjectHandle replaceKeyAndGetNew(std::string const& key, QPDFObjectHandle const& value); // Replace value of key and return the old value, or null if the // key was previously not present. QPDF_DLL - QPDFObjectHandle - replaceKeyAndGetOld(std::string const& key, QPDFObjectHandle const& value); + QPDFObjectHandle replaceKeyAndGetOld(std::string const& key, QPDFObjectHandle const& value); // Remove key, doing nothing if key does not exist. QPDF_DLL void removeKey(std::string const& key); @@ -1167,8 +1143,7 @@ class QPDFObjectHandle // Returns filtered (uncompressed) stream data. Throws an // exception if the stream is filtered and we can't decode it. QPDF_DLL - std::shared_ptr - getStreamData(qpdf_stream_decode_level_e level = qpdf_dl_generalized); + std::shared_ptr getStreamData(qpdf_stream_decode_level_e level = qpdf_dl_generalized); // Returns unfiltered (raw) stream data. QPDF_DLL @@ -1347,8 +1322,7 @@ class QPDFObjectHandle // returning true if it succeeded without errors. QPDF_DLL void replaceStreamData( - std::function - provider, + std::function provider, QPDFObjectHandle const& filter, QPDFObjectHandle const& decode_parms); @@ -1615,15 +1589,14 @@ class QPDFObjectHandle void makeDirect(QPDFObjGen::set& visited, bool stop_at_streams); void disconnect(); void setParsedOffset(qpdf_offset_t offset); - void parseContentStream_internal( - std::string const& description, ParserCallbacks* callbacks); + void parseContentStream_internal(std::string const& description, ParserCallbacks* callbacks); static void parseContentStream_data( std::shared_ptr, std::string const& description, ParserCallbacks* callbacks, QPDF* context); - std::vector arrayOrStreamToStreamArray( - std::string const& description, std::string& all_description); + std::vector + arrayOrStreamToStreamArray(std::string const& description, std::string& all_description); static void warn(QPDF*, QPDFExc const&); void checkOwnership(QPDFObjectHandle const&) const; diff --git a/include/qpdf/QPDFPageDocumentHelper.hh b/include/qpdf/QPDFPageDocumentHelper.hh index b41110fd..2cabbbb0 100644 --- a/include/qpdf/QPDFPageDocumentHelper.hh +++ b/include/qpdf/QPDFPageDocumentHelper.hh @@ -104,10 +104,7 @@ class QPDFPageDocumentHelper: public QPDFDocumentHelper // Add new page before or after refpage. See comments for addPage // for details about what newpage should be. QPDF_DLL - void addPageAt( - QPDFPageObjectHelper newpage, - bool before, - QPDFPageObjectHelper refpage); + void addPageAt(QPDFPageObjectHelper newpage, bool before, QPDFPageObjectHelper refpage); // Remove page from the pdf. QPDF_DLL @@ -125,8 +122,7 @@ class QPDFPageDocumentHelper: public QPDFDocumentHelper // comments there in QPDFAnnotationObjectHelper.hh for meanings of // those flags. QPDF_DLL - void flattenAnnotations( - int required_flags = 0, int forbidden_flags = an_invisible | an_hidden); + void flattenAnnotations(int required_flags = 0, int forbidden_flags = an_invisible | an_hidden); private: void flattenAnnotationsForPage( diff --git a/include/qpdf/QPDFPageObjectHelper.hh b/include/qpdf/QPDFPageObjectHelper.hh index ffc515e0..05a57b5c 100644 --- a/include/qpdf/QPDFPageObjectHelper.hh +++ b/include/qpdf/QPDFPageObjectHelper.hh @@ -170,26 +170,22 @@ class QPDFPageObjectHelper: public QPDFObjectHelper // Return the effective CropBox. If not defined, fall back to // MediaBox QPDF_DLL - QPDFObjectHandle - getCropBox(bool copy_if_shared = false, bool copy_if_fallback = false); + QPDFObjectHandle getCropBox(bool copy_if_shared = false, bool copy_if_fallback = false); // Return the effective BleedBox. If not defined, fall back to // CropBox. QPDF_DLL - QPDFObjectHandle - getBleedBox(bool copy_if_shared = false, bool copy_if_fallback = false); + QPDFObjectHandle getBleedBox(bool copy_if_shared = false, bool copy_if_fallback = false); // Return the effective TrimBox. If not defined, fall back to // CropBox. QPDF_DLL - QPDFObjectHandle - getTrimBox(bool copy_if_shared = false, bool copy_if_fallback = false); + QPDFObjectHandle getTrimBox(bool copy_if_shared = false, bool copy_if_fallback = false); // Return the effective ArtBox. If not defined, fall back to // CropBox. QPDF_DLL - QPDFObjectHandle - getArtBox(bool copy_if_shared = false, bool copy_if_fallback = false); + QPDFObjectHandle getArtBox(bool copy_if_shared = false, bool copy_if_fallback = false); // Iterate through XObjects, possibly recursing into form // XObjects. This works with pages or form XObjects. Call action @@ -203,26 +199,20 @@ class QPDFPageObjectHelper: public QPDFObjectHelper void forEachXObject( bool recursive, std::function action, + QPDFObjectHandle& obj, QPDFObjectHandle& xobj_dict, std::string const& key)> action, std::function selector = nullptr); // Only call action for images QPDF_DLL void forEachImage( bool recursive, std::function action); + QPDFObjectHandle& obj, QPDFObjectHandle& xobj_dict, std::string const& key)> action); // Only call action for form XObjects QPDF_DLL void forEachFormXObject( bool recursive, std::function action); + QPDFObjectHandle& obj, QPDFObjectHandle& xobj_dict, std::string const& key)> action); // Returns an empty map if there are no images or no resources. // Prior to qpdf 8.4.0, this function did not support inherited @@ -258,8 +248,7 @@ class QPDFPageObjectHelper: public QPDFObjectHelper // only_subtype is non-empty, only include annotations of the // given subtype. QPDF_DLL - std::vector - getAnnotations(std::string const& only_subtype = ""); + std::vector getAnnotations(std::string const& only_subtype = ""); // Returns a vector of stream objects representing the content // streams for the given page. This routine allows the caller to @@ -319,13 +308,11 @@ class QPDFPageObjectHelper: public QPDFObjectHelper // contents, as happens with addContentTokenFilter. See // examples/pdf-count-strings.cc for an example. QPDF_DLL - void filterContents( - QPDFObjectHandle::TokenFilter* filter, Pipeline* next = nullptr); + void filterContents(QPDFObjectHandle::TokenFilter* filter, Pipeline* next = nullptr); // Old name -- calls filterContents() QPDF_DLL - void filterPageContents( - QPDFObjectHandle::TokenFilter* filter, Pipeline* next = nullptr); + void filterPageContents(QPDFObjectHandle::TokenFilter* filter, Pipeline* next = nullptr); // Pipe a page's contents through the given pipeline. This method // works whether the contents are a single stream or an array of @@ -341,8 +328,7 @@ class QPDFPageObjectHelper: public QPDFObjectHelper // The token filter is applied to the page's contents as a single // stream. Also works on form XObjects. QPDF_DLL - void addContentTokenFilter( - std::shared_ptr token_filter); + void addContentTokenFilter(std::shared_ptr token_filter); // A page's resources dictionary maps names to objects elsewhere // in the file. This method walks through a page's contents and @@ -500,8 +486,8 @@ class QPDFPageObjectHelper: public QPDFObjectHelper bool copy_if_shared, std::function get_fallback, bool copy_if_fallback); - static bool removeUnreferencedResourcesHelper( - QPDFPageObjectHelper ph, std::set& unresolved); + static bool + removeUnreferencedResourcesHelper(QPDFPageObjectHelper ph, std::set& unresolved); class Members { diff --git a/include/qpdf/QPDFSystemError.hh b/include/qpdf/QPDFSystemError.hh index 6d23fa94..fe75b272 100644 --- a/include/qpdf/QPDFSystemError.hh +++ b/include/qpdf/QPDFSystemError.hh @@ -48,8 +48,7 @@ class QPDF_DLL_CLASS QPDFSystemError: public std::runtime_error private: QPDF_DLL_PRIVATE - static std::string - createWhat(std::string const& description, int system_errno); + static std::string createWhat(std::string const& description, 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 5dd8f9d8..b07b7c0b 100644 --- a/include/qpdf/QPDFTokenizer.hh +++ b/include/qpdf/QPDFTokenizer.hh @@ -104,8 +104,7 @@ class QPDFTokenizer { // Ignore fields other than type and value return ( - (this->type != tt_bad) && (this->type == rhs.type) && - (this->value == rhs.value)); + (this->type != tt_bad) && (this->type == rhs.type) && (this->value == rhs.value)); } bool isInteger() const @@ -216,8 +215,7 @@ class QPDFTokenizer // beginning of the token. Returns false if the token is bad // or if scanning produced an error message for any reason. - bool nextToken( - InputSource& input, std::string const& context, size_t max_len = 0); + bool nextToken(InputSource& input, std::string const& context, size_t max_len = 0); // The following methods are only valid after nextToken has been called // and until another QPDFTokenizer method is called. They allow the results @@ -317,8 +315,7 @@ QPDFTokenizer::getType() const noexcept inline std::string const& QPDFTokenizer::getValue() const noexcept { - return (this->type == tt_name || this->type == tt_string) ? this->val - : this->raw_val; + return (this->type == tt_name || this->type == tt_string) ? this->val : this->raw_val; } inline std::string const& QPDFTokenizer::getRawValue() const noexcept diff --git a/include/qpdf/QPDFWriter.hh b/include/qpdf/QPDFWriter.hh index 0d445177..d14d907f 100644 --- a/include/qpdf/QPDFWriter.hh +++ b/include/qpdf/QPDFWriter.hh @@ -561,16 +561,11 @@ class QPDFWriter void writePad(size_t nspaces); void assignCompressedObjectNumbers(QPDFObjGen const& og); void enqueueObject(QPDFObjectHandle object); - void writeObjectStreamOffsets( - std::vector& offsets, int first_obj); + void writeObjectStreamOffsets(std::vector& offsets, int first_obj); 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, - int linearization_pass); + trailer_e which, int size, bool xref_stream, qpdf_offset_t prev, int linearization_pass); bool willFilterStream( QPDFObjectHandle stream, bool& compress_stream, @@ -601,8 +596,7 @@ class QPDFWriter bool allow_modify_other, qpdf_r3_print_e print, qpdf_r3_modify_e modify); - void - disableIncompatibleEncryption(int major, int minor, int extension_level); + 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( @@ -640,8 +634,7 @@ class QPDFWriter void doWriteSetup(); void writeHeader(); void writeHintStream(int hint_id); - qpdf_offset_t - writeXRefTable(trailer_e which, int first, int last, int size); + qpdf_offset_t writeXRefTable(trailer_e which, int first, int last, int size); qpdf_offset_t writeXRefTable( trailer_e which, int first, @@ -693,8 +686,7 @@ class QPDFWriter void pushMD5Pipeline(PipelinePopper&); void computeDeterministicIDData(); - void discardGeneration( - std::map const& in, std::map& out); + void discardGeneration(std::map const& in, std::map& out); class Members { diff --git a/include/qpdf/QUtil.hh b/include/qpdf/QUtil.hh index 85224059..85e7f907 100644 --- a/include/qpdf/QUtil.hh +++ b/include/qpdf/QUtil.hh @@ -49,11 +49,9 @@ namespace QUtil QPDF_DLL std::string int_to_string_base(long long, int base, int length = 0); QPDF_DLL - std::string - uint_to_string_base(unsigned long long, int base, int length = 0); + std::string uint_to_string_base(unsigned long long, int base, int length = 0); QPDF_DLL - std::string double_to_string( - double, int decimal_places = 0, bool trim_trailing_zeroes = true); + std::string double_to_string(double, int decimal_places = 0, bool trim_trailing_zeroes = true); // These string to number methods throw std::runtime_error on // underflow/overflow. @@ -257,14 +255,7 @@ namespace QUtil QPDFTime() = default; QPDFTime(QPDFTime const&) = default; QPDFTime& operator=(QPDFTime const&) = default; - QPDFTime( - int year, - int month, - int day, - int hour, - int minute, - int second, - int tz_delta) : + QPDFTime(int year, int month, int day, int hour, int minute, int second, int tz_delta) : year(year), month(month), day(day), @@ -331,8 +322,7 @@ namespace QUtil // to pass a value of pos that is greater than or equal to the // length of the string. QPDF_DLL - unsigned long get_next_utf8_codepoint( - std::string const& utf8_val, size_t& pos, bool& error); + unsigned long get_next_utf8_codepoint(std::string const& utf8_val, size_t& pos, bool& error); // Test whether this is a UTF-16 string. This is indicated by // first two bytes being 0xFE 0xFF (big-endian) or 0xFF 0xFE @@ -360,30 +350,23 @@ namespace QUtil QPDF_DLL std::string utf8_to_ascii(std::string const& utf8, char unknown_char = '?'); QPDF_DLL - std::string - utf8_to_win_ansi(std::string const& utf8, char unknown_char = '?'); + std::string utf8_to_win_ansi(std::string const& utf8, char unknown_char = '?'); QPDF_DLL - std::string - utf8_to_mac_roman(std::string const& utf8, char unknown_char = '?'); + std::string utf8_to_mac_roman(std::string const& utf8, char unknown_char = '?'); QPDF_DLL - std::string - utf8_to_pdf_doc(std::string const& utf8, char unknown_char = '?'); + std::string utf8_to_pdf_doc(std::string const& utf8, char unknown_char = '?'); // These versions return true if the conversion was successful and // false if any unrepresentable characters were found and had to // be substituted with the unknown character. QPDF_DLL - bool utf8_to_ascii( - std::string const& utf8, std::string& ascii, char unknown_char = '?'); + bool utf8_to_ascii(std::string const& utf8, std::string& ascii, char unknown_char = '?'); QPDF_DLL - bool utf8_to_win_ansi( - std::string const& utf8, std::string& win, char unknown_char = '?'); + bool utf8_to_win_ansi(std::string const& utf8, std::string& win, char unknown_char = '?'); QPDF_DLL - bool utf8_to_mac_roman( - std::string const& utf8, std::string& mac, char unknown_char = '?'); + bool utf8_to_mac_roman(std::string const& utf8, std::string& mac, char unknown_char = '?'); QPDF_DLL - bool utf8_to_pdf_doc( - std::string const& utf8, std::string& pdfdoc, char unknown_char = '?'); + bool utf8_to_pdf_doc(std::string const& utf8, std::string& pdfdoc, char unknown_char = '?'); // Convert a UTF-16 encoded string to UTF-8. Unrepresentable code // points are converted to U+FFFD. @@ -412,10 +395,7 @@ namespace QUtil // about everything else) accepts UTF-16LE (as of 10.6.2). QPDF_DLL void analyze_encoding( - std::string const& str, - bool& has_8bit_chars, - bool& is_valid_utf8, - bool& is_utf16); + std::string const& str, bool& has_8bit_chars, bool& is_valid_utf8, bool& is_utf16); // Try to compensate for previously incorrectly encoded strings. // We want to compensate for the following errors: @@ -472,14 +452,11 @@ namespace QUtil // Filename is UTF-8 encoded, even on Windows, as described in the // comments for safe_fopen. QPDF_DLL - std::list - read_lines_from_file(char const* filename, bool preserve_eol = false); + std::list read_lines_from_file(char const* filename, bool preserve_eol = false); QPDF_DLL - std::list - read_lines_from_file(std::istream&, bool preserve_eol = false); + std::list read_lines_from_file(std::istream&, bool preserve_eol = false); QPDF_DLL - std::list - read_lines_from_file(FILE*, bool preserve_eol = false); + std::list read_lines_from_file(FILE*, bool preserve_eol = false); QPDF_DLL void read_lines_from_file( std::function next_char, @@ -487,8 +464,7 @@ namespace QUtil bool preserve_eol = false); QPDF_DLL - void read_file_into_memory( - char const* filename, std::shared_ptr& file_buf, size_t& size); + void read_file_into_memory(char const* filename, std::shared_ptr& file_buf, size_t& size); QPDF_DLL std::string read_file_into_string(char const* filename); @@ -532,8 +508,7 @@ namespace QUtil // invoked, convert all UTF-16 encoded strings to UTF-8, and call // another main. QPDF_DLL - int call_main_from_wmain( - int argc, wchar_t* argv[], std::function realmain); + int call_main_from_wmain(int argc, wchar_t* argv[], std::function realmain); QPDF_DLL int call_main_from_wmain( int argc, @@ -561,8 +536,7 @@ QUtil::is_hex_digit(char ch) inline bool QUtil::is_space(char ch) { - return ch == ' ' || ch == '\n' || ch == '\r' || ch == '\t' || ch == '\f' || - ch == '\v'; + return ch == ' ' || ch == '\n' || ch == '\r' || ch == '\t' || ch == '\f' || ch == '\v'; } inline bool @@ -603,8 +577,7 @@ inline std::string QUtil::hex_encode_char(char c) { static auto constexpr hexchars = "0123456789abcdef"; - return { - '#', hexchars[static_cast(c) >> 4], hexchars[c & 0x0f]}; + return {'#', hexchars[static_cast(c) >> 4], hexchars[c & 0x0f]}; } inline constexpr char @@ -612,8 +585,7 @@ QUtil::hex_decode_char(char digit) noexcept { return digit <= '9' && digit >= '0' ? char(digit - '0') - : (digit >= 'a' ? char(digit - 'a' + 10) - : (digit >= 'A' ? char(digit - 'A' + 10) : '\20')); + : (digit >= 'a' ? char(digit - 'a' + 10) : (digit >= 'A' ? char(digit - 'A' + 10) : '\20')); } #endif // QUTIL_HH diff --git a/include/qpdf/qpdf-c.h b/include/qpdf/qpdf-c.h index 3b56c427..4e258e9a 100644 --- a/include/qpdf/qpdf-c.h +++ b/include/qpdf/qpdf-c.h @@ -326,8 +326,7 @@ extern "C" { */ QPDF_DLL QPDF_ERROR_CODE - qpdf_create_from_json_data( - qpdf_data qpdf, char const* buffer, unsigned long long size); + qpdf_create_from_json_data(qpdf_data qpdf, char const* buffer, unsigned long long size); /* JSON UPDATE FUNCTIONS */ @@ -341,8 +340,7 @@ extern "C" { qpdf_update_from_json_file(qpdf_data qpdf, char const* filename); QPDF_DLL QPDF_ERROR_CODE - qpdf_update_from_json_data( - qpdf_data qpdf, char const* buffer, unsigned long long size); + qpdf_update_from_json_data(qpdf_data qpdf, char const* buffer, unsigned long long size); /* READ FUNCTIONS */ @@ -492,23 +490,19 @@ extern "C" { unsigned char const* qpdf_get_buffer(qpdf_data qpdf); QPDF_DLL - void - qpdf_set_object_stream_mode(qpdf_data qpdf, enum qpdf_object_stream_e mode); + void qpdf_set_object_stream_mode(qpdf_data qpdf, enum qpdf_object_stream_e mode); QPDF_DLL - void - qpdf_set_stream_data_mode(qpdf_data qpdf, enum qpdf_stream_data_e mode); + void qpdf_set_stream_data_mode(qpdf_data qpdf, enum qpdf_stream_data_e mode); QPDF_DLL void qpdf_set_compress_streams(qpdf_data qpdf, QPDF_BOOL value); QPDF_DLL - void qpdf_set_decode_level( - qpdf_data qpdf, enum qpdf_stream_decode_level_e level); + void qpdf_set_decode_level(qpdf_data qpdf, enum qpdf_stream_decode_level_e level); QPDF_DLL - void - qpdf_set_preserve_unreferenced_objects(qpdf_data qpdf, QPDF_BOOL value); + void qpdf_set_preserve_unreferenced_objects(qpdf_data qpdf, QPDF_BOOL value); QPDF_DLL void qpdf_set_newline_before_endstream(qpdf_data qpdf, QPDF_BOOL value); @@ -625,8 +619,8 @@ extern "C" { void qpdf_force_pdf_version(qpdf_data qpdf, char const* version); QPDF_DLL - void qpdf_force_pdf_version_and_extension( - qpdf_data qpdf, char const* version, int extension_level); + void + qpdf_force_pdf_version_and_extension(qpdf_data qpdf, char const* version, int extension_level); /* During write, your report_progress function will be called with * a value between 0 and 100 representing the approximate write @@ -640,9 +634,7 @@ extern "C" { */ QPDF_DLL void qpdf_register_progress_reporter( - qpdf_data qpdf, - void (*report_progress)(int percent, void* data), - void* data); + qpdf_data qpdf, void (*report_progress)(int percent, void* data), void* data); /* Do actual write operation. */ QPDF_DLL @@ -733,8 +725,7 @@ extern "C" { QPDF_DLL qpdf_oh qpdf_make_indirect_object(qpdf_data qpdf, qpdf_oh oh); QPDF_DLL - void - qpdf_replace_object(qpdf_data qpdf, int objid, int generation, qpdf_oh oh); + void qpdf_replace_object(qpdf_data qpdf, int objid, int generation, qpdf_oh oh); /* Wrappers around QPDFObjectHandle methods. Be sure to read * corresponding comments in QPDFObjectHandle.hh to understand @@ -811,8 +802,7 @@ extern "C" { QPDF_DLL unsigned long long qpdf_oh_get_uint_value(qpdf_data qpdf, qpdf_oh oh); QPDF_DLL - QPDF_BOOL qpdf_oh_get_value_as_ulonglong( - qpdf_data qpdf, qpdf_oh oh, unsigned long long* value); + QPDF_BOOL qpdf_oh_get_value_as_ulonglong(qpdf_data qpdf, qpdf_oh oh, unsigned long long* value); QPDF_DLL unsigned int qpdf_oh_get_uint_value_as_uint(qpdf_data qpdf, qpdf_oh oh); QPDF_DLL @@ -822,8 +812,8 @@ extern "C" { QPDF_DLL char const* qpdf_oh_get_real_value(qpdf_data qpdf, qpdf_oh oh); QPDF_DLL - QPDF_BOOL qpdf_oh_get_value_as_real( - qpdf_data qpdf, qpdf_oh oh, char const** value, size_t* length); + QPDF_BOOL + qpdf_oh_get_value_as_real(qpdf_data qpdf, qpdf_oh oh, char const** value, size_t* length); QPDF_DLL QPDF_BOOL qpdf_oh_is_number(qpdf_data qpdf, qpdf_oh oh); @@ -836,8 +826,8 @@ extern "C" { QPDF_DLL char const* qpdf_oh_get_name(qpdf_data qpdf, qpdf_oh oh); QPDF_DLL - QPDF_BOOL qpdf_oh_get_value_as_name( - qpdf_data qpdf, qpdf_oh oh, char const** value, size_t* length); + QPDF_BOOL + qpdf_oh_get_value_as_name(qpdf_data qpdf, qpdf_oh oh, char const** value, size_t* length); /* Return the length of the last string returned. This enables you * to retrieve the entire string for cases in which a char* @@ -858,19 +848,17 @@ extern "C" { QPDF_DLL char const* qpdf_oh_get_string_value(qpdf_data qpdf, qpdf_oh oh); QPDF_DLL - QPDF_BOOL qpdf_oh_get_value_as_string( - qpdf_data qpdf, qpdf_oh oh, char const** value, size_t* length); + QPDF_BOOL + qpdf_oh_get_value_as_string(qpdf_data qpdf, qpdf_oh oh, char const** value, size_t* length); QPDF_DLL char const* qpdf_oh_get_utf8_value(qpdf_data qpdf, qpdf_oh oh); QPDF_DLL - QPDF_BOOL qpdf_oh_get_value_as_utf8( - qpdf_data qpdf, qpdf_oh oh, char const** value, size_t* length); + QPDF_BOOL + qpdf_oh_get_value_as_utf8(qpdf_data qpdf, qpdf_oh oh, char const** value, size_t* length); QPDF_DLL - char const* - qpdf_oh_get_binary_string_value(qpdf_data qpdf, qpdf_oh oh, size_t* length); + char const* qpdf_oh_get_binary_string_value(qpdf_data qpdf, qpdf_oh oh, size_t* length); QPDF_DLL - char const* - qpdf_oh_get_binary_utf8_value(qpdf_data qpdf, qpdf_oh oh, size_t* length); + char const* qpdf_oh_get_binary_utf8_value(qpdf_data qpdf, qpdf_oh oh, size_t* length); QPDF_DLL int qpdf_oh_get_array_n_items(qpdf_data qpdf, qpdf_oh oh); @@ -906,8 +894,7 @@ extern "C" { QPDF_DLL qpdf_oh qpdf_oh_get_key(qpdf_data qpdf, qpdf_oh oh, char const* key); QPDF_DLL - qpdf_oh - qpdf_oh_get_key_if_dict(qpdf_data qpdf, qpdf_oh oh, char const* key); + qpdf_oh qpdf_oh_get_key_if_dict(qpdf_data qpdf, qpdf_oh oh, char const* key); QPDF_DLL QPDF_BOOL @@ -924,8 +911,7 @@ extern "C" { QPDF_DLL qpdf_oh qpdf_oh_new_real_from_string(qpdf_data qpdf, char const* value); QPDF_DLL - qpdf_oh qpdf_oh_new_real_from_double( - qpdf_data qpdf, double value, int decimal_places); + qpdf_oh qpdf_oh_new_real_from_double(qpdf_data qpdf, double value, int decimal_places); QPDF_DLL qpdf_oh qpdf_oh_new_name(qpdf_data qpdf, char const* name); QPDF_DLL @@ -936,11 +922,9 @@ extern "C" { * contain atrbitary binary data including embedded null characters. */ QPDF_DLL - qpdf_oh - qpdf_oh_new_binary_string(qpdf_data qpdf, char const* str, size_t length); + qpdf_oh qpdf_oh_new_binary_string(qpdf_data qpdf, char const* str, size_t length); QPDF_DLL - qpdf_oh qpdf_oh_new_binary_unicode_string( - qpdf_data qpdf, char const* str, size_t length); + qpdf_oh qpdf_oh_new_binary_unicode_string(qpdf_data qpdf, char const* str, size_t length); QPDF_DLL qpdf_oh qpdf_oh_new_array(qpdf_data qpdf); QPDF_DLL @@ -959,8 +943,7 @@ extern "C" { void qpdf_oh_make_direct(qpdf_data qpdf, qpdf_oh oh); QPDF_DLL - void - qpdf_oh_set_array_item(qpdf_data qpdf, qpdf_oh oh, int at, qpdf_oh item); + void qpdf_oh_set_array_item(qpdf_data qpdf, qpdf_oh oh, int at, qpdf_oh item); QPDF_DLL void qpdf_oh_insert_item(qpdf_data qpdf, qpdf_oh oh, int at, qpdf_oh item); QPDF_DLL @@ -969,13 +952,11 @@ extern "C" { void qpdf_oh_erase_item(qpdf_data qpdf, qpdf_oh oh, int at); QPDF_DLL - void qpdf_oh_replace_key( - qpdf_data qpdf, qpdf_oh oh, char const* key, qpdf_oh item); + void qpdf_oh_replace_key(qpdf_data qpdf, qpdf_oh oh, char const* key, qpdf_oh item); QPDF_DLL void qpdf_oh_remove_key(qpdf_data qpdf, qpdf_oh oh, char const* key); QPDF_DLL - void qpdf_oh_replace_or_remove_key( - qpdf_data qpdf, qpdf_oh oh, char const* key, qpdf_oh item); + void qpdf_oh_replace_or_remove_key(qpdf_data qpdf, qpdf_oh oh, char const* key, qpdf_oh item); QPDF_DLL qpdf_oh qpdf_oh_get_dict(qpdf_data qpdf, qpdf_oh oh); @@ -1005,8 +986,7 @@ extern "C" { * while `foreign_oh` belongs to `other_qpdf`. */ QPDF_DLL - qpdf_oh qpdf_oh_copy_foreign_object( - qpdf_data qpdf, qpdf_data other_qpdf, qpdf_oh foreign_oh); + qpdf_oh qpdf_oh_copy_foreign_object(qpdf_data qpdf, qpdf_data other_qpdf, qpdf_oh foreign_oh); /* STREAM FUNCTIONS */ @@ -1105,19 +1085,12 @@ extern "C" { /* addPage() */ QPDF_DLL - QPDF_ERROR_CODE qpdf_add_page( - qpdf_data qpdf, - qpdf_data newpage_qpdf, - qpdf_oh newpage, - QPDF_BOOL first); + QPDF_ERROR_CODE + qpdf_add_page(qpdf_data qpdf, qpdf_data newpage_qpdf, qpdf_oh newpage, QPDF_BOOL first); /* addPageAt() */ QPDF_DLL QPDF_ERROR_CODE qpdf_add_page_at( - qpdf_data qpdf, - qpdf_data newpage_qpdf, - qpdf_oh newpage, - QPDF_BOOL before, - qpdf_oh refpage); + qpdf_data qpdf, qpdf_data newpage_qpdf, qpdf_oh newpage, QPDF_BOOL before, qpdf_oh refpage); /* removePage() */ QPDF_DLL QPDF_ERROR_CODE qpdf_remove_page(qpdf_data qpdf, qpdf_oh page); diff --git a/include/qpdf/qpdfjob-c.h b/include/qpdf/qpdfjob-c.h index a251bd93..c41dbeee 100644 --- a/include/qpdf/qpdfjob-c.h +++ b/include/qpdf/qpdfjob-c.h @@ -111,8 +111,7 @@ extern "C" { * is invalid to call any other functions this job handle. */ QPDF_DLL - int - qpdfjob_initialize_from_argv(qpdfjob_handle j, char const* const argv[]); + int qpdfjob_initialize_from_argv(qpdfjob_handle j, char const* const argv[]); #ifndef QPDF_NO_WCHAR_T /* This function is the same as qpdfjob_initialize_from_argv @@ -120,8 +119,7 @@ extern "C" { * suitable for calling from a Windows wmain function. */ QPDF_DLL - int qpdfjob_initialize_from_wide_argv( - qpdfjob_handle j, wchar_t const* const argv[]); + int qpdfjob_initialize_from_wide_argv(qpdfjob_handle j, wchar_t const* const argv[]); #endif /* QPDF_NO_WCHAR_T */ /* This function wraps QPDFJob::initializeFromJson. The return @@ -167,9 +165,7 @@ extern "C" { */ QPDF_DLL void qpdfjob_register_progress_reporter( - qpdfjob_handle j, - void (*report_progress)(int percent, void* data), - void* data); + qpdfjob_handle j, void (*report_progress)(int percent, void* data), void* data); #ifdef __cplusplus } diff --git a/include/qpdf/qpdflogger-c.h b/include/qpdf/qpdflogger-c.h index 96276c07..966c47f1 100644 --- a/include/qpdf/qpdflogger-c.h +++ b/include/qpdf/qpdflogger-c.h @@ -76,22 +76,13 @@ extern "C" { QPDF_DLL void qpdflogger_set_info( - qpdflogger_handle l, - enum qpdf_log_dest_e dest, - qpdf_log_fn_t fn, - void* udata); + qpdflogger_handle l, enum qpdf_log_dest_e dest, qpdf_log_fn_t fn, void* udata); QPDF_DLL void qpdflogger_set_warn( - qpdflogger_handle l, - enum qpdf_log_dest_e dest, - qpdf_log_fn_t fn, - void* udata); + qpdflogger_handle l, enum qpdf_log_dest_e dest, qpdf_log_fn_t fn, void* udata); QPDF_DLL void qpdflogger_set_error( - qpdflogger_handle l, - enum qpdf_log_dest_e dest, - qpdf_log_fn_t fn, - void* udata); + qpdflogger_handle l, enum qpdf_log_dest_e dest, qpdf_log_fn_t fn, void* udata); /* A non-zero value for only_if_not_set means that the save * pipeline will only be changed if it is not already set. @@ -104,8 +95,7 @@ extern "C" { void* udata, int only_if_not_set); QPDF_DLL - void qpdflogger_save_to_standard_output( - qpdflogger_handle l, int only_if_not_set); + void qpdflogger_save_to_standard_output(qpdflogger_handle l, int only_if_not_set); /* For testing */ QPDF_DLL -- cgit v1.2.3-54-g00ecf