summaryrefslogtreecommitdiffstats
path: root/include
diff options
context:
space:
mode:
Diffstat (limited to 'include')
-rw-r--r--include/qpdf/Buffer.hh11
-rw-r--r--include/qpdf/Pipeline.hh2
-rw-r--r--include/qpdf/Pl_Buffer.hh2
-rw-r--r--include/qpdf/Pl_Count.hh7
-rw-r--r--include/qpdf/Pl_Discard.hh2
-rw-r--r--include/qpdf/Pl_Flate.hh2
-rw-r--r--include/qpdf/Pl_StdioFile.hh2
-rw-r--r--include/qpdf/QPDF.hh8
-rw-r--r--include/qpdf/QPDFObjectHandle.hh4
-rw-r--r--include/qpdf/QPDFWriter.hh17
-rw-r--r--include/qpdf/QPDFXRefEntry.hh6
-rw-r--r--include/qpdf/QUtil.hh9
-rw-r--r--include/qpdf/qpdf-c.h3
13 files changed, 43 insertions, 32 deletions
diff --git a/include/qpdf/Buffer.hh b/include/qpdf/Buffer.hh
index 31db93e2..234d6ec0 100644
--- a/include/qpdf/Buffer.hh
+++ b/include/qpdf/Buffer.hh
@@ -9,6 +9,7 @@
#define __BUFFER_HH__
#include <qpdf/DLL.h>
+#include <cstring> // for size_t
class Buffer
{
@@ -19,12 +20,12 @@ class Buffer
// Create a Buffer object whose memory is owned by the class and
// will be freed when the Buffer object is destroyed.
QPDF_DLL
- Buffer(unsigned long size);
+ Buffer(size_t size);
// Create a Buffer object whose memory is owned by the caller and
// will not be freed when the Buffer is destroyed.
QPDF_DLL
- Buffer(unsigned char* buf, unsigned long size);
+ Buffer(unsigned char* buf, size_t size);
QPDF_DLL
Buffer(Buffer const&);
@@ -33,19 +34,19 @@ class Buffer
QPDF_DLL
~Buffer();
QPDF_DLL
- unsigned long getSize() const;
+ size_t getSize() const;
QPDF_DLL
unsigned char const* getBuffer() const;
QPDF_DLL
unsigned char* getBuffer();
private:
- void init(unsigned long size, unsigned char* buf, bool own_memory);
+ void init(size_t size, unsigned char* buf, bool own_memory);
void copy(Buffer const&);
void destroy();
bool own_memory;
- unsigned long size;
+ size_t size;
unsigned char* buf;
};
diff --git a/include/qpdf/Pipeline.hh b/include/qpdf/Pipeline.hh
index 796bd0eb..4bab715a 100644
--- a/include/qpdf/Pipeline.hh
+++ b/include/qpdf/Pipeline.hh
@@ -46,7 +46,7 @@ class Pipeline
// and then, if they are not end-of-line pipelines, call
// getNext()->write or getNext()->finish.
QPDF_DLL
- virtual void write(unsigned char* data, int len) = 0;
+ virtual void write(unsigned char* data, size_t len) = 0;
QPDF_DLL
virtual void finish() = 0;
diff --git a/include/qpdf/Pl_Buffer.hh b/include/qpdf/Pl_Buffer.hh
index a85a595d..c8cdc92b 100644
--- a/include/qpdf/Pl_Buffer.hh
+++ b/include/qpdf/Pl_Buffer.hh
@@ -32,7 +32,7 @@ class Pl_Buffer: public Pipeline
QPDF_DLL
virtual ~Pl_Buffer();
QPDF_DLL
- virtual void write(unsigned char*, int);
+ virtual void write(unsigned char*, size_t);
QPDF_DLL
virtual void finish();
diff --git a/include/qpdf/Pl_Count.hh b/include/qpdf/Pl_Count.hh
index c2543f21..e5b8939f 100644
--- a/include/qpdf/Pl_Count.hh
+++ b/include/qpdf/Pl_Count.hh
@@ -12,6 +12,7 @@
// calling finish().
#include <qpdf/Pipeline.hh>
+#include <qpdf/Types.h>
class Pl_Count: public Pipeline
{
@@ -21,19 +22,19 @@ class Pl_Count: public Pipeline
QPDF_DLL
virtual ~Pl_Count();
QPDF_DLL
- virtual void write(unsigned char*, int);
+ virtual void write(unsigned char*, size_t);
QPDF_DLL
virtual void finish();
// Returns the number of bytes written
QPDF_DLL
- int getCount() const;
+ off_t getCount() const;
// Returns the last character written, or '\0' if no characters
// have been written (in which case getCount() returns 0)
QPDF_DLL
unsigned char getLastChar() const;
private:
- int count;
+ off_t count;
unsigned char last_char;
};
diff --git a/include/qpdf/Pl_Discard.hh b/include/qpdf/Pl_Discard.hh
index c08afd88..6531506a 100644
--- a/include/qpdf/Pl_Discard.hh
+++ b/include/qpdf/Pl_Discard.hh
@@ -24,7 +24,7 @@ class Pl_Discard: public Pipeline
QPDF_DLL
virtual ~Pl_Discard();
QPDF_DLL
- virtual void write(unsigned char*, int);
+ virtual void write(unsigned char*, size_t);
QPDF_DLL
virtual void finish();
};
diff --git a/include/qpdf/Pl_Flate.hh b/include/qpdf/Pl_Flate.hh
index 5244377e..fac9d467 100644
--- a/include/qpdf/Pl_Flate.hh
+++ b/include/qpdf/Pl_Flate.hh
@@ -24,7 +24,7 @@ class Pl_Flate: public Pipeline
virtual ~Pl_Flate();
QPDF_DLL
- virtual void write(unsigned char* data, int len);
+ virtual void write(unsigned char* data, size_t len);
QPDF_DLL
virtual void finish();
diff --git a/include/qpdf/Pl_StdioFile.hh b/include/qpdf/Pl_StdioFile.hh
index b40f43bb..fc7c58c1 100644
--- a/include/qpdf/Pl_StdioFile.hh
+++ b/include/qpdf/Pl_StdioFile.hh
@@ -29,7 +29,7 @@ class Pl_StdioFile: public Pipeline
virtual ~Pl_StdioFile();
QPDF_DLL
- virtual void write(unsigned char* buf, int len);
+ virtual void write(unsigned char* buf, size_t len);
QPDF_DLL
virtual void finish();
diff --git a/include/qpdf/QPDF.hh b/include/qpdf/QPDF.hh
index 6a9728b1..ee9dba87 100644
--- a/include/qpdf/QPDF.hh
+++ b/include/qpdf/QPDF.hh
@@ -388,7 +388,7 @@ class QPDF
virtual off_t tell() = 0;
virtual void seek(off_t offset, int whence) = 0;
virtual void rewind() = 0;
- virtual size_t read(char* buffer, int length) = 0;
+ virtual size_t read(char* buffer, size_t length) = 0;
virtual void unreadCh(char ch) = 0;
protected:
@@ -405,7 +405,7 @@ class QPDF
virtual off_t tell();
virtual void seek(off_t offset, int whence);
virtual void rewind();
- virtual size_t read(char* buffer, int length);
+ virtual size_t read(char* buffer, size_t length);
virtual void unreadCh(char ch);
private:
@@ -428,7 +428,7 @@ class QPDF
virtual off_t tell();
virtual void seek(off_t offset, int whence);
virtual void rewind();
- virtual size_t read(char* buffer, int length);
+ virtual size_t read(char* buffer, size_t length);
virtual void unreadCh(char ch);
private:
@@ -490,7 +490,7 @@ class QPDF
PointerHolder<InputSource> input, int objid, int generation,
bool in_object_stream,
bool in_array, bool in_dictionary);
- int recoverStreamLength(
+ size_t recoverStreamLength(
PointerHolder<InputSource> input, int objid, int generation,
off_t stream_offset);
QPDFTokenizer::Token readToken(PointerHolder<InputSource>);
diff --git a/include/qpdf/QPDFObjectHandle.hh b/include/qpdf/QPDFObjectHandle.hh
index 6213ff10..f2ed22b7 100644
--- a/include/qpdf/QPDFObjectHandle.hh
+++ b/include/qpdf/QPDFObjectHandle.hh
@@ -327,7 +327,7 @@ class QPDFObjectHandle
// object must be dictionary object
static QPDFObjectHandle newStream(
QPDF* qpdf, int objid, int generation,
- QPDFObjectHandle stream_dict, off_t offset, int length)
+ QPDFObjectHandle stream_dict, off_t offset, size_t length)
{
return QPDFObjectHandle::newStream(
qpdf, objid, generation, stream_dict, offset, length);
@@ -371,7 +371,7 @@ class QPDFObjectHandle
static QPDFObjectHandle newIndirect(QPDF*, int objid, int generation);
static QPDFObjectHandle newStream(
QPDF* qpdf, int objid, int generation,
- QPDFObjectHandle stream_dict, off_t offset, int length);
+ QPDFObjectHandle stream_dict, off_t offset, size_t length);
void assertInitialized() const;
void assertType(char const* type_name, bool istype);
diff --git a/include/qpdf/QPDFWriter.hh b/include/qpdf/QPDFWriter.hh
index a8a51791..6a1c23cf 100644
--- a/include/qpdf/QPDFWriter.hh
+++ b/include/qpdf/QPDFWriter.hh
@@ -21,6 +21,7 @@
#include <qpdf/DLL.h>
#include <qpdf/Constants.h>
+#include <qpdf/Types.h>
#include <qpdf/QPDFXRefEntry.hh>
@@ -219,7 +220,7 @@ class QPDFWriter
void writePad(int nspaces);
void assignCompressedObjectNumbers(int objid);
void enqueueObject(QPDFObjectHandle object);
- void writeObjectStreamOffsets(std::vector<int>& offsets, int first_obj);
+ void writeObjectStreamOffsets(std::vector<off_t>& offsets, int first_obj);
void writeObjectStream(QPDFObjectHandle object);
void writeObject(QPDFObjectHandle object, int object_stream_index = -1);
void writeTrailer(trailer_e which, int size,
@@ -229,7 +230,7 @@ class QPDFWriter
void unparseObject(QPDFObjectHandle object, int level,
unsigned int flags,
// for stream dictionaries
- int stream_length, bool compress);
+ size_t stream_length, bool compress);
void unparseChild(QPDFObjectHandle child, int level, int flags);
void initializeSpecialStreams();
void preserveObjectStreams();
@@ -266,8 +267,8 @@ class QPDFWriter
int prev,
bool suppress_offsets,
int hint_id,
- int hint_offset,
- int hint_length);
+ off_t hint_offset,
+ off_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,
@@ -275,8 +276,8 @@ class QPDFWriter
// for linearization
int prev,
int hint_id,
- int hint_offset,
- int hint_length,
+ off_t hint_offset,
+ off_t hint_length,
bool skip_compression);
int calculateXrefStreamPadding(int xref_bytes);
@@ -295,7 +296,7 @@ class QPDFWriter
// stack items are of type Pl_Buffer, the buffer is retrieved.
void popPipelineStack(PointerHolder<Buffer>* bp = 0);
- void adjustAESStreamLength(unsigned long& length);
+ void adjustAESStreamLength(size_t& length);
void pushEncryptionFilter();
void pushDiscardFilter();
@@ -336,7 +337,7 @@ class QPDFWriter
std::map<int, size_t> lengths;
int next_objid;
int cur_stream_length_id;
- unsigned long cur_stream_length;
+ size_t cur_stream_length;
bool added_newline;
int max_ostream_index;
std::set<int> normalized_streams;
diff --git a/include/qpdf/QPDFXRefEntry.hh b/include/qpdf/QPDFXRefEntry.hh
index 35843970..c362cc97 100644
--- a/include/qpdf/QPDFXRefEntry.hh
+++ b/include/qpdf/QPDFXRefEntry.hh
@@ -23,12 +23,12 @@ class QPDFXRefEntry
QPDF_DLL
QPDFXRefEntry();
QPDF_DLL
- QPDFXRefEntry(int type, int field1, int field2);
+ QPDFXRefEntry(int type, off_t field1, int field2);
QPDF_DLL
int getType() const;
QPDF_DLL
- int getOffset() const; // only for type 1
+ off_t getOffset() const; // only for type 1
QPDF_DLL
int getObjStreamNumber() const; // only for type 2
QPDF_DLL
@@ -36,7 +36,7 @@ class QPDFXRefEntry
private:
int type;
- int field1;
+ off_t field1;
int field2;
};
diff --git a/include/qpdf/QUtil.hh b/include/qpdf/QUtil.hh
index 7f5a38df..37307101 100644
--- a/include/qpdf/QUtil.hh
+++ b/include/qpdf/QUtil.hh
@@ -9,6 +9,7 @@
#define __QUTIL_HH__
#include <qpdf/DLL.h>
+#include <qpdf/Types.h>
#include <string>
#include <list>
#include <stdexcept>
@@ -20,7 +21,7 @@ namespace QUtil
// This is a collection of useful utility functions that don't
// really go anywhere else.
QPDF_DLL
- std::string int_to_string(int, int length = 0);
+ std::string int_to_string(long long, int length = 0);
QPDF_DLL
std::string double_to_string(double, int decimal_places = 0);
@@ -44,6 +45,12 @@ namespace QUtil
QPDF_DLL
FILE* fopen_wrapper(std::string const&, FILE*);
+ // Wrap around off_t versions of fseek and ftell if available
+ QPDF_DLL
+ int fseek_off_t(FILE* stream, off_t offset, int whence);
+ QPDF_DLL
+ off_t ftell_off_t(FILE* stream);
+
QPDF_DLL
char* copy_string(std::string const&);
diff --git a/include/qpdf/qpdf-c.h b/include/qpdf/qpdf-c.h
index 168da154..77af4741 100644
--- a/include/qpdf/qpdf-c.h
+++ b/include/qpdf/qpdf-c.h
@@ -71,6 +71,7 @@
#include <qpdf/DLL.h>
#include <qpdf/Constants.h>
+#include <qpdf/Types.h>
#ifdef __cplusplus
extern "C" {
@@ -300,7 +301,7 @@ extern "C" {
* if a subsequent call to qpdf_init_write or
* qpdf_init_write_memory is called. */
QPDF_DLL
- unsigned long qpdf_get_buffer_length(qpdf_data qpdf);
+ size_t qpdf_get_buffer_length(qpdf_data qpdf);
QPDF_DLL
unsigned char const* qpdf_get_buffer(qpdf_data qpdf);