aboutsummaryrefslogtreecommitdiffstats
path: root/src/utility/encoder
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--src/utility/encoder/b64Encoder.cpp70
-rw-r--r--src/utility/encoder/noopEncoder.cpp12
-rw-r--r--src/utility/encoder/qpEncoder.cpp76
-rw-r--r--src/utility/encoder/uuEncoder.cpp91
4 files changed, 123 insertions, 126 deletions
diff --git a/src/utility/encoder/b64Encoder.cpp b/src/utility/encoder/b64Encoder.cpp
index 20e16b98..274c23c0 100644
--- a/src/utility/encoder/b64Encoder.cpp
+++ b/src/utility/encoder/b64Encoder.cpp
@@ -70,34 +70,34 @@ const unsigned char b64Encoder::sm_decodeMap[256] =
};
#ifndef VMIME_BUILDING_DOC
- #define B64_WRITE(s, x, l) s.write(reinterpret_cast <utility::stream::value_type*>(x), l)
+ #define B64_WRITE(s, x, l) s.write(reinterpret_cast <byte_t*>(x), l)
#endif // VMIME_BUILDING_DOC
-utility::stream::size_type b64Encoder::encode(utility::inputStream& in,
+size_t b64Encoder::encode(utility::inputStream& in,
utility::outputStream& out, utility::progressListener* progress)
{
in.reset(); // may not work...
- const string::size_type propMaxLineLength =
- getProperties().getProperty <string::size_type>("maxlinelength", static_cast <string::size_type>(-1));
+ const size_t propMaxLineLength =
+ getProperties().getProperty <size_t>("maxlinelength", static_cast <size_t>(-1));
- const bool cutLines = (propMaxLineLength != static_cast <string::size_type>(-1));
- const string::size_type maxLineLength = std::min(propMaxLineLength, static_cast <string::size_type>(76));
+ const bool cutLines = (propMaxLineLength != static_cast <size_t>(-1));
+ const size_t maxLineLength = std::min(propMaxLineLength, static_cast <size_t>(76));
// Process data
- utility::stream::value_type buffer[65536];
- utility::stream::size_type bufferLength = 0;
- utility::stream::size_type bufferPos = 0;
+ byte_t buffer[65536];
+ size_t bufferLength = 0;
+ size_t bufferPos = 0;
- unsigned char bytes[3];
- unsigned char output[4];
+ byte_t bytes[3];
+ byte_t output[4];
- utility::stream::size_type total = 0;
- utility::stream::size_type inTotal = 0;
+ size_t total = 0;
+ size_t inTotal = 0;
- string::size_type curCol = 0;
+ size_t curCol = 0;
if (progress)
progress->start(0);
@@ -191,21 +191,21 @@ utility::stream::size_type b64Encoder::encode(utility::inputStream& in,
}
-utility::stream::size_type b64Encoder::decode(utility::inputStream& in,
+size_t b64Encoder::decode(utility::inputStream& in,
utility::outputStream& out, utility::progressListener* progress)
{
in.reset(); // may not work...
// Process the data
- char buffer[16384];
- utility::stream::size_type bufferLength = 0;
- utility::stream::size_type bufferPos = 0;
+ byte_t buffer[16384];
+ size_t bufferLength = 0;
+ size_t bufferPos = 0;
- utility::stream::size_type total = 0;
- utility::stream::size_type inTotal = 0;
+ size_t total = 0;
+ size_t inTotal = 0;
- unsigned char bytes[4];
- unsigned char output[3];
+ byte_t bytes[4];
+ byte_t output[3];
if (progress)
progress->start(0);
@@ -234,7 +234,7 @@ utility::stream::size_type b64Encoder::decode(utility::inputStream& in,
while (count < 4 && bufferPos < bufferLength)
{
- const unsigned char c = buffer[bufferPos++];
+ const byte_t c = buffer[bufferPos++];
if (!parserHelpers::isSpace(c))
bytes[count++] = c;
@@ -250,7 +250,7 @@ utility::stream::size_type b64Encoder::decode(utility::inputStream& in,
while (count < 4 && bufferPos < bufferLength)
{
- const unsigned char c = buffer[bufferPos++];
+ const byte_t c = buffer[bufferPos++];
if (!parserHelpers::isSpace(c))
bytes[count++] = c;
@@ -259,13 +259,13 @@ utility::stream::size_type b64Encoder::decode(utility::inputStream& in,
}
// Decode the bytes
- unsigned char c1 = bytes[0];
- unsigned char c2 = bytes[1];
+ byte_t c1 = bytes[0];
+ byte_t c2 = bytes[1];
if (c1 == '=' || c2 == '=') // end
break;
- output[0] = static_cast <unsigned char>((sm_decodeMap[c1] << 2) | ((sm_decodeMap[c2] & 0x30) >> 4));
+ output[0] = static_cast <byte_t>((sm_decodeMap[c1] << 2) | ((sm_decodeMap[c2] & 0x30) >> 4));
c1 = bytes[2];
@@ -276,7 +276,7 @@ utility::stream::size_type b64Encoder::decode(utility::inputStream& in,
break;
}
- output[1] = static_cast <unsigned char>(((sm_decodeMap[c2] & 0xf) << 4) | ((sm_decodeMap[c1] & 0x3c) >> 2));
+ output[1] = static_cast <byte_t>(((sm_decodeMap[c2] & 0xf) << 4) | ((sm_decodeMap[c1] & 0x3c) >> 2));
c2 = bytes[3];
@@ -287,7 +287,7 @@ utility::stream::size_type b64Encoder::decode(utility::inputStream& in,
break;
}
- output[2] = static_cast <unsigned char>(((sm_decodeMap[c1] & 0x03) << 6) | sm_decodeMap[c2]);
+ output[2] = static_cast <byte_t>(((sm_decodeMap[c1] & 0x03) << 6) | sm_decodeMap[c2]);
B64_WRITE(out, output, 3);
total += 3;
@@ -304,13 +304,13 @@ utility::stream::size_type b64Encoder::decode(utility::inputStream& in,
}
-utility::stream::size_type b64Encoder::getEncodedSize(const utility::stream::size_type n) const
+size_t b64Encoder::getEncodedSize(const size_t n) const
{
- const string::size_type propMaxLineLength =
- getProperties().getProperty <string::size_type>("maxlinelength", static_cast <string::size_type>(-1));
+ const size_t propMaxLineLength =
+ getProperties().getProperty <size_t>("maxlinelength", static_cast <size_t>(-1));
- const bool cutLines = (propMaxLineLength != static_cast <string::size_type>(-1));
- const string::size_type maxLineLength = std::min(propMaxLineLength, static_cast <string::size_type>(76));
+ const bool cutLines = (propMaxLineLength != static_cast <size_t>(-1));
+ const size_t maxLineLength = std::min(propMaxLineLength, static_cast <size_t>(76));
return (n * 4) / 3 // 3 bytes of input provide 4 bytes of output
+ (cutLines ? (n / maxLineLength) * 2 : 0) // CRLF (2 bytes) for each line.
@@ -318,7 +318,7 @@ utility::stream::size_type b64Encoder::getEncodedSize(const utility::stream::siz
}
-utility::stream::size_type b64Encoder::getDecodedSize(const utility::stream::size_type n) const
+size_t b64Encoder::getDecodedSize(const size_t n) const
{
// 4 bytes of input provide 3 bytes of output
return (n * 3) / 4;
diff --git a/src/utility/encoder/noopEncoder.cpp b/src/utility/encoder/noopEncoder.cpp
index cf72a4f6..3d991b5d 100644
--- a/src/utility/encoder/noopEncoder.cpp
+++ b/src/utility/encoder/noopEncoder.cpp
@@ -36,13 +36,13 @@ noopEncoder::noopEncoder()
}
-utility::stream::size_type noopEncoder::encode(utility::inputStream& in,
+size_t noopEncoder::encode(utility::inputStream& in,
utility::outputStream& out, utility::progressListener* progress)
{
in.reset(); // may not work...
// No encoding performed
- utility::stream::size_type res = 0;
+ size_t res = 0;
if (progress)
res = utility::bufferedStreamCopy(in, out, 0, progress);
@@ -53,13 +53,13 @@ utility::stream::size_type noopEncoder::encode(utility::inputStream& in,
}
-utility::stream::size_type noopEncoder::decode(utility::inputStream& in,
+size_t noopEncoder::decode(utility::inputStream& in,
utility::outputStream& out, utility::progressListener* progress)
{
in.reset(); // may not work...
// No decoding performed
- utility::stream::size_type res = 0;
+ size_t res = 0;
if (progress)
res = utility::bufferedStreamCopy(in, out, 0, progress);
@@ -70,13 +70,13 @@ utility::stream::size_type noopEncoder::decode(utility::inputStream& in,
}
-utility::stream::size_type noopEncoder::getEncodedSize(const utility::stream::size_type n) const
+size_t noopEncoder::getEncodedSize(const size_t n) const
{
return n;
}
-utility::stream::size_type noopEncoder::getDecodedSize(const utility::stream::size_type n) const
+size_t noopEncoder::getDecodedSize(const size_t n) const
{
return n;
}
diff --git a/src/utility/encoder/qpEncoder.cpp b/src/utility/encoder/qpEncoder.cpp
index 1768818c..c77b5163 100644
--- a/src/utility/encoder/qpEncoder.cpp
+++ b/src/utility/encoder/qpEncoder.cpp
@@ -69,7 +69,7 @@ const unsigned char qpEncoder::sm_hexDigits[] = "0123456789ABCDEF";
// This is a quick lookup table:
// '1' means "encode", '0' means "no encoding"
//
-const unsigned char qpEncoder::sm_RFC2047EncodeTable[] =
+const vmime_uint8 qpEncoder::sm_RFC2047EncodeTable[] =
{
/* 0 NUL */ 1, /* 1 SOH */ 1, /* 2 STX */ 1, /* 3 ETX */ 1, /* 4 EOT */ 1, /* 5 ENQ */ 1,
/* 6 ACK */ 1, /* 7 BEL */ 1, /* 8 BS */ 1, /* 9 TAB */ 1, /* 10 LF */ 1, /* 11 VT */ 1,
@@ -97,7 +97,7 @@ const unsigned char qpEncoder::sm_RFC2047EncodeTable[] =
// Hex-decoding table
-const unsigned char qpEncoder::sm_hexDecodeTable[256] =
+const vmime_uint8 qpEncoder::sm_hexDecodeTable[256] =
{
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
@@ -119,14 +119,14 @@ const unsigned char qpEncoder::sm_hexDecodeTable[256] =
// static
-bool qpEncoder::RFC2047_isEncodingNeededForChar(const unsigned char c)
+bool qpEncoder::RFC2047_isEncodingNeededForChar(const byte_t c)
{
return (c >= 128 || sm_RFC2047EncodeTable[c] != 0);
}
// static
-int qpEncoder::RFC2047_getEncodedLength(const unsigned char c)
+int qpEncoder::RFC2047_getEncodedLength(const byte_t c)
{
if (c >= 128 || sm_RFC2047EncodeTable[c] != 0)
{
@@ -157,37 +157,37 @@ int qpEncoder::RFC2047_getEncodedLength(const unsigned char c)
outBufferPos += 3; \
curCol += 3
-#define QP_WRITE(s, x, l) s.write(reinterpret_cast <utility::stream::value_type*>(x), l)
+#define QP_WRITE(s, x, l) s.write(reinterpret_cast <byte_t*>(x), l)
#endif // VMIME_BUILDING_DOC
-utility::stream::size_type qpEncoder::encode(utility::inputStream& in,
+size_t qpEncoder::encode(utility::inputStream& in,
utility::outputStream& out, utility::progressListener* progress)
{
in.reset(); // may not work...
- const string::size_type propMaxLineLength =
- getProperties().getProperty <string::size_type>("maxlinelength", static_cast <string::size_type>(-1));
+ const size_t propMaxLineLength =
+ getProperties().getProperty <size_t>("maxlinelength", static_cast <size_t>(-1));
const bool rfc2047 = getProperties().getProperty <bool>("rfc2047", false);
const bool text = getProperties().getProperty <bool>("text", false); // binary mode by default
- const bool cutLines = (propMaxLineLength != static_cast <string::size_type>(-1));
- const string::size_type maxLineLength = std::min(propMaxLineLength, static_cast <string::size_type>(74));
+ const bool cutLines = (propMaxLineLength != static_cast <size_t>(-1));
+ const size_t maxLineLength = std::min(propMaxLineLength, static_cast <size_t>(74));
// Process the data
- char buffer[16384];
- utility::stream::size_type bufferLength = 0;
- utility::stream::size_type bufferPos = 0;
+ byte_t buffer[16384];
+ size_t bufferLength = 0;
+ size_t bufferPos = 0;
- string::size_type curCol = 0;
+ size_t curCol = 0;
- unsigned char outBuffer[16384];
- int outBufferPos = 0;
+ byte_t outBuffer[16384];
+ size_t outBufferPos = 0;
- utility::stream::size_type total = 0;
- utility::stream::size_type inTotal = 0;
+ size_t total = 0;
+ size_t inTotal = 0;
if (progress)
progress->start(0);
@@ -215,7 +215,7 @@ utility::stream::size_type qpEncoder::encode(utility::inputStream& in,
}
// Get the next char and encode it
- const unsigned char c = static_cast <unsigned char>(buffer[bufferPos++]);
+ const byte_t c = buffer[bufferPos++];
if (rfc2047)
{
@@ -371,7 +371,7 @@ utility::stream::size_type qpEncoder::encode(utility::inputStream& in,
}
-utility::stream::size_type qpEncoder::decode(utility::inputStream& in,
+size_t qpEncoder::decode(utility::inputStream& in,
utility::outputStream& out, utility::progressListener* progress)
{
in.reset(); // may not work...
@@ -379,20 +379,20 @@ utility::stream::size_type qpEncoder::decode(utility::inputStream& in,
// Process the data
const bool rfc2047 = getProperties().getProperty <bool>("rfc2047", false);
- char buffer[16384];
- utility::stream::size_type bufferLength = 0;
- utility::stream::size_type bufferPos = 0;
+ byte_t buffer[16384];
+ size_t bufferLength = 0;
+ size_t bufferPos = 0;
- unsigned char outBuffer[16384];
- int outBufferPos = 0;
+ byte_t outBuffer[16384];
+ size_t outBufferPos = 0;
- utility::stream::size_type total = 0;
- utility::stream::size_type inTotal = 0;
+ size_t total = 0;
+ size_t inTotal = 0;
while (bufferPos < bufferLength || !in.eof())
{
// Flush current output buffer
- if (outBufferPos >= static_cast <int>(sizeof(outBuffer)))
+ if (outBufferPos >= sizeof(outBuffer))
{
QP_WRITE(out, outBuffer, outBufferPos);
@@ -412,7 +412,7 @@ utility::stream::size_type qpEncoder::decode(utility::inputStream& in,
}
// Decode the next sequence (hex-encoded byte or printable character)
- unsigned char c = static_cast <unsigned char>(buffer[bufferPos++]);
+ byte_t c = buffer[bufferPos++];
++inTotal;
@@ -428,7 +428,7 @@ utility::stream::size_type qpEncoder::decode(utility::inputStream& in,
if (bufferPos < bufferLength)
{
- c = static_cast <unsigned char>(buffer[bufferPos++]);
+ c = buffer[bufferPos++];
++inTotal;
@@ -468,11 +468,11 @@ utility::stream::size_type qpEncoder::decode(utility::inputStream& in,
if (bufferPos < bufferLength)
{
- const unsigned char next = static_cast <unsigned char>(buffer[bufferPos++]);
+ const byte_t next = buffer[bufferPos++];
++inTotal;
- const unsigned char value = static_cast <unsigned char>
+ const byte_t value = static_cast <byte_t>
(sm_hexDecodeTable[c] * 16 + sm_hexDecodeTable[next]);
outBuffer[outBufferPos++] = value;
@@ -532,13 +532,13 @@ utility::stream::size_type qpEncoder::decode(utility::inputStream& in,
}
-utility::stream::size_type qpEncoder::getEncodedSize(const utility::stream::size_type n) const
+size_t qpEncoder::getEncodedSize(const size_t n) const
{
- const string::size_type propMaxLineLength =
- getProperties().getProperty <string::size_type>("maxlinelength", static_cast <string::size_type>(-1));
+ const size_t propMaxLineLength =
+ getProperties().getProperty <size_t>("maxlinelength", static_cast <size_t>(-1));
- const bool cutLines = (propMaxLineLength != static_cast <string::size_type>(-1));
- const string::size_type maxLineLength = std::min(propMaxLineLength, static_cast <string::size_type>(74));
+ const bool cutLines = (propMaxLineLength != static_cast <size_t>(-1));
+ const size_t maxLineLength = std::min(propMaxLineLength, static_cast <size_t>(74));
// Worst cast: 1 byte of input provide 3 bytes of output
// Count CRLF (2 bytes) for each line.
@@ -546,7 +546,7 @@ utility::stream::size_type qpEncoder::getEncodedSize(const utility::stream::size
}
-utility::stream::size_type qpEncoder::getDecodedSize(const utility::stream::size_type n) const
+size_t qpEncoder::getDecodedSize(const size_t n) const
{
// Worst case: 1 byte of input equals 1 byte of output
return n;
diff --git a/src/utility/encoder/uuEncoder.cpp b/src/utility/encoder/uuEncoder.cpp
index 3f751d3b..0375a397 100644
--- a/src/utility/encoder/uuEncoder.cpp
+++ b/src/utility/encoder/uuEncoder.cpp
@@ -52,19 +52,19 @@ const std::vector <string> uuEncoder::getAvailableProperties() const
// This is the character encoding function to make a character printable
-static inline unsigned char UUENCODE(const unsigned long c)
+static inline byte_t UUENCODE(const unsigned int c)
{
- return static_cast <unsigned char>((c & 077) + ' ');
+ return static_cast <byte_t>((c & 077) + ' ');
}
// Single character decoding
-static inline unsigned char UUDECODE(const unsigned long c)
+static inline unsigned int UUDECODE(const unsigned int c)
{
- return static_cast <unsigned char>((c - ' ') & 077);
+ return (c - ' ') & 077;
}
-utility::stream::size_type uuEncoder::encode(utility::inputStream& in,
+size_t uuEncoder::encode(utility::inputStream& in,
utility::outputStream& out, utility::progressListener* progress)
{
in.reset(); // may not work...
@@ -72,12 +72,11 @@ utility::stream::size_type uuEncoder::encode(utility::inputStream& in,
const string propFilename = getProperties().getProperty <string>("filename", "");
const string propMode = getProperties().getProperty <string>("mode", "644");
- const string::size_type maxLineLength =
- std::min(getProperties().getProperty <string::size_type>("maxlinelength", 46),
- static_cast <string::size_type>(46));
+ const size_t maxLineLength =
+ std::min(getProperties().getProperty <size_t>("maxlinelength", 46), static_cast <size_t>(46));
- utility::stream::size_type total = 0;
- utility::stream::size_type inTotal = 0;
+ size_t total = 0;
+ size_t inTotal = 0;
// Output the prelude text ("begin [mode] [filename]")
out << "begin";
@@ -92,8 +91,8 @@ utility::stream::size_type uuEncoder::encode(utility::inputStream& in,
total += 7;
// Process the data
- utility::stream::value_type inBuffer[64];
- utility::stream::value_type outBuffer[64];
+ byte_t inBuffer[64];
+ byte_t outBuffer[64];
if (progress)
progress->start(0);
@@ -103,17 +102,17 @@ utility::stream::size_type uuEncoder::encode(utility::inputStream& in,
// Process up to 45 characters per line
std::fill(inBuffer, inBuffer + sizeof(inBuffer), 0);
- const utility::stream::size_type inLength = in.read(inBuffer, maxLineLength - 1);
+ const size_t inLength = in.read(inBuffer, maxLineLength - 1);
- outBuffer[0] = UUENCODE(inLength); // Line length
+ outBuffer[0] = UUENCODE(static_cast <unsigned int>(inLength)); // Line length
- utility::stream::size_type j = 1;
+ size_t j = 1;
- for (utility::stream::size_type i = 0 ; i < inLength ; i += 3, j += 4)
+ for (size_t i = 0 ; i < inLength ; i += 3, j += 4)
{
- 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 byte_t c1 = inBuffer[i];
+ const byte_t c2 = inBuffer[i + 1];
+ const byte_t c3 = inBuffer[i + 2];
outBuffer[j] = UUENCODE(c1 >> 2);
outBuffer[j + 1] = UUENCODE(((c1 << 4) & 060) | ((c2 >> 4) & 017));
@@ -143,17 +142,17 @@ utility::stream::size_type uuEncoder::encode(utility::inputStream& in,
}
-utility::stream::size_type uuEncoder::decode(utility::inputStream& in,
+size_t uuEncoder::decode(utility::inputStream& in,
utility::outputStream& out, utility::progressListener* progress)
{
in.reset(); // may not work...
// Process the data
- utility::stream::value_type inBuffer[64];
- utility::stream::value_type outBuffer[64];
+ byte_t inBuffer[64];
+ byte_t outBuffer[64];
- utility::stream::size_type total = 0;
- utility::stream::size_type inTotal = 0;
+ size_t total = 0;
+ size_t inTotal = 0;
bool stop = false;
@@ -165,15 +164,14 @@ utility::stream::size_type uuEncoder::decode(utility::inputStream& in,
while (!stop && !in.eof())
{
// Get the line length
- utility::stream::value_type lengthChar;
+ byte_t lengthChar;
if (in.read(&lengthChar, 1) == 0)
break;
- const utility::stream::size_type outLength = UUDECODE(lengthChar);
- const utility::stream::size_type inLength =
- std::min((outLength * 4) / 3, static_cast <utility::stream::size_type>(64));
- utility::stream::size_type inPos = 0;
+ const size_t outLength = UUDECODE(lengthChar);
+ const size_t inLength = std::min((outLength * 4) / 3, static_cast <size_t>(64));
+ size_t inPos = 0;
switch (lengthChar)
{
@@ -199,10 +197,10 @@ utility::stream::size_type uuEncoder::decode(utility::inputStream& in,
{
inTotal += 5;
- utility::stream::value_type c = 0;
+ byte_t c = 0;
- utility::stream::size_type count = 0;
- utility::stream::value_type buffer[512];
+ size_t count = 0;
+ byte_t buffer[512];
while (count < sizeof(buffer) - 1 && in.read(&c, 1) == 1)
{
@@ -229,11 +227,11 @@ utility::stream::size_type uuEncoder::decode(utility::inputStream& in,
{
buffer[count] = '\0';
- utility::stream::value_type* p = buffer;
+ byte_t* p = buffer;
while (*p && parserHelpers::isSpace(*p)) ++p;
- utility::stream::value_type* modeStart = buffer;
+ byte_t* modeStart = buffer;
while (*p && !parserHelpers::isSpace(*p)) ++p;
@@ -241,7 +239,7 @@ utility::stream::size_type uuEncoder::decode(utility::inputStream& in,
while (*p && parserHelpers::isSpace(*p)) ++p;
- utility::stream::value_type* filenameStart = buffer;
+ byte_t* filenameStart = buffer;
while (*p && !(*p == '\r' || *p == '\n')) ++p;
@@ -289,22 +287,21 @@ utility::stream::size_type uuEncoder::decode(utility::inputStream& in,
inTotal += (inLength - inPos);
// Decode data
- for (utility::stream::size_type i = 0, j = 0 ; i < inLength ; i += 4, j += 3)
+ for (size_t i = 0, j = 0 ; i < inLength ; i += 4, j += 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 byte_t c1 = inBuffer[i];
+ const byte_t c2 = inBuffer[i + 1];
+ const byte_t c3 = inBuffer[i + 2];
+ const byte_t c4 = inBuffer[i + 3];
- const utility::stream::size_type n =
- std::min(inLength - i, static_cast <utility::stream::size_type>(3));
+ const size_t n = std::min(inLength - i, static_cast <size_t>(3));
switch (n)
{
default:
- case 3: outBuffer[j + 2] = static_cast <unsigned char>(UUDECODE(c3) << 6 | UUDECODE(c4));
- case 2: outBuffer[j + 1] = static_cast <unsigned char>(UUDECODE(c2) << 4 | UUDECODE(c3) >> 2);
- case 1: outBuffer[j] = static_cast <unsigned char>(UUDECODE(c1) << 2 | UUDECODE(c2) >> 4);
+ case 3: outBuffer[j + 2] = static_cast <byte_t>(UUDECODE(c3) << 6 | UUDECODE(c4));
+ case 2: outBuffer[j + 1] = static_cast <byte_t>(UUDECODE(c2) << 4 | UUDECODE(c3) >> 2);
+ case 1: outBuffer[j] = static_cast <byte_t>(UUDECODE(c1) << 2 | UUDECODE(c2) >> 4);
case 0: break;
}
@@ -326,7 +323,7 @@ utility::stream::size_type uuEncoder::decode(utility::inputStream& in,
}
-utility::stream::size_type uuEncoder::getEncodedSize(const utility::stream::size_type n) const
+size_t uuEncoder::getEncodedSize(const size_t n) const
{
// 3 bytes of input provide 4 bytes of output.
// Count CRLF (2 bytes) for each line of 45 characters.
@@ -335,7 +332,7 @@ utility::stream::size_type uuEncoder::getEncodedSize(const utility::stream::size
}
-utility::stream::size_type uuEncoder::getDecodedSize(const utility::stream::size_type n) const
+size_t uuEncoder::getDecodedSize(const size_t n) const
{
// 4 bytes of input provide 3 bytes of output
return (n * 3) / 4;