summaryrefslogtreecommitdiffstats
path: root/libtests
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 /libtests
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 'libtests')
-rw-r--r--libtests/aes.cc4
-rw-r--r--libtests/ascii85.cc2
-rw-r--r--libtests/bits.cc2
-rw-r--r--libtests/hex.cc2
-rw-r--r--libtests/lzw.cc2
-rw-r--r--libtests/md5.cc2
-rw-r--r--libtests/rc4.cc6
7 files changed, 10 insertions, 10 deletions
diff --git a/libtests/aes.cc b/libtests/aes.cc
index 418c3297..ad2f0dd8 100644
--- a/libtests/aes.cc
+++ b/libtests/aes.cc
@@ -46,7 +46,7 @@ int main(int argc, char* argv[])
usage();
}
- unsigned int hexkeylen = strlen(hexkey);
+ unsigned int hexkeylen = (unsigned int)strlen(hexkey);
unsigned int keylen = hexkeylen / 2;
if (keylen != Pl_AES_PDF::key_size)
{
@@ -93,7 +93,7 @@ int main(int argc, char* argv[])
bool done = false;
while (! done)
{
- int len = fread(buf, 1, sizeof(buf), infile);
+ size_t len = fread(buf, 1, sizeof(buf), infile);
if (len <= 0)
{
done = true;
diff --git a/libtests/ascii85.cc b/libtests/ascii85.cc
index 497df79a..7fd7f69b 100644
--- a/libtests/ascii85.cc
+++ b/libtests/ascii85.cc
@@ -15,7 +15,7 @@ int main()
bool done = false;
while (! done)
{
- int len = fread(buf, 1, sizeof(buf), stdin);
+ size_t len = fread(buf, 1, sizeof(buf), stdin);
if (len <= 0)
{
done = true;
diff --git a/libtests/bits.cc b/libtests/bits.cc
index b1857988..7837ac68 100644
--- a/libtests/bits.cc
+++ b/libtests/bits.cc
@@ -46,7 +46,7 @@ print_buffer(Pl_Buffer* bp)
bp->finish();
Buffer* b = bp->getBuffer();
unsigned char const* p = b->getBuffer();
- unsigned long l = b->getSize();
+ size_t l = b->getSize();
for (unsigned long i = 0; i < l; ++i)
{
printf("%02x%s", (unsigned int)(p[i]),
diff --git a/libtests/hex.cc b/libtests/hex.cc
index 0a08fcb8..4e3eefde 100644
--- a/libtests/hex.cc
+++ b/libtests/hex.cc
@@ -15,7 +15,7 @@ int main()
bool done = false;
while (! done)
{
- int len = fread(buf, 1, sizeof(buf), stdin);
+ size_t len = fread(buf, 1, sizeof(buf), stdin);
if (len <= 0)
{
done = true;
diff --git a/libtests/lzw.cc b/libtests/lzw.cc
index 5bfdbbd5..6fd8ca91 100644
--- a/libtests/lzw.cc
+++ b/libtests/lzw.cc
@@ -38,7 +38,7 @@ int main(int argc, char* argv[])
bool done = false;
while (! done)
{
- int len = fread(buf, 1, sizeof(buf), infile);
+ size_t len = fread(buf, 1, sizeof(buf), infile);
if (len <= 0)
{
done = true;
diff --git a/libtests/md5.cc b/libtests/md5.cc
index 9b1ae483..ed6a7d7a 100644
--- a/libtests/md5.cc
+++ b/libtests/md5.cc
@@ -54,7 +54,7 @@ int main(int, char*[])
bool done = false;
while (! done)
{
- int len = fread(buf, 1, sizeof(buf), f);
+ size_t len = fread(buf, 1, sizeof(buf), f);
if (len <= 0)
{
done = true;
diff --git a/libtests/rc4.cc b/libtests/rc4.cc
index 8f809ec1..1328fc85 100644
--- a/libtests/rc4.cc
+++ b/libtests/rc4.cc
@@ -17,8 +17,8 @@ int main(int argc, char* argv[])
char* hexkey = argv[1];
char* infilename = argv[2];
char* outfilename = argv[3];
- int hexkeylen = strlen(hexkey);
- int keylen = hexkeylen / 2;
+ unsigned int hexkeylen = (unsigned int)strlen(hexkey);
+ unsigned int keylen = hexkeylen / 2;
unsigned char* key = new unsigned char[keylen + 1];
key[keylen] = '\0';
@@ -56,7 +56,7 @@ int main(int argc, char* argv[])
bool done = false;
while (! done)
{
- int len = fread(buf, 1, sizeof(buf), infile);
+ size_t len = fread(buf, 1, sizeof(buf), infile);
if (len <= 0)
{
done = true;