aboutsummaryrefslogtreecommitdiffstats
path: root/src/utility/encoder/b64Encoder.cpp
diff options
context:
space:
mode:
authorVincent Richard <[email protected]>2012-12-22 12:40:18 +0000
committerVincent Richard <[email protected]>2012-12-22 12:40:18 +0000
commit9e8cdca585b63e368834e92f026a2a39be5f1844 (patch)
tree3a9fdd4b849e2a3cc77cb3618de49ca0021b80c7 /src/utility/encoder/b64Encoder.cpp
parentFixed first modifier not being generated. (diff)
downloadvmime-9e8cdca585b63e368834e92f026a2a39be5f1844.tar.gz
vmime-9e8cdca585b63e368834e92f026a2a39be5f1844.zip
Fixed type for maximum line length.
Diffstat (limited to 'src/utility/encoder/b64Encoder.cpp')
-rw-r--r--src/utility/encoder/b64Encoder.cpp11
1 files changed, 6 insertions, 5 deletions
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 <int>("maxlinelength", -1);
+ const string::size_type propMaxLineLength =
+ getProperties().getProperty <string::size_type>("maxlinelength", static_cast <string::size_type>(-1));
- const bool cutLines = (propMaxLineLength != -1);
- const int maxLineLength = std::min(propMaxLineLength, 76);
+ const bool cutLines = (propMaxLineLength != static_cast <string::size_type>(-1));
+ const string::size_type maxLineLength = std::min(propMaxLineLength, static_cast <string::size_type>(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;