aboutsummaryrefslogtreecommitdiffstats
path: root/libqpdf/Pl_RC4.cc
diff options
context:
space:
mode:
authorJay Berkenbilt <ejb@ql.org>2012-06-20 17:20:57 +0200
committerJay Berkenbilt <ejb@ql.org>2012-06-20 21:20:26 +0200
commit5d4cad9c02e9d4f31477fed0e3b20b35c83936f8 (patch)
tree38768f5e4a797e09de304b1e184021f5b280da29 /libqpdf/Pl_RC4.cc
parent24e2b2b76f1f0051f240c8371b2352c4cde85bf9 (diff)
downloadqpdf-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_RC4.cc')
-rw-r--r--libqpdf/Pl_RC4.cc11
1 files changed, 6 insertions, 5 deletions
diff --git a/libqpdf/Pl_RC4.cc b/libqpdf/Pl_RC4.cc
index f98c8744..74bb16b9 100644
--- a/libqpdf/Pl_RC4.cc
+++ b/libqpdf/Pl_RC4.cc
@@ -3,7 +3,7 @@
Pl_RC4::Pl_RC4(char const* identifier, Pipeline* next,
unsigned char const* key_data, int key_len,
- int out_bufsize) :
+ size_t out_bufsize) :
Pipeline(identifier, next),
out_bufsize(out_bufsize),
rc4(key_data, key_len)
@@ -21,7 +21,7 @@ Pl_RC4::~Pl_RC4()
}
void
-Pl_RC4::write(unsigned char* data, int len)
+Pl_RC4::write(unsigned char* data, size_t len)
{
if (this->outbuf == 0)
{
@@ -30,14 +30,15 @@ Pl_RC4::write(unsigned char* data, int len)
": Pl_RC4: write() called after finish() called");
}
- int bytes_left = len;
+ size_t bytes_left = len;
unsigned char* p = data;
while (bytes_left > 0)
{
- int bytes = (bytes_left < this->out_bufsize ? bytes_left : out_bufsize);
+ size_t bytes =
+ (bytes_left < this->out_bufsize ? bytes_left : out_bufsize);
bytes_left -= bytes;
- rc4.process(p, bytes, outbuf);
+ rc4.process(p, (int)bytes, outbuf);
p += bytes;
getNext()->write(outbuf, bytes);
}