From 5d4cad9c02e9d4f31477fed0e3b20b35c83936f8 Mon Sep 17 00:00:00 2001 From: Jay Berkenbilt Date: Wed, 20 Jun 2012 11:20:57 -0400 Subject: 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. --- libqpdf/Pl_AES_PDF.cc | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) (limited to 'libqpdf/Pl_AES_PDF.cc') diff --git a/libqpdf/Pl_AES_PDF.cc b/libqpdf/Pl_AES_PDF.cc index a43d7e69..0f73c09c 100644 --- a/libqpdf/Pl_AES_PDF.cc +++ b/libqpdf/Pl_AES_PDF.cc @@ -60,9 +60,9 @@ Pl_AES_PDF::useStaticIV() } void -Pl_AES_PDF::write(unsigned char* data, int len) +Pl_AES_PDF::write(unsigned char* data, size_t len) { - unsigned int bytes_left = len; + size_t bytes_left = len; unsigned char* p = data; while (bytes_left > 0) @@ -72,8 +72,8 @@ Pl_AES_PDF::write(unsigned char* data, int len) flush(false); } - unsigned int available = this->buf_size - this->offset; - int bytes = (bytes_left < available ? bytes_left : available); + size_t available = this->buf_size - this->offset; + size_t bytes = (bytes_left < available ? bytes_left : available); bytes_left -= bytes; std::memcpy(this->inbuf + this->offset, p, bytes); this->offset += bytes; @@ -93,7 +93,7 @@ Pl_AES_PDF::finish() // Pad as described in section 3.5.1 of version 1.7 of the PDF // specification, including providing an entire block of padding // if the input was a multiple of 16 bytes. - unsigned char pad = this->buf_size - this->offset; + unsigned char pad = (unsigned char) (this->buf_size - this->offset); memset(this->inbuf + this->offset, pad, pad); this->offset = this->buf_size; flush(false); -- cgit v1.2.3-70-g09d2