From 9e8cdca585b63e368834e92f026a2a39be5f1844 Mon Sep 17 00:00:00 2001 From: Vincent Richard Date: Sat, 22 Dec 2012 13:40:18 +0100 Subject: Fixed type for maximum line length. --- src/utility/encoder/b64Encoder.cpp | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) (limited to 'src/utility/encoder/b64Encoder.cpp') diff --git a/src/utility/encoder/b64Encoder.cpp b/src/utility/encoder/b64Encoder.cpp index 85c972f9..13ce2ce3 100644 --- a/src/utility/encoder/b64Encoder.cpp +++ b/src/utility/encoder/b64Encoder.cpp @@ -80,10 +80,11 @@ utility::stream::size_type b64Encoder::encode(utility::inputStream& in, { in.reset(); // may not work... - const int propMaxLineLength = getProperties().getProperty ("maxlinelength", -1); + const string::size_type propMaxLineLength = + getProperties().getProperty ("maxlinelength", static_cast (-1)); - const bool cutLines = (propMaxLineLength != -1); - const int maxLineLength = std::min(propMaxLineLength, 76); + const bool cutLines = (propMaxLineLength != static_cast (-1)); + const string::size_type maxLineLength = std::min(propMaxLineLength, static_cast (76)); // Process data utility::stream::value_type buffer[65536]; @@ -96,7 +97,7 @@ utility::stream::size_type b64Encoder::encode(utility::inputStream& in, utility::stream::size_type total = 0; utility::stream::size_type inTotal = 0; - int curCol = 0; + string::size_type curCol = 0; if (progress) progress->start(0); @@ -173,7 +174,7 @@ utility::stream::size_type b64Encoder::encode(utility::inputStream& in, total += 4; curCol += 4; - if (cutLines && curCol >= maxLineLength - 2 /* \r\n */ - 4 /* next bytes */) + if (cutLines && curCol + 2 /* \r\n */ + 4 /* next bytes */ >= maxLineLength) { out.write("\r\n", 2); curCol = 0; -- cgit v1.2.3