From 3a5621c2aa3931be608508d4fadc42c2a09cb251 Mon Sep 17 00:00:00 2001 From: Vincent Richard Date: Wed, 12 Dec 2012 16:35:55 +0100 Subject: [PATCH] Trivial 64-bit warning fixes. --- CMakeLists.txt | 3 +++ SConstruct | 2 ++ cmake/config.hpp.cmake | 2 ++ src/addressList.cpp | 14 +++++++------- src/attachmentHelper.cpp | 4 ++-- src/body.cpp | 16 ++++++++-------- src/component.cpp | 2 +- src/header.cpp | 12 ++++++------ src/htmlTextPart.cpp | 14 +++++++------- src/mailbox.cpp | 2 +- src/mailboxGroup.cpp | 16 ++++++++-------- src/mailboxList.cpp | 12 ++++++------ src/mdn/receivedMDNInfos.cpp | 2 +- src/messageBuilder.cpp | 8 ++++---- src/messageIdSequence.cpp | 12 ++++++------ src/messageParser.cpp | 12 ++++++------ src/net/imap/IMAPFolder.cpp | 2 +- src/net/imap/IMAPMessage.cpp | 4 ++-- src/net/imap/IMAPStructure.cpp | 6 +++--- src/net/imap/IMAPUtils.cpp | 4 ++-- src/net/maildir/format/courierMaildirFormat.cpp | 10 +++++----- src/net/maildir/maildirFolder.cpp | 4 ++-- src/net/maildir/maildirMessage.cpp | 6 +++--- src/net/message.cpp | 6 +++--- src/net/pop3/POP3Response.cpp | 4 ++-- src/net/pop3/POP3Store.cpp | 2 +- src/net/pop3/POP3Utils.cpp | 2 +- src/net/serviceFactory.cpp | 4 ++-- src/net/smtp/SMTPResponse.cpp | 4 ++-- src/net/smtp/SMTPTransport.cpp | 8 ++++---- src/net/transport.cpp | 2 +- src/parameterizedHeaderField.cpp | 12 ++++++------ src/plainTextPart.cpp | 2 +- src/security/digest/md5/md5MessageDigest.cpp | 4 ++-- src/security/digest/sha1/sha1MessageDigest.cpp | 4 ++-- src/text.cpp | 14 +++++++------- src/utility/encoder/encoderFactory.cpp | 4 ++-- src/utility/path.cpp | 10 +++++----- src/utility/random.cpp | 6 +++--- tests/parser/attachmentHelperTest.cpp | 2 +- tests/testUtils.cpp | 1 + tests/testUtils.hpp | 6 +++--- vmime/addressList.hpp | 12 ++++++------ vmime/body.hpp | 12 ++++++------ vmime/header.hpp | 12 ++++++------ vmime/htmlTextPart.hpp | 6 +++--- vmime/mailboxGroup.hpp | 12 ++++++------ vmime/mailboxList.hpp | 12 ++++++------ vmime/messageBuilder.hpp | 8 ++++---- vmime/messageIdSequence.hpp | 12 ++++++------ vmime/messageParser.hpp | 8 ++++---- vmime/net/imap/IMAPStructure.hpp | 6 +++--- vmime/net/message.hpp | 12 ++++++------ vmime/net/pop3/POP3Response.hpp | 6 +++--- vmime/net/serviceFactory.hpp | 4 ++-- vmime/net/smtp/SMTPResponse.hpp | 4 ++-- vmime/parameterizedHeaderField.hpp | 12 ++++++------ vmime/plainTextPart.hpp | 2 +- vmime/text.hpp | 12 ++++++------ vmime/textPart.hpp | 2 +- vmime/types.hpp | 4 ++++ vmime/utility/encoder/encoderFactory.hpp | 4 ++-- vmime/utility/path.hpp | 10 +++++----- vmime/utility/random.hpp | 2 +- 64 files changed, 226 insertions(+), 214 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 79a8ee03..4f044a2b 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -341,6 +341,9 @@ SET( INCLUDE(cmake/TargetArch.cmake) TARGET_ARCHITECTURE(CMAKE_TARGET_ARCHITECTURES) +INCLUDE(CheckTypeSize) +CHECK_TYPE_SIZE(size_t VMIME_HAVE_SIZE_T) + ############################################################################## # Sendmail path diff --git a/SConstruct b/SConstruct index 3fe9588d..421d715f 100644 --- a/SConstruct +++ b/SConstruct @@ -810,6 +810,8 @@ config_hpp.write('// -- 32-bit\n') config_hpp.write('typedef signed ' + env['pf_32bit_type'] + ' vmime_int32;\n') config_hpp.write('typedef unsigned ' + env['pf_32bit_type'] + ' vmime_uint32;\n') config_hpp.write('\n') +config_hpp.write('#define VMIME_HAVE_SIZE_T 1\n') +config_hpp.write('\n') config_hpp.write('// Options\n') diff --git a/cmake/config.hpp.cmake b/cmake/config.hpp.cmake index 0b54fe97..8e7f727d 100644 --- a/cmake/config.hpp.cmake +++ b/cmake/config.hpp.cmake @@ -35,6 +35,8 @@ typedef unsigned @VMIME_16BIT_TYPE@ vmime_uint16; typedef signed @VMIME_32BIT_TYPE@ vmime_int32; typedef unsigned @VMIME_32BIT_TYPE@ vmime_uint32; +#cmakedefine01 VMIME_HAVE_SIZE_T + // Options // -- File-system support #cmakedefine01 VMIME_HAVE_FILESYSTEM_FEATURES diff --git a/src/addressList.cpp b/src/addressList.cpp index f06460d3..dc280c89 100644 --- a/src/addressList.cpp +++ b/src/addressList.cpp @@ -121,7 +121,7 @@ addressList& addressList::operator=(const mailboxList& other) { removeAllAddresses(); - for (int i = 0 ; i < other.getMailboxCount() ; ++i) + for (size_t i = 0 ; i < other.getMailboxCount() ; ++i) m_list.push_back(other.getMailboxAt(i)->clone().dynamicCast
()); return (*this); @@ -152,7 +152,7 @@ void addressList::insertAddressBefore(ref
beforeAddress, ref
} -void addressList::insertAddressBefore(const int pos, ref
addr) +void addressList::insertAddressBefore(const size_t pos, ref
addr) { m_list.insert(m_list.begin() + pos, addr); } @@ -170,7 +170,7 @@ void addressList::insertAddressAfter(ref
afterAddress, ref
a } -void addressList::insertAddressAfter(const int pos, ref
addr) +void addressList::insertAddressAfter(const size_t pos, ref
addr) { m_list.insert(m_list.begin() + pos + 1, addr); } @@ -188,7 +188,7 @@ void addressList::removeAddress(ref
addr) } -void addressList::removeAddress(const int pos) +void addressList::removeAddress(const size_t pos) { const std::vector >::iterator it = m_list.begin() + pos; @@ -202,7 +202,7 @@ void addressList::removeAllAddresses() } -int addressList::getAddressCount() const +size_t addressList::getAddressCount() const { return (m_list.size()); } @@ -214,13 +214,13 @@ bool addressList::isEmpty() const } -ref
addressList::getAddressAt(const int pos) +ref
addressList::getAddressAt(const size_t pos) { return (m_list[pos]); } -const ref addressList::getAddressAt(const int pos) const +const ref addressList::getAddressAt(const size_t pos) const { return (m_list[pos]); } diff --git a/src/attachmentHelper.cpp b/src/attachmentHelper.cpp index 01746813..68c003f9 100644 --- a/src/attachmentHelper.cpp +++ b/src/attachmentHelper.cpp @@ -183,7 +183,7 @@ const std::vector > { ref bdy = part->getBody(); - for (int i = 0 ; i < bdy->getPartCount() ; ++i) + for (size_t i = 0 ; i < bdy->getPartCount() ; ++i) { std::vector > partAtts = findAttachmentsInBodyPart(bdy->getPartAt(i), options); @@ -295,7 +295,7 @@ ref attachmentHelper::findBodyPart // Try in sub-parts ref bdy = part->getBody(); - for (int i = 0 ; i < bdy->getPartCount() ; ++i) + for (size_t i = 0 ; i < bdy->getPartCount() ; ++i) { ref found = findBodyPart(bdy->getPartAt(i), type); diff --git a/src/body.cpp b/src/body.cpp index e235d49a..6c3c629c 100644 --- a/src/body.cpp +++ b/src/body.cpp @@ -446,7 +446,7 @@ void body::generateImpl(utility::outputStream& os, const string::size_type maxLi os << "--" << boundary; - for (int p = 0 ; p < getPartCount() ; ++p) + for (size_t p = 0 ; p < getPartCount() ; ++p) { os << CRLF; @@ -705,7 +705,7 @@ void body::copyFrom(const component& other) removeAllParts(); - for (int p = 0 ; p < bdy.getPartCount() ; ++p) + for (size_t p = 0 ; p < bdy.getPartCount() ; ++p) { ref part = bdy.getPartAt(p)->clone().dynamicCast (); @@ -854,7 +854,7 @@ void body::insertPartBefore(ref beforePart, ref part) } -void body::insertPartBefore(const int pos, ref part) +void body::insertPartBefore(const size_t pos, ref part) { initNewPart(part); @@ -876,7 +876,7 @@ void body::insertPartAfter(ref afterPart, ref part) } -void body::insertPartAfter(const int pos, ref part) +void body::insertPartAfter(const size_t pos, ref part) { initNewPart(part); @@ -896,7 +896,7 @@ void body::removePart(ref part) } -void body::removePart(const int pos) +void body::removePart(const size_t pos) { m_parts.erase(m_parts.begin() + pos); } @@ -908,7 +908,7 @@ void body::removeAllParts() } -int body::getPartCount() const +size_t body::getPartCount() const { return (m_parts.size()); } @@ -920,13 +920,13 @@ bool body::isEmpty() const } -ref body::getPartAt(const int pos) +ref body::getPartAt(const size_t pos) { return (m_parts[pos]); } -const ref body::getPartAt(const int pos) const +const ref body::getPartAt(const size_t pos) const { return (m_parts[pos]); } diff --git a/src/component.cpp b/src/component.cpp index e93aacf3..8db5d3f5 100644 --- a/src/component.cpp +++ b/src/component.cpp @@ -110,7 +110,7 @@ void component::offsetParsedBounds(const utility::stream::size_type offset) // Offset parsed bounds of our children std::vector > children = getChildComponents(); - for (unsigned int i = 0, n = children.size() ; i < n ; ++i) + for (size_t i = 0, n = children.size() ; i < n ; ++i) children[i]->offsetParsedBounds(offset); } diff --git a/src/header.cpp b/src/header.cpp index fcdca2c9..386cb5ed 100644 --- a/src/header.cpp +++ b/src/header.cpp @@ -232,7 +232,7 @@ void header::insertFieldBefore(ref beforeField, ref } -void header::insertFieldBefore(const int pos, ref field) +void header::insertFieldBefore(const size_t pos, ref field) { m_fields.insert(m_fields.begin() + pos, field); } @@ -250,7 +250,7 @@ void header::insertFieldAfter(ref afterField, ref fi } -void header::insertFieldAfter(const int pos, ref field) +void header::insertFieldAfter(const size_t pos, ref field) { m_fields.insert(m_fields.begin() + pos + 1, field); } @@ -268,7 +268,7 @@ void header::removeField(ref field) } -void header::removeField(const int pos) +void header::removeField(const size_t pos) { const std::vector >::iterator it = m_fields.begin() + pos; @@ -291,7 +291,7 @@ void header::removeAllFields(const string& fieldName) } -int header::getFieldCount() const +size_t header::getFieldCount() const { return (m_fields.size()); } @@ -303,13 +303,13 @@ bool header::isEmpty() const } -const ref header::getFieldAt(const int pos) +const ref header::getFieldAt(const size_t pos) { return (m_fields[pos]); } -const ref header::getFieldAt(const int pos) const +const ref header::getFieldAt(const size_t pos) const { return (m_fields[pos]); } diff --git a/src/htmlTextPart.cpp b/src/htmlTextPart.cpp index 98524afb..578796bd 100644 --- a/src/htmlTextPart.cpp +++ b/src/htmlTextPart.cpp @@ -56,7 +56,7 @@ const mediaType htmlTextPart::getType() const } -int htmlTextPart::getPartCount() const +size_t htmlTextPart::getPartCount() const { return (m_plainText->isEmpty() ? 1 : 2); } @@ -131,7 +131,7 @@ void htmlTextPart::generateIn(ref /* message */, ref paren void htmlTextPart::findEmbeddedParts(const bodyPart& part, std::vector >& cidParts, std::vector >& locParts) { - for (int i = 0 ; i < part.getBody()->getPartCount() ; ++i) + for (size_t i = 0 ; i < part.getBody()->getPartCount() ; ++i) { ref p = part.getBody()->getPartAt(i); @@ -278,7 +278,7 @@ bool htmlTextPart::findPlainTextPart(const bodyPart& part, const bodyPart& paren { ref foundPart = NULL; - for (int i = 0 ; i < part.getBody()->getPartCount() ; ++i) + for (size_t i = 0 ; i < part.getBody()->getPartCount() ; ++i) { const ref p = part.getBody()->getPartAt(i); @@ -294,7 +294,7 @@ bool htmlTextPart::findPlainTextPart(const bodyPart& part, const bodyPart& paren bool found = false; // Now, search for the alternative plain text part - for (int i = 0 ; !found && i < part.getBody()->getPartCount() ; ++i) + for (size_t i = 0 ; !found && i < part.getBody()->getPartCount() ; ++i) { const ref p = part.getBody()->getPartAt(i); @@ -332,7 +332,7 @@ bool htmlTextPart::findPlainTextPart(const bodyPart& part, const bodyPart& paren bool found = false; - for (int i = 0 ; !found && i < part.getBody()->getPartCount() ; ++i) + for (size_t i = 0 ; !found && i < part.getBody()->getPartCount() ; ++i) { found = findPlainTextPart(*part.getBody()->getPartAt(i), parent, textPart); } @@ -377,13 +377,13 @@ void htmlTextPart::setText(ref text) } -int htmlTextPart::getObjectCount() const +size_t htmlTextPart::getObjectCount() const { return m_objects.size(); } -const ref htmlTextPart::getObjectAt(const int pos) const +const ref htmlTextPart::getObjectAt(const size_t pos) const { return m_objects[pos]; } diff --git a/src/mailbox.cpp b/src/mailbox.cpp index dfdccad7..cdfbaf50 100644 --- a/src/mailbox.cpp +++ b/src/mailbox.cpp @@ -377,7 +377,7 @@ void mailbox::generateImpl(utility::outputStream& os, const string::size_type ma // and/or contain the special chars. bool forceEncode = false; - for (int w = 0 ; !forceEncode && w != m_name.getWordCount() ; ++w) + for (size_t w = 0 ; !forceEncode && w != m_name.getWordCount() ; ++w) { if (m_name.getWordAt(w)->getCharset() == charset(charsets::US_ASCII)) { diff --git a/src/mailboxGroup.cpp b/src/mailboxGroup.cpp index c37444a0..4144f524 100644 --- a/src/mailboxGroup.cpp +++ b/src/mailboxGroup.cpp @@ -90,7 +90,7 @@ void mailboxGroup::parseImpl(const string& buffer, const string::size_type posit // Sub-groups are not allowed in mailbox groups: so, we add all // the contents of the sub-group into this group... - for (int i = 0 ; i < group->getMailboxCount() ; ++i) + for (size_t i = 0 ; i < group->getMailboxCount() ; ++i) { m_list.push_back(group->getMailboxAt(i)->clone().staticCast ()); } @@ -123,7 +123,7 @@ void mailboxGroup::generateImpl(utility::outputStream& os, const string::size_ty // and/or contain the special chars. bool forceEncode = false; - for (int w = 0 ; !forceEncode && w < m_name.getWordCount() ; ++w) + for (size_t w = 0 ; !forceEncode && w < m_name.getWordCount() ; ++w) { if (m_name.getWordAt(w)->getCharset() == charset(charsets::US_ASCII)) { @@ -258,7 +258,7 @@ void mailboxGroup::insertMailboxBefore(ref beforeMailbox, ref mbox) +void mailboxGroup::insertMailboxBefore(const size_t pos, ref mbox) { m_list.insert(m_list.begin() + pos, mbox); } @@ -276,7 +276,7 @@ void mailboxGroup::insertMailboxAfter(ref afterMailbox, ref } -void mailboxGroup::insertMailboxAfter(const int pos, ref mbox) +void mailboxGroup::insertMailboxAfter(const size_t pos, ref mbox) { m_list.insert(m_list.begin() + pos + 1, mbox); } @@ -294,7 +294,7 @@ void mailboxGroup::removeMailbox(ref mbox) } -void mailboxGroup::removeMailbox(const int pos) +void mailboxGroup::removeMailbox(const size_t pos) { const std::vector >::iterator it = m_list.begin() + pos; @@ -308,19 +308,19 @@ void mailboxGroup::removeAllMailboxes() } -int mailboxGroup::getMailboxCount() const +size_t mailboxGroup::getMailboxCount() const { return (m_list.size()); } -ref mailboxGroup::getMailboxAt(const int pos) +ref mailboxGroup::getMailboxAt(const size_t pos) { return (m_list[pos]); } -const ref mailboxGroup::getMailboxAt(const int pos) const +const ref mailboxGroup::getMailboxAt(const size_t pos) const { return (m_list[pos]); } diff --git a/src/mailboxList.cpp b/src/mailboxList.cpp index f87fb48d..2a6a26bf 100644 --- a/src/mailboxList.cpp +++ b/src/mailboxList.cpp @@ -59,7 +59,7 @@ void mailboxList::insertMailboxBefore(ref beforeMailbox, ref } -void mailboxList::insertMailboxBefore(const int pos, ref mbox) +void mailboxList::insertMailboxBefore(const size_t pos, ref mbox) { m_list.insertAddressBefore(pos, mbox); } @@ -78,7 +78,7 @@ void mailboxList::insertMailboxAfter(ref afterMailbox, ref m } -void mailboxList::insertMailboxAfter(const int pos, ref mbox) +void mailboxList::insertMailboxAfter(const size_t pos, ref mbox) { m_list.insertAddressAfter(pos, mbox); } @@ -97,7 +97,7 @@ void mailboxList::removeMailbox(ref mbox) } -void mailboxList::removeMailbox(const int pos) +void mailboxList::removeMailbox(const size_t pos) { m_list.removeAddress(pos); } @@ -109,7 +109,7 @@ void mailboxList::removeAllMailboxes() } -int mailboxList::getMailboxCount() const +size_t mailboxList::getMailboxCount() const { return (m_list.getAddressCount()); } @@ -121,13 +121,13 @@ bool mailboxList::isEmpty() const } -ref mailboxList::getMailboxAt(const int pos) +ref mailboxList::getMailboxAt(const size_t pos) { return m_list.getAddressAt(pos).staticCast (); } -const ref mailboxList::getMailboxAt(const int pos) const +const ref mailboxList::getMailboxAt(const size_t pos) const { return m_list.getAddressAt(pos).staticCast (); } diff --git a/src/mdn/receivedMDNInfos.cpp b/src/mdn/receivedMDNInfos.cpp index f97a58d4..1416071c 100644 --- a/src/mdn/receivedMDNInfos.cpp +++ b/src/mdn/receivedMDNInfos.cpp @@ -81,7 +81,7 @@ void receivedMDNInfos::extract() { const ref bdy = m_msg->getBody(); - for (int i = 0 ; i < bdy->getPartCount() ; ++i) + for (size_t i = 0 ; i < bdy->getPartCount() ; ++i) { const ref part = bdy->getPartAt(i); diff --git a/src/messageBuilder.cpp b/src/messageBuilder.cpp index 3597b3ae..8b8af883 100644 --- a/src/messageBuilder.cpp +++ b/src/messageBuilder.cpp @@ -280,25 +280,25 @@ void messageBuilder::setSubject(const text& subject) } -void messageBuilder::removeAttachment(const int pos) +void messageBuilder::removeAttachment(const size_t pos) { m_attach.erase(m_attach.begin() + pos); } -const ref messageBuilder::getAttachmentAt(const int pos) const +const ref messageBuilder::getAttachmentAt(const size_t pos) const { return (m_attach[pos]); } -ref messageBuilder::getAttachmentAt(const int pos) +ref messageBuilder::getAttachmentAt(const size_t pos) { return (m_attach[pos]); } -int messageBuilder::getAttachmentCount() const +size_t messageBuilder::getAttachmentCount() const { return (m_attach.size()); } diff --git a/src/messageIdSequence.cpp b/src/messageIdSequence.cpp index 0a5c9a01..6e5a76c1 100644 --- a/src/messageIdSequence.cpp +++ b/src/messageIdSequence.cpp @@ -148,7 +148,7 @@ void messageIdSequence::insertMessageIdBefore(ref beforeMid, ref mid) +void messageIdSequence::insertMessageIdBefore(const size_t pos, ref mid) { m_list.insert(m_list.begin() + pos, mid); } @@ -166,7 +166,7 @@ void messageIdSequence::insertMessageIdAfter(ref afterMid, ref mid) +void messageIdSequence::insertMessageIdAfter(const size_t pos, ref mid) { m_list.insert(m_list.begin() + pos + 1, mid); } @@ -184,7 +184,7 @@ void messageIdSequence::removeMessageId(ref mid) } -void messageIdSequence::removeMessageId(const int pos) +void messageIdSequence::removeMessageId(const size_t pos) { const std::vector >::iterator it = m_list.begin() + pos; @@ -198,7 +198,7 @@ void messageIdSequence::removeAllMessageIds() } -int messageIdSequence::getMessageIdCount() const +size_t messageIdSequence::getMessageIdCount() const { return (m_list.size()); } @@ -210,13 +210,13 @@ bool messageIdSequence::isEmpty() const } -const ref messageIdSequence::getMessageIdAt(const int pos) +const ref messageIdSequence::getMessageIdAt(const size_t pos) { return (m_list[pos]); } -const ref messageIdSequence::getMessageIdAt(const int pos) const +const ref messageIdSequence::getMessageIdAt(const size_t pos) const { return (m_list[pos]); } diff --git a/src/messageParser.cpp b/src/messageParser.cpp index 35e0bbad..b8860a0c 100644 --- a/src/messageParser.cpp +++ b/src/messageParser.cpp @@ -165,7 +165,7 @@ bool messageParser::findSubTextParts(ref msg, ref > textParts; - for (int i = 0 ; i < part->getBody()->getPartCount() ; ++i) + for (size_t i = 0 ; i < part->getBody()->getPartCount() ; ++i) { const ref p = part->getBody()->getPartAt(i); @@ -228,7 +228,7 @@ bool messageParser::findSubTextParts(ref msg, ref getBody()->getPartCount()) ; ++i) + for (size_t i = 0 ; !found && (i < part->getBody()->getPartCount()) ; ++i) { found = findSubTextParts(msg, part->getBody()->getPartAt(i)); } @@ -279,13 +279,13 @@ const std::vector > messageParser::getAttachmentList() c } -int messageParser::getAttachmentCount() const +size_t messageParser::getAttachmentCount() const { return (m_attach.size()); } -const ref messageParser::getAttachmentAt(const int pos) const +const ref messageParser::getAttachmentAt(const size_t pos) const { return (m_attach[pos]); } @@ -307,13 +307,13 @@ const std::vector > messageParser::getTextPartList() const } -int messageParser::getTextPartCount() const +size_t messageParser::getTextPartCount() const { return (m_textParts.size()); } -const ref messageParser::getTextPartAt(const int pos) const +const ref messageParser::getTextPartAt(const size_t pos) const { return (m_textParts[pos]); } diff --git a/src/net/imap/IMAPFolder.cpp b/src/net/imap/IMAPFolder.cpp index 8eac9eae..ddd53994 100644 --- a/src/net/imap/IMAPFolder.cpp +++ b/src/net/imap/IMAPFolder.cpp @@ -590,7 +590,7 @@ std::vector > IMAPFolder::getMessagesByUID(const std::vector ::size_type i = 1, n = uids.size() ; i < n ; ++i) cmd << "," << IMAPUtils::extractUIDFromGlobalUID(uids[i]); cmd << " UID"; diff --git a/src/net/imap/IMAPMessage.cpp b/src/net/imap/IMAPMessage.cpp index 45d4699b..55f2108e 100644 --- a/src/net/imap/IMAPMessage.cpp +++ b/src/net/imap/IMAPMessage.cpp @@ -233,7 +233,7 @@ void IMAPMessage::fetchPartHeader(ref p) void IMAPMessage::fetchPartHeaderForStructure(ref str) { - for (int i = 0, n = str->getPartCount() ; i < n ; ++i) + for (size_t i = 0, n = str->getPartCount() ; i < n ; ++i) { ref part = str->getPartAt(i); @@ -694,7 +694,7 @@ void IMAPMessage::constructParsedMessage(ref parentPart, ref getPartCount() ; i < n ; ++i) + for (size_t i = 0, n = str->getPartCount() ; i < n ; ++i) { ref part = str->getPartAt(i); diff --git a/src/net/imap/IMAPStructure.cpp b/src/net/imap/IMAPStructure.cpp index a0bd98bb..6b0a6c02 100644 --- a/src/net/imap/IMAPStructure.cpp +++ b/src/net/imap/IMAPStructure.cpp @@ -59,19 +59,19 @@ IMAPStructure::IMAPStructure(ref parent, const std::vector IMAPStructure::getPartAt(const int x) const +ref IMAPStructure::getPartAt(const size_t x) const { return m_parts[x]; } -ref IMAPStructure::getPartAt(const int x) +ref IMAPStructure::getPartAt(const size_t x) { return m_parts[x]; } -int IMAPStructure::getPartCount() const +size_t IMAPStructure::getPartCount() const { return m_parts.size(); } diff --git a/src/net/imap/IMAPUtils.cpp b/src/net/imap/IMAPUtils.cpp index 3f1c704b..68507644 100644 --- a/src/net/imap/IMAPUtils.cpp +++ b/src/net/imap/IMAPUtils.cpp @@ -122,7 +122,7 @@ const string IMAPUtils::pathToString { string result; - for (int i = 0 ; i < path.getSize() ; ++i) + for (size_t i = 0 ; i < path.getSize() ; ++i) { if (i > 0) result += hierarchySeparator; result += toModifiedUTF7(hierarchySeparator, path[i]); @@ -556,7 +556,7 @@ const string IMAPUtils::listToSet(const std::vector & list) res << extractUIDFromGlobalUID(list[0]); - for (unsigned int i = 1, n = list.size() ; i < n ; ++i) + for (std::vector ::size_type i = 1, n = list.size() ; i < n ; ++i) res << "," << extractUIDFromGlobalUID(list[i]); return res.str(); diff --git a/src/net/maildir/format/courierMaildirFormat.cpp b/src/net/maildir/format/courierMaildirFormat.cpp index 033951a1..58176a27 100644 --- a/src/net/maildir/format/courierMaildirFormat.cpp +++ b/src/net/maildir/format/courierMaildirFormat.cpp @@ -91,7 +91,7 @@ void courierMaildirFormat::destroyFolder(const folder::path& path) // Recursively delete directories of subfolders const std::vector folders = listFolders(path, true); - for (unsigned int i = 0, n = folders.size() ; i < n ; ++i) + for (std::vector ::size_type i = 0, n = folders.size() ; i < n ; ++i) { maildirUtils::recursiveFSDelete(fsf->create (folderPathToFileSystemPath(folders[i], ROOT_DIRECTORY))); @@ -108,7 +108,7 @@ void courierMaildirFormat::renameFolder { const std::vector folders = listFolders(oldPath, true); - for (unsigned int i = 0, n = folders.size() ; i < n ; ++i) + for (std::vector ::size_type i = 0, n = folders.size() ; i < n ; ++i) { const folder::path folderOldPath = folders[i]; @@ -188,7 +188,7 @@ const utility::file::path courierMaildirFormat::folderPathToFileSystemPath { string folderComp; - for (int i = 0, n = path.getSize() ; i < n ; ++i) + for (size_t i = 0, n = path.getSize() ; i < n ; ++i) folderComp += "." + toModifiedUTF7(path[i]); fsPath /= utility::file::path::component(folderComp); @@ -237,7 +237,7 @@ const std::vector courierMaildirFormat::listFolders // Then, map directories to folders std::vector folders; - for (unsigned int i = 0, n = dirs.size() ; i < n ; ++i) + for (std::vector ::size_type i = 0, n = dirs.size() ; i < n ; ++i) { const string dir = dirs[i].substr(1) + "."; folder::path path; @@ -273,7 +273,7 @@ bool courierMaildirFormat::listDirectories(const folder::path& root, if (!root.isRoot()) { - for (int i = 0, n = root.getSize() ; i < n ; ++i) + for (size_t i = 0, n = root.getSize() ; i < n ; ++i) base += "." + toModifiedUTF7(root[i]); } diff --git a/src/net/maildir/maildirFolder.cpp b/src/net/maildir/maildirFolder.cpp index cbea38ee..d8ca8695 100644 --- a/src/net/maildir/maildirFolder.cpp +++ b/src/net/maildir/maildirFolder.cpp @@ -505,7 +505,7 @@ void maildirFolder::listFolders(std::vector >& list, const bool re list.reserve(pathList.size()); - for (unsigned int i = 0, n = pathList.size() ; i < n ; ++i) + for (std::vector ::size_type i = 0, n = pathList.size() ; i < n ; ++i) { ref subFolder = vmime::create (pathList[i], store); @@ -1264,7 +1264,7 @@ void maildirFolder::expunge() if (!nums.empty()) { - for (int i = nums.size() - 1 ; i >= 0 ; --i) + for (std::vector ::size_type i = nums.size() - 1 ; i >= 0 ; --i) m_messageInfos.erase(m_messageInfos.begin() + i); } diff --git a/src/net/maildir/maildirMessage.cpp b/src/net/maildir/maildirMessage.cpp index dd38cbd8..0bd1b277 100644 --- a/src/net/maildir/maildirMessage.cpp +++ b/src/net/maildir/maildirMessage.cpp @@ -143,17 +143,17 @@ public: } - ref getPartAt(const int x) const + ref getPartAt(const size_t x) const { return m_parts[x]; } - ref getPartAt(const int x) + ref getPartAt(const size_t x) { return m_parts[x]; } - int getPartCount() const + size_t getPartCount() const { return m_parts.size(); } diff --git a/src/net/message.cpp b/src/net/message.cpp index b8624330..8639625e 100644 --- a/src/net/message.cpp +++ b/src/net/message.cpp @@ -34,19 +34,19 @@ namespace vmime { namespace net { -ref part::getPartAt(const int pos) const +ref part::getPartAt(const size_t pos) const { return getStructure()->getPartAt(pos); } -ref part::getPartAt(const int pos) +ref part::getPartAt(const size_t pos) { return getStructure()->getPartAt(pos); } -int part::getPartCount() const +size_t part::getPartCount() const { return getStructure()->getPartCount(); } diff --git a/src/net/pop3/POP3Response.cpp b/src/net/pop3/POP3Response.cpp index ab792611..6ca0ad75 100644 --- a/src/net/pop3/POP3Response.cpp +++ b/src/net/pop3/POP3Response.cpp @@ -136,13 +136,13 @@ const string POP3Response::getText() const } -const string POP3Response::getLineAt(const unsigned int pos) const +const string POP3Response::getLineAt(const size_t pos) const { return m_lines[pos]; } -unsigned int POP3Response::getLineCount() const +size_t POP3Response::getLineCount() const { return m_lines.size(); } diff --git a/src/net/pop3/POP3Store.cpp b/src/net/pop3/POP3Store.cpp index a1dac0a0..4e3f4512 100644 --- a/src/net/pop3/POP3Store.cpp +++ b/src/net/pop3/POP3Store.cpp @@ -653,7 +653,7 @@ const std::vector POP3Store::getCapabilities() if (response->isSuccess()) { - for (unsigned int i = 0, n = response->getLineCount() ; i < n ; ++i) + for (size_t i = 0, n = response->getLineCount() ; i < n ; ++i) res.push_back(response->getLineAt(i)); } diff --git a/src/net/pop3/POP3Utils.cpp b/src/net/pop3/POP3Utils.cpp index c065b695..c4654956 100644 --- a/src/net/pop3/POP3Utils.cpp +++ b/src/net/pop3/POP3Utils.cpp @@ -43,7 +43,7 @@ void POP3Utils::parseMultiListOrUidlResponse(ref response, std::m { std::map ids; - for (unsigned int i = 0, n = response->getLineCount() ; i < n ; ++i) + for (size_t i = 0, n = response->getLineCount() ; i < n ; ++i) { string line = response->getLineAt(i); string::iterator it = line.begin(); diff --git a/src/net/serviceFactory.cpp b/src/net/serviceFactory.cpp index 71b7efea..3a547bb2 100644 --- a/src/net/serviceFactory.cpp +++ b/src/net/serviceFactory.cpp @@ -105,13 +105,13 @@ ref serviceFactory::getServiceByProtoc } -int serviceFactory::getServiceCount() const +size_t serviceFactory::getServiceCount() const { return (m_services.size()); } -ref serviceFactory::getServiceAt(const int pos) const +ref serviceFactory::getServiceAt(const size_t pos) const { return (m_services[pos]); } diff --git a/src/net/smtp/SMTPResponse.cpp b/src/net/smtp/SMTPResponse.cpp index 28a1ea87..c0000e94 100644 --- a/src/net/smtp/SMTPResponse.cpp +++ b/src/net/smtp/SMTPResponse.cpp @@ -200,13 +200,13 @@ int SMTPResponse::extractResponseCode(const string& response) } -const SMTPResponse::responseLine SMTPResponse::getLineAt(const unsigned int pos) const +const SMTPResponse::responseLine SMTPResponse::getLineAt(const size_t pos) const { return m_lines[pos]; } -unsigned int SMTPResponse::getLineCount() const +size_t SMTPResponse::getLineCount() const { return m_lines.size(); } diff --git a/src/net/smtp/SMTPTransport.cpp b/src/net/smtp/SMTPTransport.cpp index 7c67fa02..0ea4e379 100644 --- a/src/net/smtp/SMTPTransport.cpp +++ b/src/net/smtp/SMTPTransport.cpp @@ -231,7 +231,7 @@ void SMTPTransport::helo() // Get supported extensions from SMTP response // One extension per line, format is: EXT PARAM1 PARAM2... - for (int i = 1, n = resp->getLineCount() ; i < n ; ++i) + for (size_t i = 1, n = resp->getLineCount() ; i < n ; ++i) { const string line = resp->getLineAt(i).getText(); std::istringstream iss(line); @@ -582,7 +582,7 @@ void SMTPTransport::send(const mailbox& expeditor, const mailboxList& recipients sendRequest("MAIL FROM:<" + expeditor.getEmail() + ">"); // Emit a "RCPT TO" command for each recipient - for (int i = 0 ; i < recipients.getMailboxCount() ; ++i) + for (size_t i = 0 ; i < recipients.getMailboxCount() ; ++i) { const mailbox& mbox = *recipients.getMailboxAt(i); @@ -602,7 +602,7 @@ void SMTPTransport::send(const mailbox& expeditor, const mailboxList& recipients } // Read responses for "RCPT TO" commands - for (int i = 0 ; i < recipients.getMailboxCount() ; ++i) + for (size_t i = 0 ; i < recipients.getMailboxCount() ; ++i) { const mailbox& mbox = *recipients.getMailboxAt(i); @@ -632,7 +632,7 @@ void SMTPTransport::send(const mailbox& expeditor, const mailboxList& recipients } // Emit a "RCPT TO" command for each recipient - for (int i = 0 ; i < recipients.getMailboxCount() ; ++i) + for (size_t i = 0 ; i < recipients.getMailboxCount() ; ++i) { const mailbox& mbox = *recipients.getMailboxAt(i); diff --git a/src/net/transport.cpp b/src/net/transport.cpp index 9349e750..90279170 100644 --- a/src/net/transport.cpp +++ b/src/net/transport.cpp @@ -50,7 +50,7 @@ transport::transport(ref sess, const serviceInfos& infos, ref mbox = list.getAddressAt(i)->clone().dynamicCast (); diff --git a/src/parameterizedHeaderField.cpp b/src/parameterizedHeaderField.cpp index 756d02f2..8c60b205 100644 --- a/src/parameterizedHeaderField.cpp +++ b/src/parameterizedHeaderField.cpp @@ -456,7 +456,7 @@ void parameterizedHeaderField::insertParameterBefore(ref beforeParam } -void parameterizedHeaderField::insertParameterBefore(const int pos, ref param) +void parameterizedHeaderField::insertParameterBefore(const size_t pos, ref param) { m_params.insert(m_params.begin() + pos, param); } @@ -474,7 +474,7 @@ void parameterizedHeaderField::insertParameterAfter(ref afterParam, } -void parameterizedHeaderField::insertParameterAfter(const int pos, ref param) +void parameterizedHeaderField::insertParameterAfter(const size_t pos, ref param) { m_params.insert(m_params.begin() + pos + 1, param); } @@ -492,7 +492,7 @@ void parameterizedHeaderField::removeParameter(ref param) } -void parameterizedHeaderField::removeParameter(const int pos) +void parameterizedHeaderField::removeParameter(const size_t pos) { const std::vector >::iterator it = m_params.begin() + pos; @@ -506,7 +506,7 @@ void parameterizedHeaderField::removeAllParameters() } -int parameterizedHeaderField::getParameterCount() const +size_t parameterizedHeaderField::getParameterCount() const { return (m_params.size()); } @@ -518,13 +518,13 @@ bool parameterizedHeaderField::isEmpty() const } -const ref parameterizedHeaderField::getParameterAt(const int pos) +const ref parameterizedHeaderField::getParameterAt(const size_t pos) { return (m_params[pos]); } -const ref parameterizedHeaderField::getParameterAt(const int pos) const +const ref parameterizedHeaderField::getParameterAt(const size_t pos) const { return (m_params[pos]); } diff --git a/src/plainTextPart.cpp b/src/plainTextPart.cpp index 15bcb5eb..5ac372da 100644 --- a/src/plainTextPart.cpp +++ b/src/plainTextPart.cpp @@ -51,7 +51,7 @@ const mediaType plainTextPart::getType() const } -int plainTextPart::getPartCount() const +size_t plainTextPart::getPartCount() const { return (1); } diff --git a/src/security/digest/md5/md5MessageDigest.cpp b/src/security/digest/md5/md5MessageDigest.cpp index 84ca99ae..f803a6e4 100644 --- a/src/security/digest/md5/md5MessageDigest.cpp +++ b/src/security/digest/md5/md5MessageDigest.cpp @@ -211,8 +211,8 @@ void md5MessageDigest::finalize() memset(p, 0, padding); - reinterpret_cast (m_block)[14] = (m_byteCount << 3); - reinterpret_cast (m_block)[15] = (m_byteCount >> 29); + reinterpret_cast (m_block)[14] = static_cast (m_byteCount << 3); + reinterpret_cast (m_block)[15] = static_cast (m_byteCount >> 29); #if VMIME_BYTE_ORDER_BIG_ENDIAN swapUint32Array((vmime_uint32*) m_block, (64 - 8) / 4); diff --git a/src/security/digest/sha1/sha1MessageDigest.cpp b/src/security/digest/sha1/sha1MessageDigest.cpp index e4bcea41..3fb102ff 100644 --- a/src/security/digest/sha1/sha1MessageDigest.cpp +++ b/src/security/digest/sha1/sha1MessageDigest.cpp @@ -108,10 +108,10 @@ void sha1MessageDigest::update(const byte_t* buffer, const unsigned long len) j = (m_count[0] >> 3) & 63; - if ((m_count[0] += len << 3) < (len << 3)) + if ((m_count[0] += static_cast (len << 3)) < static_cast (len << 3)) m_count[1]++; - m_count[1] += (len >> 29); + m_count[1] += static_cast (len >> 29); if ((j + len) > 63) { diff --git a/src/text.cpp b/src/text.cpp index 91b81e1b..0fda458a 100644 --- a/src/text.cpp +++ b/src/text.cpp @@ -159,19 +159,19 @@ void text::appendWord(ref w) } -void text::insertWordBefore(const int pos, ref w) +void text::insertWordBefore(const size_t pos, ref w) { m_words.insert(m_words.begin() + pos, w); } -void text::insertWordAfter(const int pos, ref w) +void text::insertWordAfter(const size_t pos, ref w) { m_words.insert(m_words.begin() + pos + 1, w); } -void text::removeWord(const int pos) +void text::removeWord(const size_t pos) { const std::vector >::iterator it = m_words.begin() + pos; @@ -185,7 +185,7 @@ void text::removeAllWords() } -int text::getWordCount() const +size_t text::getWordCount() const { return (m_words.size()); } @@ -197,13 +197,13 @@ bool text::isEmpty() const } -const ref text::getWordAt(const int pos) +const ref text::getWordAt(const size_t pos) { return (m_words[pos]); } -const ref text::getWordAt(const int pos) const +const ref text::getWordAt(const size_t pos) const { return (m_words[pos]); } @@ -354,7 +354,7 @@ void text::encodeAndFold(utility::outputStream& os, const string::size_type maxL string::size_type curLineLength = firstLineOffset; word::generatorState state; - for (int wi = 0 ; wi < getWordCount() ; ++wi) + for (size_t wi = 0 ; wi < getWordCount() ; ++wi) { getWordAt(wi)->generate(os, maxLineLength, curLineLength, &curLineLength, flags, &state); diff --git a/src/utility/encoder/encoderFactory.cpp b/src/utility/encoder/encoderFactory.cpp index 1798ffaf..3b86f682 100644 --- a/src/utility/encoder/encoderFactory.cpp +++ b/src/utility/encoder/encoderFactory.cpp @@ -89,13 +89,13 @@ const ref encoderFactory::getEncoderBy } -int encoderFactory::getEncoderCount() const +size_t encoderFactory::getEncoderCount() const { return (m_encoders.size()); } -const ref encoderFactory::getEncoderAt(const int pos) const +const ref encoderFactory::getEncoderAt(const size_t pos) const { return (m_encoders[pos]); } diff --git a/src/utility/path.cpp b/src/utility/path.cpp index 9e314e6a..2702f48c 100644 --- a/src/utility/path.cpp +++ b/src/utility/path.cpp @@ -171,19 +171,19 @@ path::component& path::getLastComponent() } -int path::getSize() const +size_t path::getSize() const { return (m_list.size()); } -const path::component& path::operator[](const int x) const +const path::component& path::operator[](const size_t x) const { return (m_list[x]); } -path::component& path::operator[](const int x) +path::component& path::operator[](const size_t x) { return (m_list[x]); } @@ -250,13 +250,13 @@ void path::appendComponent(const path::component& c) } -const path::component& path::getComponentAt(const int pos) const +const path::component& path::getComponentAt(const size_t pos) const { return (m_list[pos]); } -path::component& path::getComponentAt(const int pos) +path::component& path::getComponentAt(const size_t pos) { return (m_list[pos]); } diff --git a/src/utility/random.cpp b/src/utility/random.cpp index d12989b8..20719ad6 100644 --- a/src/utility/random.cpp +++ b/src/utility/random.cpp @@ -56,13 +56,13 @@ unsigned int random::getProcess() } -const string random::getString(const int length, const string& randomChars) +const string random::getString(const string::size_type length, const string& randomChars) { string res; res.resize(length); - const unsigned int x = randomChars.length(); - int c = 0; + const unsigned int x = static_cast (randomChars.length()); + string::size_type c = 0; while (c < length) { diff --git a/tests/parser/attachmentHelperTest.cpp b/tests/parser/attachmentHelperTest.cpp index 142730c5..d764ecc1 100644 --- a/tests/parser/attachmentHelperTest.cpp +++ b/tests/parser/attachmentHelperTest.cpp @@ -54,7 +54,7 @@ VMIME_TEST_SUITE_BEGIN res += "["; - for (int i = 0 ; i < bdy->getPartCount() ; ++i) + for (size_t i = 0 ; i < bdy->getPartCount() ; ++i) { vmime::ref subPart = bdy->getPartAt(i); diff --git a/tests/testUtils.cpp b/tests/testUtils.cpp index 8b16c4e8..8e02b3c7 100644 --- a/tests/testUtils.cpp +++ b/tests/testUtils.cpp @@ -110,6 +110,7 @@ void testSocket::sendRaw(const char* buffer, const size_type count) testSocket::size_type testSocket::sendRawNonBlocking(const char* buffer, const size_type count) { sendRaw(buffer, count); + return count; } diff --git a/tests/testUtils.hpp b/tests/testUtils.hpp index 34271f44..b522e400 100644 --- a/tests/testUtils.hpp +++ b/tests/testUtils.hpp @@ -106,7 +106,7 @@ inline std::ostream& operator<<(std::ostream& os, const vmime::text& txt) { os << "[text: ["; - for (int i = 0 ; i < txt.getWordCount() ; ++i) + for (size_t i = 0 ; i < txt.getWordCount() ; ++i) { const vmime::word& w = *txt.getWordAt(i); @@ -134,7 +134,7 @@ inline std::ostream& operator<<(std::ostream& os, const vmime::mailboxGroup& gro { os << "[mailbox-group: name=" << group.getName() << ", list=["; - for (int i = 0 ; i < group.getMailboxCount() ; ++i) + for (size_t i = 0 ; i < group.getMailboxCount() ; ++i) { if (i != 0) os << ","; @@ -152,7 +152,7 @@ inline std::ostream& operator<<(std::ostream& os, const vmime::addressList& list { os << "[address-list: ["; - for (int i = 0 ; i < list.getAddressCount() ; ++i) + for (size_t i = 0 ; i < list.getAddressCount() ; ++i) { const vmime::address& addr = *list.getAddressAt(i); diff --git a/vmime/addressList.hpp b/vmime/addressList.hpp index 9dc283c7..48e270e4 100644 --- a/vmime/addressList.hpp +++ b/vmime/addressList.hpp @@ -79,7 +79,7 @@ public: * the beginning of the list) * @param addr address to insert */ - void insertAddressBefore(const int pos, ref
addr); + void insertAddressBefore(const size_t pos, ref
addr); /** Insert a new address after the specified address. * @@ -94,7 +94,7 @@ public: * @param pos position of the address before the new address * @param addr address to insert */ - void insertAddressAfter(const int pos, ref
addr); + void insertAddressAfter(const size_t pos, ref
addr); /** Remove the specified address from the list. * @@ -107,7 +107,7 @@ public: * * @param pos position of the address to remove */ - void removeAddress(const int pos); + void removeAddress(const size_t pos); /** Remove all addresses from the list. */ @@ -117,7 +117,7 @@ public: * * @return number of addresses */ - int getAddressCount() const; + size_t getAddressCount() const; /** Tests whether the list of addresses is empty. * @@ -130,14 +130,14 @@ public: * @param pos position * @return address at position 'pos' */ - ref
getAddressAt(const int pos); + ref
getAddressAt(const size_t pos); /** Return the address at the specified position. * * @param pos position * @return address at position 'pos' */ - const ref getAddressAt(const int pos) const; + const ref getAddressAt(const size_t pos) const; /** Return the address list. * diff --git a/vmime/body.hpp b/vmime/body.hpp index bd5bbb92..e288a28e 100644 --- a/vmime/body.hpp +++ b/vmime/body.hpp @@ -76,7 +76,7 @@ public: * the beginning of the list) * @param part part to insert */ - void insertPartBefore(const int pos, ref part); + void insertPartBefore(const size_t pos, ref part); /** Insert a new part after the specified part. * @@ -91,7 +91,7 @@ public: * @param pos position of the part before the new part * @param part part to insert */ - void insertPartAfter(const int pos, ref part); + void insertPartAfter(const size_t pos, ref part); /** Remove the specified part from the list. * @@ -104,7 +104,7 @@ public: * * @param pos position of the part to remove */ - void removePart(const int pos); + void removePart(const size_t pos); /** Remove all parts from the list. */ @@ -114,7 +114,7 @@ public: * * @return number of parts */ - int getPartCount() const; + size_t getPartCount() const; /** Tests whether the list of parts is empty. * @@ -127,14 +127,14 @@ public: * @param pos position * @return part at position 'pos' */ - ref getPartAt(const int pos); + ref getPartAt(const size_t pos); /** Return the part at the specified position. * * @param pos position * @return part at position 'pos' */ - const ref getPartAt(const int pos) const; + const ref getPartAt(const size_t pos) const; /** Return the part list. * diff --git a/vmime/header.hpp b/vmime/header.hpp index ed555b0c..b369d07f 100644 --- a/vmime/header.hpp +++ b/vmime/header.hpp @@ -140,7 +140,7 @@ public: * the beginning of the list) * @param field field to insert */ - void insertFieldBefore(const int pos, ref field); + void insertFieldBefore(const size_t pos, ref field); /** Insert a new field after the specified field. * @@ -155,7 +155,7 @@ public: * @param pos position of the field before the new field * @param field field to insert */ - void insertFieldAfter(const int pos, ref field); + void insertFieldAfter(const size_t pos, ref field); /** Remove the specified field from the list. * @@ -168,7 +168,7 @@ public: * * @param pos position of the field to remove */ - void removeField(const int pos); + void removeField(const size_t pos); /** Remove all fields from the list. */ @@ -182,7 +182,7 @@ public: * * @return number of fields */ - int getFieldCount() const; + size_t getFieldCount() const; /** Tests whether the list of fields is empty. * @@ -195,14 +195,14 @@ public: * @param pos position * @return field at position 'pos' */ - const ref getFieldAt(const int pos); + const ref getFieldAt(const size_t pos); /** Return the field at the specified position. * * @param pos position * @return field at position 'pos' */ - const ref getFieldAt(const int pos) const; + const ref getFieldAt(const size_t pos) const; /** Return the field list. * diff --git a/vmime/htmlTextPart.hpp b/vmime/htmlTextPart.hpp index 5795eeb2..afc872a5 100644 --- a/vmime/htmlTextPart.hpp +++ b/vmime/htmlTextPart.hpp @@ -121,14 +121,14 @@ public: * * @return number of embedded objects */ - int getObjectCount() const; + size_t getObjectCount() const; /** Return the embedded object at the specified position. * * @param pos position of the embedded object * @return embedded object at position 'pos' */ - const ref getObjectAt(const int pos) const; + const ref getObjectAt(const size_t pos) const; /** Embed an object and returns a string which identifies it. * The returned identifier is suitable for use in the 'src' attribute @@ -168,7 +168,7 @@ public: const string addObject(ref data, const encoding& enc, const mediaType& type); - int getPartCount() const; + size_t getPartCount() const; void generateIn(ref message, ref parent) const; void parse(ref message, ref parent, ref textPart); diff --git a/vmime/mailboxGroup.hpp b/vmime/mailboxGroup.hpp index 14331410..df15f28e 100644 --- a/vmime/mailboxGroup.hpp +++ b/vmime/mailboxGroup.hpp @@ -86,7 +86,7 @@ public: * the beginning of the list) * @param mbox mailbox to insert */ - void insertMailboxBefore(const int pos, ref mbox); + void insertMailboxBefore(const size_t pos, ref mbox); /** Insert a new mailbox after the specified mailbox. * @@ -101,7 +101,7 @@ public: * @param pos position of the mailbox before the new mailbox * @param mbox mailbox to insert */ - void insertMailboxAfter(const int pos, ref mbox); + void insertMailboxAfter(const size_t pos, ref mbox); /** Remove the specified mailbox from the list. * @@ -114,7 +114,7 @@ public: * * @param pos position of the mailbox to remove */ - void removeMailbox(const int pos); + void removeMailbox(const size_t pos); /** Remove all mailboxes from the list. */ @@ -124,7 +124,7 @@ public: * * @return number of mailboxes */ - int getMailboxCount() const; + size_t getMailboxCount() const; /** Tests whether the list of mailboxes is empty. * @@ -137,14 +137,14 @@ public: * @param pos position * @return mailbox at position 'pos' */ - ref getMailboxAt(const int pos); + ref getMailboxAt(const size_t pos); /** Return the mailbox at the specified position. * * @param pos position * @return mailbox at position 'pos' */ - const ref getMailboxAt(const int pos) const; + const ref getMailboxAt(const size_t pos) const; /** Return the mailbox list. * diff --git a/vmime/mailboxList.hpp b/vmime/mailboxList.hpp index 1b480c17..9db0fe65 100644 --- a/vmime/mailboxList.hpp +++ b/vmime/mailboxList.hpp @@ -73,7 +73,7 @@ public: * the beginning of the list) * @param mbox mailbox to insert */ - void insertMailboxBefore(const int pos, ref mbox); + void insertMailboxBefore(const size_t pos, ref mbox); /** Insert a new mailbox after the specified mailbox. * @@ -88,7 +88,7 @@ public: * @param pos position of the mailbox before the new mailbox * @param mbox mailbox to insert */ - void insertMailboxAfter(const int pos, ref mbox); + void insertMailboxAfter(const size_t pos, ref mbox); /** Remove the specified mailbox from the list. * @@ -101,7 +101,7 @@ public: * * @param pos position of the mailbox to remove */ - void removeMailbox(const int pos); + void removeMailbox(const size_t pos); /** Remove all mailboxes from the list. */ @@ -111,7 +111,7 @@ public: * * @return number of mailboxes */ - int getMailboxCount() const; + size_t getMailboxCount() const; /** Tests whether the list of mailboxes is empty. * @@ -124,14 +124,14 @@ public: * @param pos position * @return mailbox at position 'pos' */ - ref getMailboxAt(const int pos); + ref getMailboxAt(const size_t pos); /** Return the mailbox at the specified position. * * @param pos position * @return mailbox at position 'pos' */ - const ref getMailboxAt(const int pos) const; + const ref getMailboxAt(const size_t pos) const; /** Return the mailbox list. * diff --git a/vmime/messageBuilder.hpp b/vmime/messageBuilder.hpp index 03712889..0d271b78 100644 --- a/vmime/messageBuilder.hpp +++ b/vmime/messageBuilder.hpp @@ -148,27 +148,27 @@ public: * * @param pos position of the attachment to remove */ - void removeAttachment(const int pos); + void removeAttachment(const size_t pos); /** Return the attachment at the specified position. * * @param pos position of the attachment * @return attachment at the specified position */ - const ref getAttachmentAt(const int pos) const; + const ref getAttachmentAt(const size_t pos) const; /** Return the attachment at the specified position. * * @param pos position of the attachment * @return attachment at the specified position */ - ref getAttachmentAt(const int pos); + ref getAttachmentAt(const size_t pos); /** Return the number of attachments in the message. * * @return number of attachments */ - int getAttachmentCount() const; + size_t getAttachmentCount() const; /** Return the list of attachments. * diff --git a/vmime/messageIdSequence.hpp b/vmime/messageIdSequence.hpp index 6736d0a9..47e47207 100644 --- a/vmime/messageIdSequence.hpp +++ b/vmime/messageIdSequence.hpp @@ -72,7 +72,7 @@ public: * the beginning of the list) * @param mid message-id to insert */ - void insertMessageIdBefore(const int pos, ref mid); + void insertMessageIdBefore(const size_t pos, ref mid); /** Insert a new message-id after the specified message-id. * @@ -87,7 +87,7 @@ public: * @param pos position of the message-id before the new message-id * @param mid message-id to insert */ - void insertMessageIdAfter(const int pos, ref mid); + void insertMessageIdAfter(const size_t pos, ref mid); /** Remove the specified message-id from the list. * @@ -100,7 +100,7 @@ public: * * @param pos position of the message-id to remove */ - void removeMessageId(const int pos); + void removeMessageId(const size_t pos); /** Remove all message-ids from the list. */ @@ -110,7 +110,7 @@ public: * * @return number of message-ides */ - int getMessageIdCount() const; + size_t getMessageIdCount() const; /** Tests whether the list of message-ides is empty. * @@ -123,14 +123,14 @@ public: * @param pos position * @return message-id at position 'pos' */ - const ref getMessageIdAt(const int pos); + const ref getMessageIdAt(const size_t pos); /** Return the message-id at the specified position. * * @param pos position * @return message-id at position 'pos' */ - const ref getMessageIdAt(const int pos) const; + const ref getMessageIdAt(const size_t pos) const; /** Return the message-id list. * diff --git a/vmime/messageParser.hpp b/vmime/messageParser.hpp index c7d56467..3c8376ba 100644 --- a/vmime/messageParser.hpp +++ b/vmime/messageParser.hpp @@ -94,14 +94,14 @@ public: * * @return number of attachments */ - int getAttachmentCount() const; + size_t getAttachmentCount() const; /** Return the attachment at the specified position. * * @param pos position of the attachment * @return attachment at position 'pos' */ - const ref getAttachmentAt(const int pos) const; + const ref getAttachmentAt(const size_t pos) const; /** Return the attachments of the message. * @@ -119,14 +119,14 @@ public: * * @return number of text parts */ - int getTextPartCount() const; + size_t getTextPartCount() const; /** Return the text part at the specified position. * * @param pos position of the text part * @return text part at position 'pos' */ - const ref getTextPartAt(const int pos) const; + const ref getTextPartAt(const size_t pos) const; private: diff --git a/vmime/net/imap/IMAPStructure.hpp b/vmime/net/imap/IMAPStructure.hpp index abf76bba..917d30bc 100644 --- a/vmime/net/imap/IMAPStructure.hpp +++ b/vmime/net/imap/IMAPStructure.hpp @@ -52,9 +52,9 @@ public: IMAPStructure(const IMAPParser::body* body); IMAPStructure(ref parent, const std::vector & list); - ref getPartAt(const int x) const; - ref getPartAt(const int x); - int getPartCount() const; + ref getPartAt(const size_t x) const; + ref getPartAt(const size_t x); + size_t getPartCount() const; static ref emptyStructure(); diff --git a/vmime/net/message.hpp b/vmime/net/message.hpp index e25e8cd2..c98e3b3e 100644 --- a/vmime/net/message.hpp +++ b/vmime/net/message.hpp @@ -105,7 +105,7 @@ public: * @param pos index of the sub-part * @return sub-part at position 'pos' */ - ref getPartAt(const int pos) const; + ref getPartAt(const size_t pos) const; /** Return the sub-part at the specified position (zero is the * first part). @@ -113,13 +113,13 @@ public: * @param pos index of the sub-part * @return sub-part at position 'pos' */ - ref getPartAt(const int pos); + ref getPartAt(const size_t pos); /** Return the number of sub-parts in this part. * * @return number of sub-parts */ - int getPartCount() const; + size_t getPartCount() const; }; @@ -143,7 +143,7 @@ public: * @param pos position * @return part at position 'pos' */ - virtual ref getPartAt(const int pos) const = 0; + virtual ref getPartAt(const size_t pos) const = 0; /** Return the part at the specified position (first * part is at position 0). @@ -151,13 +151,13 @@ public: * @param pos position * @return part at position 'pos' */ - virtual ref getPartAt(const int pos) = 0; + virtual ref getPartAt(const size_t pos) = 0; /** Return the number of parts in this part. * * @return number of parts */ - virtual int getPartCount() const = 0; + virtual size_t getPartCount() const = 0; }; diff --git a/vmime/net/pop3/POP3Response.hpp b/vmime/net/pop3/POP3Response.hpp index b968b577..1f9b7179 100644 --- a/vmime/net/pop3/POP3Response.hpp +++ b/vmime/net/pop3/POP3Response.hpp @@ -137,13 +137,13 @@ public: * @param pos line index * @return line at the specified index */ - const string getLineAt(const unsigned int pos) const; + const string getLineAt(const size_t pos) const; /** Return the number of lines in the response. * * @return number of lines in the response */ - unsigned int getLineCount() const; + size_t getLineCount() const; private: @@ -171,7 +171,7 @@ private: string m_firstLine; ResponseCode m_code; string m_text; - + std::vector m_lines; }; diff --git a/vmime/net/serviceFactory.hpp b/vmime/net/serviceFactory.hpp index e752004c..cf7caedb 100644 --- a/vmime/net/serviceFactory.hpp +++ b/vmime/net/serviceFactory.hpp @@ -138,14 +138,14 @@ public: * * @return number of registered services */ - int getServiceCount() const; + size_t getServiceCount() const; /** Return the registered service at the specified position. * * @param pos position of the registered service to return * @return registered service at the specified position */ - ref getServiceAt(const int pos) const; + ref getServiceAt(const size_t pos) const; /** Return a list of all registered services. * diff --git a/vmime/net/smtp/SMTPResponse.hpp b/vmime/net/smtp/SMTPResponse.hpp index 0a96530c..9ebe7ab6 100644 --- a/vmime/net/smtp/SMTPResponse.hpp +++ b/vmime/net/smtp/SMTPResponse.hpp @@ -109,13 +109,13 @@ public: * @param pos line index * @return line at the specified index */ - const responseLine getLineAt(const unsigned int pos) const; + const responseLine getLineAt(const size_t pos) const; /** Return the number of lines in the response. * * @return number of lines in the response */ - unsigned int getLineCount() const; + size_t getLineCount() const; /** Return the last line in the response. * diff --git a/vmime/parameterizedHeaderField.hpp b/vmime/parameterizedHeaderField.hpp index d2c934f7..e0649741 100644 --- a/vmime/parameterizedHeaderField.hpp +++ b/vmime/parameterizedHeaderField.hpp @@ -100,7 +100,7 @@ public: * the beginning of the list) * @param param parameter to insert */ - void insertParameterBefore(const int pos, ref param); + void insertParameterBefore(const size_t pos, ref param); /** Insert a new parameter after the specified parameter. * @@ -115,7 +115,7 @@ public: * @param pos position of the parameter before the new parameter * @param param parameter to insert */ - void insertParameterAfter(const int pos, ref param); + void insertParameterAfter(const size_t pos, ref param); /** Remove the specified parameter from the list. * @@ -128,7 +128,7 @@ public: * * @param pos position of the parameter to remove */ - void removeParameter(const int pos); + void removeParameter(const size_t pos); /** Remove all parameters from the list. */ @@ -138,7 +138,7 @@ public: * * @return number of parameters */ - int getParameterCount() const; + size_t getParameterCount() const; /** Tests whether the list of parameters is empty. * @@ -151,14 +151,14 @@ public: * @param pos position * @return parameter at position 'pos' */ - const ref getParameterAt(const int pos); + const ref getParameterAt(const size_t pos); /** Return the parameter at the specified position. * * @param pos position * @return parameter at position 'pos' */ - const ref getParameterAt(const int pos) const; + const ref getParameterAt(const size_t pos) const; /** Return the parameter list. * diff --git a/vmime/plainTextPart.hpp b/vmime/plainTextPart.hpp index 72c12acb..ec0ccec2 100644 --- a/vmime/plainTextPart.hpp +++ b/vmime/plainTextPart.hpp @@ -50,7 +50,7 @@ public: const ref getText() const; void setText(ref text); - int getPartCount() const; + size_t getPartCount() const; void generateIn(ref message, ref parent) const; void parse(ref message, ref parent, ref textPart); diff --git a/vmime/text.hpp b/vmime/text.hpp index 778ce865..c410b20b 100644 --- a/vmime/text.hpp +++ b/vmime/text.hpp @@ -72,20 +72,20 @@ public: * the beginning of the list) * @param w word to insert */ - void insertWordBefore(const int pos, ref w); + void insertWordBefore(const size_t pos, ref w); /** Insert a new word after the specified position. * * @param pos position of the word before the new word * @param w word to insert */ - void insertWordAfter(const int pos, ref w); + void insertWordAfter(const size_t pos, ref w); /** Remove the word at the specified position. * * @param pos position of the word to remove */ - void removeWord(const int pos); + void removeWord(const size_t pos); /** Remove all words from the list. */ @@ -95,7 +95,7 @@ public: * * @return number of words */ - int getWordCount() const; + size_t getWordCount() const; /** Tests whether the list of words is empty. * @@ -108,14 +108,14 @@ public: * @param pos position * @return word at position 'pos' */ - const ref getWordAt(const int pos); + const ref getWordAt(const size_t pos); /** Return the word at the specified position. * * @param pos position * @return word at position 'pos' */ - const ref getWordAt(const int pos) const; + const ref getWordAt(const size_t pos) const; /** Return the word list. * diff --git a/vmime/textPart.hpp b/vmime/textPart.hpp index acd9fb3d..8e762365 100644 --- a/vmime/textPart.hpp +++ b/vmime/textPart.hpp @@ -87,7 +87,7 @@ public: * * @return number of body parts */ - virtual int getPartCount() const = 0; + virtual size_t getPartCount() const = 0; /** Generate the text part(s) into the specified message. * diff --git a/vmime/types.hpp b/vmime/types.hpp index d1137e1e..fb422509 100644 --- a/vmime/types.hpp +++ b/vmime/types.hpp @@ -44,6 +44,10 @@ namespace vmime typedef vmime_uint8 byte_t; typedef std::vector byteArray; +#if !VMIME_HAVE_SIZE_T + typedef unsigned long size_t; +#endif // !VMIME_HAVE_SIZE_T + // Some aliases namespace utils = utility; diff --git a/vmime/utility/encoder/encoderFactory.hpp b/vmime/utility/encoder/encoderFactory.hpp index 6abb2234..4ec9b7af 100644 --- a/vmime/utility/encoder/encoderFactory.hpp +++ b/vmime/utility/encoder/encoderFactory.hpp @@ -127,14 +127,14 @@ public: * * @return number of registered encoders */ - int getEncoderCount() const; + size_t getEncoderCount() const; /** Return the registered encoder at the specified position. * * @param pos position of the registered encoder to return * @return registered encoder at the specified position */ - const ref getEncoderAt(const int pos) const; + const ref getEncoderAt(const size_t pos) const; /** Return a list of all registered encoders. * diff --git a/vmime/utility/path.hpp b/vmime/utility/path.hpp index e43291cd..6d8a7875 100644 --- a/vmime/utility/path.hpp +++ b/vmime/utility/path.hpp @@ -80,14 +80,14 @@ public: * @param pos position * @return component at position 'pos' */ - const component& getComponentAt(const int pos) const; + const component& getComponentAt(const size_t pos) const; /** Return the component at the specified position. * * @param pos position * @return component at position 'pos' */ - component& getComponentAt(const int pos); + component& getComponentAt(const size_t pos); /** Test whether this path is empty (root). * @@ -117,21 +117,21 @@ public: * * @return number of components */ - int getSize() const; + size_t getSize() const; /** Return the specified component of the path (const version). * * @param x index of the component * @return component at the specified index */ - const component& operator[](const int x) const; + const component& operator[](const size_t x) const; /** Return the specified component of the path (non-const version). * * @param x index of the component * @return component at the specified index */ - component& operator[](const int x); + component& operator[](const size_t x); /** Test whether this path is a direct parent of another one. * diff --git a/vmime/utility/random.hpp b/vmime/utility/random.hpp index f706c558..fbcb81e8 100644 --- a/vmime/utility/random.hpp +++ b/vmime/utility/random.hpp @@ -65,7 +65,7 @@ public: * @param randomChars list of characters to use * @return random string */ - static const string getString(const int length, const string& randomChars + static const string getString(const string::size_type length, const string& randomChars = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789"); protected: