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/MD5.cc | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'libqpdf/MD5.cc') diff --git a/libqpdf/MD5.cc b/libqpdf/MD5.cc index f00dbe4b..70be696d 100644 --- a/libqpdf/MD5.cc +++ b/libqpdf/MD5.cc @@ -308,7 +308,7 @@ void MD5::reset() void MD5::encodeString(char const* str) { - unsigned int len = strlen(str); + unsigned int len = (unsigned int)strlen(str); update((unsigned char *)str, len); final(); @@ -316,7 +316,7 @@ void MD5::encodeString(char const* str) void MD5::appendString(char const* input_string) { - update((unsigned char *)input_string, strlen(input_string)); + update((unsigned char *)input_string, (unsigned int) strlen(input_string)); } void MD5::encodeDataIncrementally(char const* data, int len) @@ -332,7 +332,7 @@ void MD5::encodeFile(char const *filename, int up_to_size) std::string("MD5: open ") + filename, fopen(filename, "rb")); - int len; + size_t len; int so_far = 0; int to_try = 1024; do @@ -344,7 +344,7 @@ void MD5::encodeFile(char const *filename, int up_to_size) len = fread(buffer, 1, to_try, file); if (len > 0) { - update(buffer, len); + update(buffer, (unsigned int) len); so_far += len; if ((up_to_size >= 0) && (so_far >= up_to_size)) { -- cgit v1.2.3-54-g00ecf