diff options
author | Vincent Richard <[email protected]> | 2005-01-01 11:32:23 +0000 |
---|---|---|
committer | Vincent Richard <[email protected]> | 2005-01-01 11:32:23 +0000 |
commit | fc1c6b08d191b3ee9964bf53ea95767bc54377ee (patch) | |
tree | 0e6a61589b60909b065523e5e8e1e0039f2fc93d /src/encoderUUE.cpp | |
parent | Fixed config file for Doxygen. (diff) | |
download | vmime-fc1c6b08d191b3ee9964bf53ea95767bc54377ee.tar.gz vmime-fc1c6b08d191b3ee9964bf53ea95767bc54377ee.zip |
Converted all C-style casts to C++-style casts + added unit test for utility::md5.
Diffstat (limited to 'src/encoderUUE.cpp')
-rw-r--r-- | src/encoderUUE.cpp | 17 |
1 files changed, 9 insertions, 8 deletions
diff --git a/src/encoderUUE.cpp b/src/encoderUUE.cpp index 26c0410f..3040cb9d 100644 --- a/src/encoderUUE.cpp +++ b/src/encoderUUE.cpp @@ -101,9 +101,9 @@ const utility::stream::size_type encoderUUE::encode(utility::inputStream& in, ut for (utility::stream::size_type i = 0 ; i < inLength ; i += 3, j += 4) { - const unsigned char c1 = (unsigned char) inBuffer[i]; - const unsigned char c2 = (unsigned char) inBuffer[i + 1]; - const unsigned char c3 = (unsigned char) inBuffer[i + 2]; + const unsigned char c1 = static_cast <unsigned char>(inBuffer[i]); + const unsigned char c2 = static_cast <unsigned char>(inBuffer[i + 1]); + const unsigned char c3 = static_cast <unsigned char>(inBuffer[i + 2]); outBuffer[j] = UUENCODE(c1 >> 2); outBuffer[j + 1] = UUENCODE((c1 << 4) & 060 | (c2 >> 4) & 017); @@ -149,7 +149,8 @@ const utility::stream::size_type encoderUUE::decode(utility::inputStream& in, ut break; const utility::stream::size_type outLength = UUDECODE(lengthChar); - const utility::stream::size_type inLength = std::min((outLength * 4) / 3, (utility::stream::size_type) 64); + const utility::stream::size_type inLength = + std::min((outLength * 4) / 3, static_cast <utility::stream::size_type>(64)); utility::stream::value_type inPos = 0; switch (lengthChar) @@ -257,10 +258,10 @@ const utility::stream::size_type encoderUUE::decode(utility::inputStream& in, ut // Decode data for (utility::stream::size_type i = 0, j = 0 ; i < inLength ; i += 4, j += 3) { - const unsigned char c1 = (unsigned char) inBuffer[i]; - const unsigned char c2 = (unsigned char) inBuffer[i + 1]; - const unsigned char c3 = (unsigned char) inBuffer[i + 2]; - const unsigned char c4 = (unsigned char) inBuffer[i + 3]; + const unsigned char c1 = static_cast <unsigned char>(inBuffer[i]); + const unsigned char c2 = static_cast <unsigned char>(inBuffer[i + 1]); + const unsigned char c3 = static_cast <unsigned char>(inBuffer[i + 2]); + const unsigned char c4 = static_cast <unsigned char>(inBuffer[i + 3]); const utility::stream::size_type n = std::min(inLength - i, static_cast <utility::stream::size_type>(3)); |