diff --git a/src/address.cpp b/src/address.cpp
index 08a478ec..c6fa74f1 100644
--- a/src/address.cpp
+++ b/src/address.cpp
@@ -67,8 +67,8 @@ address-list = (address *("," address)) / obs-addr-list
*/
shared_ptr
address::parseNext
- (const parsingContext& ctx, const string& buffer, const string::size_type position,
- const string::size_type end, string::size_type* newPosition, bool *isLastAddressOfGroup)
+ (const parsingContext& ctx, const string& buffer, const size_t position,
+ const size_t end, size_t* newPosition, bool *isLastAddressOfGroup)
{
bool escaped = false;
bool quoted = false;
@@ -81,12 +81,12 @@ shared_ptr address::parseNext
if (isLastAddressOfGroup)
*isLastAddressOfGroup = false;
- string::size_type pos = position;
+ size_t pos = position;
while (pos < end && parserHelpers::isSpace(buffer[pos]))
++pos;
- const string::size_type start = pos;
+ const size_t start = pos;
while (!stop && pos < end)
{
diff --git a/src/addressList.cpp b/src/addressList.cpp
index 15b9227b..5c7d34ac 100644
--- a/src/addressList.cpp
+++ b/src/addressList.cpp
@@ -51,12 +51,12 @@ addressList::~addressList()
void addressList::parseImpl
- (const parsingContext& ctx, const string& buffer, const string::size_type position,
- const string::size_type end, string::size_type* newPosition)
+ (const parsingContext& ctx, const string& buffer, const size_t position,
+ const size_t end, size_t* newPosition)
{
removeAllAddresses();
- string::size_type pos = position;
+ size_t pos = position;
while (pos < end)
{
@@ -75,9 +75,9 @@ void addressList::parseImpl
void addressList::generateImpl
(const generationContext& ctx, utility::outputStream& os,
- const string::size_type curLinePos, string::size_type* newLinePos) const
+ const size_t curLinePos, size_t* newLinePos) const
{
- string::size_type pos = curLinePos;
+ size_t pos = curLinePos;
generationContext tmpCtx(ctx);
tmpCtx.setMaxLineLength(tmpCtx.getMaxLineLength() - 2);
diff --git a/src/base.cpp b/src/base.cpp
index f7985376..9f9a87be 100644
--- a/src/base.cpp
+++ b/src/base.cpp
@@ -86,7 +86,7 @@ const string libapi() { return (VMIME_API); }
// New line sequence to be used when folding header fields.
const string NEW_LINE_SEQUENCE = "\r\n ";
-const string::size_type NEW_LINE_SEQUENCE_LENGTH = 1; // space
+const size_t NEW_LINE_SEQUENCE_LENGTH = 1; // space
/** The CR-LF sequence.
*/
@@ -110,10 +110,13 @@ nullPtrType null;
// Line length limits
namespace lineLengthLimits
{
- const string::size_type infinite = std::numeric_limits ::max();
+ const size_t infinite = std::numeric_limits ::max();
}
+const size_t npos = std::numeric_limits ::max();
+
+
#ifndef VMIME_BUILDING_DOC
diff --git a/src/body.cpp b/src/body.cpp
index d24d800e..8f5401cf 100644
--- a/src/body.cpp
+++ b/src/body.cpp
@@ -55,30 +55,30 @@ body::~body()
// static
-utility::stream::size_type body::findNextBoundaryPosition
+size_t body::findNextBoundaryPosition
(shared_ptr parser, const string& boundary,
- const utility::stream::size_type position, const utility::stream::size_type end,
- utility::stream::size_type* boundaryStart, utility::stream::size_type* boundaryEnd)
+ const size_t position, const size_t end,
+ size_t* boundaryStart, size_t* boundaryEnd)
{
- utility::stream::size_type pos = position;
+ size_t pos = position;
- while (pos != utility::stream::npos && pos < end)
+ while (pos != npos && pos < end)
{
pos = parser->findNext(boundary, pos);
- if (pos == utility::stream::npos)
+ if (pos == npos)
break; // not found
if (pos != 0)
{
// Skip transport padding bytes (SPACE or HTAB), if any
- utility::stream::size_type advance = 0;
+ size_t advance = 0;
while (pos != 0)
{
parser->seek(pos - advance - 1);
- const utility::stream::value_type c = parser->peekByte();
+ const byte_t c = parser->peekByte();
if (c == ' ' || c == '\t')
++advance;
@@ -96,7 +96,7 @@ utility::stream::size_type body::findNextBoundaryPosition
{
parser->seek(pos + boundary.length());
- const utility::stream::value_type next = parser->peekByte();
+ const byte_t next = parser->peekByte();
// Boundary should be followed by a new line or a dash
if (next == '\r' || next == '\n' || next == '-')
@@ -130,9 +130,7 @@ utility::stream::size_type body::findNextBoundaryPosition
void body::parseImpl
(const parsingContext& /* ctx */,
shared_ptr parser,
- const utility::stream::size_type position,
- const utility::stream::size_type end,
- utility::stream::size_type* newPosition)
+ const size_t position, const size_t end, size_t* newPosition)
{
removeAllParts();
@@ -174,7 +172,7 @@ void body::parseImpl
{
// No "boundary" parameter specified: we can try to
// guess it by scanning the body contents...
- utility::stream::size_type pos = position;
+ size_t pos = position;
parser->seek(pos);
@@ -186,23 +184,23 @@ void body::parseImpl
{
pos = parser->findNext("\n--", position);
- if ((pos != utility::stream::npos) && (pos + 3 < end))
+ if ((pos != npos) && (pos + 3 < end))
pos += 3; // skip \n--
}
- if ((pos != utility::stream::npos) && (pos < end))
+ if ((pos != npos) && (pos < end))
{
parser->seek(pos);
// Read some bytes after boundary separator
- utility::stream::value_type buffer[256];
- const utility::stream::size_type bufferLen =
+ byte_t buffer[256];
+ const size_t bufferLen =
parser->read(buffer, std::min(end - pos, sizeof(buffer) / sizeof(buffer[0])));
buffer[sizeof(buffer) / sizeof(buffer[0]) - 1] = '\0';
// Skip transport padding bytes (SPACE or HTAB), if any
- utility::stream::size_type boundarySkip = 0;
+ size_t boundarySkip = 0;
while (boundarySkip < bufferLen && parserHelpers::isSpace(buffer[boundarySkip]))
++boundarySkip;
@@ -210,10 +208,10 @@ void body::parseImpl
// Extract boundary from buffer (stop at first CR or LF).
// We have to stop after a reasonnably long boundary length (100)
// not to take the whole body contents for a boundary...
- string::value_type boundaryBytes[100];
- string::size_type boundaryLen = 0;
+ byte_t boundaryBytes[100];
+ size_t boundaryLen = 0;
- for (string::value_type c = buffer[boundarySkip] ;
+ for (byte_t c = buffer[boundarySkip] ;
boundaryLen < bufferLen && boundaryLen < 100 && !(c == '\r' || c == '\n') ;
++boundaryLen, c = buffer[boundarySkip + boundaryLen])
{
@@ -244,18 +242,18 @@ void body::parseImpl
// This is a multi-part body
if (isMultipart && !boundary.empty())
{
- utility::stream::size_type partStart = position;
- utility::stream::size_type pos = position;
+ size_t partStart = position;
+ size_t pos = position;
bool lastPart = false;
// Find the first boundary
- utility::stream::size_type boundaryStart, boundaryEnd;
+ size_t boundaryStart, boundaryEnd;
pos = findNextBoundaryPosition(parser, boundary, pos, end, &boundaryStart, &boundaryEnd);
- for (int index = 0 ; !lastPart && (pos != utility::stream::npos) && (pos < end) ; ++index)
+ for (int index = 0 ; !lastPart && (pos != npos) && (pos < end) ; ++index)
{
- utility::stream::size_type partEnd = boundaryStart;
+ size_t partEnd = boundaryStart;
// Check whether it is the last part (boundary terminated by "--")
parser->seek(boundaryEnd);
@@ -321,7 +319,7 @@ void body::parseImpl
m_contents = make_shared ();
// Last part was not found: recover from missing boundary
- if (!lastPart && pos == utility::stream::npos)
+ if (!lastPart && pos == npos)
{
shared_ptr part = m_part->createChildPart();
@@ -364,7 +362,7 @@ void body::parseImpl
}
// Extract the (encoded) contents
- const utility::stream::size_type length = end - position;
+ const size_t length = end - position;
shared_ptr contentStream =
make_shared
@@ -416,7 +414,7 @@ text body::getActualEpilogText(const generationContext& ctx) const
void body::generateImpl
(const generationContext& ctx, utility::outputStream& os,
- const string::size_type /* curLinePos */, string::size_type* newLinePos) const
+ const size_t /* curLinePos */, size_t* newLinePos) const
{
// MIME-Multipart
if (getPartCount() != 0)
@@ -500,12 +498,12 @@ void body::generateImpl
}
-utility::stream::size_type body::getGeneratedSize(const generationContext& ctx)
+size_t body::getGeneratedSize(const generationContext& ctx)
{
// MIME-Multipart
if (getPartCount() != 0)
{
- utility::stream::size_type size = 0;
+ size_t size = 0;
// Size of parts and boundaries
for (size_t p = 0 ; p < getPartCount() ; ++p)
@@ -588,7 +586,7 @@ const string body::generateRandomBoundaryString()
this document.)
*/
- string::value_type boundary[2 + 48 + 1] = { 0 };
+ char boundary[2 + 48 + 1] = { 0 };
boundary[0] = '=';
boundary[1] = '_';
@@ -622,7 +620,7 @@ bool body::isValidBoundary(const string& boundary)
if (boundary.length() > 0 && boundary.length() < 70)
{
- const string::value_type last = *(end - 1);
+ const char last = *(end - 1);
if (!(last == ' ' || last == '\t' || last == '\n'))
{
diff --git a/src/bodyPart.cpp b/src/bodyPart.cpp
index be5b8e3a..12896f84 100644
--- a/src/bodyPart.cpp
+++ b/src/bodyPart.cpp
@@ -38,14 +38,11 @@ bodyPart::bodyPart()
void bodyPart::parseImpl
- (const parsingContext& ctx,
- shared_ptr parser,
- const utility::stream::size_type position,
- const utility::stream::size_type end,
- utility::stream::size_type* newPosition)
+ (const parsingContext& ctx, shared_ptr parser,
+ const size_t position, const size_t end, size_t* newPosition)
{
// Parse the headers
- string::size_type pos = position;
+ size_t pos = position;
m_header->parse(ctx, parser, pos, end, &pos);
// Parse the body contents
@@ -60,7 +57,7 @@ void bodyPart::parseImpl
void bodyPart::generateImpl
(const generationContext& ctx, utility::outputStream& os,
- const string::size_type /* curLinePos */, string::size_type* newLinePos) const
+ const size_t /* curLinePos */, size_t* newLinePos) const
{
m_header->generate(ctx, os);
@@ -73,7 +70,7 @@ void bodyPart::generateImpl
}
-utility::stream::size_type bodyPart::getGeneratedSize(const generationContext& ctx)
+size_t bodyPart::getGeneratedSize(const generationContext& ctx)
{
return m_header->getGeneratedSize(ctx) + 2 /* CRLF */ + m_body->getGeneratedSize(ctx);
}
diff --git a/src/charset.cpp b/src/charset.cpp
index 03c7b6a9..22bff301 100644
--- a/src/charset.cpp
+++ b/src/charset.cpp
@@ -58,8 +58,8 @@ charset::charset(const char* name)
void charset::parseImpl
- (const parsingContext& /* ctx */, const string& buffer, const string::size_type position,
- const string::size_type end, string::size_type* newPosition)
+ (const parsingContext& /* ctx */, const string& buffer, const size_t position,
+ const size_t end, size_t* newPosition)
{
m_name = utility::stringUtils::trim
(string(buffer.begin() + position, buffer.begin() + end));
@@ -77,7 +77,7 @@ void charset::parseImpl
void charset::generateImpl
(const generationContext& /* ctx */, utility::outputStream& os,
- const string::size_type curLinePos, string::size_type* newLinePos) const
+ const size_t curLinePos, size_t* newLinePos) const
{
os << m_name;
diff --git a/src/charsetConverter_iconv.cpp b/src/charsetConverter_iconv.cpp
index 0efa8445..75d7b170 100644
--- a/src/charsetConverter_iconv.cpp
+++ b/src/charsetConverter_iconv.cpp
@@ -44,11 +44,15 @@ extern "C"
// HACK: prototypes may differ depending on the compiler and/or system (the
// second parameter may or may not be 'const'). This relies on the compiler
// for choosing the right type.
- class ICONV_HACK
+
+ class ICONV_IN_TYPE
{
public:
- ICONV_HACK(const char** ptr) : m_ptr(ptr) { }
+ ICONV_IN_TYPE(const char** ptr) : m_ptr(ptr) { }
+
+ ICONV_IN_TYPE(const vmime::byte_t** ptr)
+ : m_ptr(reinterpret_cast (ptr)) { }
operator const char**() { return m_ptr; }
operator char**() { return const_cast (m_ptr); }
@@ -58,6 +62,22 @@ extern "C"
const char** m_ptr;
};
+ class ICONV_OUT_TYPE
+ {
+ public:
+
+ ICONV_OUT_TYPE(char** ptr) : m_ptr(ptr) { }
+
+ ICONV_OUT_TYPE(vmime::byte_t** ptr)
+ : m_ptr(reinterpret_cast (ptr)) { }
+
+ operator char**() { return m_ptr; }
+
+ private:
+
+ char** m_ptr;
+ };
+
#endif // VMIME_BUILDING_DOC
}
@@ -69,14 +89,14 @@ void outputInvalidChar(OUTPUT_CLASS& out, ICONV_DESC cd,
const vmime::charsetConverterOptions& opts = vmime::charsetConverterOptions())
{
const char* invalidCharIn = opts.invalidSequence.c_str();
- size_t invalidCharInLen = opts.invalidSequence.length();
+ vmime::size_t invalidCharInLen = opts.invalidSequence.length();
- char invalidCharOutBuffer[16];
- char* invalidCharOutPtr = invalidCharOutBuffer;
- size_t invalidCharOutLen = 16;
+ vmime::byte_t invalidCharOutBuffer[16];
+ vmime::byte_t* invalidCharOutPtr = invalidCharOutBuffer;
+ vmime::size_t invalidCharOutLen = 16;
- if (iconv(cd, ICONV_HACK(&invalidCharIn), &invalidCharInLen,
- &invalidCharOutPtr, &invalidCharOutLen) != static_cast (-1))
+ if (iconv(cd, ICONV_IN_TYPE(&invalidCharIn), &invalidCharInLen,
+ ICONV_OUT_TYPE(&invalidCharOutPtr), &invalidCharOutLen) != static_cast (-1))
{
out.write(invalidCharOutBuffer, 16 - invalidCharOutLen);
}
@@ -134,8 +154,8 @@ void charsetConverter_iconv::convert(utility::inputStream& in, utility::outputSt
const iconv_t cd = *static_cast (m_desc);
- char inBuffer[32768];
- char outBuffer[32768];
+ byte_t inBuffer[32768];
+ byte_t outBuffer[32768];
size_t inPos = 0;
bool prevIsInvalid = false;
@@ -147,13 +167,13 @@ void charsetConverter_iconv::convert(utility::inputStream& in, utility::outputSt
size_t inLength = static_cast (in.read(inBuffer + inPos, sizeof(inBuffer) - inPos) + inPos);
size_t outLength = sizeof(outBuffer);
- const char* inPtr = breakAfterNext ? NULL : inBuffer;
+ const byte_t* inPtr = breakAfterNext ? NULL : inBuffer;
size_t *ptrLength = breakAfterNext ? NULL : &inLength;
- char* outPtr = outBuffer;
+ byte_t* outPtr = outBuffer;
// Convert input bytes
- if (iconv(cd, ICONV_HACK(&inPtr), ptrLength,
- &outPtr, &outLength) == static_cast (-1))
+ if (iconv(cd, ICONV_IN_TYPE(&inPtr), ptrLength,
+ ICONV_OUT_TYPE(&outPtr), &outLength) == static_cast (-1))
{
// Illegal input sequence or input sequence has no equivalent
// sequence in the destination charset.
@@ -167,7 +187,7 @@ void charsetConverter_iconv::convert(utility::inputStream& in, utility::outputSt
outputInvalidChar(out, cd, m_options);
// Skip a byte and leave unconverted bytes in the input buffer
- std::copy(const_cast (inPtr + 1), inBuffer + sizeof(inBuffer), inBuffer);
+ std::copy(const_cast (inPtr + 1), inBuffer + sizeof(inBuffer), inBuffer);
inPos = inLength - 1;
}
else
@@ -176,7 +196,7 @@ void charsetConverter_iconv::convert(utility::inputStream& in, utility::outputSt
out.write(outBuffer, sizeof(outBuffer) - outLength);
// Leave unconverted bytes in the input buffer
- std::copy(const_cast (inPtr), inBuffer + sizeof(inBuffer), inBuffer);
+ std::copy(const_cast (inPtr), inBuffer + sizeof(inBuffer), inBuffer);
inPos = inLength;
if (errno != E2BIG)
@@ -271,16 +291,16 @@ outputStream& charsetFilteredOutputStream_iconv::getNextOutputStream()
}
-void charsetFilteredOutputStream_iconv::write
- (const value_type* const data, const size_type count)
+void charsetFilteredOutputStream_iconv::writeImpl
+ (const byte_t* const data, const size_t count)
{
if (m_desc == NULL)
throw exceptions::charset_conv_error("Cannot initialize converter.");
const iconv_t cd = *static_cast (m_desc);
- const value_type* curData = data;
- size_type curDataLen = count;
+ const byte_t* curData = data;
+ size_t curDataLen = count;
// If there is some unconverted bytes left, add more data from this
// chunk to see if it can now be converted.
@@ -303,7 +323,7 @@ void charsetFilteredOutputStream_iconv::write
}
// Get more data
- const size_type remaining =
+ const size_t remaining =
std::min(curDataLen, sizeof(m_unconvBuffer) - m_unconvCount);
std::copy(curData, curData + remaining, m_unconvBuffer + m_unconvCount);
@@ -316,14 +336,15 @@ void charsetFilteredOutputStream_iconv::write
return; // no more data
// Try a conversion
- const char* inPtr = m_unconvBuffer;
+ const byte_t* inPtr = m_unconvBuffer;
size_t inLength = m_unconvCount;
- char* outPtr = m_outputBuffer;
+ byte_t* outPtr = m_outputBuffer;
size_t outLength = sizeof(m_outputBuffer);
const size_t inLength0 = inLength;
- if (iconv(cd, ICONV_HACK(&inPtr), &inLength, &outPtr, &outLength) == static_cast (-1))
+ if (iconv(cd, ICONV_IN_TYPE(&inPtr), &inLength,
+ ICONV_OUT_TYPE(&outPtr), &outLength) == static_cast (-1))
{
const size_t inputConverted = inLength0 - inLength;
@@ -350,14 +371,15 @@ void charsetFilteredOutputStream_iconv::write
return; // no more data
// Now, convert the current data buffer
- const char* inPtr = curData;
+ const byte_t* inPtr = curData;
size_t inLength = std::min(curDataLen, sizeof(m_outputBuffer) / MAX_CHARACTER_WIDTH);
- char* outPtr = m_outputBuffer;
+ byte_t* outPtr = m_outputBuffer;
size_t outLength = sizeof(m_outputBuffer);
const size_t inLength0 = inLength;
- if (iconv(cd, ICONV_HACK(&inPtr), &inLength, &outPtr, &outLength) == static_cast (-1))
+ if (iconv(cd, ICONV_IN_TYPE(&inPtr), &inLength,
+ ICONV_OUT_TYPE(&outPtr), &outLength) == static_cast (-1))
{
// Write successfully converted bytes
m_stream.write(m_outputBuffer, sizeof(m_outputBuffer) - outLength);
@@ -403,14 +425,14 @@ void charsetFilteredOutputStream_iconv::flush()
while (m_unconvCount != 0)
{
// Try a conversion
- const char* inPtr = m_unconvBuffer + offset;
+ const byte_t* inPtr = m_unconvBuffer + offset;
size_t inLength = m_unconvCount;
- char* outPtr = m_outputBuffer;
+ byte_t* outPtr = m_outputBuffer;
size_t outLength = sizeof(m_outputBuffer);
const size_t inLength0 = inLength;
- if (iconv(cd, ICONV_HACK(&inPtr), &inLength, &outPtr, &outLength) == static_cast (-1))
+ if (iconv(cd, ICONV_IN_TYPE(&inPtr), &inLength, ICONV_OUT_TYPE(&outPtr), &outLength) == static_cast (-1))
{
const size_t inputConverted = inLength0 - inLength;
diff --git a/src/charsetConverter_icu.cpp b/src/charsetConverter_icu.cpp
index d967790e..3374d448 100644
--- a/src/charsetConverter_icu.cpp
+++ b/src/charsetConverter_icu.cpp
@@ -96,7 +96,7 @@ void charsetConverter_icu::convert(utility::inputStream& in, utility::outputStre
UErrorCode err = U_ZERO_ERROR;
// From buffers
- char cpInBuffer[16]; // stream data put here
+ byte_t cpInBuffer[16]; // stream data put here
size_t outSize = ucnv_getMinCharSize(m_from) * sizeof(cpInBuffer) * sizeof(UChar);
UChar* uOutBuffer = new UChar[outSize]; // Unicode chars end up here
@@ -120,10 +120,10 @@ void charsetConverter_icu::convert(utility::inputStream& in, utility::outputStre
while (!in.eof())
{
// Read input data into buffer
- size_t inLength = static_cast(in.read(cpInBuffer, sizeof(cpInBuffer)));
+ size_t inLength = in.read(cpInBuffer, sizeof(cpInBuffer));
// Beginning of read data
- const char* source = &cpInBuffer[0];
+ const char* source = reinterpret_cast (&cpInBuffer[0]);
const char* sourceLimit = source + inLength; // end + 1
UBool flush = in.eof(); // is this last run?
@@ -250,8 +250,8 @@ outputStream& charsetFilteredOutputStream_icu::getNextOutputStream()
}
-void charsetFilteredOutputStream_icu::write
- (const value_type* const data, const size_type count)
+void charsetFilteredOutputStream_icu::writeImpl
+ (const byte_t* const data, const size_t count)
{
if (m_from == NULL || m_to == NULL)
throw exceptions::charset_conv_error("Cannot initialize converters.");
@@ -264,8 +264,8 @@ void charsetFilteredOutputStream_icu::write
// Conversion loop
UErrorCode toErr = U_ZERO_ERROR;
- const char* uniSource = data;
- const char* uniSourceLimit = data + count;
+ const char* uniSource = reinterpret_cast (data);
+ const char* uniSourceLimit = uniSource + count;
do
{
diff --git a/src/charsetConverter_idna.cpp b/src/charsetConverter_idna.cpp
index a6b339b6..aea6eca7 100644
--- a/src/charsetConverter_idna.cpp
+++ b/src/charsetConverter_idna.cpp
@@ -95,8 +95,8 @@ void charsetConverter_idna::convert(const string& in, string& out)
string inUTF8;
charset::convert(in, inUTF8, m_source, vmime::charsets::UTF_8);
- const string::value_type* ch = inUTF8.c_str();
- const string::value_type* end = inUTF8.c_str() + inUTF8.length();
+ const char* ch = inUTF8.c_str();
+ const char* end = inUTF8.c_str() + inUTF8.length();
std::vector unichars;
unichars.reserve(inUTF8.length());
@@ -139,8 +139,8 @@ void charsetConverter_idna::convert(const string& in, string& out)
if (status == punycode_success)
{
- std::vector outUTF8Bytes(outputLen * 4);
- string::value_type* p = &outUTF8Bytes[0];
+ std::vector outUTF8Bytes(outputLen * 4);
+ char* p = &outUTF8Bytes[0];
for (std::vector ::const_iterator it = output.begin() ;
it != output.begin() + outputLen ; ++it)
diff --git a/src/component.cpp b/src/component.cpp
index cb013899..46ff4036 100644
--- a/src/component.cpp
+++ b/src/component.cpp
@@ -47,15 +47,15 @@ component::~component()
void component::parse
- (shared_ptr inputStream, const utility::stream::size_type length)
+ (shared_ptr inputStream, const size_t length)
{
parse(inputStream, 0, length, NULL);
}
void component::parse
- (shared_ptr inputStream, const utility::stream::size_type position,
- const utility::stream::size_type end, utility::stream::size_type* newPosition)
+ (shared_ptr inputStream, const size_t position,
+ const size_t end, size_t* newPosition)
{
parse(parsingContext::getDefaultContext(), inputStream, position, end, newPosition);
}
@@ -63,8 +63,8 @@ void component::parse
void component::parse
(const parsingContext& ctx,
- shared_ptr inputStream, const utility::stream::size_type position,
- const utility::stream::size_type end, utility::stream::size_type* newPosition)
+ shared_ptr inputStream, const size_t position,
+ const size_t end, size_t* newPosition)
{
m_parsedOffset = m_parsedLength = 0;
@@ -109,8 +109,8 @@ void component::parse(const parsingContext& ctx, const string& buffer)
void component::parse
- (const string& buffer, const string::size_type position,
- const string::size_type end, string::size_type* newPosition)
+ (const string& buffer, const size_t position,
+ const size_t end, size_t* newPosition)
{
m_parsedOffset = m_parsedLength = 0;
@@ -120,8 +120,8 @@ void component::parse
void component::parse
(const parsingContext& ctx,
- const string& buffer, const string::size_type position,
- const string::size_type end, string::size_type* newPosition)
+ const string& buffer, const size_t position,
+ const size_t end, size_t* newPosition)
{
m_parsedOffset = m_parsedLength = 0;
@@ -129,7 +129,7 @@ void component::parse
}
-void component::offsetParsedBounds(const utility::stream::size_type offset)
+void component::offsetParsedBounds(const size_t offset)
{
// Offset parsed bounds of this component
if (m_parsedLength != 0)
@@ -145,8 +145,7 @@ void component::offsetParsedBounds(const utility::stream::size_type offset)
void component::parseImpl
(const parsingContext& ctx, shared_ptr parser,
- const utility::stream::size_type position,
- const utility::stream::size_type end, utility::stream::size_type* newPosition)
+ const size_t position, const size_t end, size_t* newPosition)
{
// This is the default implementation for parsing from an input stream:
// actually, we extract the substring and use the "parse from string" implementation
@@ -163,8 +162,8 @@ void component::parseImpl
void component::parseImpl
- (const parsingContext& ctx, const string& buffer, const string::size_type position,
- const string::size_type end, string::size_type* newPosition)
+ (const parsingContext& ctx, const string& buffer, const size_t position,
+ const size_t end, size_t* newPosition)
{
// This is the default implementation for parsing from a string:
// actually, we encapsulate the string buffer in an input stream, then use
@@ -179,8 +178,8 @@ void component::parseImpl
}
-const string component::generate(const string::size_type maxLineLength,
- const string::size_type curLinePos) const
+const string component::generate
+ (const size_t maxLineLength, const size_t curLinePos) const
{
std::ostringstream oss;
utility::outputStreamAdapter adapter(oss);
@@ -195,9 +194,7 @@ const string component::generate(const string::size_type maxLineLength,
void component::generate
- (utility::outputStream& os,
- const string::size_type curLinePos,
- string::size_type* newLinePos) const
+ (utility::outputStream& os, const size_t curLinePos, size_t* newLinePos) const
{
generateImpl(generationContext::getDefaultContext(),
os, curLinePos, newLinePos);
@@ -205,38 +202,36 @@ void component::generate
void component::generate
- (const generationContext& ctx,
- utility::outputStream& outputStream,
- const string::size_type curLinePos,
- string::size_type* newLinePos) const
+ (const generationContext& ctx, utility::outputStream& outputStream,
+ const size_t curLinePos, size_t* newLinePos) const
{
generateImpl(ctx, outputStream, curLinePos, newLinePos);
}
-string::size_type component::getParsedOffset() const
+size_t component::getParsedOffset() const
{
return (m_parsedOffset);
}
-string::size_type component::getParsedLength() const
+size_t component::getParsedLength() const
{
return (m_parsedLength);
}
-void component::setParsedBounds(const string::size_type start, const string::size_type end)
+void component::setParsedBounds(const size_t start, const size_t end)
{
m_parsedOffset = start;
m_parsedLength = end - start;
}
-utility::stream::size_type component::getGeneratedSize(const generationContext& ctx)
+size_t component::getGeneratedSize(const generationContext& ctx)
{
std::vector > children = getChildComponents();
- utility::stream::size_type totalSize = 0;
+ size_t totalSize = 0;
for (std::vector >::iterator it = children.begin() ; it != children.end() ; ++it)
totalSize += (*it)->getGeneratedSize(ctx);
diff --git a/src/constants.cpp b/src/constants.cpp
index 551d0a18..3b0a54c0 100644
--- a/src/constants.cpp
+++ b/src/constants.cpp
@@ -32,205 +32,205 @@ namespace vmime
namespace mediaTypes
{
// Types
- const string::value_type* const TEXT = "text";
- const string::value_type* const MULTIPART = "multipart";
- const string::value_type* const MESSAGE = "message";
- const string::value_type* const APPLICATION = "application";
- const string::value_type* const IMAGE = "image";
- const string::value_type* const AUDIO = "audio";
- const string::value_type* const VIDEO = "video";
+ const char* const TEXT = "text";
+ const char* const MULTIPART = "multipart";
+ const char* const MESSAGE = "message";
+ const char* const APPLICATION = "application";
+ const char* const IMAGE = "image";
+ const char* const AUDIO = "audio";
+ const char* const VIDEO = "video";
// Sub-types
- const string::value_type* const TEXT_PLAIN = "plain";
- const string::value_type* const TEXT_HTML = "html";
- const string::value_type* const TEXT_RICHTEXT = "richtext";
- const string::value_type* const TEXT_ENRICHED = "enriched";
- const string::value_type* const TEXT_RFC822_HEADERS = "rfc822-headers"; // RFC-1892
- const string::value_type* const TEXT_DIRECTORY = "directory"; // RFC-2426
+ const char* const TEXT_PLAIN = "plain";
+ const char* const TEXT_HTML = "html";
+ const char* const TEXT_RICHTEXT = "richtext";
+ const char* const TEXT_ENRICHED = "enriched";
+ const char* const TEXT_RFC822_HEADERS = "rfc822-headers"; // RFC-1892
+ const char* const TEXT_DIRECTORY = "directory"; // RFC-2426
- const string::value_type* const MULTIPART_MIXED = "mixed";
- const string::value_type* const MULTIPART_RELATED = "related";
- const string::value_type* const MULTIPART_ALTERNATIVE = "alternative";
- const string::value_type* const MULTIPART_PARALLEL = "parallel";
- const string::value_type* const MULTIPART_DIGEST = "digest";
- const string::value_type* const MULTIPART_REPORT = "report"; // RFC-1892
+ const char* const MULTIPART_MIXED = "mixed";
+ const char* const MULTIPART_RELATED = "related";
+ const char* const MULTIPART_ALTERNATIVE = "alternative";
+ const char* const MULTIPART_PARALLEL = "parallel";
+ const char* const MULTIPART_DIGEST = "digest";
+ const char* const MULTIPART_REPORT = "report"; // RFC-1892
- const string::value_type* const MESSAGE_RFC822 = "rfc822";
- const string::value_type* const MESSAGE_PARTIAL = "partial";
- const string::value_type* const MESSAGE_EXTERNAL_BODY = "external-body";
- const string::value_type* const MESSAGE_DISPOSITION_NOTIFICATION = "disposition-notification";
+ const char* const MESSAGE_RFC822 = "rfc822";
+ const char* const MESSAGE_PARTIAL = "partial";
+ const char* const MESSAGE_EXTERNAL_BODY = "external-body";
+ const char* const MESSAGE_DISPOSITION_NOTIFICATION = "disposition-notification";
- const string::value_type* const APPLICATION_OCTET_STREAM = "octet-stream";
+ const char* const APPLICATION_OCTET_STREAM = "octet-stream";
- const string::value_type* const IMAGE_JPEG = "jpeg";
- const string::value_type* const IMAGE_GIF = "gif";
+ const char* const IMAGE_JPEG = "jpeg";
+ const char* const IMAGE_GIF = "gif";
- const string::value_type* const AUDIO_BASIC = "basic";
+ const char* const AUDIO_BASIC = "basic";
- const string::value_type* const VIDEO_MPEG = "mpeg";
+ const char* const VIDEO_MPEG = "mpeg";
}
// Encoding types
namespace encodingTypes
{
- const string::value_type* const SEVEN_BIT = "7bit";
- const string::value_type* const EIGHT_BIT = "8bit";
- const string::value_type* const BASE64 = "base64";
- const string::value_type* const QUOTED_PRINTABLE = "quoted-printable";
- const string::value_type* const BINARY = "binary";
- const string::value_type* const UUENCODE = "uuencode";
+ const char* const SEVEN_BIT = "7bit";
+ const char* const EIGHT_BIT = "8bit";
+ const char* const BASE64 = "base64";
+ const char* const QUOTED_PRINTABLE = "quoted-printable";
+ const char* const BINARY = "binary";
+ const char* const UUENCODE = "uuencode";
}
// Content disposition types
namespace contentDispositionTypes
{
- const string::value_type* const INLINE = "inline";
- const string::value_type* const ATTACHMENT = "attachment";
+ const char* const INLINE = "inline";
+ const char* const ATTACHMENT = "attachment";
}
// Charsets
namespace charsets
{
- const string::value_type* const ISO8859_1 = "iso-8859-1";
- const string::value_type* const ISO8859_2 = "iso-8859-2";
- const string::value_type* const ISO8859_3 = "iso-8859-3";
- const string::value_type* const ISO8859_4 = "iso-8859-4";
- const string::value_type* const ISO8859_5 = "iso-8859-5";
- const string::value_type* const ISO8859_6 = "iso-8859-6";
- const string::value_type* const ISO8859_7 = "iso-8859-7";
- const string::value_type* const ISO8859_8 = "iso-8859-8";
- const string::value_type* const ISO8859_9 = "iso-8859-9";
- const string::value_type* const ISO8859_10 = "iso-8859-10";
- const string::value_type* const ISO8859_13 = "iso-8859-13";
- const string::value_type* const ISO8859_14 = "iso-8859-14";
- const string::value_type* const ISO8859_15 = "iso-8859-15";
- const string::value_type* const ISO8859_16 = "iso-8859-16";
+ const char* const ISO8859_1 = "iso-8859-1";
+ const char* const ISO8859_2 = "iso-8859-2";
+ const char* const ISO8859_3 = "iso-8859-3";
+ const char* const ISO8859_4 = "iso-8859-4";
+ const char* const ISO8859_5 = "iso-8859-5";
+ const char* const ISO8859_6 = "iso-8859-6";
+ const char* const ISO8859_7 = "iso-8859-7";
+ const char* const ISO8859_8 = "iso-8859-8";
+ const char* const ISO8859_9 = "iso-8859-9";
+ const char* const ISO8859_10 = "iso-8859-10";
+ const char* const ISO8859_13 = "iso-8859-13";
+ const char* const ISO8859_14 = "iso-8859-14";
+ const char* const ISO8859_15 = "iso-8859-15";
+ const char* const ISO8859_16 = "iso-8859-16";
- const string::value_type* const CP_437 = "cp437";
- const string::value_type* const CP_737 = "cp737";
- const string::value_type* const CP_775 = "cp775";
- const string::value_type* const CP_850 = "cp850";
- const string::value_type* const CP_852 = "cp852";
- const string::value_type* const CP_853 = "cp853";
- const string::value_type* const CP_855 = "cp855";
- const string::value_type* const CP_857 = "cp857";
- const string::value_type* const CP_858 = "cp858";
- const string::value_type* const CP_860 = "cp860";
- const string::value_type* const CP_861 = "cp861";
- const string::value_type* const CP_862 = "cp862";
- const string::value_type* const CP_863 = "cp863";
- const string::value_type* const CP_864 = "cp864";
- const string::value_type* const CP_865 = "cp865";
- const string::value_type* const CP_866 = "cp866";
- const string::value_type* const CP_869 = "cp869";
- const string::value_type* const CP_874 = "cp874";
- const string::value_type* const CP_1125 = "cp1125";
- const string::value_type* const CP_1250 = "cp1250";
- const string::value_type* const CP_1251 = "cp1251";
- const string::value_type* const CP_1252 = "cp1252";
- const string::value_type* const CP_1253 = "cp1253";
- const string::value_type* const CP_1254 = "cp1254";
- const string::value_type* const CP_1255 = "cp1255";
- const string::value_type* const CP_1256 = "cp1256";
- const string::value_type* const CP_1257 = "cp1257";
+ const char* const CP_437 = "cp437";
+ const char* const CP_737 = "cp737";
+ const char* const CP_775 = "cp775";
+ const char* const CP_850 = "cp850";
+ const char* const CP_852 = "cp852";
+ const char* const CP_853 = "cp853";
+ const char* const CP_855 = "cp855";
+ const char* const CP_857 = "cp857";
+ const char* const CP_858 = "cp858";
+ const char* const CP_860 = "cp860";
+ const char* const CP_861 = "cp861";
+ const char* const CP_862 = "cp862";
+ const char* const CP_863 = "cp863";
+ const char* const CP_864 = "cp864";
+ const char* const CP_865 = "cp865";
+ const char* const CP_866 = "cp866";
+ const char* const CP_869 = "cp869";
+ const char* const CP_874 = "cp874";
+ const char* const CP_1125 = "cp1125";
+ const char* const CP_1250 = "cp1250";
+ const char* const CP_1251 = "cp1251";
+ const char* const CP_1252 = "cp1252";
+ const char* const CP_1253 = "cp1253";
+ const char* const CP_1254 = "cp1254";
+ const char* const CP_1255 = "cp1255";
+ const char* const CP_1256 = "cp1256";
+ const char* const CP_1257 = "cp1257";
- const string::value_type* const US_ASCII = "us-ascii";
+ const char* const US_ASCII = "us-ascii";
- const string::value_type* const UTF_7 = "utf-7";
- const string::value_type* const UTF_8 = "utf-8";
- const string::value_type* const UTF_16 = "utf-16";
- const string::value_type* const UTF_32 = "utf-32";
+ const char* const UTF_7 = "utf-7";
+ const char* const UTF_8 = "utf-8";
+ const char* const UTF_16 = "utf-16";
+ const char* const UTF_32 = "utf-32";
- const string::value_type* const WINDOWS_1250 = "windows-1250";
- const string::value_type* const WINDOWS_1251 = "windows-1251";
- const string::value_type* const WINDOWS_1252 = "windows-1252";
- const string::value_type* const WINDOWS_1253 = "windows-1253";
- const string::value_type* const WINDOWS_1254 = "windows-1254";
- const string::value_type* const WINDOWS_1255 = "windows-1255";
- const string::value_type* const WINDOWS_1256 = "windows-1256";
- const string::value_type* const WINDOWS_1257 = "windows-1257";
- const string::value_type* const WINDOWS_1258 = "windows-1258";
+ const char* const WINDOWS_1250 = "windows-1250";
+ const char* const WINDOWS_1251 = "windows-1251";
+ const char* const WINDOWS_1252 = "windows-1252";
+ const char* const WINDOWS_1253 = "windows-1253";
+ const char* const WINDOWS_1254 = "windows-1254";
+ const char* const WINDOWS_1255 = "windows-1255";
+ const char* const WINDOWS_1256 = "windows-1256";
+ const char* const WINDOWS_1257 = "windows-1257";
+ const char* const WINDOWS_1258 = "windows-1258";
- const string::value_type* const IDNA = "idna";
+ const char* const IDNA = "idna";
}
// Fields
namespace fields
{
- const string::value_type* const RECEIVED = "Received";
- const string::value_type* const FROM = "From";
- const string::value_type* const SENDER = "Sender";
- const string::value_type* const REPLY_TO = "Reply-To";
- const string::value_type* const TO = "To";
- const string::value_type* const CC = "Cc";
- const string::value_type* const BCC = "Bcc";
- const string::value_type* const DATE = "Date";
- const string::value_type* const SUBJECT = "Subject";
- const string::value_type* const ORGANIZATION = "Organization";
- const string::value_type* const USER_AGENT = "User-Agent";
- const string::value_type* const DELIVERED_TO = "Delivered-To";
- const string::value_type* const RETURN_PATH = "Return-Path";
- const string::value_type* const MIME_VERSION = "Mime-Version";
- const string::value_type* const MESSAGE_ID = "Message-Id";
- const string::value_type* const CONTENT_TYPE = "Content-Type";
- const string::value_type* const CONTENT_TRANSFER_ENCODING = "Content-Transfer-Encoding";
- const string::value_type* const CONTENT_DESCRIPTION = "Content-Description";
- const string::value_type* const CONTENT_DISPOSITION = "Content-Disposition";
- const string::value_type* const CONTENT_ID = "Content-Id";
- const string::value_type* const CONTENT_LOCATION = "Content-Location";
- const string::value_type* const IN_REPLY_TO = "In-Reply-To";
- const string::value_type* const REFERENCES = "References";
+ const char* const RECEIVED = "Received";
+ const char* const FROM = "From";
+ const char* const SENDER = "Sender";
+ const char* const REPLY_TO = "Reply-To";
+ const char* const TO = "To";
+ const char* const CC = "Cc";
+ const char* const BCC = "Bcc";
+ const char* const DATE = "Date";
+ const char* const SUBJECT = "Subject";
+ const char* const ORGANIZATION = "Organization";
+ const char* const USER_AGENT = "User-Agent";
+ const char* const DELIVERED_TO = "Delivered-To";
+ const char* const RETURN_PATH = "Return-Path";
+ const char* const MIME_VERSION = "Mime-Version";
+ const char* const MESSAGE_ID = "Message-Id";
+ const char* const CONTENT_TYPE = "Content-Type";
+ const char* const CONTENT_TRANSFER_ENCODING = "Content-Transfer-Encoding";
+ const char* const CONTENT_DESCRIPTION = "Content-Description";
+ const char* const CONTENT_DISPOSITION = "Content-Disposition";
+ const char* const CONTENT_ID = "Content-Id";
+ const char* const CONTENT_LOCATION = "Content-Location";
+ const char* const IN_REPLY_TO = "In-Reply-To";
+ const char* const REFERENCES = "References";
- const string::value_type* const X_MAILER = "X-Mailer";
- const string::value_type* const X_PRIORITY = "X-Priority";
+ const char* const X_MAILER = "X-Mailer";
+ const char* const X_PRIORITY = "X-Priority";
// RFC-3798: Message Disposition
- const string::value_type* const ORIGINAL_MESSAGE_ID = "Original-Message-ID";
- const string::value_type* const DISPOSITION_NOTIFICATION_TO = "Disposition-Notification-To";
- const string::value_type* const DISPOSITION_NOTIFICATION_OPTIONS = "Disposition-Notification-Options";
- const string::value_type* const DISPOSITION = "Disposition";
- const string::value_type* const FAILURE = "Failure";
- const string::value_type* const ERROR = "Error";
- const string::value_type* const WARNING = "Warning";
- const string::value_type* const ORIGINAL_RECIPIENT = "Original-Recipient";
- const string::value_type* const FINAL_RECIPIENT = "Final-Recipient";
- const string::value_type* const REPORTING_UA = "Reporting-UA";
- const string::value_type* const MDN_GATEWAY = "MDN-Gateway";
+ const char* const ORIGINAL_MESSAGE_ID = "Original-Message-ID";
+ const char* const DISPOSITION_NOTIFICATION_TO = "Disposition-Notification-To";
+ const char* const DISPOSITION_NOTIFICATION_OPTIONS = "Disposition-Notification-Options";
+ const char* const DISPOSITION = "Disposition";
+ const char* const FAILURE = "Failure";
+ const char* const ERROR = "Error";
+ const char* const WARNING = "Warning";
+ const char* const ORIGINAL_RECIPIENT = "Original-Recipient";
+ const char* const FINAL_RECIPIENT = "Final-Recipient";
+ const char* const REPORTING_UA = "Reporting-UA";
+ const char* const MDN_GATEWAY = "MDN-Gateway";
}
// Constants for disposition action modes (RFC-3978).
namespace dispositionActionModes
{
- const string::value_type* const MANUAL = "manual";
- const string::value_type* const AUTOMATIC = "automatic";
+ const char* const MANUAL = "manual";
+ const char* const AUTOMATIC = "automatic";
}
// Constants for disposition sending modes (RFC-3798).
namespace dispositionSendingModes
{
- const string::value_type* const SENT_MANUALLY = "MDN-sent-manually";
- const string::value_type* const SENT_AUTOMATICALLY ="MDN-sent-automatically";
+ const char* const SENT_MANUALLY = "MDN-sent-manually";
+ const char* const SENT_AUTOMATICALLY ="MDN-sent-automatically";
}
// Constants for disposition types (RFC-3798).
namespace dispositionTypes
{
- const string::value_type* const DISPLAYED = "displayed";
- const string::value_type* const DELETED = "deleted";
+ const char* const DISPLAYED = "displayed";
+ const char* const DELETED = "deleted";
}
// Constants for disposition modifiers (RFC-3798).
namespace dispositionModifiers
{
- const string::value_type* const ERROR = "error";
+ const char* const ERROR = "error";
}
diff --git a/src/contentDisposition.cpp b/src/contentDisposition.cpp
index aa9b4fe3..3cf92e27 100644
--- a/src/contentDisposition.cpp
+++ b/src/contentDisposition.cpp
@@ -48,8 +48,8 @@ contentDisposition::contentDisposition(const contentDisposition& type)
void contentDisposition::parseImpl
- (const parsingContext& /* ctx */, const string& buffer, const string::size_type position,
- const string::size_type end, string::size_type* newPosition)
+ (const parsingContext& /* ctx */, const string& buffer, const size_t position,
+ const size_t end, size_t* newPosition)
{
m_name = utility::stringUtils::trim(utility::stringUtils::toLower
(string(buffer.begin() + position, buffer.begin() + end)));
@@ -63,7 +63,7 @@ void contentDisposition::parseImpl
void contentDisposition::generateImpl
(const generationContext& /* ctx */, utility::outputStream& os,
- const string::size_type curLinePos, string::size_type* newLinePos) const
+ const size_t curLinePos, size_t* newLinePos) const
{
os << m_name;
diff --git a/src/dateTime.cpp b/src/dateTime.cpp
index 2c045e6d..eca8e785 100644
--- a/src/dateTime.cpp
+++ b/src/dateTime.cpp
@@ -69,11 +69,11 @@ zone = "UT" / "GMT" ; Universal Time
void datetime::parseImpl
- (const parsingContext& /* ctx */, const string& buffer, const string::size_type position,
- const string::size_type end, string::size_type* newPosition)
+ (const parsingContext& /* ctx */, const string& buffer, const size_t position,
+ const size_t end, size_t* newPosition)
{
- const string::value_type* const pend = buffer.data() + end;
- const string::value_type* p = buffer.data() + position;
+ const char* const pend = buffer.data() + end;
+ const char* p = buffer.data() + position;
// Parse the date and time value
while (p < pend && parserHelpers::isSpace(*p)) ++p;
@@ -592,11 +592,11 @@ void datetime::parseImpl
void datetime::generateImpl
(const generationContext& /* ctx */, utility::outputStream& os,
- const string::size_type curLinePos, string::size_type* newLinePos) const
+ const size_t curLinePos, size_t* newLinePos) const
{
- static const string::value_type* dayNames[] =
+ static const char* dayNames[] =
{ "Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat" };
- static const string::value_type* monthNames[] =
+ static const char* monthNames[] =
{ "Jan", "Feb", "Mar", "Apr", "May", "Jun",
"Jul", "Aug", "Sep", "Oct", "Nov", "Dec" };
diff --git a/src/disposition.cpp b/src/disposition.cpp
index 08e34afc..352d3251 100644
--- a/src/disposition.cpp
+++ b/src/disposition.cpp
@@ -172,22 +172,22 @@ const std::vector disposition::getModifierList() const
void disposition::parseImpl
- (const parsingContext& /* ctx */, const string& buffer, const string::size_type position,
- const string::size_type end, string::size_type* newPosition)
+ (const parsingContext& /* ctx */, const string& buffer, const size_t position,
+ const size_t end, size_t* newPosition)
{
// disposition-mode ";" disposition-type
// [ "/" disposition-modifier *( "," disposition-modifier ) ]
//
// disposition-mode = action-mode "/" sending-mode
- string::size_type pos = position;
+ size_t pos = position;
while (pos < end && parserHelpers::isSpace(buffer[pos]))
++pos;
// -- disposition-mode
- const string::size_type modeStart = pos;
- string::size_type modeEnd = pos;
+ const size_t modeStart = pos;
+ size_t modeEnd = pos;
while (pos < end && buffer[pos] != ';')
{
@@ -199,7 +199,7 @@ void disposition::parseImpl
--modeEnd;
const string mode = string(buffer.begin() + modeStart, buffer.begin() + modeEnd);
- const string::size_type slash = mode.find('/');
+ const size_t slash = mode.find('/');
if (slash != string::npos)
{
@@ -222,8 +222,8 @@ void disposition::parseImpl
++pos;
// -- disposition-type
- const string::size_type typeStart = pos;
- string::size_type typeEnd = pos;
+ const size_t typeStart = pos;
+ size_t typeEnd = pos;
while (pos < end && buffer[pos] != '/')
{
@@ -248,8 +248,8 @@ void disposition::parseImpl
while (pos < end && parserHelpers::isSpace(buffer[pos]))
++pos;
- const string::size_type modifierStart = pos;
- string::size_type modifierEnd = pos;
+ const size_t modifierStart = pos;
+ size_t modifierEnd = pos;
while (pos < end && buffer[pos] != ',')
{
@@ -279,9 +279,9 @@ void disposition::parseImpl
void disposition::generateImpl
(const generationContext& ctx, utility::outputStream& os,
- const string::size_type curLinePos, string::size_type* newLinePos) const
+ const size_t curLinePos, size_t* newLinePos) const
{
- string::size_type pos = curLinePos;
+ size_t pos = curLinePos;
const string actionMode = (m_actionMode.empty() ? "automatic-action" : m_actionMode);
const string sendingMode = (m_sendingMode.empty() ? "MDN-sent-automatically" : m_sendingMode);
diff --git a/src/emailAddress.cpp b/src/emailAddress.cpp
index eb76e16d..e185b17b 100644
--- a/src/emailAddress.cpp
+++ b/src/emailAddress.cpp
@@ -72,12 +72,12 @@ emailAddress::emailAddress(const word& localName, const word& domainName)
void emailAddress::parseImpl
- (const parsingContext& /* ctx */, const string& buffer, const string::size_type position,
- const string::size_type end, string::size_type* newPosition)
+ (const parsingContext& /* ctx */, const string& buffer, const size_t position,
+ const size_t end, size_t* newPosition)
{
- const string::value_type* const pend = buffer.data() + end;
- const string::value_type* const pstart = buffer.data() + position;
- const string::value_type* p = pstart;
+ const char* const pend = buffer.data() + end;
+ const char* const pstart = buffer.data() + position;
+ const char* p = pstart;
enum ParserStates
{
@@ -104,7 +104,7 @@ void emailAddress::parseImpl
while (p < pend && !stop)
{
- const string::value_type c = *p;
+ const char c = *p;
if ((localPart.str().length() + domainPart.str().length()) >= 256)
{
@@ -371,9 +371,9 @@ void emailAddress::parseImpl
static const string domainNameToIDNA(const string& domainName)
{
std::ostringstream idnaDomain;
- string::size_type p = 0;
+ size_t p = 0;
- for (string::size_type n = domainName.find('.', p) ;
+ for (size_t n = domainName.find('.', p) ;
(n = domainName.find('.', p)) != string::npos ; p = n + 1)
{
string idnaPart;
@@ -398,7 +398,7 @@ static const string domainNameToIDNA(const string& domainName)
void emailAddress::generateImpl
(const generationContext& ctx, utility::outputStream& os,
- const string::size_type curLinePos, string::size_type* newLinePos) const
+ const size_t curLinePos, size_t* newLinePos) const
{
string localPart, domainPart;
diff --git a/src/emptyContentHandler.cpp b/src/emptyContentHandler.cpp
index f6cdee95..e0f191f3 100644
--- a/src/emptyContentHandler.cpp
+++ b/src/emptyContentHandler.cpp
@@ -40,7 +40,7 @@ shared_ptr emptyContentHandler::clone() const
void emptyContentHandler::generate(utility::outputStream& /* os */, const vmime::encoding& /* enc */,
- const string::size_type /* maxLineLength */) const
+ const size_t /* maxLineLength */) const
{
// Nothing to do.
}
@@ -72,7 +72,7 @@ void emptyContentHandler::extractRaw(utility::outputStream& /* os */,
}
-string::size_type emptyContentHandler::getLength() const
+size_t emptyContentHandler::getLength() const
{
return (0);
}
diff --git a/src/encoding.cpp b/src/encoding.cpp
index 317d441f..26922395 100644
--- a/src/encoding.cpp
+++ b/src/encoding.cpp
@@ -62,8 +62,8 @@ encoding::encoding(const encoding& enc)
void encoding::parseImpl
- (const parsingContext& /* ctx */, const string& buffer, const string::size_type position,
- const string::size_type end, string::size_type* newPosition)
+ (const parsingContext& /* ctx */, const string& buffer, const size_t position,
+ const size_t end, size_t* newPosition)
{
m_usage = USAGE_UNKNOWN;
@@ -83,7 +83,7 @@ void encoding::parseImpl
void encoding::generateImpl
(const generationContext& /* ctx */, utility::outputStream& os,
- const string::size_type curLinePos, string::size_type* newLinePos) const
+ const size_t curLinePos, size_t* newLinePos) const
{
os << m_name;
@@ -146,8 +146,8 @@ const encoding encoding::decideImpl
// "lineLengthLimits::convenient" characters (7-bit requires that)
string::const_iterator p = begin;
- const string::size_type maxLen = lineLengthLimits::convenient;
- string::size_type len = 0;
+ const size_t maxLen = lineLengthLimits::convenient;
+ size_t len = 0;
for ( ; p != end && len <= maxLen ; )
{
diff --git a/src/fileAttachment.cpp b/src/fileAttachment.cpp
index 1db1a1a8..25a97fcc 100644
--- a/src/fileAttachment.cpp
+++ b/src/fileAttachment.cpp
@@ -212,8 +212,8 @@ const datetime& fileAttachment::fileInfo::getReadDate() const { return (*m_readD
void fileAttachment::fileInfo::setReadDate(const datetime& date) { if (m_readDate) { *m_readDate = date; } else { m_readDate = new datetime(date); } }
bool fileAttachment::fileInfo::hasSize() const { return (m_size != NULL); }
-utility::stream::size_type fileAttachment::fileInfo::getSize() const { return (*m_size); }
-void fileAttachment::fileInfo::setSize(const utility::stream::size_type size) { if (m_size) { *m_size = size; } else { m_size = new utility::stream::size_type(size); } }
+size_t fileAttachment::fileInfo::getSize() const { return (*m_size); }
+void fileAttachment::fileInfo::setSize(const size_t size) { if (m_size) { *m_size = size; } else { m_size = new size_t(size); } }
} // vmime
diff --git a/src/generationContext.cpp b/src/generationContext.cpp
index 0f19e623..e9662883 100644
--- a/src/generationContext.cpp
+++ b/src/generationContext.cpp
@@ -53,13 +53,13 @@ generationContext& generationContext::getDefaultContext()
}
-string::size_type generationContext::getMaxLineLength() const
+size_t generationContext::getMaxLineLength() const
{
return m_maxLineLength;
}
-void generationContext::setMaxLineLength(const string::size_type maxLineLength)
+void generationContext::setMaxLineLength(const size_t maxLineLength)
{
m_maxLineLength = maxLineLength;
}
diff --git a/src/header.cpp b/src/header.cpp
index 2dc07b8f..34b5fa6e 100644
--- a/src/header.cpp
+++ b/src/header.cpp
@@ -63,10 +63,10 @@ field-body-contents =
*/
void header::parseImpl
- (const parsingContext& ctx, const string& buffer, const string::size_type position,
- const string::size_type end, string::size_type* newPosition)
+ (const parsingContext& ctx, const string& buffer, const size_t position,
+ const size_t end, size_t* newPosition)
{
- string::size_type pos = position;
+ size_t pos = position;
removeAllFields();
@@ -87,7 +87,7 @@ void header::parseImpl
void header::generateImpl
(const generationContext& ctx, utility::outputStream& os,
- const string::size_type /* curLinePos */, string::size_type* newLinePos) const
+ const size_t /* curLinePos */, size_t* newLinePos) const
{
// Generate the fields
for (std::vector >::const_iterator it = m_fields.begin() ;
@@ -102,7 +102,7 @@ void header::generateImpl
}
-utility::stream::size_type header::getGeneratedSize(const generationContext& ctx)
+size_t header::getGeneratedSize(const generationContext& ctx)
{
return component::getGeneratedSize(ctx) + 2 * m_fields.size() /* CRLF */;
}
diff --git a/src/headerField.cpp b/src/headerField.cpp
index c6baa32e..f4c6187e 100644
--- a/src/headerField.cpp
+++ b/src/headerField.cpp
@@ -76,10 +76,10 @@ headerField& headerField::operator=(const headerField& other)
shared_ptr headerField::parseNext
- (const parsingContext& ctx, const string& buffer, const string::size_type position,
- const string::size_type end, string::size_type* newPosition)
+ (const parsingContext& ctx, const string& buffer, const size_t position,
+ const size_t end, size_t* newPosition)
{
- string::size_type pos = position;
+ size_t pos = position;
while (pos < end)
{
@@ -106,12 +106,12 @@ shared_ptr headerField::parseNext
// This line may be a field description
if (!parserHelpers::isSpace(c))
{
- const string::size_type nameStart = pos; // remember the start position of the line
+ const size_t nameStart = pos; // remember the start position of the line
while (pos < end && (buffer[pos] != ':' && !parserHelpers::isSpace(buffer[pos])))
++pos;
- const string::size_type nameEnd = pos;
+ const size_t nameEnd = pos;
while (pos < end && (buffer[pos] == ' ' || buffer[pos] == '\t'))
++pos;
@@ -141,8 +141,8 @@ shared_ptr headerField::parseNext
while (pos < end && (buffer[pos] == ' ' || buffer[pos] == '\t'))
++pos;
- const string::size_type contentsStart = pos;
- string::size_type contentsEnd = 0;
+ const size_t contentsStart = pos;
+ size_t contentsEnd = 0;
// Extract the field value
while (pos < end)
@@ -280,8 +280,8 @@ shared_ptr headerField::parseNext
void headerField::parseImpl
- (const parsingContext& ctx, const string& buffer, const string::size_type position,
- const string::size_type end, string::size_type* newPosition)
+ (const parsingContext& ctx, const string& buffer, const size_t position,
+ const size_t end, size_t* newPosition)
{
m_value->parse(ctx, buffer, position, end, newPosition);
}
@@ -289,7 +289,7 @@ void headerField::parseImpl
void headerField::generateImpl
(const generationContext& ctx, utility::outputStream& os,
- const string::size_type curLinePos, string::size_type* newLinePos) const
+ const size_t curLinePos, size_t* newLinePos) const
{
os << m_name + ": ";
@@ -297,7 +297,7 @@ void headerField::generateImpl
}
-utility::stream::size_type headerField::getGeneratedSize(const generationContext& ctx)
+size_t headerField::getGeneratedSize(const generationContext& ctx)
{
return m_name.length() + 2 /* ": " */ + m_value->getGeneratedSize(ctx);
}
diff --git a/src/headerFieldValue.cpp b/src/headerFieldValue.cpp
index 19daf9f2..a93e0061 100644
--- a/src/headerFieldValue.cpp
+++ b/src/headerFieldValue.cpp
@@ -30,7 +30,7 @@ namespace vmime
{
-utility::stream::size_type headerFieldValue::getGeneratedSize(const generationContext& ctx)
+size_t headerFieldValue::getGeneratedSize(const generationContext& ctx)
{
std::ostringstream oss;
utility::outputStreamAdapter osa(oss);
diff --git a/src/mailbox.cpp b/src/mailbox.cpp
index a38aada0..7c6d5e3b 100644
--- a/src/mailbox.cpp
+++ b/src/mailbox.cpp
@@ -67,12 +67,12 @@ angle-addr = [CFWS] "<" addr-spec ">" [CFWS] / obs-angle-addr
*/
void mailbox::parseImpl
- (const parsingContext& ctx, const string& buffer, const string::size_type position,
- const string::size_type end, string::size_type* newPosition)
+ (const parsingContext& ctx, const string& buffer, const size_t position,
+ const size_t end, size_t* newPosition)
{
- const string::value_type* const pend = buffer.data() + end;
- const string::value_type* const pstart = buffer.data() + position;
- const string::value_type* p = pstart;
+ const char* const pend = buffer.data() + end;
+ const char* const pstart = buffer.data() + position;
+ const char* p = pstart;
// Ignore blank spaces at the beginning
while (p < pend && parserHelpers::isSpace(*p)) ++p;
@@ -333,7 +333,7 @@ void mailbox::parseImpl
void mailbox::generateImpl
(const generationContext& ctx, utility::outputStream& os,
- const string::size_type curLinePos, string::size_type* newLinePos) const
+ const size_t curLinePos, size_t* newLinePos) const
{
string generatedEmail;
utility::outputStreamStringAdapter generatedEmailStream(generatedEmail);
@@ -341,7 +341,7 @@ void mailbox::generateImpl
if (m_name.isEmpty())
{
- string::size_type pos = curLinePos;
+ size_t pos = curLinePos;
// No display name is specified, only email address.
if (curLinePos + generatedEmail.length() > ctx.getMaxLineLength())
@@ -404,7 +404,7 @@ void mailbox::generateImpl
}
}
- string::size_type pos = curLinePos;
+ size_t pos = curLinePos;
m_name.encodeAndFold(ctx, os, pos, &pos,
text::QUOTE_IF_POSSIBLE | (forceEncode ? text::FORCE_ENCODING : 0));
diff --git a/src/mailboxField.cpp b/src/mailboxField.cpp
index 7d138f3e..29fe9d33 100644
--- a/src/mailboxField.cpp
+++ b/src/mailboxField.cpp
@@ -44,8 +44,8 @@ mailboxField::mailboxField(const mailboxField&)
void mailboxField::parse
- (const parsingContext& ctx, const string& buffer, const string::size_type position,
- const string::size_type end, string::size_type* newPosition)
+ (const parsingContext& ctx, const string& buffer, const size_t position,
+ const size_t end, size_t* newPosition)
{
shared_ptr mbox = make_shared ();
diff --git a/src/mailboxGroup.cpp b/src/mailboxGroup.cpp
index 0245affb..5e8d6b1b 100644
--- a/src/mailboxGroup.cpp
+++ b/src/mailboxGroup.cpp
@@ -55,12 +55,12 @@ mailboxGroup::~mailboxGroup()
void mailboxGroup::parseImpl
- (const parsingContext& ctx, const string& buffer, const string::size_type position,
- const string::size_type end, string::size_type* newPosition)
+ (const parsingContext& ctx, const string& buffer, const size_t position,
+ const size_t end, size_t* newPosition)
{
- const string::value_type* const pend = buffer.data() + end;
- const string::value_type* const pstart = buffer.data() + position;
- const string::value_type* p = pstart;
+ const char* const pend = buffer.data() + end;
+ const char* const pstart = buffer.data() + position;
+ const char* p = pstart;
while (p < pend && parserHelpers::isSpace(*p))
++p;
@@ -77,7 +77,7 @@ void mailboxGroup::parseImpl
++p;
- string::size_type pos = position + (p - pstart);
+ size_t pos = position + (p - pstart);
bool isLastAddressOfGroup = false;
while (pos < end && !isLastAddressOfGroup)
@@ -115,7 +115,7 @@ void mailboxGroup::parseImpl
void mailboxGroup::generateImpl
(const generationContext& ctx, utility::outputStream& os,
- const string::size_type curLinePos, string::size_type* newLinePos) const
+ const size_t curLinePos, size_t* newLinePos) const
{
// We have to encode the name:
// - if it contains characters in a charset different from "US-ASCII",
@@ -157,7 +157,7 @@ void mailboxGroup::generateImpl
}
}
- string::size_type pos = curLinePos;
+ size_t pos = curLinePos;
generationContext tmpCtx(ctx);
tmpCtx.setMaxLineLength(ctx.getMaxLineLength() - 2);
diff --git a/src/mailboxList.cpp b/src/mailboxList.cpp
index 7d6674fc..b356a1e7 100644
--- a/src/mailboxList.cpp
+++ b/src/mailboxList.cpp
@@ -177,12 +177,12 @@ const std::vector > mailboxList::getChildComponents()
void mailboxList::parseImpl
- (const parsingContext& ctx, const string& buffer, const string::size_type position,
- const string::size_type end, string::size_type* newPosition)
+ (const parsingContext& ctx, const string& buffer, const size_t position,
+ const size_t end, size_t* newPosition)
{
m_list.removeAllAddresses();
- string::size_type pos = position;
+ size_t pos = position;
while (pos < end)
{
@@ -214,7 +214,7 @@ void mailboxList::parseImpl
void mailboxList::generateImpl(const generationContext& ctx, utility::outputStream& os,
- const string::size_type curLinePos, string::size_type* newLinePos) const
+ const size_t curLinePos, size_t* newLinePos) const
{
m_list.generate(ctx, os, curLinePos, newLinePos);
}
diff --git a/src/mediaType.cpp b/src/mediaType.cpp
index 2f9ca6b1..60486da7 100644
--- a/src/mediaType.cpp
+++ b/src/mediaType.cpp
@@ -49,15 +49,15 @@ mediaType::mediaType(const string& type, const string& subType)
void mediaType::parseImpl
- (const parsingContext& /* ctx */, const string& buffer, const string::size_type position,
- const string::size_type end, string::size_type* newPosition)
+ (const parsingContext& /* ctx */, const string& buffer, const size_t position,
+ const size_t end, size_t* newPosition)
{
- const string::value_type* const pend = buffer.data() + end;
- const string::value_type* const pstart = buffer.data() + position;
- const string::value_type* p = pstart;
+ const char* const pend = buffer.data() + end;
+ const char* const pstart = buffer.data() + position;
+ const char* p = pstart;
// Extract the type
- const string::size_type typeStart = position;
+ const size_t typeStart = position;
while (p < pend && *p != '/') ++p;
@@ -85,7 +85,7 @@ void mediaType::parseImpl
void mediaType::generateImpl
(const generationContext& ctx, utility::outputStream& os,
- const string::size_type curLinePos, string::size_type* newLinePos) const
+ const size_t curLinePos, size_t* newLinePos) const
{
const string value = m_type + "/" + m_subType;
diff --git a/src/message.cpp b/src/message.cpp
index 75016c36..76735496 100644
--- a/src/message.cpp
+++ b/src/message.cpp
@@ -37,8 +37,8 @@ message::message()
}
-const string message::generate(const string::size_type maxLineLength,
- const string::size_type curLinePos) const
+const string message::generate
+ (const size_t maxLineLength, const size_t curLinePos) const
{
return bodyPart::generate(maxLineLength, curLinePos);
}
diff --git a/src/messageId.cpp b/src/messageId.cpp
index d981f061..edc4d1fb 100644
--- a/src/messageId.cpp
+++ b/src/messageId.cpp
@@ -62,12 +62,12 @@ messageId::messageId(const string& left, const string& right)
*/
void messageId::parseImpl
- (const parsingContext& /* ctx */, const string& buffer, const string::size_type position,
- const string::size_type end, string::size_type* newPosition)
+ (const parsingContext& /* ctx */, const string& buffer, const size_t position,
+ const size_t end, size_t* newPosition)
{
- const string::value_type* const pend = buffer.data() + end;
- const string::value_type* const pstart = buffer.data() + position;
- const string::value_type* p = pstart;
+ const char* const pend = buffer.data() + end;
+ const char* const pstart = buffer.data() + position;
+ const char* p = pstart;
m_left.clear();
m_right.clear();
@@ -117,7 +117,7 @@ void messageId::parseImpl
if (p < pend)
{
// Extract left part
- const string::size_type leftStart = position + (p - pstart);
+ const size_t leftStart = position + (p - pstart);
while (p < pend && *p != '@' && *p != '>') ++p;
@@ -130,7 +130,7 @@ void messageId::parseImpl
++p;
// Extract right part
- const string::size_type rightStart = position + (p - pstart);
+ const size_t rightStart = position + (p - pstart);
while (p < pend && *p != '>' && (hasBrackets || !parserHelpers::isSpace(*p))) ++p;
@@ -147,17 +147,17 @@ void messageId::parseImpl
shared_ptr messageId::parseNext
- (const parsingContext& ctx, const string& buffer, const string::size_type position,
- const string::size_type end, string::size_type* newPosition)
+ (const parsingContext& ctx, const string& buffer, const size_t position,
+ const size_t end, size_t* newPosition)
{
- string::size_type pos = position;
+ size_t pos = position;
while (pos < end && parserHelpers::isSpace(buffer[pos]))
++pos;
if (pos != end)
{
- const string::size_type begin = pos;
+ const size_t begin = pos;
while (pos < end && !parserHelpers::isSpace(buffer[pos]))
++pos;
@@ -189,9 +189,9 @@ const string messageId::getId() const
void messageId::generateImpl
(const generationContext& ctx, utility::outputStream& os,
- const string::size_type curLinePos, string::size_type* newLinePos) const
+ const size_t curLinePos, size_t* newLinePos) const
{
- string::size_type pos = curLinePos;
+ size_t pos = curLinePos;
if (curLinePos + m_left.length() + m_right.length() + 3 > ctx.getMaxLineLength())
{
diff --git a/src/messageIdSequence.cpp b/src/messageIdSequence.cpp
index bfd0c30f..23b12773 100644
--- a/src/messageIdSequence.cpp
+++ b/src/messageIdSequence.cpp
@@ -85,12 +85,12 @@ const std::vector > messageIdSequence::getChildComponent
void messageIdSequence::parseImpl
- (const parsingContext& ctx, const string& buffer, const string::size_type position,
- const string::size_type end, string::size_type* newPosition)
+ (const parsingContext& ctx, const string& buffer, const size_t position,
+ const size_t end, size_t* newPosition)
{
removeAllMessageIds();
- string::size_type pos = position;
+ size_t pos = position;
while (pos < end)
{
@@ -109,9 +109,9 @@ void messageIdSequence::parseImpl
void messageIdSequence::generateImpl
(const generationContext& ctx, utility::outputStream& os,
- const string::size_type curLinePos, string::size_type* newLinePos) const
+ const size_t curLinePos, size_t* newLinePos) const
{
- string::size_type pos = curLinePos;
+ size_t pos = curLinePos;
if (!m_list.empty())
{
diff --git a/src/net/fetchAttributes.cpp b/src/net/fetchAttributes.cpp
index b98e573f..85a41b8c 100644
--- a/src/net/fetchAttributes.cpp
+++ b/src/net/fetchAttributes.cpp
@@ -51,6 +51,7 @@ fetchAttributes::fetchAttributes(const int attribs)
fetchAttributes::fetchAttributes(const fetchAttributes& attribs)
+ : object()
{
m_predefinedAttribs = attribs.m_predefinedAttribs;
m_headers = attribs.m_headers;
diff --git a/src/net/imap/IMAPConnection.cpp b/src/net/imap/IMAPConnection.cpp
index 0dba1ecc..234c2b6a 100644
--- a/src/net/imap/IMAPConnection.cpp
+++ b/src/net/imap/IMAPConnection.cpp
@@ -394,10 +394,10 @@ void IMAPConnection::authenticateSASL()
}
byte_t* challenge = 0;
- long challengeLen = 0;
+ size_t challengeLen = 0;
byte_t* resp = 0;
- long respLen = 0;
+ size_t respLen = 0;
try
{
@@ -530,7 +530,7 @@ bool IMAPConnection::hasCapability(const string& capa)
const string normCapa = utility::stringUtils::toUpper(capa);
- for (unsigned int i = 0, n = m_capabilities.size() ; i < n ; ++i)
+ for (size_t i = 0, n = m_capabilities.size() ; i < n ; ++i)
{
if (m_capabilities[i] == normCapa)
return true;
@@ -566,7 +566,7 @@ bool IMAPConnection::processCapabilityResponseData(const IMAPParser::response* r
const std::vector & respDataList =
resp->continue_req_or_response_data();
- for (unsigned int i = 0 ; i < respDataList.size() ; ++i)
+ for (size_t i = 0 ; i < respDataList.size() ; ++i)
{
if (respDataList[i]->response_data() == NULL)
continue;
@@ -739,7 +739,7 @@ void IMAPConnection::send(bool tag, const string& what, bool end)
}
-void IMAPConnection::sendRaw(const char* buffer, const int count)
+void IMAPConnection::sendRaw(const byte_t* buffer, const size_t count)
{
m_socket->sendRaw(buffer, count);
}
diff --git a/src/net/imap/IMAPFolder.cpp b/src/net/imap/IMAPFolder.cpp
index 06d331df..fb98887c 100644
--- a/src/net/imap/IMAPFolder.cpp
+++ b/src/net/imap/IMAPFolder.cpp
@@ -791,8 +791,8 @@ void IMAPFolder::fetchMessages(std::vector >& msg, const f
const std::vector & respDataList =
resp->continue_req_or_response_data();
- const int total = msg.size();
- int current = 0;
+ const size_t total = msg.size();
+ size_t current = 0;
if (progress)
progress->start(total);
@@ -1005,7 +1005,7 @@ void IMAPFolder::addMessage(shared_ptr msg, const int flags,
}
-void IMAPFolder::addMessage(utility::inputStream& is, const int size, const int flags,
+void IMAPFolder::addMessage(utility::inputStream& is, const size_t size, const int flags,
vmime::datetime* date, utility::progressListener* progress)
{
shared_ptr store = m_store.lock();
@@ -1064,22 +1064,22 @@ void IMAPFolder::addMessage(utility::inputStream& is, const int size, const int
}
// Send message data
- const int total = size;
- int current = 0;
+ const size_t total = size;
+ size_t current = 0;
if (progress)
progress->start(total);
- const socket::size_type blockSize = std::min(is.getBlockSize(),
+ const size_t blockSize = std::min(is.getBlockSize(),
static_cast (m_connection->getSocket()->getBlockSize()));
- std::vector vbuffer(blockSize);
- char* buffer = &vbuffer.front();
+ std::vector vbuffer(blockSize);
+ byte_t* buffer = &vbuffer.front();
while (!is.eof())
{
// Read some data from the input stream
- const int read = is.read(buffer, sizeof(buffer));
+ const size_t read = is.read(buffer, sizeof(buffer));
current += read;
// Put read data into socket output stream
diff --git a/src/net/imap/IMAPFolderStatus.cpp b/src/net/imap/IMAPFolderStatus.cpp
index 25c88b02..c78a40f3 100644
--- a/src/net/imap/IMAPFolderStatus.cpp
+++ b/src/net/imap/IMAPFolderStatus.cpp
@@ -115,7 +115,8 @@ bool IMAPFolderStatus::updateFromResponse(const IMAPParser::mailbox_data* resp)
{
case IMAPParser::status_att_val::MESSAGES:
{
- const unsigned int count = (*jt)->value_as_number()->value();
+ const unsigned int count =
+ static_cast ((*jt)->value_as_number()->value());
if (m_count != count)
{
@@ -127,7 +128,8 @@ bool IMAPFolderStatus::updateFromResponse(const IMAPParser::mailbox_data* resp)
}
case IMAPParser::status_att_val::UNSEEN:
{
- const unsigned int unseen = (*jt)->value_as_number()->value();
+ const unsigned int unseen =
+ static_cast ((*jt)->value_as_number()->value());
if (m_unseen != unseen)
{
@@ -139,7 +141,8 @@ bool IMAPFolderStatus::updateFromResponse(const IMAPParser::mailbox_data* resp)
}
case IMAPParser::status_att_val::RECENT:
{
- const unsigned int recent = (*jt)->value_as_number()->value();
+ const unsigned int recent =
+ static_cast ((*jt)->value_as_number()->value());
if (m_recent != recent)
{
@@ -151,7 +154,8 @@ bool IMAPFolderStatus::updateFromResponse(const IMAPParser::mailbox_data* resp)
}
case IMAPParser::status_att_val::UIDNEXT:
{
- const vmime_uint32 uidNext = (*jt)->value_as_number()->value();
+ const vmime_uint32 uidNext =
+ static_cast ((*jt)->value_as_number()->value());
if (m_uidNext != uidNext)
{
@@ -163,7 +167,8 @@ bool IMAPFolderStatus::updateFromResponse(const IMAPParser::mailbox_data* resp)
}
case IMAPParser::status_att_val::UIDVALIDITY:
{
- const vmime_uint32 uidValidity = (*jt)->value_as_number()->value();
+ const vmime_uint32 uidValidity =
+ static_cast ((*jt)->value_as_number()->value());
if (m_uidValidity != uidValidity)
{
@@ -175,7 +180,8 @@ bool IMAPFolderStatus::updateFromResponse(const IMAPParser::mailbox_data* resp)
}
case IMAPParser::status_att_val::HIGHESTMODSEQ:
{
- const vmime_uint64 highestModSeq = (*jt)->value_as_mod_sequence_value()->value();
+ const vmime_uint64 highestModSeq =
+ static_cast ((*jt)->value_as_mod_sequence_value()->value());
if (m_highestModSeq != highestModSeq)
{
@@ -191,7 +197,8 @@ bool IMAPFolderStatus::updateFromResponse(const IMAPParser::mailbox_data* resp)
}
else if (resp->type() == IMAPParser::mailbox_data::EXISTS)
{
- const unsigned int count = resp->number()->value();
+ const unsigned int count =
+ static_cast (resp->number()->value());
if (m_count != count)
{
@@ -201,7 +208,8 @@ bool IMAPFolderStatus::updateFromResponse(const IMAPParser::mailbox_data* resp)
}
else if (resp->type() == IMAPParser::mailbox_data::RECENT)
{
- const unsigned int recent = resp->number()->value();
+ const unsigned int recent =
+ static_cast (resp->number()->value());
if (m_recent != recent)
{
@@ -222,7 +230,8 @@ bool IMAPFolderStatus::updateFromResponse(const IMAPParser::resp_text_code* resp
{
case IMAPParser::resp_text_code::UIDVALIDITY:
{
- const vmime_uint32 uidValidity = resp->nz_number()->value();
+ const vmime_uint32 uidValidity =
+ static_cast (resp->nz_number()->value());
if (m_uidValidity != uidValidity)
{
@@ -234,7 +243,8 @@ bool IMAPFolderStatus::updateFromResponse(const IMAPParser::resp_text_code* resp
}
case IMAPParser::resp_text_code::UIDNEXT:
{
- const vmime_uint32 uidNext = resp->nz_number()->value();
+ const vmime_uint32 uidNext =
+ static_cast (resp->nz_number()->value());
if (m_uidNext != uidNext)
{
@@ -246,7 +256,8 @@ bool IMAPFolderStatus::updateFromResponse(const IMAPParser::resp_text_code* resp
}
case IMAPParser::resp_text_code::UNSEEN:
{
- const unsigned int unseen = resp->nz_number()->value();
+ const unsigned int unseen =
+ static_cast (resp->nz_number()->value());
if (m_unseen != unseen)
{
@@ -258,7 +269,8 @@ bool IMAPFolderStatus::updateFromResponse(const IMAPParser::resp_text_code* resp
}
case IMAPParser::resp_text_code::HIGHESTMODSEQ:
{
- const vmime_uint64 highestModSeq = resp->mod_sequence_value()->value();
+ const vmime_uint64 highestModSeq =
+ static_cast (resp->mod_sequence_value()->value());
if (m_highestModSeq != highestModSeq)
{
diff --git a/src/net/imap/IMAPMessage.cpp b/src/net/imap/IMAPMessage.cpp
index ae51bfe8..c11aafc2 100644
--- a/src/net/imap/IMAPMessage.cpp
+++ b/src/net/imap/IMAPMessage.cpp
@@ -98,7 +98,7 @@ private:
IMAPMessage::IMAPMessage(shared_ptr folder, const int num)
- : m_folder(folder), m_num(num), m_size(-1), m_flags(FLAG_UNDEFINED),
+ : m_folder(folder), m_num(num), m_size(-1U), m_flags(FLAG_UNDEFINED),
m_expunged(false), m_modseq(0), m_structure(null)
{
folder->registerMessage(this);
@@ -146,9 +146,9 @@ vmime_uint64 IMAPMessage::getModSequence() const
}
-int IMAPMessage::getSize() const
+size_t IMAPMessage::getSize() const
{
- if (m_size == -1)
+ if (m_size == -1U)
throw exceptions::unfetched_object();
return (m_size);
@@ -197,28 +197,36 @@ shared_ptr IMAPMessage::getHeader() const
}
-void IMAPMessage::extract(utility::outputStream& os, utility::progressListener* progress,
- const int start, const int length, const bool peek) const
+void IMAPMessage::extract
+ (utility::outputStream& os,
+ utility::progressListener* progress,
+ const size_t start, const size_t length,
+ const bool peek) const
{
shared_ptr folder = m_folder.lock();
if (!folder)
throw exceptions::folder_not_found();
- extractImpl(null, os, progress, start, length, EXTRACT_HEADER | EXTRACT_BODY | (peek ? EXTRACT_PEEK : 0));
+ extractImpl(null, os, progress, start, length,
+ EXTRACT_HEADER | EXTRACT_BODY | (peek ? EXTRACT_PEEK : 0));
}
void IMAPMessage::extractPart
- (shared_ptr p, utility::outputStream& os, utility::progressListener* progress,
- const int start, const int length, const bool peek) const
+ (shared_ptr p,
+ utility::outputStream& os,
+ utility::progressListener* progress,
+ const size_t start, const size_t length,
+ const bool peek) const
{
shared_ptr folder = m_folder.lock();
if (!folder)
throw exceptions::folder_not_found();
- extractImpl(p, os, progress, start, length, EXTRACT_HEADER | EXTRACT_BODY | (peek ? EXTRACT_PEEK : 0));
+ extractImpl(p, os, progress, start, length,
+ EXTRACT_HEADER | EXTRACT_BODY | (peek ? EXTRACT_PEEK : 0));
}
@@ -253,9 +261,12 @@ void IMAPMessage::fetchPartHeaderForStructure(shared_ptr str)
}
-void IMAPMessage::extractImpl(shared_ptr p, utility::outputStream& os,
- utility::progressListener* progress, const int start,
- const int length, const int extractFlags) const
+void IMAPMessage::extractImpl
+ (shared_ptr p,
+ utility::outputStream& os,
+ utility::progressListener* progress,
+ const size_t start, const size_t length,
+ const int extractFlags) const
{
shared_ptr folder = m_folder.lock();
@@ -340,7 +351,7 @@ void IMAPMessage::extractImpl(shared_ptr p, utility::outputS
command << "]";
- if (start != 0 || length != -1)
+ if (start != 0 || length != static_cast (-1))
command << "<" << start << "." << length << ">";
// Send the request
@@ -473,7 +484,7 @@ int IMAPMessage::processFetchResponse
}
case IMAPParser::msg_att_item::RFC822_SIZE:
{
- m_size = (*it)->number()->value();
+ m_size = static_cast ((*it)->number()->value());
break;
}
case IMAPParser::msg_att_item::BODY_SECTION:
diff --git a/src/net/imap/IMAPMessagePart.cpp b/src/net/imap/IMAPMessagePart.cpp
index 153470cf..eed885dc 100644
--- a/src/net/imap/IMAPMessagePart.cpp
+++ b/src/net/imap/IMAPMessagePart.cpp
@@ -104,7 +104,7 @@ const mediaType& IMAPMessagePart::getType() const
}
-int IMAPMessagePart::getSize() const
+size_t IMAPMessagePart::getSize() const
{
return m_size;
}
diff --git a/src/net/imap/IMAPMessagePartContentHandler.cpp b/src/net/imap/IMAPMessagePartContentHandler.cpp
index 7112e3d2..1f53f082 100644
--- a/src/net/imap/IMAPMessagePartContentHandler.cpp
+++ b/src/net/imap/IMAPMessagePartContentHandler.cpp
@@ -59,7 +59,7 @@ shared_ptr IMAPMessagePartContentHandler::clone() const
void IMAPMessagePartContentHandler::generate
- (utility::outputStream& os, const vmime::encoding& enc, const string::size_type maxLineLength) const
+ (utility::outputStream& os, const vmime::encoding& enc, const size_t maxLineLength) const
{
shared_ptr msg = constCast (m_message.lock());
shared_ptr part = constCast (m_part.lock());
@@ -165,7 +165,7 @@ void IMAPMessagePartContentHandler::extractRaw
}
-string::size_type IMAPMessagePartContentHandler::getLength() const
+size_t IMAPMessagePartContentHandler::getLength() const
{
return m_part.lock()->getSize();
}
diff --git a/src/net/imap/IMAPUtils.cpp b/src/net/imap/IMAPUtils.cpp
index bf310414..ff81ce71 100644
--- a/src/net/imap/IMAPUtils.cpp
+++ b/src/net/imap/IMAPUtils.cpp
@@ -190,9 +190,9 @@ const string IMAPUtils::toModifiedUTF7
int b = 0, k = 0;
bool base64 = false;
- string::size_type remaining = cvt.length();
+ size_t remaining = cvt.length();
- for (string::size_type i = 0, len = cvt.length() ; i < len ; )
+ for (size_t i = 0, len = cvt.length() ; i < len ; )
{
const unsigned char c = cvt[i];
@@ -206,7 +206,7 @@ const string IMAPUtils::toModifiedUTF7
continue;
}
- string::size_type n = 0;
+ size_t n = 0;
int ch = 0;
if (c < 0x80)
@@ -232,7 +232,7 @@ const string IMAPUtils::toModifiedUTF7
++i;
--remaining;
- for (string::size_type j = 0 ; j < n ; j++)
+ for (size_t j = 0 ; j < n ; j++)
{
if ((cvt[i + j] & 0xc0) != 0x80)
return ""; // error
@@ -280,7 +280,7 @@ const string IMAPUtils::toModifiedUTF7
base64 = false;
}
- out += static_cast (ch);
+ out += static_cast (ch);
if (ch == '&')
out += '-';
diff --git a/src/net/maildir/format/courierMaildirFormat.cpp b/src/net/maildir/format/courierMaildirFormat.cpp
index a948de3e..6d460d5e 100644
--- a/src/net/maildir/format/courierMaildirFormat.cpp
+++ b/src/net/maildir/format/courierMaildirFormat.cpp
@@ -242,7 +242,7 @@ const std::vector courierMaildirFormat::listFolders
const string dir = dirs[i].substr(1) + ".";
folder::path path;
- for (string::size_type pos = dir.find("."), prev = 0 ;
+ for (size_t pos = dir.find("."), prev = 0 ;
pos != string::npos ; prev = pos + 1, pos = dir.find(".", pos + 1))
{
const string comp = dir.substr(prev, pos - prev);
diff --git a/src/net/maildir/format/kmailMaildirFormat.cpp b/src/net/maildir/format/kmailMaildirFormat.cpp
index 70c9b909..975752a5 100644
--- a/src/net/maildir/format/kmailMaildirFormat.cpp
+++ b/src/net/maildir/format/kmailMaildirFormat.cpp
@@ -118,11 +118,12 @@ const utility::file::path kmailMaildirFormat::folderPathToFileSystemPath
// Root path
utility::file::path fsPath = getContext()->getStore()->getFileSystemPath();
- const int count = (type == CONTAINER_DIRECTORY
- ? path.getSize() : path.getSize() - 1);
+ const size_t pathSize = path.getSize();
+ const size_t count = (type == CONTAINER_DIRECTORY
+ ? pathSize : (pathSize >= 1 ? pathSize - 1 : 0));
// Parent folders
- for (int i = 0 ; i < count ; ++i)
+ for (size_t i = 0 ; i < count ; ++i)
{
utility::file::path::component comp(path[i]);
diff --git a/src/net/maildir/maildirFolder.cpp b/src/net/maildir/maildirFolder.cpp
index f476d98a..660178ff 100644
--- a/src/net/maildir/maildirFolder.cpp
+++ b/src/net/maildir/maildirFolder.cpp
@@ -719,7 +719,7 @@ void maildirFolder::addMessage(shared_ptr msg, const int flags,
}
-void maildirFolder::addMessage(utility::inputStream& is, const int size,
+void maildirFolder::addMessage(utility::inputStream& is, const size_t size,
const int flags, vmime::datetime* /* date */, utility::progressListener* progress)
{
shared_ptr store = m_store.lock();
@@ -816,7 +816,7 @@ void maildirFolder::addMessage(utility::inputStream& is, const int size,
void maildirFolder::copyMessageImpl(const utility::file::path& tmpDirPath,
const utility::file::path& dstDirPath,
const utility::file::path::component& filename,
- utility::inputStream& is, const utility::stream::size_type size,
+ utility::inputStream& is, const size_t size,
utility::progressListener* progress)
{
shared_ptr fsf = platform::getHandler()->getFileSystemFactory();
@@ -834,12 +834,12 @@ void maildirFolder::copyMessageImpl(const utility::file::path& tmpDirPath,
shared_ptr fw = file->getFileWriter();
shared_ptr os = fw->getOutputStream();
- utility::stream::value_type buffer[65536];
- utility::stream::size_type total = 0;
+ byte_t buffer[65536];
+ size_t total = 0;
while (!is.eof())
{
- const utility::stream::size_type read = is.read(buffer, sizeof(buffer));
+ const size_t read = is.read(buffer, sizeof(buffer));
if (read != 0)
{
@@ -1185,8 +1185,8 @@ void maildirFolder::fetchMessages(std::vector >& msg,
else if (!isOpen())
throw exceptions::illegal_state("Folder not open");
- const int total = msg.size();
- int current = 0;
+ const size_t total = msg.size();
+ size_t current = 0;
if (progress)
progress->start(total);
diff --git a/src/net/maildir/maildirMessage.cpp b/src/net/maildir/maildirMessage.cpp
index 88d743b2..a14f067e 100644
--- a/src/net/maildir/maildirMessage.cpp
+++ b/src/net/maildir/maildirMessage.cpp
@@ -40,6 +40,7 @@
#include "vmime/platform.hpp"
#include "vmime/utility/outputStreamAdapter.hpp"
+#include "vmime/utility/stringUtils.hpp"
namespace vmime {
@@ -82,9 +83,9 @@ const message::uid maildirMessage::getUID() const
}
-int maildirMessage::getSize() const
+size_t maildirMessage::getSize() const
{
- if (m_size == -1)
+ if (m_size == static_cast (-1))
throw exceptions::unfetched_object();
return (m_size);
@@ -145,16 +146,16 @@ void maildirMessage::setFlags(const int flags, const int mode)
void maildirMessage::extract(utility::outputStream& os,
- utility::progressListener* progress, const int start,
- const int length, const bool peek) const
+ utility::progressListener* progress, const size_t start,
+ const size_t length, const bool peek) const
{
extractImpl(os, progress, 0, m_size, start, length, peek);
}
void maildirMessage::extractPart(shared_ptr p, utility::outputStream& os,
- utility::progressListener* progress, const int start,
- const int length, const bool peek) const
+ utility::progressListener* progress, const size_t start,
+ const size_t length, const bool peek) const
{
shared_ptr mp = dynamicCast (p);
@@ -164,7 +165,7 @@ void maildirMessage::extractPart(shared_ptr p, utility::outp
void maildirMessage::extractImpl(utility::outputStream& os, utility::progressListener* progress,
- const int start, const int length, const int partialStart, const int partialLength,
+ const size_t start, const size_t length, const size_t partialStart, const size_t partialLength,
const bool /* peek */) const
{
shared_ptr folder = m_folder.lock();
@@ -179,20 +180,19 @@ void maildirMessage::extractImpl(utility::outputStream& os, utility::progressLis
is->skip(start + partialStart);
- utility::stream::value_type buffer[8192];
- utility::stream::size_type remaining = (partialLength == -1 ? length
- : std::min(partialLength, length));
+ byte_t buffer[8192];
+ size_t remaining = (partialLength == static_cast (-1)
+ ? length : std::min(partialLength, length));
- const int total = remaining;
- int current = 0;
+ const size_t total = remaining;
+ size_t current = 0;
if (progress)
progress->start(total);
while (!is->eof() && remaining > 0)
{
- const utility::stream::size_type read =
- is->read(buffer, std::min(remaining, sizeof(buffer)));
+ const size_t read = is->read(buffer, std::min(remaining, sizeof(buffer)));
remaining -= read;
current += read;
@@ -226,20 +226,19 @@ void maildirMessage::fetchPartHeader(shared_ptr p)
is->skip(mp->getHeaderParsedOffset());
- utility::stream::value_type buffer[1024];
- utility::stream::size_type remaining = mp->getHeaderParsedLength();
+ byte_t buffer[1024];
+ size_t remaining = mp->getHeaderParsedLength();
string contents;
contents.reserve(remaining);
while (!is->eof() && remaining > 0)
{
- const utility::stream::size_type read =
- is->read(buffer, std::min(remaining, sizeof(buffer)));
+ const size_t read = is->read(buffer, std::min(remaining, sizeof(buffer)));
remaining -= read;
- contents.append(buffer, read);
+ vmime::utility::stringUtils::appendBytesToString(contents, buffer, read);
}
mp->getOrCreateHeader().parse(contents);
@@ -279,30 +278,30 @@ void maildirMessage::fetch(shared_ptr msgFolder, const fetchAttr
// Need whole message contents for structure
if (options.has(fetchAttributes::STRUCTURE))
{
- utility::stream::value_type buffer[16384];
+ byte_t buffer[16384];
contents.reserve(file->getLength());
while (!is->eof())
{
- const utility::stream::size_type read = is->read(buffer, sizeof(buffer));
- contents.append(buffer, read);
+ const size_t read = is->read(buffer, sizeof(buffer));
+ vmime::utility::stringUtils::appendBytesToString(contents, buffer, read);
}
}
// Need only header
else
{
- utility::stream::value_type buffer[1024];
+ byte_t buffer[1024];
contents.reserve(4096);
while (!is->eof())
{
- const utility::stream::size_type read = is->read(buffer, sizeof(buffer));
- contents.append(buffer, read);
+ const size_t read = is->read(buffer, sizeof(buffer));
+ vmime::utility::stringUtils::appendBytesToString(contents, buffer, read);
- const string::size_type sep1 = contents.rfind("\r\n\r\n");
- const string::size_type sep2 = contents.rfind("\n\n");
+ const size_t sep1 = contents.rfind("\r\n\r\n");
+ const size_t sep2 = contents.rfind("\n\n");
if (sep1 != string::npos)
{
diff --git a/src/net/maildir/maildirMessagePart.cpp b/src/net/maildir/maildirMessagePart.cpp
index 683e259e..6ae085c9 100644
--- a/src/net/maildir/maildirMessagePart.cpp
+++ b/src/net/maildir/maildirMessagePart.cpp
@@ -93,7 +93,7 @@ const mediaType& maildirMessagePart::getType() const
}
-int maildirMessagePart::getSize() const
+size_t maildirMessagePart::getSize() const
{
return m_size;
}
@@ -123,25 +123,25 @@ header& maildirMessagePart::getOrCreateHeader()
}
-int maildirMessagePart::getHeaderParsedOffset() const
+size_t maildirMessagePart::getHeaderParsedOffset() const
{
return m_headerParsedOffset;
}
-int maildirMessagePart::getHeaderParsedLength() const
+size_t maildirMessagePart::getHeaderParsedLength() const
{
return m_headerParsedLength;
}
-int maildirMessagePart::getBodyParsedOffset() const
+size_t maildirMessagePart::getBodyParsedOffset() const
{
return m_bodyParsedOffset;
}
-int maildirMessagePart::getBodyParsedLength() const
+size_t maildirMessagePart::getBodyParsedLength() const
{
return m_bodyParsedLength;
}
diff --git a/src/net/maildir/maildirStore.cpp b/src/net/maildir/maildirStore.cpp
index c7ceb6fa..87e733e2 100644
--- a/src/net/maildir/maildirStore.cpp
+++ b/src/net/maildir/maildirStore.cpp
@@ -122,7 +122,7 @@ bool maildirStore::isValidFolderName(const folder::path::component& name) const
return false;
// Name cannot start with '.'
- const int length = buf.length();
+ const size_t length = buf.length();
int pos = 0;
while ((pos < length) && (buf[pos] == '.'))
diff --git a/src/net/maildir/maildirUtils.cpp b/src/net/maildir/maildirUtils.cpp
index 5a5ac90f..77aac715 100644
--- a/src/net/maildir/maildirUtils.cpp
+++ b/src/net/maildir/maildirUtils.cpp
@@ -71,7 +71,7 @@ bool maildirUtils::isMessageFile(const utility::file& file)
const utility::file::path::component maildirUtils::extractId
(const utility::file::path::component& filename)
{
- string::size_type sep = filename.getBuffer().rfind(':'); // try colon
+ size_t sep = filename.getBuffer().rfind(':'); // try colon
if (sep == string::npos)
{
@@ -86,7 +86,7 @@ const utility::file::path::component maildirUtils::extractId
int maildirUtils::extractFlags(const utility::file::path::component& comp)
{
- string::size_type sep = comp.getBuffer().rfind(':'); // try colon
+ size_t sep = comp.getBuffer().rfind(':'); // try colon
if (sep == string::npos)
{
@@ -95,11 +95,11 @@ int maildirUtils::extractFlags(const utility::file::path::component& comp)
}
const string flagsString(comp.getBuffer().begin() + sep + 1, comp.getBuffer().end());
- const string::size_type count = flagsString.length();
+ const size_t count = flagsString.length();
int flags = 0;
- for (string::size_type i = 0 ; i < count ; ++i)
+ for (size_t i = 0 ; i < count ; ++i)
{
switch (flagsString[i])
{
diff --git a/src/net/messageSet.cpp b/src/net/messageSet.cpp
index 71a8a788..2939042e 100644
--- a/src/net/messageSet.cpp
+++ b/src/net/messageSet.cpp
@@ -151,14 +151,14 @@ messageSet::messageSet(const messageSet& other)
{
m_ranges.resize(other.m_ranges.size());
- for (unsigned int i = 0, n = other.m_ranges.size() ; i < n ; ++i)
+ for (size_t i = 0, n = other.m_ranges.size() ; i < n ; ++i)
m_ranges[i] = other.m_ranges[i]->clone();
}
messageSet::~messageSet()
{
- for (unsigned int i = 0, n = m_ranges.size() ; i < n ; ++i)
+ for (size_t i = 0, n = m_ranges.size() ; i < n ; ++i)
delete m_ranges[i];
}
@@ -256,12 +256,12 @@ messageSet messageSet::byUID(const std::vector & uids)
{
std::vector numericUIDs;
- for (unsigned int i = 0, n = uids.size() ; i < n ; ++i)
+ for (size_t i = 0, n = uids.size() ; i < n ; ++i)
{
const string uid = uids[i];
int numericUID = 0;
- const string::value_type* p = uid.c_str();
+ const char* p = uid.c_str();
for ( ; *p >= '0' && *p <= '9' ; ++p)
numericUID = (numericUID * 10) + (*p - '0');
@@ -271,7 +271,7 @@ messageSet messageSet::byUID(const std::vector & uids)
messageSet set;
// Non-numeric UID, fall back to plain UID list (single-UID ranges)
- for (unsigned int i = 0, n = uids.size() ; i < n ; ++i)
+ for (size_t i = 0, n = uids.size() ; i < n ; ++i)
set.m_ranges.push_back(new UIDMessageRange(uids[i]));
return set;
@@ -342,7 +342,7 @@ void messageSet::addRange(const messageRange& range)
void messageSet::enumerate(messageSetEnumerator& en) const
{
- for (unsigned int i = 0, n = m_ranges.size() ; i < n ; ++i)
+ for (size_t i = 0, n = m_ranges.size() ; i < n ; ++i)
m_ranges[i]->enumerate(en);
}
diff --git a/src/net/pop3/POP3Connection.cpp b/src/net/pop3/POP3Connection.cpp
index 547ef5ef..5fa923f4 100644
--- a/src/net/pop3/POP3Connection.cpp
+++ b/src/net/pop3/POP3Connection.cpp
@@ -463,10 +463,10 @@ void POP3Connection::authenticateSASL()
case POP3Response::CODE_READY:
{
byte_t* challenge = 0;
- long challengeLen = 0;
+ size_t challengeLen = 0;
byte_t* resp = 0;
- long respLen = 0;
+ size_t respLen = 0;
try
{
@@ -495,7 +495,7 @@ void POP3Connection::authenticateSASL()
}
// Cancel SASL exchange
- m_socket->sendRaw("*\r\n", 3);
+ m_socket->send("*\r\n");
}
catch (...)
{
diff --git a/src/net/pop3/POP3Folder.cpp b/src/net/pop3/POP3Folder.cpp
index 66ace31c..096de8af 100644
--- a/src/net/pop3/POP3Folder.cpp
+++ b/src/net/pop3/POP3Folder.cpp
@@ -318,8 +318,8 @@ void POP3Folder::fetchMessages(std::vector >& msg, const f
else if (!isOpen())
throw exceptions::illegal_state("Folder not open");
- const int total = msg.size();
- int current = 0;
+ const size_t total = msg.size();
+ size_t current = 0;
if (progress)
progress->start(total);
@@ -362,7 +362,7 @@ void POP3Folder::fetchMessages(std::vector >& msg, const f
if (x != result.end())
{
- int size = 0;
+ size_t size = 0;
std::istringstream iss((*x).second);
iss >> size;
@@ -446,7 +446,7 @@ void POP3Folder::fetchMessage(shared_ptr msg, const fetchAttributes& o
if (it != responseText.end())
{
- int size = 0;
+ size_t size = 0;
std::istringstream iss(string(it, responseText.end()));
iss >> size;
@@ -601,15 +601,17 @@ void POP3Folder::rename(const folder::path& /* newPath */)
}
-void POP3Folder::addMessage(shared_ptr /* msg */, const int /* flags */,
- vmime::datetime* /* date */, utility::progressListener* /* progress */)
+void POP3Folder::addMessage
+ (shared_ptr /* msg */, const int /* flags */,
+ vmime::datetime* /* date */, utility::progressListener* /* progress */)
{
throw exceptions::operation_not_supported();
}
-void POP3Folder::addMessage(utility::inputStream& /* is */, const int /* size */, const int /* flags */,
- vmime::datetime* /* date */, utility::progressListener* /* progress */)
+void POP3Folder::addMessage
+ (utility::inputStream& /* is */, const size_t /* size */, const int /* flags */,
+ vmime::datetime* /* date */, utility::progressListener* /* progress */)
{
throw exceptions::operation_not_supported();
}
diff --git a/src/net/pop3/POP3Message.cpp b/src/net/pop3/POP3Message.cpp
index 5f0fb725..08523611 100644
--- a/src/net/pop3/POP3Message.cpp
+++ b/src/net/pop3/POP3Message.cpp
@@ -78,9 +78,9 @@ const message::uid POP3Message::getUID() const
}
-int POP3Message::getSize() const
+size_t POP3Message::getSize() const
{
- if (m_size == -1)
+ if (m_size == static_cast (-1))
throw exceptions::unfetched_object();
return (m_size);
@@ -125,9 +125,11 @@ shared_ptr POP3Message::getHeader() const
}
-void POP3Message::extract(utility::outputStream& os,
- utility::progressListener* progress, const int start,
- const int length, const bool /* peek */) const
+void POP3Message::extract
+ (utility::outputStream& os,
+ utility::progressListener* progress,
+ const size_t start, const size_t length,
+ const bool /* peek */) const
{
shared_ptr folder = m_folder.lock();
@@ -136,7 +138,7 @@ void POP3Message::extract(utility::outputStream& os,
else if (!folder->getStore())
throw exceptions::illegal_state("Store disconnected");
- if (start != 0 && length != -1)
+ if (start != 0 && length != static_cast (-1))
throw exceptions::partial_fetch_not_supported();
// Emit the "RETR" command
@@ -157,9 +159,10 @@ void POP3Message::extract(utility::outputStream& os,
void POP3Message::extractPart
- (shared_ptr /* p */, utility::outputStream& /* os */,
+ (shared_ptr /* p */,
+ utility::outputStream& /* os */,
utility::progressListener* /* progress */,
- const int /* start */, const int /* length */,
+ const size_t /* start */, const size_t /* length */,
const bool /* peek */) const
{
throw exceptions::operation_not_supported();
diff --git a/src/net/pop3/POP3Response.cpp b/src/net/pop3/POP3Response.cpp
index e24634c6..1dc5ee76 100644
--- a/src/net/pop3/POP3Response.cpp
+++ b/src/net/pop3/POP3Response.cpp
@@ -98,7 +98,7 @@ shared_ptr POP3Response::readMultilineResponse(shared_ptr POP3Response::readLargeResponse
(shared_ptr conn, utility::outputStream& os,
- utility::progressListener* progress, const long predictedSize)
+ utility::progressListener* progress, const size_t predictedSize)
{
shared_ptr resp = shared_ptr
(new POP3Response(conn->getSocket(), conn->getTimeoutHandler()));
@@ -159,7 +159,7 @@ void POP3Response::readResponseImpl(string& buffer, const bool multiLine)
buffer.clear();
- string::value_type last1 = '\0', last2 = '\0';
+ char last1 = '\0', last2 = '\0';
for ( ; !foundTerminator ; )
{
@@ -187,7 +187,7 @@ void POP3Response::readResponseImpl(string& buffer, const bool multiLine)
m_timeoutHandler->resetTimeOut();
// Check for transparent characters: '\n..' becomes '\n.'
- const string::value_type first = receiveBuffer[0];
+ const char first = receiveBuffer[0];
if (first == '.' && last2 == '\n' && last1 == '.')
{
@@ -199,7 +199,7 @@ void POP3Response::readResponseImpl(string& buffer, const bool multiLine)
receiveBuffer.erase(receiveBuffer.begin());
}
- for (string::size_type trans ;
+ for (size_t trans ;
string::npos != (trans = receiveBuffer.find("\n..")) ; )
{
receiveBuffer.replace(trans, 3, "\n.");
@@ -228,9 +228,9 @@ void POP3Response::readResponseImpl(string& buffer, const bool multiLine)
void POP3Response::readResponseImpl
(string& firstLine, utility::outputStream& os,
- utility::progressListener* progress, const long predictedSize)
+ utility::progressListener* progress, const size_t predictedSize)
{
- long current = 0, total = predictedSize;
+ size_t current = 0, total = predictedSize;
string temp;
bool codeDone = false;
@@ -264,8 +264,8 @@ void POP3Response::readResponseImpl
}
// Receive data from the socket
- utility::stream::value_type buffer[65536];
- const utility::stream::size_type read = is.read(buffer, sizeof(buffer));
+ byte_t buffer[65536];
+ const size_t read = is.read(buffer, sizeof(buffer));
if (read == 0) // buffer is empty
{
@@ -289,7 +289,7 @@ void POP3Response::readResponseImpl
// If we don't have extracted the response code yet
if (!codeDone)
{
- temp.append(buffer, read);
+ vmime::utility::stringUtils::appendBytesToString(temp, buffer, read);
string responseData;
@@ -322,7 +322,7 @@ void POP3Response::readResponseImpl
bool POP3Response::stripFirstLine
(const string& buffer, string& result, string* firstLine)
{
- const string::size_type end = buffer.find('\n');
+ const size_t end = buffer.find('\n');
if (end != string::npos)
{
@@ -371,7 +371,7 @@ POP3Response::ResponseCode POP3Response::getResponseCode(const string& buffer)
// static
void POP3Response::stripResponseCode(const string& buffer, string& result)
{
- const string::size_type pos = buffer.find_first_of(" \t");
+ const size_t pos = buffer.find_first_of(" \t");
if (pos != string::npos)
result = buffer.substr(pos + 1);
diff --git a/src/net/sendmail/sendmailTransport.cpp b/src/net/sendmail/sendmailTransport.cpp
index 68c96e51..8ef18e3b 100644
--- a/src/net/sendmail/sendmailTransport.cpp
+++ b/src/net/sendmail/sendmailTransport.cpp
@@ -137,7 +137,7 @@ void sendmailTransport::noop()
void sendmailTransport::send
(const mailbox& expeditor, const mailboxList& recipients,
- utility::inputStream& is, const utility::stream::size_type size,
+ utility::inputStream& is, const size_t size,
utility::progressListener* progress, const mailbox& sender)
{
// If no recipient/expeditor was found, throw an exception
@@ -159,7 +159,7 @@ void sendmailTransport::send
args.push_back("--");
- for (int i = 0 ; i < recipients.getMailboxCount() ; ++i)
+ for (size_t i = 0 ; i < recipients.getMailboxCount() ; ++i)
args.push_back(recipients.getMailboxAt(i)->getEmail().generate());
// Call sendmail
@@ -176,7 +176,7 @@ void sendmailTransport::send
void sendmailTransport::internalSend
(const std::vector args, utility::inputStream& is,
- const utility::stream::size_type size, utility::progressListener* progress)
+ const size_t size, utility::progressListener* progress)
{
const utility::file::path path = vmime::platform::getHandler()->
getFileSystemFactory()->stringToPath(m_sendmailPath);
diff --git a/src/net/smtp/SMTPChunkingOutputStreamAdapter.cpp b/src/net/smtp/SMTPChunkingOutputStreamAdapter.cpp
index 0584f7e6..69f63bc9 100644
--- a/src/net/smtp/SMTPChunkingOutputStreamAdapter.cpp
+++ b/src/net/smtp/SMTPChunkingOutputStreamAdapter.cpp
@@ -47,7 +47,7 @@ SMTPChunkingOutputStreamAdapter::SMTPChunkingOutputStreamAdapter(shared_ptr SMTPCommand::MAIL(const mailbox& mbox, const bool utf8)
// static
-shared_ptr SMTPCommand::MAIL(const mailbox& mbox, const bool utf8, const unsigned long size)
+shared_ptr SMTPCommand::MAIL(const mailbox& mbox, const bool utf8, const size_t size)
{
std::ostringstream cmd;
cmd.imbue(std::locale::classic());
@@ -160,7 +160,7 @@ shared_ptr SMTPCommand::DATA()
// static
-shared_ptr SMTPCommand::BDAT(const unsigned long chunkSize, const bool last)
+shared_ptr SMTPCommand::BDAT(const size_t chunkSize, const bool last)
{
std::ostringstream cmd;
cmd.imbue(std::locale::classic());
diff --git a/src/net/smtp/SMTPConnection.cpp b/src/net/smtp/SMTPConnection.cpp
index 9fcacbc1..26be25db 100644
--- a/src/net/smtp/SMTPConnection.cpp
+++ b/src/net/smtp/SMTPConnection.cpp
@@ -396,10 +396,10 @@ void SMTPConnection::authenticateSASL()
case 334:
{
byte_t* challenge = 0;
- long challengeLen = 0;
+ size_t challengeLen = 0;
byte_t* resp = 0;
- long respLen = 0;
+ size_t respLen = 0;
try
{
@@ -428,7 +428,7 @@ void SMTPConnection::authenticateSASL()
}
// Cancel SASL exchange
- m_socket->sendRaw("*\r\n", 3);
+ m_socket->send("*\r\n");
}
catch (...)
{
diff --git a/src/net/smtp/SMTPResponse.cpp b/src/net/smtp/SMTPResponse.cpp
index baefc38d..f7980351 100644
--- a/src/net/smtp/SMTPResponse.cpp
+++ b/src/net/smtp/SMTPResponse.cpp
@@ -128,11 +128,11 @@ const string SMTPResponse::readResponseLine()
while (true)
{
// Get a line from the response buffer
- const string::size_type lineEnd = currentBuffer.find_first_of('\n');
+ const size_t lineEnd = currentBuffer.find_first_of('\n');
if (lineEnd != string::npos)
{
- string::size_type actualLineEnd = lineEnd;
+ size_t actualLineEnd = lineEnd;
if (actualLineEnd != 0 && currentBuffer[actualLineEnd - 1] == '\r') // CRLF case
actualLineEnd--;
diff --git a/src/net/smtp/SMTPTransport.cpp b/src/net/smtp/SMTPTransport.cpp
index 4f409a03..0020d010 100644
--- a/src/net/smtp/SMTPTransport.cpp
+++ b/src/net/smtp/SMTPTransport.cpp
@@ -163,7 +163,7 @@ void SMTPTransport::noop()
void SMTPTransport::sendEnvelope
(const mailbox& expeditor, const mailboxList& recipients,
const mailbox& sender, bool sendDATACommand,
- const utility::stream::size_type size)
+ const size_t size)
{
// If no recipient/expeditor was found, throw an exception
if (recipients.isEmpty())
@@ -315,7 +315,7 @@ void SMTPTransport::sendEnvelope
void SMTPTransport::send
(const mailbox& expeditor, const mailboxList& recipients,
- utility::inputStream& is, const utility::stream::size_type size,
+ utility::inputStream& is, const size_t size,
utility::progressListener* progress, const mailbox& sender)
{
if (!isConnected())
@@ -334,7 +334,7 @@ void SMTPTransport::send
fos.flush();
// Send end-of-data delimiter
- m_connection->getSocket()->sendRaw("\r\n.\r\n", 5);
+ m_connection->getSocket()->send("\r\n.\r\n");
shared_ptr resp;
diff --git a/src/net/tls/gnutls/TLSSocket_GnuTLS.cpp b/src/net/tls/gnutls/TLSSocket_GnuTLS.cpp
index bb21cb9d..5a90565b 100644
--- a/src/net/tls/gnutls/TLSSocket_GnuTLS.cpp
+++ b/src/net/tls/gnutls/TLSSocket_GnuTLS.cpp
@@ -37,6 +37,10 @@
#include "vmime/security/cert/X509Certificate.hpp"
+#include "vmime/utility/stringUtils.hpp"
+
+#include
+
namespace vmime {
namespace net {
@@ -110,7 +114,7 @@ bool TLSSocket_GnuTLS::isConnected() const
}
-TLSSocket::size_type TLSSocket_GnuTLS::getBlockSize() const
+size_t TLSSocket_GnuTLS::getBlockSize() const
{
return 16384; // 16 KB
}
@@ -130,18 +134,24 @@ const string TLSSocket_GnuTLS::getPeerAddress() const
void TLSSocket_GnuTLS::receive(string& buffer)
{
- const int size = receiveRaw(m_buffer, sizeof(m_buffer));
- buffer = vmime::string(m_buffer, size);
+ const size_t size = receiveRaw(m_buffer, sizeof(m_buffer));
+ buffer = utility::stringUtils::makeStringFromBytes(m_buffer, size);
}
void TLSSocket_GnuTLS::send(const string& buffer)
{
- sendRaw(buffer.data(), buffer.length());
+ sendRaw(reinterpret_cast (buffer.data()), buffer.length());
}
-TLSSocket::size_type TLSSocket_GnuTLS::receiveRaw(char* buffer, const size_type count)
+void TLSSocket_GnuTLS::send(const char* str)
+{
+ sendRaw(reinterpret_cast (str), ::strlen(str));
+}
+
+
+size_t TLSSocket_GnuTLS::receiveRaw(byte_t* buffer, const size_t count)
{
m_status &= ~STATUS_WOULDBLOCK;
@@ -160,14 +170,14 @@ TLSSocket::size_type TLSSocket_GnuTLS::receiveRaw(char* buffer, const size_type
return 0;
}
- TLSSession_GnuTLS::throwTLSException("gnutls_record_recv", ret);
+ TLSSession_GnuTLS::throwTLSException("gnutls_record_recv", static_cast (ret));
}
- return static_cast (ret);
+ return static_cast (ret);
}
-void TLSSocket_GnuTLS::sendRaw(const char* buffer, const size_type count)
+void TLSSocket_GnuTLS::sendRaw(const byte_t* buffer, const size_t count)
{
ssize_t ret = gnutls_record_send
(*m_session->m_gnutlsSession,
@@ -184,12 +194,12 @@ void TLSSocket_GnuTLS::sendRaw(const char* buffer, const size_type count)
return;
}
- TLSSession_GnuTLS::throwTLSException("gnutls_record_send", ret);
+ TLSSession_GnuTLS::throwTLSException("gnutls_record_send", static_cast (ret));
}
}
-TLSSocket::size_type TLSSocket_GnuTLS::sendRawNonBlocking(const char* buffer, const size_type count)
+size_t TLSSocket_GnuTLS::sendRawNonBlocking(const byte_t* buffer, const size_t count)
{
ssize_t ret = gnutls_record_send
(*m_session->m_gnutlsSession,
@@ -209,7 +219,7 @@ TLSSocket::size_type TLSSocket_GnuTLS::sendRawNonBlocking(const char* buffer, co
TLSSession_GnuTLS::throwTLSException("gnutls_record_send", static_cast (ret));
}
- return static_cast (ret);
+ return static_cast (ret);
}
@@ -288,7 +298,7 @@ ssize_t TLSSocket_GnuTLS::gnutlsPushFunc
try
{
sok->m_wrapped->sendRaw
- (reinterpret_cast (data), static_cast (len));
+ (reinterpret_cast (data), len);
}
catch (exception& e)
{
@@ -318,8 +328,7 @@ ssize_t TLSSocket_GnuTLS::gnutlsPullFunc
{
const ssize_t ret = static_cast
(sok->m_wrapped->receiveRaw
- (reinterpret_cast (data),
- static_cast (len)));
+ (reinterpret_cast (data), len));
if (ret == 0)
{
@@ -345,8 +354,7 @@ ssize_t TLSSocket_GnuTLS::gnutlsPullFunc
{
const ssize_t n = static_cast
(sok->m_wrapped->receiveRaw
- (reinterpret_cast (data),
- static_cast (len)));
+ (reinterpret_cast (data), len));
if (n == 0 && sok->m_wrapped->getStatus() & socket::STATUS_WOULDBLOCK)
return GNUTLS_E_AGAIN;
diff --git a/src/net/tls/openssl/TLSSocket_OpenSSL.cpp b/src/net/tls/openssl/TLSSocket_OpenSSL.cpp
index 9aec43e5..8f304c78 100644
--- a/src/net/tls/openssl/TLSSocket_OpenSSL.cpp
+++ b/src/net/tls/openssl/TLSSocket_OpenSSL.cpp
@@ -38,7 +38,10 @@
#include "vmime/security/cert/openssl/X509Certificate_OpenSSL.hpp"
+#include "vmime/utility/stringUtils.hpp"
+
#include
+#include
namespace vmime {
@@ -60,7 +63,8 @@ BIO_METHOD TLSSocket_OpenSSL::sm_customBIOMethod =
TLSSocket_OpenSSL::bio_gets,
TLSSocket_OpenSSL::bio_ctrl,
TLSSocket_OpenSSL::bio_create,
- TLSSocket_OpenSSL::bio_destroy
+ TLSSocket_OpenSSL::bio_destroy,
+ 0
};
@@ -160,7 +164,7 @@ bool TLSSocket_OpenSSL::isConnected() const
}
-TLSSocket::size_type TLSSocket_OpenSSL::getBlockSize() const
+size_t TLSSocket_OpenSSL::getBlockSize() const
{
return 16384; // 16 KB
}
@@ -180,20 +184,28 @@ const string TLSSocket_OpenSSL::getPeerAddress() const
void TLSSocket_OpenSSL::receive(string& buffer)
{
- const size_type size = receiveRaw(m_buffer, sizeof(m_buffer));
+ const size_t size = receiveRaw(m_buffer, sizeof(m_buffer));
- if (size >= 0)
- buffer = vmime::string(m_buffer, size);
+ if (size != 0)
+ buffer = utility::stringUtils::makeStringFromBytes(m_buffer, size);
+ else
+ buffer.clear();
}
void TLSSocket_OpenSSL::send(const string& buffer)
{
- sendRaw(buffer.data(), buffer.length());
+ sendRaw(reinterpret_cast (buffer.data()), buffer.length());
}
-TLSSocket::size_type TLSSocket_OpenSSL::receiveRaw(char* buffer, const size_type count)
+void TLSSocket_OpenSSL::send(const char* str)
+{
+ sendRaw(reinterpret_cast (str), ::strlen(str));
+}
+
+
+size_t TLSSocket_OpenSSL::receiveRaw(byte_t* buffer, const size_t count)
{
int rc = SSL_read(m_ssl, buffer, static_cast (count));
handleError(rc);
@@ -205,14 +217,14 @@ TLSSocket::size_type TLSSocket_OpenSSL::receiveRaw(char* buffer, const size_type
}
-void TLSSocket_OpenSSL::sendRaw(const char* buffer, const size_type count)
+void TLSSocket_OpenSSL::sendRaw(const byte_t* buffer, const size_t count)
{
int rc = SSL_write(m_ssl, buffer, static_cast (count));
handleError(rc);
}
-TLSSocket_OpenSSL::size_type TLSSocket_OpenSSL::sendRawNonBlocking(const char* buffer, const size_type count)
+size_t TLSSocket_OpenSSL::sendRawNonBlocking(const byte_t* buffer, const size_t count)
{
int rc = SSL_write(m_ssl, buffer, static_cast (count));
handleError(rc);
@@ -391,7 +403,8 @@ int TLSSocket_OpenSSL::bio_write(BIO* bio, const char* buf, int len)
{
BIO_clear_retry_flags(bio);
- const size_type n = sok->m_wrapped->sendRawNonBlocking(buf, len);
+ const size_t n = sok->m_wrapped->sendRawNonBlocking
+ (reinterpret_cast (buf), len);
BIO_clear_retry_flags(bio);
@@ -422,7 +435,8 @@ int TLSSocket_OpenSSL::bio_read(BIO* bio, char* buf, int len)
try
{
- const size_type n = sok->m_wrapped->receiveRaw(buf, len);
+ const size_t n = sok->m_wrapped->receiveRaw
+ (reinterpret_cast (buf), len);
BIO_clear_retry_flags(bio);
diff --git a/src/parameter.cpp b/src/parameter.cpp
index d7fcd7d3..b8d5b36e 100644
--- a/src/parameter.cpp
+++ b/src/parameter.cpp
@@ -114,8 +114,8 @@ void parameter::setValue(const word& value)
void parameter::parseImpl
- (const parsingContext& ctx, const string& buffer, const string::size_type position,
- const string::size_type end, string::size_type* newPosition)
+ (const parsingContext& ctx, const string& buffer, const size_t position,
+ const size_t end, size_t* newPosition)
{
m_value->setBuffer(string(buffer.begin() + position, buffer.begin() + end));
@@ -145,15 +145,15 @@ void parameter::parse(const parsingContext& ctx, const std::vector &
// Decode following data
if (chunk.encoded)
{
- const string::size_type len = chunk.data.length();
- string::size_type pos = 0;
+ const size_t len = chunk.data.length();
+ size_t pos = 0;
// If this is the first encoded chunk, extract charset
// and language information
if (!foundCharsetChunk)
{
// Eg. "us-ascii'en'This%20is%20even%20more%20"
- string::size_type q = chunk.data.find_first_of('\'');
+ size_t q = chunk.data.find_first_of('\'');
if (q != string::npos)
{
@@ -178,9 +178,9 @@ void parameter::parse(const parsingContext& ctx, const std::vector &
foundCharsetChunk = true;
}
- for (string::size_type i = pos ; i < len ; ++i)
+ for (size_t i = pos ; i < len ; ++i)
{
- const string::value_type c = chunk.data[i];
+ const char c = chunk.data[i];
if (c == '%' && i + 2 < len)
{
@@ -218,7 +218,7 @@ void parameter::parse(const parsingContext& ctx, const std::vector &
break;
}
- value << static_cast (v);
+ value << static_cast (v);
i += 2; // skip next 2 chars
}
@@ -273,7 +273,7 @@ void parameter::parse(const parsingContext& ctx, const std::vector &
void parameter::generateImpl
(const generationContext& ctx, utility::outputStream& os,
- const string::size_type curLinePos, string::size_type* newLinePos) const
+ const size_t curLinePos, size_t* newLinePos) const
{
const string& name = m_name;
const string& value = m_value->getBuffer();
@@ -293,7 +293,7 @@ void parameter::generateImpl
string sevenBitBuffer;
utility::outputStreamStringAdapter sevenBitStream(sevenBitBuffer);
- string::size_type pos = curLinePos;
+ size_t pos = curLinePos;
if (pos + name.length() + 10 + value.length() > ctx.getMaxLineLength())
{
@@ -303,10 +303,10 @@ void parameter::generateImpl
bool needQuoting = false;
bool needQuotedPrintable = false;
- string::size_type valueLength = 0;
+ size_t valueLength = 0;
// Use worst-case length name.length()+2 for 'name=' part of line
- for (string::size_type i = 0 ; (i < value.length()) && (pos + name.length() + 2 + valueLength < ctx.getMaxLineLength() - 4) ; ++i, ++valueLength)
+ for (size_t i = 0 ; (i < value.length()) && (pos + name.length() + 2 + valueLength < ctx.getMaxLineLength() - 4) ; ++i, ++valueLength)
{
switch (value[i])
{
@@ -378,7 +378,7 @@ void parameter::generateImpl
else
{
// Do not chop off this value, but just add the complete name as one header line.
- for (string::size_type i = 0 ; i < value.length() ; ++i)
+ for (size_t i = 0 ; i < value.length() ; ++i)
{
const char_t c = value[i];
@@ -446,7 +446,7 @@ void parameter::generateImpl
// Check whether there is enough space for the first section:
// parameter name, section identifier, charset and separators
// + at least 5 characters for the value
- const string::size_type firstSectionLength =
+ const size_t firstSectionLength =
name.length() + 4 /* *0*= */ + 2 /* '' */
+ m_value->getCharset().getName().length();
@@ -461,9 +461,9 @@ void parameter::generateImpl
std::vector sectionText;
string currentSection;
- string::size_type currentSectionLength = firstSectionLength;
+ size_t currentSectionLength = firstSectionLength;
- for (string::size_type i = 0 ; i < value.length() ; ++i)
+ for (size_t i = 0 ; i < value.length() ; ++i)
{
// Check whether we should start a new line (taking into
// account the next character will be encoded = worst case)
diff --git a/src/parameterizedHeaderField.cpp b/src/parameterizedHeaderField.cpp
index 95421b3f..e2925d25 100644
--- a/src/parameterizedHeaderField.cpp
+++ b/src/parameterizedHeaderField.cpp
@@ -71,23 +71,23 @@ struct paramInfo
{
bool extended;
std::vector value;
- string::size_type start;
- string::size_type end;
+ size_t start;
+ size_t end;
};
#endif // VMIME_BUILDING_DOC
void parameterizedHeaderField::parseImpl
- (const parsingContext& ctx, const string& buffer, const string::size_type position,
- const string::size_type end, string::size_type* newPosition)
+ (const parsingContext& ctx, const string& buffer, const size_t position,
+ const size_t end, size_t* newPosition)
{
- const string::value_type* const pend = buffer.data() + end;
- const string::value_type* const pstart = buffer.data() + position;
- const string::value_type* p = pstart;
+ const char* const pend = buffer.data() + end;
+ const char* const pstart = buffer.data() + position;
+ const char* p = pstart;
// Skip non-significant whitespaces
- string::size_type valueStart = position;
+ size_t valueStart = position;
while (p < pend && parserHelpers::isSpace(*p))
{
@@ -96,7 +96,7 @@ void parameterizedHeaderField::parseImpl
}
// Advance up to ';', if any
- string::size_type valueLength = 0;
+ size_t valueLength = 0;
while (p < pend && *p != ';' && (!parserHelpers::isSpace(*p))) // FIXME: support ";" inside quoted or RFC-2047-encoded text
{
@@ -132,7 +132,7 @@ void parameterizedHeaderField::parseImpl
while (p < pend && parserHelpers::isSpace(*p)) ++p;
- const string::size_type attrStart = position + (p - pstart);
+ const size_t attrStart = position + (p - pstart);
while (p < pend && !(*p == ';' || *p == '='))
++p;
@@ -148,7 +148,7 @@ void parameterizedHeaderField::parseImpl
else
{
// Extract the attribute name
- string::size_type attrEnd = position + (p - pstart);
+ size_t attrEnd = position + (p - pstart);
while (attrEnd != attrStart && parserHelpers::isSpace(buffer[attrEnd - 1]))
--attrEnd;
@@ -173,7 +173,7 @@ void parameterizedHeaderField::parseImpl
bool stop = false;
std::ostringstream ss;
- string::size_type start = position + (p - pstart);
+ size_t start = position + (p - pstart);
for ( ; p < pend && !stop ; ++p)
{
@@ -218,12 +218,12 @@ void parameterizedHeaderField::parseImpl
// -- the value is a simple token
else
{
- const string::size_type valStart = position + (p - pstart);
+ const size_t valStart = position + (p - pstart);
while (p < pend && *p != ';')
++p;
- string::size_type valEnd = position + (p - pstart);
+ size_t valEnd = position + (p - pstart);
while (valEnd != valStart && parserHelpers::isSpace(buffer[valEnd - 1]))
--valEnd;
@@ -250,13 +250,13 @@ void parameterizedHeaderField::parseImpl
}
// Check for RFC-2231 multi-section parameters
- const string::size_type star = name.find_last_of('*');
+ const size_t star = name.find_last_of('*');
if (star != string::npos)
{
bool allDigits = true;
- for (string::size_type i = star + 1 ; allDigits && (i < name.length()) ; ++i)
+ for (size_t i = star + 1 ; allDigits && (i < name.length()) ; ++i)
allDigits = parserHelpers::isDigit(name[i]);
if (allDigits)
@@ -337,9 +337,9 @@ void parameterizedHeaderField::parseImpl
void parameterizedHeaderField::generateImpl
(const generationContext& ctx, utility::outputStream& os,
- const string::size_type curLinePos, string::size_type* newLinePos) const
+ const size_t curLinePos, size_t* newLinePos) const
{
- string::size_type pos = curLinePos;
+ size_t pos = curLinePos;
// Parent header field
headerField::generateImpl(ctx, os, pos, &pos);
diff --git a/src/path.cpp b/src/path.cpp
index 8722c9a7..3f1bc6af 100644
--- a/src/path.cpp
+++ b/src/path.cpp
@@ -113,10 +113,10 @@ const std::vector > path::getChildComponents()
void path::parseImpl
- (const parsingContext& /* ctx */, const string& buffer, const string::size_type position,
- const string::size_type end, string::size_type* newPosition)
+ (const parsingContext& /* ctx */, const string& buffer, const size_t position,
+ const size_t end, size_t* newPosition)
{
- string::size_type pos = position;
+ size_t pos = position;
while (pos < end && parserHelpers::isSpace(buffer[pos]))
++pos;
@@ -131,12 +131,12 @@ void path::parseImpl
while (pos < end && parserHelpers::isSpace(buffer[pos]))
++pos;
- const string::size_type addrStart = pos;
+ const size_t addrStart = pos;
while (pos < end && buffer[pos] != '>')
++pos;
- string::size_type addrEnd = pos;
+ size_t addrEnd = pos;
while (addrEnd > addrStart && parserHelpers::isSpace(buffer[addrEnd - 1]))
addrEnd--;
@@ -148,7 +148,7 @@ void path::parseImpl
addrSpec = string(buffer.begin() + position, buffer.begin() + end);
}
- const string::size_type at = addrSpec.find_first_of('@');
+ const size_t at = addrSpec.find_first_of('@');
if (at != string::npos)
{
@@ -168,7 +168,7 @@ void path::parseImpl
void path::generateImpl
(const generationContext& /* ctx */, utility::outputStream& os,
- const string::size_type curLinePos, string::size_type* newLinePos) const
+ const size_t curLinePos, size_t* newLinePos) const
{
if (m_localPart.empty() && m_domain.empty())
{
diff --git a/src/platforms/posix/posixChildProcess.cpp b/src/platforms/posix/posixChildProcess.cpp
index c4761624..54d4cd75 100644
--- a/src/platforms/posix/posixChildProcess.cpp
+++ b/src/platforms/posix/posixChildProcess.cpp
@@ -118,7 +118,14 @@ public:
{
}
- void write(const value_type* const data, const size_type count)
+ void flush()
+ {
+ ::fsync(m_desc);
+ }
+
+protected:
+
+ void writeImpl(const byte_t* const data, const size_t count)
{
if (::write(m_desc, data, count) == -1)
{
@@ -127,11 +134,6 @@ public:
}
}
- void flush()
- {
- ::fsync(m_desc);
- }
-
private:
const int m_desc;
@@ -159,13 +161,13 @@ public:
// Do nothing: unsupported
}
- size_type skip(const size_type count)
+ size_t skip(const size_t count)
{
// TODO: not tested
- value_type buffer[4096];
+ byte_t buffer[4096];
- int bytesSkipped = 0;
- int bytesRead = 0;
+ ssize_t bytesSkipped = 0;
+ ssize_t bytesRead = 0;
while ((bytesRead = ::read(m_desc, buffer,
std::min(sizeof(buffer), count - bytesSkipped))) != 0)
@@ -179,12 +181,12 @@ public:
bytesSkipped += bytesRead;
}
- return static_cast (bytesSkipped);
+ return static_cast (bytesSkipped);
}
- size_type read(value_type* const data, const size_type count)
+ size_t read(byte_t* const data, const size_t count)
{
- int bytesRead = 0;
+ ssize_t bytesRead = 0;
if ((bytesRead = ::read(m_desc, data, count)) == -1)
{
@@ -194,7 +196,7 @@ public:
m_eof = (bytesRead == 0);
- return static_cast (bytesRead);
+ return static_cast (bytesRead);
}
private:
diff --git a/src/platforms/posix/posixFile.cpp b/src/platforms/posix/posixFile.cpp
index 1e4dd070..9387414d 100644
--- a/src/platforms/posix/posixFile.cpp
+++ b/src/platforms/posix/posixFile.cpp
@@ -97,7 +97,7 @@ void posixFileIterator::getNextElement()
while ((m_dirEntry = ::readdir(m_dir)) != NULL)
{
const char* name = m_dirEntry->d_name;
- const int len = ::strlen(name);
+ const size_t len = ::strlen(name);
if (!(len == 1 && name[0] == '.') &&
!(len == 2 && name[0] == '.' && name[1] == '.'))
@@ -128,9 +128,10 @@ posixFileWriterOutputStream::~posixFileWriterOutputStream()
}
-void posixFileWriterOutputStream::write(const value_type* const data, const size_type count)
+void posixFileWriterOutputStream::writeImpl
+ (const byte_t* const data, const size_t count)
{
- const value_type* array = data;
+ const byte_t* array = data;
size_t size = count;
while (1)
@@ -196,8 +197,8 @@ void posixFileReaderInputStream::reset()
}
-vmime::utility::stream::size_type posixFileReaderInputStream::read
- (value_type* const data, const size_type count)
+size_t posixFileReaderInputStream::read
+ (byte_t* const data, const size_t count)
{
ssize_t c = 0;
@@ -207,11 +208,11 @@ vmime::utility::stream::size_type posixFileReaderInputStream::read
if (c == 0 && count != 0)
m_eof = true;
- return static_cast (c);
+ return static_cast (c);
}
-vmime::utility::stream::size_type posixFileReaderInputStream::skip(const size_type count)
+size_t posixFileReaderInputStream::skip(const size_t count)
{
const off_t curPos = ::lseek(m_fd, 0, SEEK_CUR);
@@ -223,22 +224,22 @@ vmime::utility::stream::size_type posixFileReaderInputStream::skip(const size_ty
if (newPos == off_t(-1))
posixFileSystemFactory::reportError(m_path, errno);
- return static_cast (newPos - curPos);
+ return static_cast (newPos - curPos);
}
-vmime::utility::stream::size_type posixFileReaderInputStream::getPosition() const
+size_t posixFileReaderInputStream::getPosition() const
{
const off_t curPos = ::lseek(m_fd, 0, SEEK_CUR);
if (curPos == off_t(-1))
posixFileSystemFactory::reportError(m_path, errno);
- return static_cast (curPos);
+ return static_cast (curPos);
}
-void posixFileReaderInputStream::seek(const size_type pos)
+void posixFileReaderInputStream::seek(const size_t pos)
{
const off_t newPos = ::lseek(m_fd, pos, SEEK_SET);
@@ -528,8 +529,8 @@ const vmime::string posixFileSystemFactory::pathToString(const vmime::utility::f
const vmime::utility::file::path posixFileSystemFactory::stringToPathImpl(const vmime::string& str)
{
- vmime::string::size_type offset = 0;
- vmime::string::size_type prev = 0;
+ vmime::size_t offset = 0;
+ vmime::size_t prev = 0;
vmime::utility::file::path path;
diff --git a/src/platforms/posix/posixHandler.cpp b/src/platforms/posix/posixHandler.cpp
index b5d08ce6..7ab0341a 100644
--- a/src/platforms/posix/posixHandler.cpp
+++ b/src/platforms/posix/posixHandler.cpp
@@ -181,7 +181,7 @@ static inline bool isFQDN(const vmime::string& str)
if (utility::stringUtils::isStringEqualNoCase(str, "localhost", 9))
return false;
- const vmime::string::size_type p = str.find_first_of(".");
+ const vmime::size_t p = str.find_first_of(".");
return p != vmime::string::npos && p > 0 && p != str.length() - 1;
}
diff --git a/src/platforms/posix/posixSocket.cpp b/src/platforms/posix/posixSocket.cpp
index e0bcf03a..eb00beb6 100644
--- a/src/platforms/posix/posixSocket.cpp
+++ b/src/platforms/posix/posixSocket.cpp
@@ -40,6 +40,8 @@
#include
#include
+#include "vmime/utility/stringUtils.hpp"
+
#include "vmime/exception.hpp"
@@ -426,7 +428,7 @@ const string posixSocket::getPeerName() const
}
-posixSocket::size_type posixSocket::getBlockSize() const
+size_t posixSocket::getBlockSize() const
{
return 16384; // 16 KB
}
@@ -434,12 +436,12 @@ posixSocket::size_type posixSocket::getBlockSize() const
void posixSocket::receive(vmime::string& buffer)
{
- const size_type size = receiveRaw(m_buffer, sizeof(m_buffer));
- buffer = vmime::string(m_buffer, size);
+ const size_t size = receiveRaw(m_buffer, sizeof(m_buffer));
+ buffer = utility::stringUtils::makeStringFromBytes(m_buffer, size);
}
-posixSocket::size_type posixSocket::receiveRaw(char* buffer, const size_type count)
+size_t posixSocket::receiveRaw(byte_t* buffer, const size_t count)
{
m_status &= ~STATUS_WOULDBLOCK;
@@ -529,15 +531,21 @@ posixSocket::size_type posixSocket::receiveRaw(char* buffer, const size_type cou
void posixSocket::send(const vmime::string& buffer)
{
- sendRaw(buffer.data(), buffer.length());
+ sendRaw(reinterpret_cast (buffer.data()), buffer.length());
}
-void posixSocket::sendRaw(const char* buffer, const size_type count)
+void posixSocket::send(const char* str)
+{
+ sendRaw(reinterpret_cast (str), ::strlen(str));
+}
+
+
+void posixSocket::sendRaw(const byte_t* buffer, const size_t count)
{
m_status &= ~STATUS_WOULDBLOCK;
- size_type size = count;
+ size_t size = count;
while (size > 0)
{
@@ -563,7 +571,7 @@ void posixSocket::sendRaw(const char* buffer, const size_type count)
}
-posixSocket::size_type posixSocket::sendRawNonBlocking(const char* buffer, const size_type count)
+size_t posixSocket::sendRawNonBlocking(const byte_t* buffer, const size_t count)
{
m_status &= ~STATUS_WOULDBLOCK;
diff --git a/src/platforms/windows/windowsFile.cpp b/src/platforms/windows/windowsFile.cpp
index 8d2a19da..6aa0fea8 100644
--- a/src/platforms/windows/windowsFile.cpp
+++ b/src/platforms/windows/windowsFile.cpp
@@ -61,8 +61,8 @@ const vmime::string windowsFileSystemFactory::pathToString(const vmime::utility:
const vmime::utility::file::path windowsFileSystemFactory::stringToPathImpl(const vmime::string& str)
{
- vmime::string::size_type offset = 0;
- vmime::string::size_type prev = 0;
+ vmime::size_t offset = 0;
+ vmime::size_t prev = 0;
vmime::utility::file::path path;
@@ -117,7 +117,7 @@ bool windowsFileSystemFactory::isValidPathComponent(
}
// Check for invalid characters
- for (string::size_type i = 0 ; i < buffer.length() ; ++i)
+ for (size_t i = 0 ; i < buffer.length() ; ++i)
{
const unsigned char c = buffer[i];
@@ -467,7 +467,7 @@ void windowsFileReaderInputStream::reset()
SetFilePointer(m_hFile, 0, NULL, FILE_BEGIN);
}
-vmime::utility::stream::size_type windowsFileReaderInputStream::read(value_type* const data, const size_type count)
+size_t windowsFileReaderInputStream::read(byte_t* const data, const size_t count)
{
DWORD dwBytesRead;
if (!ReadFile(m_hFile, (LPVOID)data, (DWORD)count, &dwBytesRead, NULL))
@@ -475,24 +475,24 @@ vmime::utility::stream::size_type windowsFileReaderInputStream::read(value_type*
return dwBytesRead;
}
-vmime::utility::stream::size_type windowsFileReaderInputStream::skip(const size_type count)
+size_t windowsFileReaderInputStream::skip(const size_t count)
{
DWORD dwCurPos = SetFilePointer(m_hFile, 0, NULL, FILE_CURRENT);
DWORD dwNewPos = SetFilePointer(m_hFile, (LONG)count, NULL, FILE_CURRENT);
return (dwNewPos - dwCurPos);
}
-vmime::utility::stream::size_type windowsFileReaderInputStream::getPosition() const
+size_t windowsFileReaderInputStream::getPosition() const
{
DWORD dwCurPos = SetFilePointer(m_hFile, 0, NULL, FILE_CURRENT);
if (dwCurPos == INVALID_SET_FILE_POINTER)
windowsFileSystemFactory::reportError(m_path, GetLastError());
- return static_cast (dwCurPos);
+ return static_cast (dwCurPos);
}
-void windowsFileReaderInputStream::seek(const size_type pos)
+void windowsFileReaderInputStream::seek(const size_t pos)
{
DWORD dwNewPos = SetFilePointer(m_hFile, (LONG)pos, NULL, FILE_BEGIN);
@@ -530,7 +530,7 @@ windowsFileWriterOutputStream::~windowsFileWriterOutputStream()
CloseHandle(m_hFile);
}
-void windowsFileWriterOutputStream::write(const value_type* const data, const size_type count)
+void windowsFileWriterOutputStream::writeImpl(const byte_t* const data, const size_t count)
{
DWORD dwBytesWritten;
if (!WriteFile(m_hFile, data, (DWORD)count, &dwBytesWritten, NULL))
diff --git a/src/platforms/windows/windowsHandler.cpp b/src/platforms/windows/windowsHandler.cpp
index 5b9c37ce..9c96b271 100644
--- a/src/platforms/windows/windowsHandler.cpp
+++ b/src/platforms/windows/windowsHandler.cpp
@@ -206,7 +206,7 @@ static inline bool isFQDN(const vmime::string& str)
if (utility::stringUtils::isStringEqualNoCase(str, "localhost", 9))
return false;
- const vmime::string::size_type p = str.find_first_of(".");
+ const vmime::size_t p = str.find_first_of(".");
return p != vmime::string::npos && p > 0 && p != str.length() - 1;
}
diff --git a/src/platforms/windows/windowsSocket.cpp b/src/platforms/windows/windowsSocket.cpp
index 502d1067..2cad21c0 100644
--- a/src/platforms/windows/windowsSocket.cpp
+++ b/src/platforms/windows/windowsSocket.cpp
@@ -230,7 +230,7 @@ const string windowsSocket::getPeerName() const
}
-windowsSocket::size_type windowsSocket::getBlockSize() const
+size_t windowsSocket::getBlockSize() const
{
return 16384; // 16 KB
}
@@ -238,12 +238,12 @@ windowsSocket::size_type windowsSocket::getBlockSize() const
void windowsSocket::receive(vmime::string& buffer)
{
- const size_type size = receiveRaw(m_buffer, sizeof(m_buffer));
+ const size_t size = receiveRaw(m_buffer, sizeof(m_buffer));
buffer = vmime::string(m_buffer, size);
}
-windowsSocket::size_type windowsSocket::receiveRaw(char* buffer, const size_type count)
+size_t windowsSocket::receiveRaw(char* buffer, const size_t count)
{
m_status &= ~STATUS_WOULDBLOCK;
@@ -307,15 +307,21 @@ windowsSocket::size_type windowsSocket::receiveRaw(char* buffer, const size_type
void windowsSocket::send(const vmime::string& buffer)
{
- sendRaw(buffer.data(), buffer.length());
+ sendRaw(reinterpret_cast (buffer.data()), buffer.length());
}
-void windowsSocket::sendRaw(const char* buffer, const size_type count)
+void windowsSocket::send(const char* str)
+{
+ sendRaw(reinterpret_cast (str), strlen(str));
+}
+
+
+void windowsSocket::sendRaw(const char* buffer, const size_t count)
{
m_status &= ~STATUS_WOULDBLOCK;
- size_type size = count;
+ size_t size = count;
while (size > 0)
{
@@ -344,7 +350,7 @@ void windowsSocket::sendRaw(const char* buffer, const size_type count)
}
-windowsSocket::size_type windowsSocket::sendRawNonBlocking(const char* buffer, const size_type count)
+size_t windowsSocket::sendRawNonBlocking(const char* buffer, const size_t count)
{
m_status &= ~STATUS_WOULDBLOCK;
diff --git a/src/propertySet.cpp b/src/propertySet.cpp
index 151c3e12..c22e79a6 100644
--- a/src/propertySet.cpp
+++ b/src/propertySet.cpp
@@ -131,7 +131,7 @@ void propertySet::parse(const string& props)
{
value.reserve(50);
- const string::value_type quoteChar = *pos;
+ const char quoteChar = *pos;
bool theEnd = false;
bool escape = false;
diff --git a/src/relay.cpp b/src/relay.cpp
index 327118c5..e5d30c9e 100644
--- a/src/relay.cpp
+++ b/src/relay.cpp
@@ -59,12 +59,12 @@ relay::relay(const relay& r)
*/
void relay::parseImpl
- (const parsingContext& ctx, const string& buffer, const string::size_type position,
- const string::size_type end, string::size_type* newPosition)
+ (const parsingContext& ctx, const string& buffer, const size_t position,
+ const size_t end, size_t* newPosition)
{
- const string::value_type* const pend = buffer.data() + end;
- const string::value_type* const pstart = buffer.data() + position;
- const string::value_type* p = pend - 1;
+ const char* const pend = buffer.data() + end;
+ const char* const pstart = buffer.data() + position;
+ const char* p = pend - 1;
// Find the beginning of the date part
while (p >= pstart && *p != ';')
@@ -107,7 +107,7 @@ void relay::parseImpl
// A little hack for handling comments
if (inComment)
{
- string::size_type par = word.find(')');
+ size_t par = word.find(')');
if (par != string::npos)
{
@@ -202,7 +202,7 @@ void relay::parseImpl
void relay::generateImpl
(const generationContext& ctx, utility::outputStream& os,
- const string::size_type curLinePos, string::size_type* newLinePos) const
+ const size_t curLinePos, size_t* newLinePos) const
{
std::ostringstream oss;
int count = 0;
diff --git a/src/security/cert/gnutls/X509Certificate_GnuTLS.cpp b/src/security/cert/gnutls/X509Certificate_GnuTLS.cpp
index 327ddefa..f96ddddb 100644
--- a/src/security/cert/gnutls/X509Certificate_GnuTLS.cpp
+++ b/src/security/cert/gnutls/X509Certificate_GnuTLS.cpp
@@ -92,11 +92,11 @@ void* X509Certificate_GnuTLS::getInternalData()
shared_ptr X509Certificate::import(utility::inputStream& is)
{
byteArray bytes;
- utility::stream::value_type chunk[4096];
+ byte_t chunk[4096];
while (!is.eof())
{
- const utility::stream::size_type len = is.read(chunk, sizeof(chunk));
+ const size_t len = is.read(chunk, sizeof(chunk));
bytes.insert(bytes.end(), chunk, chunk + len);
}
@@ -146,7 +146,7 @@ void X509Certificate_GnuTLS::write
gnutls_x509_crt_export(m_data->cert, fmt, &data[0], &dataSize);
- os.write(reinterpret_cast (&data[0]), dataSize);
+ os.write(reinterpret_cast (&data[0]), dataSize);
}
diff --git a/src/security/cert/openssl/X509Certificate_OpenSSL.cpp b/src/security/cert/openssl/X509Certificate_OpenSSL.cpp
index 8c7174a0..5f81b2bf 100644
--- a/src/security/cert/openssl/X509Certificate_OpenSSL.cpp
+++ b/src/security/cert/openssl/X509Certificate_OpenSSL.cpp
@@ -171,11 +171,11 @@ shared_ptr X509Certificate_OpenSSL::importInternal(X509* cert)
shared_ptr X509Certificate::import(utility::inputStream& is)
{
byteArray bytes;
- utility::stream::value_type chunk[4096];
+ byte_t chunk[4096];
while (!is.eof())
{
- const int len = is.read(chunk, sizeof(chunk));
+ const size_t len = is.read(chunk, sizeof(chunk));
bytes.insert(bytes.end(), chunk, chunk + len);
}
@@ -189,7 +189,7 @@ shared_ptr X509Certificate::import
{
shared_ptr cert = make_shared ();
- BIO* membio = BIO_new_mem_buf(const_cast (data), length);
+ BIO* membio = BIO_new_mem_buf(const_cast (data), static_cast (length));
if (!PEM_read_bio_X509(membio, &(cert->m_data->cert), 0, 0))
{
@@ -207,7 +207,7 @@ void X509Certificate_OpenSSL::write
(utility::outputStream& os, const Format format) const
{
BIO* membio = 0;
- int dataSize = 0;
+ long dataSize = 0;
unsigned char* out = 0;
if (format == FORMAT_DER)
@@ -215,7 +215,7 @@ void X509Certificate_OpenSSL::write
if ((dataSize = i2d_X509(m_data->cert, &out)) < 0)
goto err;
- os.write(reinterpret_cast (out), dataSize);
+ os.write(reinterpret_cast (out), dataSize);
os.flush();
OPENSSL_free(out);
}
@@ -228,7 +228,7 @@ void X509Certificate_OpenSSL::write
goto pem_err;
dataSize = BIO_get_mem_data(membio, &out);
- os.write(reinterpret_cast (out), dataSize);
+ os.write(reinterpret_cast (out), dataSize);
os.flush();
BIO_vfree(membio);
}
@@ -281,7 +281,7 @@ bool X509Certificate_OpenSSL::checkIssuer(shared_ptr cer
out = BIO_new(BIO_s_mem());
X509_NAME_print_ex(out, X509_get_issuer_name(m_data->cert), 0, XN_FLAG_RFC2253);
- int n = BIO_get_mem_data(out, &issuer);
+ long n = BIO_get_mem_data(out, &issuer);
vmime::string thisIssuerName((char*)issuer, n);
BIO_free(out);
diff --git a/src/security/digest/md5/md5MessageDigest.cpp b/src/security/digest/md5/md5MessageDigest.cpp
index 88f9c9de..a83f0623 100644
--- a/src/security/digest/md5/md5MessageDigest.cpp
+++ b/src/security/digest/md5/md5MessageDigest.cpp
@@ -83,7 +83,7 @@ void md5MessageDigest::init()
}
-static void copyUint8Array(vmime_uint8* dest, const vmime_uint8* src, unsigned long count)
+static void copyUint8Array(vmime_uint8* dest, const vmime_uint8* src, size_t count)
{
for ( ; count >= 4 ; count -= 4, dest += 4, src += 4)
{
@@ -104,7 +104,7 @@ static inline vmime_uint32 swapUint32(const vmime_uint32 D)
}
-static inline void swapUint32Array(vmime_uint32* buf, unsigned long words)
+static inline void swapUint32Array(vmime_uint32* buf, size_t words)
{
for ( ; words >= 4 ; words -= 4, buf += 4)
{
@@ -131,17 +131,16 @@ void md5MessageDigest::update(const string& s)
}
-void md5MessageDigest::update(const byte_t* data, const unsigned long offset,
- const unsigned long len)
+void md5MessageDigest::update(const byte_t* data, const size_t offset, const size_t len)
{
update(data + offset, len);
}
-void md5MessageDigest::update(const byte_t* data, const unsigned long length)
+void md5MessageDigest::update(const byte_t* data, const size_t length)
{
- const unsigned long avail = 64 - (m_byteCount & 0x3f);
- unsigned long len = length;
+ const size_t avail = 64 - (m_byteCount & 0x3f);
+ size_t len = length;
m_byteCount += len;
@@ -177,7 +176,7 @@ void md5MessageDigest::finalize(const string& s)
}
-void md5MessageDigest::finalize(const byte_t* buffer, const unsigned long len)
+void md5MessageDigest::finalize(const byte_t* buffer, const size_t len)
{
update(buffer, len);
finalize();
@@ -185,7 +184,7 @@ void md5MessageDigest::finalize(const byte_t* buffer, const unsigned long len)
void md5MessageDigest::finalize(const byte_t* buffer,
- const unsigned long offset, const unsigned long len)
+ const size_t offset, const size_t len)
{
update(buffer, offset, len);
finalize();
@@ -329,7 +328,7 @@ void md5MessageDigest::transform()
}
-int md5MessageDigest::getDigestLength() const
+size_t md5MessageDigest::getDigestLength() const
{
return 16;
}
diff --git a/src/security/digest/messageDigest.cpp b/src/security/digest/messageDigest.cpp
index 2cc11617..18fc8628 100644
--- a/src/security/digest/messageDigest.cpp
+++ b/src/security/digest/messageDigest.cpp
@@ -34,14 +34,14 @@ namespace digest {
const string messageDigest::getHexDigest() const
{
const byte_t* hash = getDigest();
- const int len = getDigestLength();
+ const size_t len = getDigestLength();
static const unsigned char hex[] = "0123456789abcdef";
std::ostringstream oss;
oss.imbue(std::locale::classic());
- for (int i = 0 ; i < len ; ++i)
+ for (size_t i = 0 ; i < len ; ++i)
{
oss << hex[(hash[i] & 0xf0) >> 4];
oss << hex[(hash[i] & 0x0f)];
diff --git a/src/security/digest/sha1/sha1MessageDigest.cpp b/src/security/digest/sha1/sha1MessageDigest.cpp
index e022eb8a..aa055af5 100644
--- a/src/security/digest/sha1/sha1MessageDigest.cpp
+++ b/src/security/digest/sha1/sha1MessageDigest.cpp
@@ -95,14 +95,14 @@ void sha1MessageDigest::update(const string& s)
}
-void sha1MessageDigest::update(const byte_t* buffer, const unsigned long offset,
+void sha1MessageDigest::update(const byte_t* buffer, const size_t offset,
const unsigned long len)
{
update(buffer + offset, len);
}
-void sha1MessageDigest::update(const byte_t* buffer, const unsigned long len)
+void sha1MessageDigest::update(const byte_t* buffer, const size_t len)
{
unsigned int i, j;
@@ -174,7 +174,7 @@ void sha1MessageDigest::finalize(const string& s)
}
-void sha1MessageDigest::finalize(const byte_t* buffer, const unsigned long len)
+void sha1MessageDigest::finalize(const byte_t* buffer, const size_t len)
{
update(buffer, len);
finalize();
@@ -182,7 +182,7 @@ void sha1MessageDigest::finalize(const byte_t* buffer, const unsigned long len)
void sha1MessageDigest::finalize(const byte_t* buffer,
- const unsigned long offset, const unsigned long len)
+ const size_t offset, const size_t len)
{
finalize(buffer + offset, len);
}
@@ -251,7 +251,7 @@ void sha1MessageDigest::transform
}
-int sha1MessageDigest::getDigestLength() const
+size_t sha1MessageDigest::getDigestLength() const
{
return 20;
}
diff --git a/src/security/sasl/SASLContext.cpp b/src/security/sasl/SASLContext.cpp
index c4d60bd9..3474cbeb 100644
--- a/src/security/sasl/SASLContext.cpp
+++ b/src/security/sasl/SASLContext.cpp
@@ -106,7 +106,7 @@ shared_ptr SASLContext::suggestMechanism
}
-void SASLContext::decodeB64(const string& input, byte_t** output, long* outputLen)
+void SASLContext::decodeB64(const string& input, byte_t** output, size_t* outputLen)
{
string res;
@@ -127,7 +127,7 @@ void SASLContext::decodeB64(const string& input, byte_t** output, long* outputLe
}
-const string SASLContext::encodeB64(const byte_t* input, const long inputLen)
+const string SASLContext::encodeB64(const byte_t* input, const size_t inputLen)
{
string res;
diff --git a/src/security/sasl/SASLSession.cpp b/src/security/sasl/SASLSession.cpp
index 1bdd0889..087ef27b 100644
--- a/src/security/sasl/SASLSession.cpp
+++ b/src/security/sasl/SASLSession.cpp
@@ -99,8 +99,8 @@ shared_ptr SASLSession::getContext()
bool SASLSession::evaluateChallenge
- (const byte_t* challenge, const long challengeLen,
- byte_t** response, long* responseLen)
+ (const byte_t* challenge, const size_t challengeLen,
+ byte_t** response, size_t* responseLen)
{
return m_mech->step(dynamicCast (shared_from_this()),
challenge, challengeLen, response, responseLen);
diff --git a/src/security/sasl/SASLSocket.cpp b/src/security/sasl/SASLSocket.cpp
index 37e297dc..12d634c2 100644
--- a/src/security/sasl/SASLSocket.cpp
+++ b/src/security/sasl/SASLSocket.cpp
@@ -30,9 +30,12 @@
#include "vmime/security/sasl/SASLSocket.hpp"
#include "vmime/security/sasl/SASLSession.hpp"
+#include "vmime/utility/stringUtils.hpp"
+
#include "vmime/exception.hpp"
#include
+#include
#include
@@ -75,7 +78,7 @@ bool SASLSocket::isConnected() const
}
-SASLSocket::size_type SASLSocket::getBlockSize() const
+size_t SASLSocket::getBlockSize() const
{
return m_wrapped->getBlockSize();
}
@@ -95,17 +98,17 @@ const string SASLSocket::getPeerAddress() const
void SASLSocket::receive(string& buffer)
{
- const size_type n = receiveRaw(m_recvBuffer, sizeof(m_recvBuffer));
+ const size_t n = receiveRaw(m_recvBuffer, sizeof(m_recvBuffer));
- buffer = string(m_recvBuffer, n);
+ buffer = utility::stringUtils::makeStringFromBytes(m_recvBuffer, n);
}
-SASLSocket::size_type SASLSocket::receiveRaw(char* buffer, const size_type count)
+size_t SASLSocket::receiveRaw(byte_t* buffer, const size_t count)
{
if (m_pendingLen != 0)
{
- const size_type copyLen =
+ const size_t copyLen =
(count >= m_pendingLen ? m_pendingLen : count);
std::copy(m_pendingBuffer + m_pendingPos,
@@ -127,14 +130,13 @@ SASLSocket::size_type SASLSocket::receiveRaw(char* buffer, const size_type count
return copyLen;
}
- const size_type n = m_wrapped->receiveRaw(buffer, count);
+ const size_t n = m_wrapped->receiveRaw(buffer, count);
byte_t* output = 0;
- long outputLen = 0;
+ size_t outputLen = 0;
m_session->getMechanism()->decode
- (m_session, reinterpret_cast (buffer), n,
- &output, &outputLen);
+ (m_session, buffer, n, &output, &outputLen);
// If we can not copy all decoded data into the output buffer, put
// remaining data into a pending buffer for next calls to receive()
@@ -161,23 +163,27 @@ SASLSocket::size_type SASLSocket::receiveRaw(char* buffer, const size_type count
void SASLSocket::send(const string& buffer)
{
- sendRaw(buffer.data(), buffer.length());
+ sendRaw(reinterpret_cast (buffer.data()), buffer.length());
}
-void SASLSocket::sendRaw(const char* buffer, const size_type count)
+void SASLSocket::send(const char* str)
+{
+ sendRaw(reinterpret_cast (str), strlen(str));
+}
+
+
+void SASLSocket::sendRaw(const byte_t* buffer, const size_t count)
{
byte_t* output = 0;
- long outputLen = 0;
+ size_t outputLen = 0;
m_session->getMechanism()->encode
- (m_session, reinterpret_cast (buffer), count,
- &output, &outputLen);
+ (m_session, buffer, count, &output, &outputLen);
try
{
- m_wrapped->sendRaw
- (reinterpret_cast (output), outputLen);
+ m_wrapped->sendRaw(output, outputLen);
}
catch (...)
{
@@ -189,21 +195,19 @@ void SASLSocket::sendRaw(const char* buffer, const size_type count)
}
-SASLSocket::size_type SASLSocket::sendRawNonBlocking(const char* buffer, const size_type count)
+size_t SASLSocket::sendRawNonBlocking(const byte_t* buffer, const size_t count)
{
byte_t* output = 0;
- long outputLen = 0;
+ size_t outputLen = 0;
m_session->getMechanism()->encode
- (m_session, reinterpret_cast (buffer), count,
- &output, &outputLen);
+ (m_session, buffer, count, &output, &outputLen);
- size_type bytesSent = 0;
+ size_t bytesSent = 0;
try
{
- bytesSent = m_wrapped->sendRawNonBlocking
- (reinterpret_cast (output), outputLen);
+ bytesSent = m_wrapped->sendRawNonBlocking(output, outputLen);
}
catch (...)
{
diff --git a/src/security/sasl/builtinSASLMechanism.cpp b/src/security/sasl/builtinSASLMechanism.cpp
index e7bd723e..e179e715 100644
--- a/src/security/sasl/builtinSASLMechanism.cpp
+++ b/src/security/sasl/builtinSASLMechanism.cpp
@@ -63,8 +63,8 @@ const string builtinSASLMechanism::getName() const
bool builtinSASLMechanism::step
- (shared_ptr sess, const byte_t* challenge, const long challengeLen,
- byte_t** response, long* responseLen)
+ (shared_ptr sess, const byte_t* challenge, const size_t challengeLen,
+ byte_t** response, size_t* responseLen)
{
char* output = 0;
size_t outputLen = 0;
@@ -121,8 +121,8 @@ bool builtinSASLMechanism::isComplete() const
void builtinSASLMechanism::encode
- (shared_ptr sess, const byte_t* input, const long inputLen,
- byte_t** output, long* outputLen)
+ (shared_ptr sess, const byte_t* input, const size_t inputLen,
+ byte_t** output, size_t* outputLen)
{
char* coutput = 0;
size_t coutputLen = 0;
@@ -154,8 +154,8 @@ void builtinSASLMechanism::encode
void builtinSASLMechanism::decode
- (shared_ptr sess, const byte_t* input, const long inputLen,
- byte_t** output, long* outputLen)
+ (shared_ptr sess, const byte_t* input, const size_t inputLen,
+ byte_t** output, size_t* outputLen)
{
char* coutput = 0;
size_t coutputLen = 0;
diff --git a/src/streamContentHandler.cpp b/src/streamContentHandler.cpp
index b84fdae5..8676cc34 100644
--- a/src/streamContentHandler.cpp
+++ b/src/streamContentHandler.cpp
@@ -40,7 +40,7 @@ streamContentHandler::streamContentHandler()
streamContentHandler::streamContentHandler(shared_ptr is,
- const utility::stream::size_type length, const vmime::encoding& enc)
+ const size_t length, const vmime::encoding& enc)
{
setData(is, length, enc);
}
@@ -52,7 +52,7 @@ streamContentHandler::~streamContentHandler()
streamContentHandler::streamContentHandler(const streamContentHandler& cts)
- : contentHandler(), m_encoding(cts.m_encoding), m_contentType(cts.m_contentType),
+ : contentHandler(), m_contentType(cts.m_contentType), m_encoding(cts.m_encoding),
m_stream(cts.m_stream), m_length(cts.m_length)
{
}
@@ -77,7 +77,7 @@ streamContentHandler& streamContentHandler::operator=(const streamContentHandler
void streamContentHandler::setData(shared_ptr is,
- const utility::stream::size_type length, const vmime::encoding& enc)
+ const size_t length, const vmime::encoding& enc)
{
m_encoding = enc;
m_length = length;
@@ -86,7 +86,7 @@ void streamContentHandler::setData(shared_ptr is,
void streamContentHandler::generate(utility::outputStream& os, const vmime::encoding& enc,
- const string::size_type maxLineLength) const
+ const size_t maxLineLength) const
{
if (!m_stream)
return;
@@ -185,7 +185,7 @@ void streamContentHandler::extractRaw(utility::outputStream& os,
}
-string::size_type streamContentHandler::getLength() const
+size_t streamContentHandler::getLength() const
{
return (m_length);
}
diff --git a/src/stringContentHandler.cpp b/src/stringContentHandler.cpp
index 0fb032dd..9a66663c 100644
--- a/src/stringContentHandler.cpp
+++ b/src/stringContentHandler.cpp
@@ -56,8 +56,8 @@ stringContentHandler::stringContentHandler(const utility::stringProxy& str, cons
}
-stringContentHandler::stringContentHandler(const string& buffer, const string::size_type start,
- const string::size_type end, const vmime::encoding& enc)
+stringContentHandler::stringContentHandler(const string& buffer, const size_t start,
+ const size_t end, const vmime::encoding& enc)
: m_encoding(enc), m_string(buffer, start, end)
{
}
@@ -98,8 +98,8 @@ void stringContentHandler::setData(const string& buffer, const vmime::encoding&
}
-void stringContentHandler::setData(const string& buffer, const string::size_type start,
- const string::size_type end, const vmime::encoding& enc)
+void stringContentHandler::setData(const string& buffer, const size_t start,
+ const size_t end, const vmime::encoding& enc)
{
m_encoding = enc;
m_string.set(buffer, start, end);
@@ -114,7 +114,7 @@ stringContentHandler& stringContentHandler::operator=(const string& buffer)
void stringContentHandler::generate(utility::outputStream& os,
- const vmime::encoding& enc, const string::size_type maxLineLength) const
+ const vmime::encoding& enc, const size_t maxLineLength) const
{
// Managed data is already encoded
if (isEncoded())
@@ -191,7 +191,7 @@ void stringContentHandler::extractRaw(utility::outputStream& os,
}
-string::size_type stringContentHandler::getLength() const
+size_t stringContentHandler::getLength() const
{
return (m_string.length());
}
diff --git a/src/text.cpp b/src/text.cpp
index 987510c1..08fc9ba9 100644
--- a/src/text.cpp
+++ b/src/text.cpp
@@ -68,12 +68,12 @@ text::~text()
void text::parseImpl
- (const parsingContext& ctx, const string& buffer, const string::size_type position,
- const string::size_type end, string::size_type* newPosition)
+ (const parsingContext& ctx, const string& buffer, const size_t position,
+ const size_t end, size_t* newPosition)
{
removeAllWords();
- string::size_type newPos;
+ size_t newPos;
const std::vector > words = word::parseMultiple(ctx, buffer, position, end, &newPos);
@@ -88,7 +88,7 @@ void text::parseImpl
void text::generateImpl
(const generationContext& ctx, utility::outputStream& os,
- const string::size_type curLinePos, string::size_type* newLinePos) const
+ const size_t curLinePos, size_t* newLinePos) const
{
encodeAndFold(ctx, os, curLinePos, newLinePos, 0);
}
@@ -251,8 +251,8 @@ shared_ptr text::newFromString(const string& in, const charset& ch)
void text::createFromString(const string& in, const charset& ch)
{
- string::size_type asciiCount = 0;
- string::size_type asciiPercent = 0;
+ size_t asciiCount = 0;
+ size_t asciiPercent = 0;
removeAllWords();
@@ -281,7 +281,7 @@ void text::createFromString(const string& in, const charset& ch)
bool prevIs8bit = false; // is previous word 8-bit?
unsigned int count = 0; // total number of words
- for (string::size_type end = in.size(), pos = 0, start = 0 ; ; )
+ for (size_t end = in.size(), pos = 0, start = 0 ; ; )
{
if (pos == end || parserHelpers::isSpace(in[pos]))
{
@@ -352,9 +352,9 @@ void text::createFromString(const string& in, const charset& ch)
void text::encodeAndFold
(const generationContext& ctx, utility::outputStream& os,
- const string::size_type firstLineOffset, string::size_type* lastLineLength, const int flags) const
+ const size_t firstLineOffset, size_t* lastLineLength, const int flags) const
{
- string::size_type curLineLength = firstLineOffset;
+ size_t curLineLength = firstLineOffset;
word::generatorState state;
for (size_t wi = 0 ; wi < getWordCount() ; ++wi)
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 (x), l)
+ #define B64_WRITE(s, x, l) s.write(reinterpret_cast (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 ("maxlinelength", static_cast (-1));
+ const size_t propMaxLineLength =
+ getProperties().getProperty ("maxlinelength", static_cast (-1));
- const bool cutLines = (propMaxLineLength != static_cast (-1));
- const string::size_type maxLineLength = std::min(propMaxLineLength, static_cast (76));
+ const bool cutLines = (propMaxLineLength != static_cast (-1));
+ const size_t maxLineLength = std::min(propMaxLineLength, static_cast (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 ((sm_decodeMap[c1] << 2) | ((sm_decodeMap[c2] & 0x30) >> 4));
+ output[0] = static_cast ((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