diff options
author | Jay Berkenbilt <ejb@ql.org> | 2012-06-20 17:20:57 +0200 |
---|---|---|
committer | Jay Berkenbilt <ejb@ql.org> | 2012-06-20 21:20:26 +0200 |
commit | 5d4cad9c02e9d4f31477fed0e3b20b35c83936f8 (patch) | |
tree | 38768f5e4a797e09de304b1e184021f5b280da29 /libqpdf/Pl_LZWDecoder.cc | |
parent | 24e2b2b76f1f0051f240c8371b2352c4cde85bf9 (diff) | |
download | qpdf-5d4cad9c02e9d4f31477fed0e3b20b35c83936f8.tar.zst |
ABI change: fix use of off_t, size_t, and integer types
Significantly improve the code's use of off_t for file offsets, size_t
for memory sizes, and integer types in cases where there has to be
compatibility with external interfaces. Rework sections of the code
that would have prevented qpdf from working on files larger than 2 (or
maybe 4) GB in size.
Diffstat (limited to 'libqpdf/Pl_LZWDecoder.cc')
-rw-r--r-- | libqpdf/Pl_LZWDecoder.cc | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/libqpdf/Pl_LZWDecoder.cc b/libqpdf/Pl_LZWDecoder.cc index 811415bc..646e45de 100644 --- a/libqpdf/Pl_LZWDecoder.cc +++ b/libqpdf/Pl_LZWDecoder.cc @@ -25,9 +25,9 @@ Pl_LZWDecoder::~Pl_LZWDecoder() } void -Pl_LZWDecoder::write(unsigned char* bytes, int len) +Pl_LZWDecoder::write(unsigned char* bytes, size_t len) { - for (int i = 0; i < len; ++i) + for (size_t i = 0; i < len; ++i) { this->buf[next++] = bytes[i]; if (this->next == 3) @@ -131,7 +131,7 @@ Pl_LZWDecoder::addToTable(unsigned char next) assert(idx < table.size()); Buffer& b = table[idx]; last_data = b.getBuffer(); - last_size = b.getSize(); + last_size = (unsigned int) b.getSize(); } Buffer entry(1 + last_size); @@ -170,7 +170,7 @@ Pl_LZWDecoder::handleCode(int code) // be what we read last plus the first character of what // we're reading now. unsigned char next = '\0'; - unsigned int table_size = table.size(); + unsigned int table_size = (unsigned int) table.size(); if (code < 256) { // just read < 256; last time's next was code @@ -178,7 +178,7 @@ Pl_LZWDecoder::handleCode(int code) } else if (code > 257) { - unsigned int idx = code - 258; + size_t idx = code - 258; if (idx > table_size) { throw std::runtime_error("LZWDecoder: bad code received"); |