aboutsummaryrefslogtreecommitdiffstats
path: root/libqpdf
diff options
context:
space:
mode:
authorJay Berkenbilt <ejb@ql.org>2012-06-23 21:08:21 +0200
committerJay Berkenbilt <ejb@ql.org>2012-06-24 21:20:01 +0200
commit781c313058e26b6ab6fda060a652a395d27cdb7a (patch)
tree30488e9556dcf2c584fd46ec8ec61e59d2141634 /libqpdf
parent4ef95dbda440e0aeffa26df40cc33d001e77f4c5 (diff)
downloadqpdf-781c313058e26b6ab6fda060a652a395d27cdb7a.tar.zst
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.
Diffstat (limited to 'libqpdf')
-rw-r--r--libqpdf/QPDF.cc8
-rw-r--r--libqpdf/QPDFObjectHandle.cc4
-rw-r--r--libqpdf/QPDFWriter.cc1
-rw-r--r--libqpdf/QPDF_Integer.cc4
-rw-r--r--libqpdf/qpdf/QPDF_Integer.hh6
5 files changed, 12 insertions, 11 deletions
diff --git a/libqpdf/QPDF.cc b/libqpdf/QPDF.cc
index 3ea2f1ff..6b275d28 100644
--- a/libqpdf/QPDF.cc
+++ b/libqpdf/QPDF.cc
@@ -659,7 +659,7 @@ QPDF::read_xref(qpdf_offset_t xref_offset)
this->deleted_objects.clear();
}
-int
+qpdf_offset_t
QPDF::read_xrefTable(qpdf_offset_t xref_offset)
{
PCRE xref_first_re("^\\s*(\\d+)\\s+(\\d+)");
@@ -816,7 +816,7 @@ QPDF::read_xrefTable(qpdf_offset_t xref_offset)
return xref_offset;
}
-int
+qpdf_offset_t
QPDF::read_xrefStream(qpdf_offset_t xref_offset)
{
bool found = false;
@@ -1247,7 +1247,7 @@ QPDF::readObjectInternal(PointerHolder<InputSource> input,
case QPDFTokenizer::tt_integer:
object = QPDFObjectHandle::newInteger(
- atoi(token.getValue().c_str()));
+ QUtil::string_to_ll(token.getValue().c_str()));
break;
case QPDFTokenizer::tt_real:
@@ -1892,7 +1892,7 @@ QPDF::resolveObjectsInStream(int obj_stream_number)
}
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;
}
diff --git a/libqpdf/QPDFObjectHandle.cc b/libqpdf/QPDFObjectHandle.cc
index 4db0f6fe..90756dd7 100644
--- a/libqpdf/QPDFObjectHandle.cc
+++ b/libqpdf/QPDFObjectHandle.cc
@@ -189,7 +189,7 @@ QPDFObjectHandle::getBoolValue()
// Integer accessors
-int
+long long
QPDFObjectHandle::getIntValue()
{
assertType("Integer", isInteger());
@@ -592,7 +592,7 @@ QPDFObjectHandle::newNull()
}
QPDFObjectHandle
-QPDFObjectHandle::newInteger(int value)
+QPDFObjectHandle::newInteger(long long value)
{
return QPDFObjectHandle(new QPDF_Integer(value));
}
diff --git a/libqpdf/QPDFWriter.cc b/libqpdf/QPDFWriter.cc
index 71549ff4..308f4c53 100644
--- a/libqpdf/QPDFWriter.cc
+++ b/libqpdf/QPDFWriter.cc
@@ -881,6 +881,7 @@ QPDFWriter::writeTrailer(trailer_e which, int size, bool xref_stream, int prev)
writeString(" /Prev ");
qpdf_offset_t pos = this->pipeline->getCount();
writeString(QUtil::int_to_string(prev));
+ // XXX
int nspaces = (int)(pos - this->pipeline->getCount() + 11);
assert(nspaces >= 0);
writePad(nspaces);
diff --git a/libqpdf/QPDF_Integer.cc b/libqpdf/QPDF_Integer.cc
index da3b7dc9..fb25af1b 100644
--- a/libqpdf/QPDF_Integer.cc
+++ b/libqpdf/QPDF_Integer.cc
@@ -2,7 +2,7 @@
#include <qpdf/QUtil.hh>
-QPDF_Integer::QPDF_Integer(int val) :
+QPDF_Integer::QPDF_Integer(long long val) :
val(val)
{
}
@@ -17,7 +17,7 @@ QPDF_Integer::unparse()
return QUtil::int_to_string(this->val);
}
-int
+long long
QPDF_Integer::getVal() const
{
return this->val;
diff --git a/libqpdf/qpdf/QPDF_Integer.hh b/libqpdf/qpdf/QPDF_Integer.hh
index cc11cd65..f9964693 100644
--- a/libqpdf/qpdf/QPDF_Integer.hh
+++ b/libqpdf/qpdf/QPDF_Integer.hh
@@ -6,13 +6,13 @@
class QPDF_Integer: public QPDFObject
{
public:
- QPDF_Integer(int val);
+ QPDF_Integer(long long val);
virtual ~QPDF_Integer();
virtual std::string unparse();
- int getVal() const;
+ long long getVal() const;
private:
- int val;
+ long long val;
};
#endif // __QPDF_INTEGER_HH__