diff options
Diffstat (limited to 'include')
-rw-r--r-- | include/qpdf/QPDF.hh | 47 | ||||
-rw-r--r-- | include/qpdf/QPDFWriter.hh | 48 | ||||
-rw-r--r-- | include/qpdf/QPDFXRefEntry.hh | 4 | ||||
-rw-r--r-- | include/qpdf/qpdf-c.h | 4 |
4 files changed, 54 insertions, 49 deletions
diff --git a/include/qpdf/QPDF.hh b/include/qpdf/QPDF.hh index 518069d7..7849cb76 100644 --- a/include/qpdf/QPDF.hh +++ b/include/qpdf/QPDF.hh @@ -337,7 +337,7 @@ class QPDF QPDF_DLL void generateHintStream(std::map<int, QPDFXRefEntry> const& xref, - std::map<int, size_t> const& lengths, + std::map<int, qpdf_offset_t> const& lengths, std::map<int, int> const& obj_renumber, PointerHolder<Buffer>& hint_stream, int& S, int& O); @@ -531,8 +531,9 @@ class QPDF void reconstruct_xref(QPDFExc& e); qpdf_offset_t read_xrefTable(qpdf_offset_t offset); qpdf_offset_t read_xrefStream(qpdf_offset_t offset); - int processXRefStream(qpdf_offset_t offset, QPDFObjectHandle& xref_stream); - void insertXrefEntry(int obj, int f0, int f1, int f2, + 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, int objid, int generation); @@ -609,13 +610,13 @@ class QPDF } int delta_nobjects; // 1 - int delta_page_length; // 2 + qpdf_offset_t delta_page_length; // 2 int nshared_objects; // 3 // vectors' sizes = nshared_objects std::vector<int> shared_identifiers; // 4 std::vector<int> shared_numerators; // 5 - int delta_content_offset; // 6 - int delta_content_length; // 7 + qpdf_offset_t delta_content_offset; // 6 + qpdf_offset_t delta_content_length; // 7 }; // PDF 1.4: Table F.3 @@ -639,7 +640,7 @@ class QPDF } int min_nobjects; // 1 - int first_page_offset; // 2 + qpdf_offset_t first_page_offset; // 2 int nbits_delta_nobjects; // 3 int min_page_length; // 4 int nbits_delta_page_length; // 5 @@ -686,7 +687,7 @@ class QPDF } int first_shared_obj; // 1 - int first_shared_offset; // 2 + qpdf_offset_t first_shared_offset; // 2 int nshared_first_page; // 3 int nshared_total; // 4 int nbits_nobjects; // 5 @@ -708,7 +709,7 @@ class QPDF } int first_object; // 1 - int first_object_offset; // 2 + qpdf_offset_t first_object_offset; // 2 int nobjects; // 3 int group_length; // 4 }; @@ -730,14 +731,14 @@ class QPDF { } - int file_size; // /L - int first_page_object; // /O - int first_page_end; // /E - int npages; // /N - int xref_zero_offset; // /T - int first_page; // /P - int H_offset; // offset of primary hint stream - int H_length; // length of primary hint stream + 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 @@ -851,7 +852,7 @@ class QPDF void readHSharedObject(BitStream); void readHGeneric(BitStream, HGeneric&); int maxEnd(ObjUser const& ou); - int getLinearizationOffset(ObjGen const&); + qpdf_offset_t getLinearizationOffset(ObjGen const&); QPDFObjectHandle getUncompressedObject( QPDFObjectHandle&, std::map<int, int> const& object_stream_data); int lengthNextN(int first_object, int n, @@ -878,19 +879,19 @@ class QPDF std::map<int, int> const& object_stream_data); int outputLengthNextN( int in_object, int n, - std::map<int, size_t> const& lengths, + std::map<int, qpdf_offset_t> const& lengths, std::map<int, int> const& obj_renumber); void calculateHPageOffset( std::map<int, QPDFXRefEntry> const& xref, - std::map<int, size_t> const& lengths, + std::map<int, qpdf_offset_t> const& lengths, std::map<int, int> const& obj_renumber); void calculateHSharedObject( std::map<int, QPDFXRefEntry> const& xref, - std::map<int, size_t> const& lengths, + std::map<int, qpdf_offset_t> const& lengths, std::map<int, int> const& obj_renumber); void calculateHOutline( std::map<int, QPDFXRefEntry> const& xref, - std::map<int, size_t> const& lengths, + std::map<int, qpdf_offset_t> const& lengths, std::map<int, int> const& obj_renumber); void writeHPageOffset(BitWriter&); void writeHSharedObject(BitWriter&); @@ -942,7 +943,7 @@ class QPDF std::vector<QPDFExc> warnings; // Linearization data - int first_xref_item_offset; // actual value from file + qpdf_offset_t first_xref_item_offset; // actual value from file bool uncompressed_after_compressed; // Linearization parameter dictionary and hint table data: may be diff --git a/include/qpdf/QPDFWriter.hh b/include/qpdf/QPDFWriter.hh index bcb9335b..25acbb14 100644 --- a/include/qpdf/QPDFWriter.hh +++ b/include/qpdf/QPDFWriter.hh @@ -212,8 +212,8 @@ class QPDFWriter enum trailer_e { t_normal, t_lin_first, t_lin_second }; void init(); - int bytesNeeded(unsigned long n); - void writeBinary(unsigned long val, unsigned int bytes); + int bytesNeeded(unsigned long long n); + void writeBinary(unsigned long long val, unsigned int bytes); void writeString(std::string const& str); void writeBuffer(PointerHolder<Buffer>&); void writeStringQDF(std::string const& str); @@ -226,7 +226,7 @@ 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, int prev = 0); + bool xref_stream, qpdf_offset_t prev = 0); void unparseObject(QPDFObjectHandle object, int level, unsigned int flags); void unparseObject(QPDFObjectHandle object, int level, @@ -263,24 +263,28 @@ class QPDFWriter void writeEncryptionDictionary(); void writeHeader(); void writeHintStream(int hint_id); - int writeXRefTable(trailer_e which, int first, int last, int size); - int writeXRefTable(trailer_e which, int first, int last, int size, - // for linearization - int prev, - bool suppress_offsets, - int hint_id, - qpdf_offset_t hint_offset, - qpdf_offset_t hint_length); - int writeXRefStream(int objid, int max_id, int max_offset, - trailer_e which, int first, int last, int size); - int writeXRefStream(int objid, int max_id, int max_offset, - trailer_e which, int first, int last, int size, - // for linearization - int prev, - int hint_id, - qpdf_offset_t hint_offset, - qpdf_offset_t hint_length, - bool skip_compression); + 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, + // for linearization + qpdf_offset_t prev, + bool suppress_offsets, + int hint_id, + qpdf_offset_t hint_offset, + qpdf_offset_t hint_length); + qpdf_offset_t writeXRefStream( + int objid, int max_id, qpdf_offset_t max_offset, + trailer_e which, int first, int last, int size); + qpdf_offset_t writeXRefStream( + int objid, int max_id, qpdf_offset_t max_offset, + trailer_e which, int first, int last, int size, + // for linearization + qpdf_offset_t prev, + int hint_id, + qpdf_offset_t hint_offset, + qpdf_offset_t hint_length, + bool skip_compression); int calculateXrefStreamPadding(int xref_bytes); // When filtering subsections, push additional pipelines to the @@ -336,7 +340,7 @@ class QPDFWriter std::list<QPDFObjectHandle> object_queue; std::map<int, int> obj_renumber; std::map<int, QPDFXRefEntry> xref; - std::map<int, size_t> lengths; + std::map<int, qpdf_offset_t> lengths; int next_objid; int cur_stream_length_id; size_t cur_stream_length; diff --git a/include/qpdf/QPDFXRefEntry.hh b/include/qpdf/QPDFXRefEntry.hh index f8d3f930..338c3ed3 100644 --- a/include/qpdf/QPDFXRefEntry.hh +++ b/include/qpdf/QPDFXRefEntry.hh @@ -28,9 +28,9 @@ class QPDFXRefEntry QPDF_DLL int getType() const; QPDF_DLL - qpdf_offset_t getOffset() const; // only for type 1 + qpdf_offset_t getOffset() const; // only for type 1 QPDF_DLL - int getObjStreamNumber() const; // only for type 2 + int getObjStreamNumber() const; // only for type 2 QPDF_DLL int getObjStreamIndex() const; // only for type 2 diff --git a/include/qpdf/qpdf-c.h b/include/qpdf/qpdf-c.h index 1a65e4af..ee199026 100644 --- a/include/qpdf/qpdf-c.h +++ b/include/qpdf/qpdf-c.h @@ -154,7 +154,7 @@ extern "C" { QPDF_DLL char const* qpdf_get_error_filename(qpdf_data q, qpdf_error e); QPDF_DLL - unsigned long qpdf_get_error_file_position(qpdf_data q, qpdf_error e); + unsigned long long qpdf_get_error_file_position(qpdf_data q, qpdf_error e); QPDF_DLL char const* qpdf_get_error_message_detail(qpdf_data q, qpdf_error e); @@ -195,7 +195,7 @@ extern "C" { QPDF_ERROR_CODE qpdf_read_memory(qpdf_data qpdf, char const* description, char const* buffer, - unsigned long size, + unsigned long long size, char const* password); /* Read functions below must be called after qpdf_read or |