mirror of
https://github.com/qpdf/qpdf.git
synced 2025-01-03 15:17:29 +00:00
Change QPDF_Integer from int to long long
This makes it possible to store offsets that are larger than 2 GB in the trailer dictionary.
This commit is contained in:
parent
4ef95dbda4
commit
781c313058
@ -529,8 +529,8 @@ class QPDF
|
|||||||
void setTrailer(QPDFObjectHandle obj);
|
void setTrailer(QPDFObjectHandle obj);
|
||||||
void read_xref(qpdf_offset_t offset);
|
void read_xref(qpdf_offset_t offset);
|
||||||
void reconstruct_xref(QPDFExc& e);
|
void reconstruct_xref(QPDFExc& e);
|
||||||
int read_xrefTable(qpdf_offset_t offset);
|
qpdf_offset_t read_xrefTable(qpdf_offset_t offset);
|
||||||
int read_xrefStream(qpdf_offset_t offset);
|
qpdf_offset_t read_xrefStream(qpdf_offset_t offset);
|
||||||
int processXRefStream(qpdf_offset_t offset, QPDFObjectHandle& xref_stream);
|
int processXRefStream(qpdf_offset_t offset, QPDFObjectHandle& xref_stream);
|
||||||
void insertXrefEntry(int obj, int f0, int f1, int f2,
|
void insertXrefEntry(int obj, int f0, int f1, int f2,
|
||||||
bool overwrite = false);
|
bool overwrite = false);
|
||||||
|
@ -98,7 +98,7 @@ class QPDFObjectHandle
|
|||||||
QPDF_DLL
|
QPDF_DLL
|
||||||
static QPDFObjectHandle newBool(bool value);
|
static QPDFObjectHandle newBool(bool value);
|
||||||
QPDF_DLL
|
QPDF_DLL
|
||||||
static QPDFObjectHandle newInteger(int value);
|
static QPDFObjectHandle newInteger(long long value);
|
||||||
QPDF_DLL
|
QPDF_DLL
|
||||||
static QPDFObjectHandle newReal(std::string const& value);
|
static QPDFObjectHandle newReal(std::string const& value);
|
||||||
QPDF_DLL
|
QPDF_DLL
|
||||||
@ -150,7 +150,7 @@ class QPDFObjectHandle
|
|||||||
|
|
||||||
// Methods for integer objects
|
// Methods for integer objects
|
||||||
QPDF_DLL
|
QPDF_DLL
|
||||||
int getIntValue();
|
long long getIntValue();
|
||||||
|
|
||||||
// Methods for real objects
|
// Methods for real objects
|
||||||
QPDF_DLL
|
QPDF_DLL
|
||||||
|
@ -659,7 +659,7 @@ QPDF::read_xref(qpdf_offset_t xref_offset)
|
|||||||
this->deleted_objects.clear();
|
this->deleted_objects.clear();
|
||||||
}
|
}
|
||||||
|
|
||||||
int
|
qpdf_offset_t
|
||||||
QPDF::read_xrefTable(qpdf_offset_t xref_offset)
|
QPDF::read_xrefTable(qpdf_offset_t xref_offset)
|
||||||
{
|
{
|
||||||
PCRE xref_first_re("^\\s*(\\d+)\\s+(\\d+)");
|
PCRE xref_first_re("^\\s*(\\d+)\\s+(\\d+)");
|
||||||
@ -816,7 +816,7 @@ QPDF::read_xrefTable(qpdf_offset_t xref_offset)
|
|||||||
return xref_offset;
|
return xref_offset;
|
||||||
}
|
}
|
||||||
|
|
||||||
int
|
qpdf_offset_t
|
||||||
QPDF::read_xrefStream(qpdf_offset_t xref_offset)
|
QPDF::read_xrefStream(qpdf_offset_t xref_offset)
|
||||||
{
|
{
|
||||||
bool found = false;
|
bool found = false;
|
||||||
@ -1247,7 +1247,7 @@ QPDF::readObjectInternal(PointerHolder<InputSource> input,
|
|||||||
|
|
||||||
case QPDFTokenizer::tt_integer:
|
case QPDFTokenizer::tt_integer:
|
||||||
object = QPDFObjectHandle::newInteger(
|
object = QPDFObjectHandle::newInteger(
|
||||||
atoi(token.getValue().c_str()));
|
QUtil::string_to_ll(token.getValue().c_str()));
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case QPDFTokenizer::tt_real:
|
case QPDFTokenizer::tt_real:
|
||||||
@ -1892,7 +1892,7 @@ QPDF::resolveObjectsInStream(int obj_stream_number)
|
|||||||
}
|
}
|
||||||
|
|
||||||
int num = atoi(tnum.getValue().c_str());
|
int num = atoi(tnum.getValue().c_str());
|
||||||
int offset = atoi(toffset.getValue().c_str());
|
int offset = QUtil::string_to_ll(toffset.getValue().c_str());
|
||||||
offsets[num] = offset + first;
|
offsets[num] = offset + first;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -189,7 +189,7 @@ QPDFObjectHandle::getBoolValue()
|
|||||||
|
|
||||||
// Integer accessors
|
// Integer accessors
|
||||||
|
|
||||||
int
|
long long
|
||||||
QPDFObjectHandle::getIntValue()
|
QPDFObjectHandle::getIntValue()
|
||||||
{
|
{
|
||||||
assertType("Integer", isInteger());
|
assertType("Integer", isInteger());
|
||||||
@ -592,7 +592,7 @@ QPDFObjectHandle::newNull()
|
|||||||
}
|
}
|
||||||
|
|
||||||
QPDFObjectHandle
|
QPDFObjectHandle
|
||||||
QPDFObjectHandle::newInteger(int value)
|
QPDFObjectHandle::newInteger(long long value)
|
||||||
{
|
{
|
||||||
return QPDFObjectHandle(new QPDF_Integer(value));
|
return QPDFObjectHandle(new QPDF_Integer(value));
|
||||||
}
|
}
|
||||||
|
@ -881,6 +881,7 @@ QPDFWriter::writeTrailer(trailer_e which, int size, bool xref_stream, int prev)
|
|||||||
writeString(" /Prev ");
|
writeString(" /Prev ");
|
||||||
qpdf_offset_t pos = this->pipeline->getCount();
|
qpdf_offset_t pos = this->pipeline->getCount();
|
||||||
writeString(QUtil::int_to_string(prev));
|
writeString(QUtil::int_to_string(prev));
|
||||||
|
// XXX
|
||||||
int nspaces = (int)(pos - this->pipeline->getCount() + 11);
|
int nspaces = (int)(pos - this->pipeline->getCount() + 11);
|
||||||
assert(nspaces >= 0);
|
assert(nspaces >= 0);
|
||||||
writePad(nspaces);
|
writePad(nspaces);
|
||||||
|
@ -2,7 +2,7 @@
|
|||||||
|
|
||||||
#include <qpdf/QUtil.hh>
|
#include <qpdf/QUtil.hh>
|
||||||
|
|
||||||
QPDF_Integer::QPDF_Integer(int val) :
|
QPDF_Integer::QPDF_Integer(long long val) :
|
||||||
val(val)
|
val(val)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
@ -17,7 +17,7 @@ QPDF_Integer::unparse()
|
|||||||
return QUtil::int_to_string(this->val);
|
return QUtil::int_to_string(this->val);
|
||||||
}
|
}
|
||||||
|
|
||||||
int
|
long long
|
||||||
QPDF_Integer::getVal() const
|
QPDF_Integer::getVal() const
|
||||||
{
|
{
|
||||||
return this->val;
|
return this->val;
|
||||||
|
@ -6,13 +6,13 @@
|
|||||||
class QPDF_Integer: public QPDFObject
|
class QPDF_Integer: public QPDFObject
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
QPDF_Integer(int val);
|
QPDF_Integer(long long val);
|
||||||
virtual ~QPDF_Integer();
|
virtual ~QPDF_Integer();
|
||||||
virtual std::string unparse();
|
virtual std::string unparse();
|
||||||
int getVal() const;
|
long long getVal() const;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
int val;
|
long long val;
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // __QPDF_INTEGER_HH__
|
#endif // __QPDF_INTEGER_HH__
|
||||||
|
Loading…
Reference in New Issue
Block a user