Issue #126: fixed warnings about sign mismatch.

This commit is contained in:
Vincent Richard 2016-03-23 20:05:59 +01:00
parent 7425d91de6
commit 4b62ae4174
44 changed files with 235 additions and 238 deletions

View File

@ -59,7 +59,7 @@ int main()
vmime::messageParser mp("<...MIME message content...>"); vmime::messageParser mp("<...MIME message content...>");
// Enumerate text parts // Enumerate text parts
for (int i = 0 ; i < mp.getTextPartCount() ; ++i) for (size_t i = 0 ; i < mp.getTextPartCount() ; ++i)
{ {
const vmime::textPart& part = *mp.getTextPartAt(i); const vmime::textPart& part = *mp.getTextPartAt(i);
@ -75,7 +75,7 @@ int main()
// Corresponding plain text is in "hp.getPlainText()" // Corresponding plain text is in "hp.getPlainText()"
// Enumerate embedded objects (eg. images) // Enumerate embedded objects (eg. images)
for (int j = 0 ; j < hp.getObjectCount() ; ++j) for (size_t j = 0 ; j < hp.getObjectCount() ; ++j)
{ {
const vmime::htmlTextPart::embeddedObject& obj = *hp.getObjectAt(j); const vmime::htmlTextPart::embeddedObject& obj = *hp.getObjectAt(j);

View File

@ -59,7 +59,7 @@ int main()
vmime::messageParser mp("<...MIME message content...>"); vmime::messageParser mp("<...MIME message content...>");
// Enumerate attachments // Enumerate attachments
for (int i = 0 ; i < mp.getAttachmentCount() ; ++i) for (size_t i = 0 ; i < mp.getAttachmentCount() ; ++i)
{ {
const vmime::attachment& att = *mp.getAttachmentAt(i); const vmime::attachment& att = *mp.getAttachmentAt(i);

View File

@ -53,9 +53,9 @@ static const std::string findAvailableProtocols(const vmime::net::service::Type
vmime::net::serviceFactory::getInstance(); vmime::net::serviceFactory::getInstance();
std::ostringstream res; std::ostringstream res;
int count = 0; size_t count = 0;
for (int i = 0 ; i < sf->getServiceCount() ; ++i) for (size_t i = 0 ; i < sf->getServiceCount() ; ++i)
{ {
const vmime::net::serviceFactory::registeredService& serv = *sf->getServiceAt(i); const vmime::net::serviceFactory::registeredService& serv = *sf->getServiceAt(i);
@ -136,7 +136,7 @@ static std::ostream& operator<<(std::ostream& os, const vmime::exception& e)
*/ */
static void printStructure(vmime::shared_ptr <const vmime::net::messageStructure> s, const int level = 0) static void printStructure(vmime::shared_ptr <const vmime::net::messageStructure> s, const int level = 0)
{ {
for (int i = 0 ; i < s->getPartCount() ; ++i) for (size_t i = 0 ; i < s->getPartCount() ; ++i)
{ {
vmime::shared_ptr <const vmime::net::messagePart> part = s->getPartAt(i); vmime::shared_ptr <const vmime::net::messagePart> part = s->getPartAt(i);
@ -437,14 +437,14 @@ static void connectStore()
f->open(vmime::net::folder::MODE_READ_WRITE); f->open(vmime::net::folder::MODE_READ_WRITE);
int count = f->getMessageCount(); vmime::size_t count = f->getMessageCount();
std::cout << std::endl; std::cout << std::endl;
std::cout << count << " message(s) in your inbox" << std::endl; std::cout << count << " message(s) in your inbox" << std::endl;
for (bool cont = true ; cont ; ) for (bool cont = true ; cont ; )
{ {
typedef std::map <int, vmime::shared_ptr <vmime::net::message> > MessageList; typedef std::map <vmime::size_t, vmime::shared_ptr <vmime::net::message> > MessageList;
MessageList msgList; MessageList msgList;
try try
@ -481,7 +481,7 @@ static void connectStore()
std::istringstream iss(line); std::istringstream iss(line);
int num = 0; vmime::size_t num = 0;
iss >> num; iss >> num;
if (num < 1 || num > f->getMessageCount()) if (num < 1 || num > f->getMessageCount())
@ -634,7 +634,7 @@ static void connectStore()
// Status // Status
case 7: case 7:
{ {
int count, unseen; vmime::size_t count, unseen;
f->status(count, unseen); f->status(count, unseen);
std::cout << "Status: count=" << count << ", unseen=" << unseen << std::endl; std::cout << "Status: count=" << count << ", unseen=" << unseen << std::endl;
@ -725,7 +725,7 @@ static void connectStore()
} }
else else
{ {
const int number = const vmime::size_t number =
dynamic_cast <const vmime::net::numberMessageRange&>(range).getFirst(); dynamic_cast <const vmime::net::numberMessageRange&>(range).getFirst();
std::cout << "Message has successfully been added, " std::cout << "Message has successfully been added, "
@ -760,7 +760,7 @@ static void connectStore()
} }
else else
{ {
const int number = const vmime::size_t number =
dynamic_cast <const vmime::net::numberMessageRange&>(range).getFirst(); dynamic_cast <const vmime::net::numberMessageRange&>(range).getFirst();
std::cout << "Message has successfully been copied, " std::cout << "Message has successfully been copied, "

View File

@ -47,7 +47,7 @@ int main()
std::cout << "Available encoders:" << std::endl; std::cout << "Available encoders:" << std::endl;
for (int i = 0 ; i < ef->getEncoderCount() ; ++i) for (size_t i = 0 ; i < ef->getEncoderCount() ; ++i)
{ {
vmime::shared_ptr <const vmime::utility::encoder::encoderFactory::registeredEncoder> vmime::shared_ptr <const vmime::utility::encoder::encoderFactory::registeredEncoder>
enc = ef->getEncoderAt(i); enc = ef->getEncoderAt(i);
@ -71,7 +71,7 @@ int main()
std::cout << "Available messaging services:" << std::endl; std::cout << "Available messaging services:" << std::endl;
for (int i = 0 ; i < sf->getServiceCount() ; ++i) for (size_t i = 0 ; i < sf->getServiceCount() ; ++i)
{ {
const vmime::net::serviceFactory::registeredService& serv = *sf->getServiceAt(i); const vmime::net::serviceFactory::registeredService& serv = *sf->getServiceAt(i);

View File

@ -60,7 +60,7 @@ const char* messageCountEvent::EVENT_CLASS = "messageCountEvent";
messageCountEvent::messageCountEvent messageCountEvent::messageCountEvent
(shared_ptr <folder> folder, const Types type, const std::vector <int>& nums) (shared_ptr <folder> folder, const Types type, const std::vector <size_t>& nums)
: m_folder(folder), m_type(type) : m_folder(folder), m_type(type)
{ {
m_nums.resize(nums.size()); m_nums.resize(nums.size());
@ -70,7 +70,7 @@ messageCountEvent::messageCountEvent
shared_ptr <folder> messageCountEvent::getFolder() const { return (m_folder); } shared_ptr <folder> messageCountEvent::getFolder() const { return (m_folder); }
messageCountEvent::Types messageCountEvent::getType() const { return (m_type); } messageCountEvent::Types messageCountEvent::getType() const { return (m_type); }
const std::vector <int>& messageCountEvent::getNumbers() const { return (m_nums); } const std::vector <size_t>& messageCountEvent::getNumbers() const { return (m_nums); }
void messageCountEvent::dispatch(messageCountListener* listener) void messageCountEvent::dispatch(messageCountListener* listener)
@ -96,7 +96,7 @@ const char* messageChangedEvent::EVENT_CLASS = "messageChangedEvent";
messageChangedEvent::messageChangedEvent messageChangedEvent::messageChangedEvent
(shared_ptr <folder> folder, const Types type, const std::vector <int>& nums) (shared_ptr <folder> folder, const Types type, const std::vector <size_t>& nums)
: m_folder(folder), m_type(type) : m_folder(folder), m_type(type)
{ {
m_nums.resize(nums.size()); m_nums.resize(nums.size());
@ -106,7 +106,7 @@ messageChangedEvent::messageChangedEvent
shared_ptr <folder> messageChangedEvent::getFolder() const { return (m_folder); } shared_ptr <folder> messageChangedEvent::getFolder() const { return (m_folder); }
messageChangedEvent::Types messageChangedEvent::getType() const { return (m_type); } messageChangedEvent::Types messageChangedEvent::getType() const { return (m_type); }
const std::vector <int>& messageChangedEvent::getNumbers() const { return (m_nums); } const std::vector <size_t>& messageChangedEvent::getNumbers() const { return (m_nums); }
void messageChangedEvent::dispatch(messageChangedListener* listener) void messageChangedEvent::dispatch(messageChangedListener* listener)

View File

@ -75,7 +75,7 @@ public:
}; };
messageCountEvent(shared_ptr <folder> folder, const Types type, const std::vector <int>& nums); messageCountEvent(shared_ptr <folder> folder, const Types type, const std::vector <size_t>& nums);
/** Return the folder in which messages have been added/removed. /** Return the folder in which messages have been added/removed.
* *
@ -93,7 +93,7 @@ public:
* *
* @return a list of message numbers * @return a list of message numbers
*/ */
const std::vector <int>& getNumbers() const; const std::vector <size_t>& getNumbers() const;
/** Dispatch the event to the specified listener. /** Dispatch the event to the specified listener.
* *
@ -108,7 +108,7 @@ private:
shared_ptr <folder> m_folder; shared_ptr <folder> m_folder;
const Types m_type; const Types m_type;
std::vector <int> m_nums; std::vector <size_t> m_nums;
}; };
@ -144,7 +144,7 @@ public:
}; };
messageChangedEvent(shared_ptr <folder> folder, const Types type, const std::vector <int>& nums); messageChangedEvent(shared_ptr <folder> folder, const Types type, const std::vector <size_t>& nums);
/** Return the folder in which messages have changed. /** Return the folder in which messages have changed.
* *
@ -162,7 +162,7 @@ public:
* *
* @return a list of message numbers * @return a list of message numbers
*/ */
const std::vector <int>& getNumbers() const; const std::vector <size_t>& getNumbers() const;
/** Dispatch the event to the specified listener. /** Dispatch the event to the specified listener.
* *
@ -177,7 +177,7 @@ private:
shared_ptr <folder> m_folder; shared_ptr <folder> m_folder;
const Types m_type; const Types m_type;
std::vector <int> m_nums; std::vector <size_t> m_nums;
}; };

View File

@ -185,7 +185,7 @@ public:
* @return a new object referencing the specified message * @return a new object referencing the specified message
* @throw exceptions::net_exception if an error occurs * @throw exceptions::net_exception if an error occurs
*/ */
virtual shared_ptr <message> getMessage(const int num) = 0; virtual shared_ptr <message> getMessage(const size_t num) = 0;
/** Get new references to messages in this folder, given either their /** Get new references to messages in this folder, given either their
* sequence numbers or UIDs. * sequence numbers or UIDs.
@ -220,7 +220,7 @@ public:
* *
* @return number of messages in the folder * @return number of messages in the folder
*/ */
virtual int getMessageCount() = 0; virtual size_t getMessageCount() = 0;
/** Get a new reference to a sub-folder in this folder. /** Get a new reference to a sub-folder in this folder.
* *
@ -318,7 +318,7 @@ public:
* @param unseen will receive the number of unseen messages in the folder * @param unseen will receive the number of unseen messages in the folder
* @throw exceptions::net_exception if an error occurs * @throw exceptions::net_exception if an error occurs
*/ */
virtual void status(int& count, int& unseen) = 0; virtual void status(size_t& count, size_t& unseen) = 0;
/** Request folder status without opening it. /** Request folder status without opening it.
* *
@ -394,7 +394,7 @@ public:
* @param uid the uid of the first message * @param uid the uid of the first message
* @throw exceptions::net_exception if an error occurs * @throw exceptions::net_exception if an error occurs
*/ */
virtual std::vector <int> getMessageNumbersStartingOnUID(const message::uid& uid) = 0; virtual std::vector <size_t> getMessageNumbersStartingOnUID(const message::uid& uid) = 0;
// Event listeners // Event listeners
void addMessageChangedListener(events::messageChangedListener* l); void addMessageChangedListener(events::messageChangedListener* l);

View File

@ -49,13 +49,13 @@ public:
* *
* @return number of messages * @return number of messages
*/ */
virtual unsigned int getMessageCount() const = 0; virtual size_t getMessageCount() const = 0;
/** Returns the number of unseen messages in the folder. /** Returns the number of unseen messages in the folder.
* *
* @return number of unseen messages * @return number of unseen messages
*/ */
virtual unsigned int getUnseenCount() const = 0; virtual size_t getUnseenCount() const = 0;
/** Clones this object. /** Clones this object.
* *

View File

@ -520,7 +520,7 @@ bool IMAPFolder::isOpen() const
} }
shared_ptr <message> IMAPFolder::getMessage(const int num) shared_ptr <message> IMAPFolder::getMessage(const size_t num)
{ {
if (!isOpen()) if (!isOpen())
throw exceptions::illegal_state("Folder not open"); throw exceptions::illegal_state("Folder not open");
@ -544,11 +544,11 @@ std::vector <shared_ptr <message> > IMAPFolder::getMessages(const messageSet& ms
if (msgs.isNumberSet()) if (msgs.isNumberSet())
{ {
const std::vector <int> numbers = IMAPUtils::messageSetToNumberList(msgs); const std::vector <size_t> numbers = IMAPUtils::messageSetToNumberList(msgs);
shared_ptr <IMAPFolder> thisFolder = dynamicCast <IMAPFolder>(shared_from_this()); shared_ptr <IMAPFolder> thisFolder = dynamicCast <IMAPFolder>(shared_from_this());
for (std::vector <int>::const_iterator it = numbers.begin() ; it != numbers.end() ; ++it) for (std::vector <size_t>::const_iterator it = numbers.begin() ; it != numbers.end() ; ++it)
messages.push_back(make_shared <IMAPMessage>(thisFolder, *it)); messages.push_back(make_shared <IMAPMessage>(thisFolder, *it));
} }
else if (msgs.isUIDSet()) else if (msgs.isUIDSet())
@ -594,7 +594,7 @@ std::vector <shared_ptr <message> > IMAPFolder::getMessages(const messageSet& ms
continue; continue;
// Get Process fetch response for this message // Get Process fetch response for this message
const int msgNum = static_cast <int>(messageData->number()); const size_t msgNum = messageData->number();
message::uid msgUID; message::uid msgUID;
// Find UID in message attributes // Find UID in message attributes
@ -622,7 +622,7 @@ std::vector <shared_ptr <message> > IMAPFolder::getMessages(const messageSet& ms
} }
int IMAPFolder::getMessageCount() size_t IMAPFolder::getMessageCount()
{ {
if (!isOpen()) if (!isOpen())
throw exceptions::illegal_state("Folder not open"); throw exceptions::illegal_state("Folder not open");
@ -760,10 +760,10 @@ void IMAPFolder::fetchMessages(std::vector <shared_ptr <message> >& msg, const f
return; return;
// Build message numbers list // Build message numbers list
std::vector <int> list; std::vector <size_t> list;
list.reserve(msg.size()); list.reserve(msg.size());
std::map <int, shared_ptr <IMAPMessage> > numberToMsg; std::map <size_t, shared_ptr <IMAPMessage> > numberToMsg;
for (std::vector <shared_ptr <message> >::iterator it = msg.begin() ; it != msg.end() ; ++it) for (std::vector <shared_ptr <message> >::iterator it = msg.begin() ; it != msg.end() ; ++it)
{ {
@ -813,9 +813,9 @@ void IMAPFolder::fetchMessages(std::vector <shared_ptr <message> >& msg, const f
continue; continue;
// Process fetch response for this message // Process fetch response for this message
const int num = static_cast <int>(messageData->number()); const size_t num = messageData->number();
std::map <int, shared_ptr <IMAPMessage> >::iterator msg = numberToMsg.find(num); std::map <size_t, shared_ptr <IMAPMessage> >::iterator msg = numberToMsg.find(num);
if (msg != numberToMsg.end()) if (msg != numberToMsg.end())
{ {
@ -903,7 +903,7 @@ std::vector <shared_ptr <message> > IMAPFolder::getAndFetchMessages
continue; continue;
// Get message number // Get message number
const int msgNum = static_cast <int>(messageData->number()); const size_t msgNum = messageData->number();
// Get message UID // Get message UID
const std::vector <IMAPParser::msg_att_item*> atts = messageData->msg_att()->items(); const std::vector <IMAPParser::msg_att_item*> atts = messageData->msg_att()->items();
@ -1289,7 +1289,7 @@ messageSet IMAPFolder::copyMessages(const folder::path& dest, const messageSet&
} }
void IMAPFolder::status(int& count, int& unseen) void IMAPFolder::status(size_t& count, size_t& unseen)
{ {
count = 0; count = 0;
unseen = 0; unseen = 0;
@ -1384,7 +1384,7 @@ void IMAPFolder::noop()
} }
std::vector <int> IMAPFolder::getMessageNumbersStartingOnUID(const message::uid& uid) std::vector <size_t> IMAPFolder::getMessageNumbersStartingOnUID(const message::uid& uid)
{ {
// Send the request // Send the request
std::ostringstream uidSearchKey; std::ostringstream uidSearchKey;
@ -1407,7 +1407,7 @@ std::vector <int> IMAPFolder::getMessageNumbersStartingOnUID(const message::uid&
} }
const std::vector <IMAPParser::continue_req_or_response_data*>& respDataList = resp->continue_req_or_response_data(); const std::vector <IMAPParser::continue_req_or_response_data*>& respDataList = resp->continue_req_or_response_data();
std::vector <int> seqNumbers; std::vector <size_t> seqNumbers;
for (std::vector <IMAPParser::continue_req_or_response_data*>::const_iterator for (std::vector <IMAPParser::continue_req_or_response_data*>::const_iterator
it = respDataList.begin() ; it != respDataList.end() ; ++it) it = respDataList.begin() ; it != respDataList.end() ; ++it)
@ -1492,7 +1492,7 @@ void IMAPFolder::processStatusUpdate(const IMAPParser::response* resp)
else if ((*it)->response_data() && (*it)->response_data()->message_data()) else if ((*it)->response_data() && (*it)->response_data()->message_data())
{ {
const IMAPParser::message_data* msgData = (*it)->response_data()->message_data(); const IMAPParser::message_data* msgData = (*it)->response_data()->message_data();
const int msgNumber = msgData->number(); const size_t msgNumber = msgData->number();
if ((*it)->response_data()->message_data()->type() == IMAPParser::message_data::FETCH) if ((*it)->response_data()->message_data()->type() == IMAPParser::message_data::FETCH)
{ {
@ -1507,7 +1507,7 @@ void IMAPFolder::processStatusUpdate(const IMAPParser::response* resp)
events.push_back(make_shared <events::messageChangedEvent> events.push_back(make_shared <events::messageChangedEvent>
(dynamicCast <folder>(shared_from_this()), (dynamicCast <folder>(shared_from_this()),
events::messageChangedEvent::TYPE_FLAGS, events::messageChangedEvent::TYPE_FLAGS,
std::vector <int>(1, msgNumber))); std::vector <size_t>(1, msgNumber)));
} }
else if ((*it)->response_data()->message_data()->type() == IMAPParser::message_data::EXPUNGE) else if ((*it)->response_data()->message_data()->type() == IMAPParser::message_data::EXPUNGE)
{ {
@ -1524,7 +1524,7 @@ void IMAPFolder::processStatusUpdate(const IMAPParser::response* resp)
events.push_back(make_shared <events::messageCountEvent> events.push_back(make_shared <events::messageCountEvent>
(dynamicCast <folder>(shared_from_this()), (dynamicCast <folder>(shared_from_this()),
events::messageCountEvent::TYPE_REMOVED, events::messageCountEvent::TYPE_REMOVED,
std::vector <int>(1, msgNumber))); std::vector <size_t>(1, msgNumber)));
expungedMessageCount++; expungedMessageCount++;
} }
@ -1534,9 +1534,9 @@ void IMAPFolder::processStatusUpdate(const IMAPParser::response* resp)
// New messages arrived // New messages arrived
if (m_status->getMessageCount() > oldStatus->getMessageCount() - expungedMessageCount) if (m_status->getMessageCount() > oldStatus->getMessageCount() - expungedMessageCount)
{ {
std::vector <int> newMessageNumbers; std::vector <size_t> newMessageNumbers;
for (int msgNumber = oldStatus->getMessageCount() - expungedMessageCount ; for (size_t msgNumber = oldStatus->getMessageCount() - expungedMessageCount ;
msgNumber <= m_status->getMessageCount() ; ++msgNumber) msgNumber <= m_status->getMessageCount() ; ++msgNumber)
{ {
newMessageNumbers.push_back(msgNumber); newMessageNumbers.push_back(msgNumber);

View File

@ -87,12 +87,12 @@ public:
bool isOpen() const; bool isOpen() const;
shared_ptr <message> getMessage(const int num); shared_ptr <message> getMessage(const size_t num);
std::vector <shared_ptr <message> > getMessages(const messageSet& msgs); std::vector <shared_ptr <message> > getMessages(const messageSet& msgs);
std::vector <int> getMessageNumbersStartingOnUID(const message::uid& uid); std::vector <size_t> getMessageNumbersStartingOnUID(const message::uid& uid);
int getMessageCount(); size_t getMessageCount();
shared_ptr <folder> getFolder(const folder::path::component& name); shared_ptr <folder> getFolder(const folder::path::component& name);
std::vector <shared_ptr <folder> > getFolders(const bool recursive = false); std::vector <shared_ptr <folder> > getFolders(const bool recursive = false);
@ -118,7 +118,7 @@ public:
messageSet copyMessages(const folder::path& dest, const messageSet& msgs); messageSet copyMessages(const folder::path& dest, const messageSet& msgs);
void status(int& count, int& unseen); void status(size_t& count, size_t& unseen);
shared_ptr <folderStatus> getStatus(); shared_ptr <folderStatus> getStatus();
void noop(); void noop();

View File

@ -58,19 +58,19 @@ IMAPFolderStatus::IMAPFolderStatus(const IMAPFolderStatus& other)
} }
unsigned int IMAPFolderStatus::getMessageCount() const size_t IMAPFolderStatus::getMessageCount() const
{ {
return m_count; return m_count;
} }
unsigned int IMAPFolderStatus::getUnseenCount() const size_t IMAPFolderStatus::getUnseenCount() const
{ {
return m_unseen; return m_unseen;
} }
unsigned int IMAPFolderStatus::getRecentCount() const size_t IMAPFolderStatus::getRecentCount() const
{ {
return m_recent; return m_recent;
} }
@ -115,8 +115,8 @@ bool IMAPFolderStatus::updateFromResponse(const IMAPParser::mailbox_data* resp)
{ {
case IMAPParser::status_att_val::MESSAGES: case IMAPParser::status_att_val::MESSAGES:
{ {
const unsigned int count = const size_t count =
static_cast <unsigned int>((*jt)->value_as_number()->value()); static_cast <size_t>((*jt)->value_as_number()->value());
if (m_count != count) if (m_count != count)
{ {
@ -128,8 +128,8 @@ bool IMAPFolderStatus::updateFromResponse(const IMAPParser::mailbox_data* resp)
} }
case IMAPParser::status_att_val::UNSEEN: case IMAPParser::status_att_val::UNSEEN:
{ {
const unsigned int unseen = const size_t unseen =
static_cast <unsigned int>((*jt)->value_as_number()->value()); static_cast <size_t>((*jt)->value_as_number()->value());
if (m_unseen != unseen) if (m_unseen != unseen)
{ {
@ -141,8 +141,8 @@ bool IMAPFolderStatus::updateFromResponse(const IMAPParser::mailbox_data* resp)
} }
case IMAPParser::status_att_val::RECENT: case IMAPParser::status_att_val::RECENT:
{ {
const unsigned int recent = const size_t recent =
static_cast <unsigned int>((*jt)->value_as_number()->value()); static_cast <size_t>((*jt)->value_as_number()->value());
if (m_recent != recent) if (m_recent != recent)
{ {
@ -197,8 +197,8 @@ bool IMAPFolderStatus::updateFromResponse(const IMAPParser::mailbox_data* resp)
} }
else if (resp->type() == IMAPParser::mailbox_data::EXISTS) else if (resp->type() == IMAPParser::mailbox_data::EXISTS)
{ {
const unsigned int count = const size_t count =
static_cast <unsigned int>(resp->number()->value()); static_cast <size_t>(resp->number()->value());
if (m_count != count) if (m_count != count)
{ {
@ -208,8 +208,8 @@ bool IMAPFolderStatus::updateFromResponse(const IMAPParser::mailbox_data* resp)
} }
else if (resp->type() == IMAPParser::mailbox_data::RECENT) else if (resp->type() == IMAPParser::mailbox_data::RECENT)
{ {
const unsigned int recent = const size_t recent =
static_cast <unsigned int>(resp->number()->value()); static_cast <size_t>(resp->number()->value());
if (m_recent != recent) if (m_recent != recent)
{ {
@ -256,8 +256,8 @@ bool IMAPFolderStatus::updateFromResponse(const IMAPParser::resp_text_code* resp
} }
case IMAPParser::resp_text_code::UNSEEN: case IMAPParser::resp_text_code::UNSEEN:
{ {
const unsigned int unseen = const size_t unseen =
static_cast <unsigned int>(resp->nz_number()->value()); static_cast <size_t>(resp->nz_number()->value());
if (m_unseen != unseen) if (m_unseen != unseen)
{ {

View File

@ -52,8 +52,8 @@ public:
IMAPFolderStatus(const IMAPFolderStatus& other); IMAPFolderStatus(const IMAPFolderStatus& other);
// Inherited from folderStatus // Inherited from folderStatus
unsigned int getMessageCount() const; size_t getMessageCount() const;
unsigned int getUnseenCount() const; size_t getUnseenCount() const;
shared_ptr <folderStatus> clone() const; shared_ptr <folderStatus> clone() const;
@ -61,7 +61,7 @@ public:
* *
* @return number of messages flagged Recent * @return number of messages flagged Recent
*/ */
unsigned int getRecentCount() const; size_t getRecentCount() const;
/** Returns the UID validity of the folder for the current session. /** Returns the UID validity of the folder for the current session.
* If the server is capable of persisting UIDs accross sessions, * If the server is capable of persisting UIDs accross sessions,
@ -105,9 +105,9 @@ public:
private: private:
unsigned int m_count; size_t m_count;
unsigned int m_unseen; size_t m_unseen;
unsigned int m_recent; size_t m_recent;
vmime_uint32 m_uidValidity; vmime_uint32 m_uidValidity;
vmime_uint32 m_uidNext; vmime_uint32 m_uidNext;
vmime_uint64 m_highestModSeq; vmime_uint64 m_highestModSeq;

View File

@ -97,7 +97,7 @@ private:
// //
IMAPMessage::IMAPMessage(shared_ptr <IMAPFolder> folder, const int num) IMAPMessage::IMAPMessage(shared_ptr <IMAPFolder> folder, const size_t num)
: m_folder(folder), m_num(num), m_size(-1U), 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) m_expunged(false), m_modseq(0), m_structure(null)
{ {
@ -105,7 +105,7 @@ IMAPMessage::IMAPMessage(shared_ptr <IMAPFolder> folder, const int num)
} }
IMAPMessage::IMAPMessage(shared_ptr <IMAPFolder> folder, const int num, const uid& uid) IMAPMessage::IMAPMessage(shared_ptr <IMAPFolder> folder, const size_t num, const uid& uid)
: m_folder(folder), m_num(num), m_size(-1), m_flags(FLAG_UNDEFINED), : m_folder(folder), m_num(num), m_size(-1), m_flags(FLAG_UNDEFINED),
m_expunged(false), m_uid(uid), m_modseq(0), m_structure(null) m_expunged(false), m_uid(uid), m_modseq(0), m_structure(null)
{ {
@ -135,7 +135,7 @@ void IMAPMessage::onFolderClosed()
} }
int IMAPMessage::getNumber() const size_t IMAPMessage::getNumber() const
{ {
return (m_num); return (m_num);
} }
@ -286,7 +286,7 @@ void IMAPMessage::extractImpl
if (p != NULL) if (p != NULL)
{ {
shared_ptr <const IMAPMessagePart> currentPart = dynamicCast <const IMAPMessagePart>(p); shared_ptr <const IMAPMessagePart> currentPart = dynamicCast <const IMAPMessagePart>(p);
std::vector <int> numbers; std::vector <size_t> numbers;
numbers.push_back(currentPart->getNumber()); numbers.push_back(currentPart->getNumber());
currentPart = currentPart->getParent(); currentPart = currentPart->getParent();
@ -299,7 +299,7 @@ void IMAPMessage::extractImpl
numbers.erase(numbers.end() - 1); numbers.erase(numbers.end() - 1);
for (std::vector <int>::reverse_iterator it = numbers.rbegin() ; it != numbers.rend() ; ++it) for (std::vector <size_t>::reverse_iterator it = numbers.rbegin() ; it != numbers.rend() ; ++it)
{ {
if (it != numbers.rbegin()) section << "."; if (it != numbers.rbegin()) section << ".";
section << (*it + 1); section << (*it + 1);
@ -634,7 +634,7 @@ shared_ptr <vmime::message> IMAPMessage::getParsedMessage()
} }
void IMAPMessage::renumber(const int number) void IMAPMessage::renumber(const size_t number)
{ {
m_num = number; m_num = number;
} }

View File

@ -59,12 +59,12 @@ private:
public: public:
IMAPMessage(shared_ptr <IMAPFolder> folder, const int num); IMAPMessage(shared_ptr <IMAPFolder> folder, const size_t num);
IMAPMessage(shared_ptr <IMAPFolder> folder, const int num, const uid& uid); IMAPMessage(shared_ptr <IMAPFolder> folder, const size_t num, const uid& uid);
~IMAPMessage(); ~IMAPMessage();
int getNumber() const; size_t getNumber() const;
const uid getUID() const; const uid getUID() const;
@ -115,7 +115,7 @@ private:
* *
* @param number new sequence number * @param number new sequence number
*/ */
void renumber(const int number); void renumber(const size_t number);
/** Marks the message as expunged. /** Marks the message as expunged.
*/ */
@ -169,7 +169,7 @@ private:
weak_ptr <IMAPFolder> m_folder; weak_ptr <IMAPFolder> m_folder;
int m_num; size_t m_num;
size_t m_size; size_t m_size;
int m_flags; int m_flags;
bool m_expunged; bool m_expunged;

View File

@ -36,7 +36,7 @@ namespace net {
namespace imap { namespace imap {
IMAPMessagePart::IMAPMessagePart(shared_ptr <IMAPMessagePart> parent, const int number, const IMAPParser::body_type_mpart* mpart) IMAPMessagePart::IMAPMessagePart(shared_ptr <IMAPMessagePart> parent, const size_t number, const IMAPParser::body_type_mpart* mpart)
: m_parent(parent), m_header(null), m_number(number), m_size(0) : m_parent(parent), m_header(null), m_number(number), m_size(0)
{ {
m_mediaType = vmime::mediaType m_mediaType = vmime::mediaType
@ -44,7 +44,7 @@ IMAPMessagePart::IMAPMessagePart(shared_ptr <IMAPMessagePart> parent, const int
} }
IMAPMessagePart::IMAPMessagePart(shared_ptr <IMAPMessagePart> parent, const int number, const IMAPParser::body_type_1part* part) IMAPMessagePart::IMAPMessagePart(shared_ptr <IMAPMessagePart> parent, const size_t number, const IMAPParser::body_type_1part* part)
: m_parent(parent), m_header(null), m_number(number), m_size(0) : m_parent(parent), m_header(null), m_number(number), m_size(0)
{ {
if (part->body_type_text()) if (part->body_type_text())
@ -110,7 +110,7 @@ size_t IMAPMessagePart::getSize() const
} }
int IMAPMessagePart::getNumber() const size_t IMAPMessagePart::getNumber() const
{ {
return m_number; return m_number;
} }
@ -127,7 +127,7 @@ shared_ptr <const header> IMAPMessagePart::getHeader() const
// static // static
shared_ptr <IMAPMessagePart> IMAPMessagePart::create shared_ptr <IMAPMessagePart> IMAPMessagePart::create
(shared_ptr <IMAPMessagePart> parent, const int number, const IMAPParser::body* body) (shared_ptr <IMAPMessagePart> parent, const size_t number, const IMAPParser::body* body)
{ {
if (body->body_type_mpart()) if (body->body_type_mpart())
{ {

View File

@ -48,8 +48,8 @@ class VMIME_EXPORT IMAPMessagePart : public messagePart
{ {
public: public:
IMAPMessagePart(shared_ptr <IMAPMessagePart> parent, const int number, const IMAPParser::body_type_mpart* mpart); IMAPMessagePart(shared_ptr <IMAPMessagePart> parent, const size_t number, const IMAPParser::body_type_mpart* mpart);
IMAPMessagePart(shared_ptr <IMAPMessagePart> parent, const int number, const IMAPParser::body_type_1part* part); IMAPMessagePart(shared_ptr <IMAPMessagePart> parent, const size_t number, const IMAPParser::body_type_1part* part);
shared_ptr <const messageStructure> getStructure() const; shared_ptr <const messageStructure> getStructure() const;
shared_ptr <messageStructure> getStructure(); shared_ptr <messageStructure> getStructure();
@ -58,13 +58,13 @@ public:
const mediaType& getType() const; const mediaType& getType() const;
size_t getSize() const; size_t getSize() const;
int getNumber() const; size_t getNumber() const;
shared_ptr <const header> getHeader() const; shared_ptr <const header> getHeader() const;
static shared_ptr <IMAPMessagePart> create static shared_ptr <IMAPMessagePart> create
(shared_ptr <IMAPMessagePart> parent, const int number, const IMAPParser::body* body); (shared_ptr <IMAPMessagePart> parent, const size_t number, const IMAPParser::body* body);
header& getOrCreateHeader(); header& getOrCreateHeader();
@ -75,7 +75,7 @@ private:
weak_ptr <IMAPMessagePart> m_parent; weak_ptr <IMAPMessagePart> m_parent;
shared_ptr <header> m_header; shared_ptr <header> m_header;
int m_number; size_t m_number;
size_t m_size; size_t m_size;
mediaType m_mediaType; mediaType m_mediaType;
}; };

View File

@ -49,7 +49,7 @@ IMAPMessageStructure::IMAPMessageStructure(const IMAPParser::body* body)
IMAPMessageStructure::IMAPMessageStructure(shared_ptr <IMAPMessagePart> parent, const std::vector <IMAPParser::body*>& list) IMAPMessageStructure::IMAPMessageStructure(shared_ptr <IMAPMessagePart> parent, const std::vector <IMAPParser::body*>& list)
{ {
int number = 0; size_t number = 0;
for (std::vector <IMAPParser::body*>::const_iterator for (std::vector <IMAPParser::body*>::const_iterator
it = list.begin() ; it != list.end() ; ++it, ++number) it = list.begin() ; it != list.end() ; ++it, ++number)

View File

@ -740,7 +740,7 @@ public:
void enumerateNumberMessageRange(const vmime::net::numberMessageRange& range) void enumerateNumberMessageRange(const vmime::net::numberMessageRange& range)
{ {
for (int i = range.getFirst(), last = range.getLast() ; i <= last ; ++i) for (size_t i = range.getFirst(), last = range.getLast() ; i <= last ; ++i)
m_list.push_back(i); m_list.push_back(i);
} }
@ -749,14 +749,14 @@ public:
// Not used // Not used
} }
const std::vector <int>& list() const const std::vector <size_t>& list() const
{ {
return m_list; return m_list;
} }
public: public:
std::vector <int> m_list; std::vector <size_t> m_list;
}; };
@ -772,7 +772,7 @@ const string IMAPUtils::messageSetToSequenceSet(const messageSet& msgs)
// static // static
const std::vector <int> IMAPUtils::messageSetToNumberList(const messageSet& msgs) const std::vector <size_t> IMAPUtils::messageSetToNumberList(const messageSet& msgs)
{ {
IMAPMessageSetEnumerator en; IMAPMessageSetEnumerator en;
msgs.enumerate(en); msgs.enumerate(en);

View File

@ -119,7 +119,7 @@ public:
* @param msgs message set * @param msgs message set
* @return list of message numbers * @return list of message numbers
*/ */
static const std::vector <int> messageSetToNumberList(const messageSet& msgs); static const std::vector <size_t> messageSetToNumberList(const messageSet& msgs);
/** Constructs a message set from a parser 'uid_set' structure. /** Constructs a message set from a parser 'uid_set' structure.
* *

View File

@ -312,7 +312,7 @@ void maildirFolder::scanFolder()
} }
// Update/delete existing messages (found in previous scan) // Update/delete existing messages (found in previous scan)
for (unsigned int i = 0 ; i < m_messageInfos.size() ; ++i) for (size_t i = 0 ; i < m_messageInfos.size() ; ++i)
{ {
messageInfos& msgInfos = m_messageInfos[i]; messageInfos& msgInfos = m_messageInfos[i];
@ -388,7 +388,7 @@ void maildirFolder::scanFolder()
} }
// Update message count // Update message count
int unreadMessageCount = 0; size_t unreadMessageCount = 0;
for (std::vector <messageInfos>::const_iterator for (std::vector <messageInfos>::const_iterator
it = m_messageInfos.begin() ; it != m_messageInfos.end() ; ++it) it = m_messageInfos.begin() ; it != m_messageInfos.end() ; ++it)
@ -398,7 +398,7 @@ void maildirFolder::scanFolder()
} }
m_unreadMessageCount = unreadMessageCount; m_unreadMessageCount = unreadMessageCount;
m_messageCount = m_messageInfos.size(); m_messageCount = static_cast <size_t>(m_messageInfos.size());
} }
catch (exceptions::filesystem_exception&) catch (exceptions::filesystem_exception&)
{ {
@ -407,7 +407,7 @@ void maildirFolder::scanFolder()
} }
shared_ptr <message> maildirFolder::getMessage(const int num) shared_ptr <message> maildirFolder::getMessage(const size_t num)
{ {
if (!isOpen()) if (!isOpen())
throw exceptions::illegal_state("Folder not open"); throw exceptions::illegal_state("Folder not open");
@ -427,12 +427,12 @@ std::vector <shared_ptr <message> > maildirFolder::getMessages(const messageSet&
if (msgs.isNumberSet()) if (msgs.isNumberSet())
{ {
const std::vector <int> numbers = maildirUtils::messageSetToNumberList(msgs); const std::vector <size_t> numbers = maildirUtils::messageSetToNumberList(msgs);
std::vector <shared_ptr <message> > messages; std::vector <shared_ptr <message> > messages;
shared_ptr <maildirFolder> thisFolder = dynamicCast <maildirFolder>(shared_from_this()); shared_ptr <maildirFolder> thisFolder = dynamicCast <maildirFolder>(shared_from_this());
for (std::vector <int>::const_iterator it = numbers.begin() ; it != numbers.end() ; ++it) for (std::vector <size_t>::const_iterator it = numbers.begin() ; it != numbers.end() ; ++it)
{ {
if (*it < 1|| *it > m_messageCount) if (*it < 1|| *it > m_messageCount)
throw exceptions::message_not_found(); throw exceptions::message_not_found();
@ -449,7 +449,7 @@ std::vector <shared_ptr <message> > maildirFolder::getMessages(const messageSet&
} }
int maildirFolder::getMessageCount() size_t maildirFolder::getMessageCount()
{ {
return (m_messageCount); return (m_messageCount);
} }
@ -595,7 +595,7 @@ void maildirFolder::setMessageFlags
if (msgs.isNumberSet()) if (msgs.isNumberSet())
{ {
const std::vector <int> nums = maildirUtils::messageSetToNumberList(msgs); const std::vector <size_t> nums = maildirUtils::messageSetToNumberList(msgs);
// Change message flags // Change message flags
shared_ptr <utility::fileSystemFactory> fsf = platform::getHandler()->getFileSystemFactory(); shared_ptr <utility::fileSystemFactory> fsf = platform::getHandler()->getFileSystemFactory();
@ -603,10 +603,10 @@ void maildirFolder::setMessageFlags
utility::file::path curDirPath = store->getFormat()-> utility::file::path curDirPath = store->getFormat()->
folderPathToFileSystemPath(m_path, maildirFormat::CUR_DIRECTORY); folderPathToFileSystemPath(m_path, maildirFormat::CUR_DIRECTORY);
for (std::vector <int>::const_iterator it = for (std::vector <size_t>::const_iterator it =
nums.begin() ; it != nums.end() ; ++it) nums.begin() ; it != nums.end() ; ++it)
{ {
const int num = *it - 1; const size_t num = *it - 1;
try try
{ {
@ -785,7 +785,7 @@ messageSet maildirFolder::addMessage
m_unreadMessageCount++; m_unreadMessageCount++;
// Notification // Notification
std::vector <int> nums; std::vector <size_t> nums;
nums.push_back(m_messageCount); nums.push_back(m_messageCount);
shared_ptr <events::messageCountEvent> event = shared_ptr <events::messageCountEvent> event =
@ -950,14 +950,14 @@ messageSet maildirFolder::copyMessages(const folder::path& dest, const messageSe
} }
// Copy messages // Copy messages
const std::vector <int> nums = maildirUtils::messageSetToNumberList(msgs); const std::vector <size_t> nums = maildirUtils::messageSetToNumberList(msgs);
try try
{ {
for (std::vector <int>::const_iterator it = for (std::vector <size_t>::const_iterator it =
nums.begin() ; it != nums.end() ; ++it) nums.begin() ; it != nums.end() ; ++it)
{ {
const int num = *it; const size_t num = *it;
const messageInfos& msg = m_messageInfos[num - 1]; const messageInfos& msg = m_messageInfos[num - 1];
const int flags = maildirUtils::extractFlags(msg.path); const int flags = maildirUtils::extractFlags(msg.path);
@ -995,7 +995,7 @@ void maildirFolder::notifyMessagesCopied(const folder::path& dest)
{ {
// We only need to update the first folder we found as calling // We only need to update the first folder we found as calling
// status() will notify all the folders with the same path. // status() will notify all the folders with the same path.
int count, unseen; size_t count, unseen;
(*it)->status(count, unseen); (*it)->status(count, unseen);
return; return;
@ -1004,7 +1004,7 @@ void maildirFolder::notifyMessagesCopied(const folder::path& dest)
} }
void maildirFolder::status(int& count, int& unseen) void maildirFolder::status(size_t& count, size_t& unseen)
{ {
count = 0; count = 0;
unseen = 0; unseen = 0;
@ -1020,7 +1020,7 @@ shared_ptr <folderStatus> maildirFolder::getStatus()
{ {
shared_ptr <maildirStore> store = m_store.lock(); shared_ptr <maildirStore> store = m_store.lock();
const int oldCount = m_messageCount; const size_t oldCount = m_messageCount;
scanFolder(); scanFolder();
@ -1032,10 +1032,10 @@ shared_ptr <folderStatus> maildirFolder::getStatus()
// Notify message count changed (new messages) // Notify message count changed (new messages)
if (m_messageCount > oldCount) if (m_messageCount > oldCount)
{ {
std::vector <int> nums; std::vector <size_t> nums;
nums.reserve(m_messageCount - oldCount); nums.reserve(m_messageCount - oldCount);
for (int i = oldCount + 1, j = 0 ; i <= m_messageCount ; ++i, ++j) for (size_t i = oldCount + 1, j = 0 ; i <= m_messageCount ; ++i, ++j)
nums[j] = i; nums[j] = i;
shared_ptr <events::messageCountEvent> event = shared_ptr <events::messageCountEvent> event =
@ -1087,10 +1087,10 @@ void maildirFolder::expunge()
utility::file::path curDirPath = store->getFormat()-> utility::file::path curDirPath = store->getFormat()->
folderPathToFileSystemPath(m_path, maildirFormat::CUR_DIRECTORY); folderPathToFileSystemPath(m_path, maildirFormat::CUR_DIRECTORY);
std::vector <int> nums; std::vector <size_t> nums;
int unreadCount = 0; size_t unreadCount = 0;
for (int num = 1 ; num <= m_messageCount ; ++num) for (size_t num = 1 ; num <= m_messageCount ; ++num)
{ {
messageInfos& infos = m_messageInfos[num - 1]; messageInfos& infos = m_messageInfos[num - 1];
@ -1125,11 +1125,11 @@ void maildirFolder::expunge()
if (!nums.empty()) if (!nums.empty())
{ {
for (std::vector <int>::size_type i = nums.size() ; i != 0 ; --i) for (std::vector <size_t>::size_type i = nums.size() ; i != 0 ; --i)
m_messageInfos.erase(m_messageInfos.begin() + (i - 1)); m_messageInfos.erase(m_messageInfos.begin() + (i - 1));
} }
m_messageCount -= nums.size(); m_messageCount -= static_cast <size_t>(nums.size());
m_unreadMessageCount -= unreadCount; m_unreadMessageCount -= unreadCount;
// Notify message expunged // Notify message expunged
@ -1255,7 +1255,7 @@ int maildirFolder::getFetchCapabilities() const
} }
const utility::file::path maildirFolder::getMessageFSPath(const int number) const const utility::file::path maildirFolder::getMessageFSPath(const size_t number) const
{ {
utility::file::path curDirPath = m_store.lock()->getFormat()-> utility::file::path curDirPath = m_store.lock()->getFormat()->
folderPathToFileSystemPath(m_path, maildirFormat::CUR_DIRECTORY); folderPathToFileSystemPath(m_path, maildirFormat::CUR_DIRECTORY);
@ -1264,7 +1264,7 @@ const utility::file::path maildirFolder::getMessageFSPath(const int number) cons
} }
std::vector <int> maildirFolder::getMessageNumbersStartingOnUID(const message::uid& /* uid */) std::vector <size_t> maildirFolder::getMessageNumbersStartingOnUID(const message::uid& /* uid */)
{ {
throw exceptions::operation_not_supported(); throw exceptions::operation_not_supported();
} }

View File

@ -86,10 +86,10 @@ public:
bool isOpen() const; bool isOpen() const;
shared_ptr <message> getMessage(const int num); shared_ptr <message> getMessage(const size_t num);
std::vector <shared_ptr <message> > getMessages(const messageSet& msgs); std::vector <shared_ptr <message> > getMessages(const messageSet& msgs);
int getMessageCount(); size_t getMessageCount();
shared_ptr <folder> getFolder(const folder::path::component& name); shared_ptr <folder> getFolder(const folder::path::component& name);
std::vector <shared_ptr <folder> > getFolders(const bool recursive = false); std::vector <shared_ptr <folder> > getFolders(const bool recursive = false);
@ -105,7 +105,7 @@ public:
messageSet copyMessages(const folder::path& dest, const messageSet& msgs); messageSet copyMessages(const folder::path& dest, const messageSet& msgs);
void status(int& count, int& unseen); void status(size_t& count, size_t& unseen);
shared_ptr <folderStatus> getStatus(); shared_ptr <folderStatus> getStatus();
void expunge(); void expunge();
@ -124,7 +124,7 @@ public:
int getFetchCapabilities() const; int getFetchCapabilities() const;
std::vector <int> getMessageNumbersStartingOnUID(const message::uid& uid); std::vector <size_t> getMessageNumbersStartingOnUID(const message::uid& uid);
private: private:
@ -135,16 +135,16 @@ private:
void registerMessage(maildirMessage* msg); void registerMessage(maildirMessage* msg);
void unregisterMessage(maildirMessage* msg); void unregisterMessage(maildirMessage* msg);
const utility::file::path getMessageFSPath(const int number) const; const utility::file::path getMessageFSPath(const size_t number) const;
void onStoreDisconnected(); void onStoreDisconnected();
void onClose(); void onClose();
void deleteMessagesImpl(const std::vector <int>& nums); void deleteMessagesImpl(const std::vector <size_t>& nums);
void setMessageFlagsImpl(const std::vector <int>& nums, const int flags, const int mode); void setMessageFlagsImpl(const std::vector <size_t>& nums, const int flags, const int mode);
void copyMessagesImpl(const folder::path& dest, const std::vector <int>& nums); void copyMessagesImpl(const folder::path& dest, const std::vector <size_t>& nums);
void copyMessageImpl(const utility::file::path& tmpDirPath, const utility::file::path& curDirPath, const utility::file::path::component& filename, utility::inputStream& is, const size_t size, utility::progressListener* progress); void copyMessageImpl(const utility::file::path& tmpDirPath, const utility::file::path& curDirPath, const utility::file::path::component& filename, utility::inputStream& is, const size_t size, utility::progressListener* progress);
void notifyMessagesCopied(const folder::path& dest); void notifyMessagesCopied(const folder::path& dest);
@ -158,8 +158,8 @@ private:
int m_mode; int m_mode;
bool m_open; bool m_open;
int m_unreadMessageCount; size_t m_unreadMessageCount;
int m_messageCount; size_t m_messageCount;
// Store information about scanned messages // Store information about scanned messages
struct messageInfos struct messageInfos

View File

@ -50,25 +50,25 @@ maildirFolderStatus::maildirFolderStatus(const maildirFolderStatus& other)
} }
unsigned int maildirFolderStatus::getMessageCount() const size_t maildirFolderStatus::getMessageCount() const
{ {
return m_count; return m_count;
} }
unsigned int maildirFolderStatus::getUnseenCount() const size_t maildirFolderStatus::getUnseenCount() const
{ {
return m_unseen; return m_unseen;
} }
void maildirFolderStatus::setMessageCount(const unsigned int count) void maildirFolderStatus::setMessageCount(const size_t count)
{ {
m_count = count; m_count = count;
} }
void maildirFolderStatus::setUnseenCount(const unsigned int unseen) void maildirFolderStatus::setUnseenCount(const size_t unseen)
{ {
m_unseen = unseen; m_unseen = unseen;
} }

View File

@ -50,19 +50,19 @@ public:
maildirFolderStatus(const maildirFolderStatus& other); maildirFolderStatus(const maildirFolderStatus& other);
// Inherited from folderStatus // Inherited from folderStatus
unsigned int getMessageCount() const; size_t getMessageCount() const;
unsigned int getUnseenCount() const; size_t getUnseenCount() const;
shared_ptr <folderStatus> clone() const; shared_ptr <folderStatus> clone() const;
void setMessageCount(const unsigned int count); void setMessageCount(const size_t count);
void setUnseenCount(const unsigned int unseen); void setUnseenCount(const size_t unseen);
private: private:
unsigned int m_count; size_t m_count;
unsigned int m_unseen; size_t m_unseen;
}; };

View File

@ -48,7 +48,7 @@ namespace net {
namespace maildir { namespace maildir {
maildirMessage::maildirMessage(shared_ptr <maildirFolder> folder, const int num) maildirMessage::maildirMessage(shared_ptr <maildirFolder> folder, const size_t num)
: m_folder(folder), m_num(num), m_size(-1), m_flags(FLAG_UNDEFINED), : m_folder(folder), m_num(num), m_size(-1), m_flags(FLAG_UNDEFINED),
m_expunged(false), m_structure(null) m_expunged(false), m_structure(null)
{ {
@ -78,7 +78,7 @@ void maildirMessage::onFolderClosed()
} }
int maildirMessage::getNumber() const size_t maildirMessage::getNumber() const
{ {
return (m_num); return (m_num);
} }

View File

@ -54,12 +54,12 @@ class VMIME_EXPORT maildirMessage : public message
public: public:
maildirMessage(shared_ptr <maildirFolder> folder, const int num); maildirMessage(shared_ptr <maildirFolder> folder, const size_t num);
~maildirMessage(); ~maildirMessage();
int getNumber() const; size_t getNumber() const;
const uid getUID() const; const uid getUID() const;
@ -95,7 +95,7 @@ private:
weak_ptr <maildirFolder> m_folder; weak_ptr <maildirFolder> m_folder;
int m_num; size_t m_num;
size_t m_size; size_t m_size;
int m_flags; int m_flags;
bool m_expunged; bool m_expunged;

View File

@ -36,7 +36,7 @@ namespace net {
namespace maildir { namespace maildir {
maildirMessagePart::maildirMessagePart(shared_ptr <maildirMessagePart> parent, const int number, const bodyPart& part) maildirMessagePart::maildirMessagePart(shared_ptr <maildirMessagePart> parent, const size_t number, const bodyPart& part)
: m_parent(parent), m_header(null), m_number(number) : m_parent(parent), m_header(null), m_number(number)
{ {
m_headerParsedOffset = part.getHeader()->getParsedOffset(); m_headerParsedOffset = part.getHeader()->getParsedOffset();
@ -99,7 +99,7 @@ size_t maildirMessagePart::getSize() const
} }
int maildirMessagePart::getNumber() const size_t maildirMessagePart::getNumber() const
{ {
return m_number; return m_number;
} }

View File

@ -46,7 +46,7 @@ class maildirMessagePart : public messagePart
{ {
public: public:
maildirMessagePart(shared_ptr <maildirMessagePart> parent, const int number, const bodyPart& part); maildirMessagePart(shared_ptr <maildirMessagePart> parent, const size_t number, const bodyPart& part);
~maildirMessagePart(); ~maildirMessagePart();
@ -57,7 +57,7 @@ public:
const mediaType& getType() const; const mediaType& getType() const;
size_t getSize() const; size_t getSize() const;
int getNumber() const; size_t getNumber() const;
shared_ptr <const header> getHeader() const; shared_ptr <const header> getHeader() const;
@ -77,7 +77,7 @@ private:
weak_ptr <maildirMessagePart> m_parent; weak_ptr <maildirMessagePart> m_parent;
shared_ptr <header> m_header; shared_ptr <header> m_header;
int m_number; size_t m_number;
size_t m_size; size_t m_size;
mediaType m_mediaType; mediaType m_mediaType;

View File

@ -55,7 +55,7 @@ maildirMessageStructure::maildirMessageStructure(shared_ptr <maildirMessagePart>
maildirMessageStructure::maildirMessageStructure(shared_ptr <maildirMessagePart> parent, const std::vector <shared_ptr <const vmime::bodyPart> >& list) maildirMessageStructure::maildirMessageStructure(shared_ptr <maildirMessagePart> parent, const std::vector <shared_ptr <const vmime::bodyPart> >& list)
{ {
for (unsigned int i = 0 ; i < list.size() ; ++i) for (size_t i = 0 ; i < list.size() ; ++i)
{ {
shared_ptr <maildirMessagePart> mpart = make_shared <maildirMessagePart>(parent, i, *list[i]); shared_ptr <maildirMessagePart> mpart = make_shared <maildirMessagePart>(parent, i, *list[i]);
mpart->initStructure(*list[i]); mpart->initStructure(*list[i]);

View File

@ -220,7 +220,7 @@ public:
void enumerateNumberMessageRange(const vmime::net::numberMessageRange& range) void enumerateNumberMessageRange(const vmime::net::numberMessageRange& range)
{ {
for (int i = range.getFirst(), last = range.getLast() ; i <= last ; ++i) for (size_t i = range.getFirst(), last = range.getLast() ; i <= last ; ++i)
list.push_back(i); list.push_back(i);
} }
@ -231,12 +231,12 @@ public:
public: public:
std::vector <int> list; std::vector <size_t> list;
}; };
// static // static
const std::vector <int> maildirUtils::messageSetToNumberList(const messageSet& msgs) const std::vector <size_t> maildirUtils::messageSetToNumberList(const messageSet& msgs)
{ {
maildirMessageSetEnumerator en; maildirMessageSetEnumerator en;
msgs.enumerate(en); msgs.enumerate(en);

View File

@ -137,7 +137,7 @@ public:
* @param msgs message set * @param msgs message set
* @return list of message numbers * @return list of message numbers
*/ */
static const std::vector <int> messageSetToNumberList(const messageSet& msgs); static const std::vector <size_t> messageSetToNumberList(const messageSet& msgs);
}; };

View File

@ -97,7 +97,7 @@ public:
* *
* @return part number * @return part number
*/ */
virtual int getNumber() const = 0; virtual size_t getNumber() const = 0;
/** Return the sub-part at the specified position (zero is the /** Return the sub-part at the specified position (zero is the
* first part). * first part).
@ -231,7 +231,7 @@ public:
* *
* @return sequence number of the message * @return sequence number of the message
*/ */
virtual int getNumber() const = 0; virtual size_t getNumber() const = 0;
/** Return the unique identifier (UID) of this message in its /** Return the unique identifier (UID) of this message in its
* folder (must fetch before). * folder (must fetch before).

View File

@ -52,7 +52,7 @@ messageRange::~messageRange()
// numberMessageRange // numberMessageRange
numberMessageRange::numberMessageRange(const int number) numberMessageRange::numberMessageRange(const size_t number)
: m_first(number), m_last(number) : m_first(number), m_last(number)
{ {
if (number < 1) if (number < 1)
@ -60,12 +60,12 @@ numberMessageRange::numberMessageRange(const int number)
} }
numberMessageRange::numberMessageRange(const int first, const int last) numberMessageRange::numberMessageRange(const size_t first, const size_t last)
: m_first(first), m_last(last) : m_first(first), m_last(last)
{ {
if (first < 1) if (first < 1)
throw std::invalid_argument("first"); throw std::invalid_argument("first");
else if (last != -1 && last < first) else if (last != -1U && last < first)
throw std::invalid_argument("last"); throw std::invalid_argument("last");
} }
@ -76,13 +76,13 @@ numberMessageRange::numberMessageRange(const numberMessageRange& other)
} }
int numberMessageRange::getFirst() const size_t numberMessageRange::getFirst() const
{ {
return m_first; return m_first;
} }
int numberMessageRange::getLast() const size_t numberMessageRange::getLast() const
{ {
return m_last; return m_last;
} }
@ -177,7 +177,7 @@ messageSet messageSet::empty()
// static // static
messageSet messageSet::byNumber(const int number) messageSet messageSet::byNumber(const size_t number)
{ {
messageSet set; messageSet set;
set.m_ranges.push_back(new numberMessageRange(number)); set.m_ranges.push_back(new numberMessageRange(number));
@ -187,7 +187,7 @@ messageSet messageSet::byNumber(const int number)
// static // static
messageSet messageSet::byNumber(const int first, const int last) messageSet messageSet::byNumber(const size_t first, const size_t last)
{ {
messageSet set; messageSet set;
set.m_ranges.push_back(new numberMessageRange(first, last)); set.m_ranges.push_back(new numberMessageRange(first, last));
@ -197,10 +197,10 @@ messageSet messageSet::byNumber(const int first, const int last)
// static // static
messageSet messageSet::byNumber(const std::vector <int>& numbers) messageSet messageSet::byNumber(const std::vector <size_t>& numbers)
{ {
// Sort a copy of the list // Sort a copy of the list
std::vector <int> sortedNumbers; std::vector <size_t> sortedNumbers;
sortedNumbers.resize(numbers.size()); sortedNumbers.resize(numbers.size());
@ -208,18 +208,18 @@ messageSet messageSet::byNumber(const std::vector <int>& numbers)
std::sort(sortedNumbers.begin(), sortedNumbers.end()); std::sort(sortedNumbers.begin(), sortedNumbers.end());
// Build the set by detecting ranges of continuous numbers // Build the set by detecting ranges of continuous numbers
int previous = -1, rangeStart = -1; size_t previous = -1U, rangeStart = -1U;
messageSet set; messageSet set;
for (std::vector <int>::const_iterator it = sortedNumbers.begin() ; for (std::vector <size_t>::const_iterator it = sortedNumbers.begin() ;
it != sortedNumbers.end() ; ++it) it != sortedNumbers.end() ; ++it)
{ {
const int current = *it; const size_t current = *it;
if (current == previous) if (current == previous)
continue; // skip duplicates continue; // skip duplicates
if (previous == -1) if (previous == -1U)
{ {
previous = current; previous = current;
rangeStart = current; rangeStart = current;

View File

@ -95,7 +95,7 @@ public:
* *
* @param number message number (numbering starts at 1, not 0) * @param number message number (numbering starts at 1, not 0)
*/ */
numberMessageRange(const int number); numberMessageRange(const size_t number);
/** Constructs a message range for multiple messages. /** Constructs a message range for multiple messages.
* *
@ -104,7 +104,7 @@ public:
* @param last number of the last message in the range, or use the * @param last number of the last message in the range, or use the
* special value -1 to designate the last message in the folder * special value -1 to designate the last message in the folder
*/ */
numberMessageRange(const int first, const int last); numberMessageRange(const size_t first, const size_t last);
/** Constructs a message range by copying from another range. /** Constructs a message range by copying from another range.
* *
@ -116,14 +116,14 @@ public:
* *
* @return number of the first message * @return number of the first message
*/ */
int getFirst() const; size_t getFirst() const;
/** Returns the number of the last message in the range, or -1 /** Returns the number of the last message in the range, or -1
* to designate the last message in the folder * to designate the last message in the folder
* *
* @return number of the last message * @return number of the last message
*/ */
int getLast() const; size_t getLast() const;
void enumerate(messageSetEnumerator& en) const; void enumerate(messageSetEnumerator& en) const;
@ -131,7 +131,7 @@ public:
private: private:
int m_first, m_last; size_t m_first, m_last;
}; };
@ -232,7 +232,7 @@ public:
* @param number message number (numbering starts at 1, not 0) * @param number message number (numbering starts at 1, not 0)
* @return new message set * @return new message set
*/ */
static messageSet byNumber(const int number); static messageSet byNumber(const size_t number);
/** Constructs a new message set and initializes it with a range /** Constructs a new message set and initializes it with a range
* of messages represented by their sequence number. * of messages represented by their sequence number.
@ -243,7 +243,7 @@ public:
* special value -1 to designate the last message in the folder * special value -1 to designate the last message in the folder
* @return new message set * @return new message set
*/ */
static messageSet byNumber(const int first, const int last); static messageSet byNumber(const size_t first, const size_t last);
/** Constructs a new message set and initializes it with a possibly /** Constructs a new message set and initializes it with a possibly
* unsorted list of messages represented by their sequence number. * unsorted list of messages represented by their sequence number.
@ -258,7 +258,7 @@ public:
* @param numbers a vector containing numbers of the messages * @param numbers a vector containing numbers of the messages
* @return new message set * @return new message set
*/ */
static messageSet byNumber(const std::vector <int>& numbers); static messageSet byNumber(const std::vector <size_t>& numbers);
/** Constructs a new message set and initializes it with a single /** Constructs a new message set and initializes it with a single
* message represented by its UID. * message represented by its UID.

View File

@ -219,7 +219,7 @@ bool POP3Folder::isOpen() const
} }
shared_ptr <message> POP3Folder::getMessage(const int num) shared_ptr <message> POP3Folder::getMessage(const size_t num)
{ {
shared_ptr <POP3Store> store = m_store.lock(); shared_ptr <POP3Store> store = m_store.lock();
@ -245,12 +245,12 @@ std::vector <shared_ptr <message> > POP3Folder::getMessages(const messageSet& ms
if (msgs.isNumberSet()) if (msgs.isNumberSet())
{ {
const std::vector <int> numbers = POP3Utils::messageSetToNumberList(msgs); const std::vector <size_t> numbers = POP3Utils::messageSetToNumberList(msgs);
std::vector <shared_ptr <message> > messages; std::vector <shared_ptr <message> > messages;
shared_ptr <POP3Folder> thisFolder(dynamicCast <POP3Folder>(shared_from_this())); shared_ptr <POP3Folder> thisFolder(dynamicCast <POP3Folder>(shared_from_this()));
for (std::vector <int>::const_iterator it = numbers.begin() ; it != numbers.end() ; ++it) for (std::vector <size_t>::const_iterator it = numbers.begin() ; it != numbers.end() ; ++it)
{ {
if (*it < 1|| *it > m_messageCount) if (*it < 1|| *it > m_messageCount)
throw exceptions::message_not_found(); throw exceptions::message_not_found();
@ -267,7 +267,7 @@ std::vector <shared_ptr <message> > POP3Folder::getMessages(const messageSet& ms
} }
int POP3Folder::getMessageCount() size_t POP3Folder::getMessageCount()
{ {
shared_ptr <POP3Store> store = m_store.lock(); shared_ptr <POP3Store> store = m_store.lock();
@ -357,7 +357,7 @@ void POP3Folder::fetchMessages(std::vector <shared_ptr <message> >& msg, const f
// S: 1 47548 // S: 1 47548
// S: 2 12653 // S: 2 12653
// S: . // S: .
std::map <int, string> result; std::map <size_t, string> result;
POP3Utils::parseMultiListOrUidlResponse(response, result); POP3Utils::parseMultiListOrUidlResponse(response, result);
for (std::vector <shared_ptr <message> >::iterator it = msg.begin() ; for (std::vector <shared_ptr <message> >::iterator it = msg.begin() ;
@ -365,7 +365,7 @@ void POP3Folder::fetchMessages(std::vector <shared_ptr <message> >& msg, const f
{ {
shared_ptr <POP3Message> m = dynamicCast <POP3Message>(*it); shared_ptr <POP3Message> m = dynamicCast <POP3Message>(*it);
std::map <int, string>::const_iterator x = result.find(m->m_num); std::map <size_t, string>::const_iterator x = result.find(m->m_num);
if (x != result.end()) if (x != result.end())
{ {
@ -397,7 +397,7 @@ void POP3Folder::fetchMessages(std::vector <shared_ptr <message> >& msg, const f
// S: 1 whqtswO00WBw418f9t5JxYwZ // S: 1 whqtswO00WBw418f9t5JxYwZ
// S: 2 QhdPYR:00WBw1Ph7x7 // S: 2 QhdPYR:00WBw1Ph7x7
// S: . // S: .
std::map <int, string> result; std::map <size_t, string> result;
POP3Utils::parseMultiListOrUidlResponse(response, result); POP3Utils::parseMultiListOrUidlResponse(response, result);
for (std::vector <shared_ptr <message> >::iterator it = msg.begin() ; for (std::vector <shared_ptr <message> >::iterator it = msg.begin() ;
@ -405,7 +405,7 @@ void POP3Folder::fetchMessages(std::vector <shared_ptr <message> >& msg, const f
{ {
shared_ptr <POP3Message> m = dynamicCast <POP3Message>(*it); shared_ptr <POP3Message> m = dynamicCast <POP3Message>(*it);
std::map <int, string>::const_iterator x = result.find(m->m_num); std::map <size_t, string>::const_iterator x = result.find(m->m_num);
if (x != result.end()) if (x != result.end())
m->m_uid = (*x).second; m->m_uid = (*x).second;
@ -558,7 +558,7 @@ void POP3Folder::deleteMessages(const messageSet& msgs)
{ {
shared_ptr <POP3Store> store = m_store.lock(); shared_ptr <POP3Store> store = m_store.lock();
const std::vector <int> nums = POP3Utils::messageSetToNumberList(msgs); const std::vector <size_t> nums = POP3Utils::messageSetToNumberList(msgs);
if (nums.empty()) if (nums.empty())
throw exceptions::invalid_argument(); throw exceptions::invalid_argument();
@ -568,7 +568,7 @@ void POP3Folder::deleteMessages(const messageSet& msgs)
else if (!isOpen()) else if (!isOpen())
throw exceptions::illegal_state("Folder not open"); throw exceptions::illegal_state("Folder not open");
for (std::vector <int>::const_iterator for (std::vector <size_t>::const_iterator
it = nums.begin() ; it != nums.end() ; ++it) it = nums.begin() ; it != nums.end() ; ++it)
{ {
POP3Command::DELE(*it)->send(store->getConnection()); POP3Command::DELE(*it)->send(store->getConnection());
@ -581,7 +581,7 @@ void POP3Folder::deleteMessages(const messageSet& msgs)
} }
// Sort message list // Sort message list
std::vector <int> list; std::vector <size_t> list;
list.resize(nums.size()); list.resize(nums.size());
std::copy(nums.begin(), nums.end(), list.begin()); std::copy(nums.begin(), nums.end(), list.begin());
@ -589,7 +589,7 @@ void POP3Folder::deleteMessages(const messageSet& msgs)
std::sort(list.begin(), list.end()); std::sort(list.begin(), list.end());
// Update local flags // Update local flags
for (std::map <POP3Message*, int>::iterator it = for (std::map <POP3Message*, size_t>::iterator it =
m_messages.begin() ; it != m_messages.end() ; ++it) m_messages.begin() ; it != m_messages.end() ; ++it)
{ {
POP3Message* msg = (*it).first; POP3Message* msg = (*it).first;
@ -644,7 +644,7 @@ messageSet POP3Folder::copyMessages
} }
void POP3Folder::status(int& count, int& unseen) void POP3Folder::status(size_t& count, size_t& unseen)
{ {
count = 0; count = 0;
unseen = 0; unseen = 0;
@ -672,14 +672,11 @@ shared_ptr <folderStatus> POP3Folder::getStatus()
throw exceptions::command_error("STAT", response->getFirstLine()); throw exceptions::command_error("STAT", response->getFirstLine());
int count = 0; size_t count = 0;
std::istringstream iss(response->getText()); std::istringstream iss(response->getText());
iss >> count; iss >> count;
if (count < 0)
throw exceptions::invalid_response("STAT", response->getText());
shared_ptr <POP3FolderStatus> status = make_shared <POP3FolderStatus>(); shared_ptr <POP3FolderStatus> status = make_shared <POP3FolderStatus>();
status->setMessageCount(count); status->setMessageCount(count);
@ -688,16 +685,16 @@ shared_ptr <folderStatus> POP3Folder::getStatus()
// Update local message count // Update local message count
if (m_messageCount != count) if (m_messageCount != count)
{ {
const int oldCount = m_messageCount; const size_t oldCount = m_messageCount;
m_messageCount = count; m_messageCount = count;
if (count > oldCount) if (count > oldCount)
{ {
std::vector <int> nums; std::vector <size_t> nums;
nums.resize(count - oldCount); nums.resize(count - oldCount);
for (int i = oldCount + 1, j = 0 ; i <= count ; ++i, ++j) for (size_t i = oldCount + 1, j = 0 ; i <= count ; ++i, ++j)
nums[j] = i; nums[j] = i;
// Notify message count changed // Notify message count changed
@ -738,7 +735,7 @@ void POP3Folder::expunge()
} }
std::vector <int> POP3Folder::getMessageNumbersStartingOnUID(const message::uid& /* uid */) std::vector <size_t> POP3Folder::getMessageNumbersStartingOnUID(const message::uid& /* uid */)
{ {
throw exceptions::operation_not_supported(); throw exceptions::operation_not_supported();
} }

View File

@ -83,10 +83,10 @@ public:
bool isOpen() const; bool isOpen() const;
shared_ptr <message> getMessage(const int num); shared_ptr <message> getMessage(const size_t num);
std::vector <shared_ptr <message> > getMessages(const messageSet& msgs); std::vector <shared_ptr <message> > getMessages(const messageSet& msgs);
int getMessageCount(); size_t getMessageCount();
shared_ptr <folder> getFolder(const folder::path::component& name); shared_ptr <folder> getFolder(const folder::path::component& name);
std::vector <shared_ptr <folder> > getFolders(const bool recursive = false); std::vector <shared_ptr <folder> > getFolders(const bool recursive = false);
@ -102,7 +102,7 @@ public:
messageSet copyMessages(const folder::path& dest, const messageSet& msgs); messageSet copyMessages(const folder::path& dest, const messageSet& msgs);
void status(int& count, int& unseen); void status(size_t& count, size_t& unseen);
shared_ptr <folderStatus> getStatus(); shared_ptr <folderStatus> getStatus();
void expunge(); void expunge();
@ -121,7 +121,7 @@ public:
int getFetchCapabilities() const; int getFetchCapabilities() const;
std::vector <int> getMessageNumbersStartingOnUID(const message::uid& uid); std::vector <size_t> getMessageNumbersStartingOnUID(const message::uid& uid);
private: private:
@ -141,9 +141,9 @@ private:
int m_mode; int m_mode;
bool m_open; bool m_open;
int m_messageCount; size_t m_messageCount;
typedef std::map <POP3Message*, int> MessageMap; typedef std::map <POP3Message*, size_t> MessageMap;
MessageMap m_messages; MessageMap m_messages;
}; };

View File

@ -50,25 +50,25 @@ POP3FolderStatus::POP3FolderStatus(const POP3FolderStatus& other)
} }
unsigned int POP3FolderStatus::getMessageCount() const size_t POP3FolderStatus::getMessageCount() const
{ {
return m_count; return m_count;
} }
unsigned int POP3FolderStatus::getUnseenCount() const size_t POP3FolderStatus::getUnseenCount() const
{ {
return m_unseen; return m_unseen;
} }
void POP3FolderStatus::setMessageCount(const unsigned int count) void POP3FolderStatus::setMessageCount(const size_t count)
{ {
m_count = count; m_count = count;
} }
void POP3FolderStatus::setUnseenCount(const unsigned int unseen) void POP3FolderStatus::setUnseenCount(const size_t unseen)
{ {
m_unseen = unseen; m_unseen = unseen;
} }

View File

@ -50,19 +50,19 @@ public:
POP3FolderStatus(const POP3FolderStatus& other); POP3FolderStatus(const POP3FolderStatus& other);
// Inherited from folderStatus // Inherited from folderStatus
unsigned int getMessageCount() const; size_t getMessageCount() const;
unsigned int getUnseenCount() const; size_t getUnseenCount() const;
shared_ptr <folderStatus> clone() const; shared_ptr <folderStatus> clone() const;
void setMessageCount(const unsigned int count); void setMessageCount(const size_t count);
void setUnseenCount(const unsigned int unseen); void setUnseenCount(const size_t unseen);
private: private:
unsigned int m_count; size_t m_count;
unsigned int m_unseen; size_t m_unseen;
}; };

View File

@ -44,7 +44,7 @@ namespace net {
namespace pop3 { namespace pop3 {
POP3Message::POP3Message(shared_ptr <POP3Folder> folder, const int num) POP3Message::POP3Message(shared_ptr <POP3Folder> folder, const size_t num)
: m_folder(folder), m_num(num), m_size(-1), m_deleted(false) : m_folder(folder), m_num(num), m_size(-1), m_deleted(false)
{ {
folder->registerMessage(this); folder->registerMessage(this);
@ -73,7 +73,7 @@ void POP3Message::onFolderClosed()
} }
int POP3Message::getNumber() const size_t POP3Message::getNumber() const
{ {
return (m_num); return (m_num);
} }

View File

@ -56,12 +56,12 @@ private:
public: public:
POP3Message(shared_ptr <POP3Folder> folder, const int num); POP3Message(shared_ptr <POP3Folder> folder, const size_t num);
~POP3Message(); ~POP3Message();
int getNumber() const; size_t getNumber() const;
const uid getUID() const; const uid getUID() const;
@ -101,7 +101,7 @@ private:
void onFolderClosed(); void onFolderClosed();
weak_ptr <POP3Folder> m_folder; weak_ptr <POP3Folder> m_folder;
int m_num; size_t m_num;
uid m_uid; uid m_uid;
size_t m_size; size_t m_size;

View File

@ -39,9 +39,9 @@ namespace pop3 {
// static // static
void POP3Utils::parseMultiListOrUidlResponse(shared_ptr <POP3Response> response, std::map <int, string>& result) void POP3Utils::parseMultiListOrUidlResponse(shared_ptr <POP3Response> response, std::map <size_t, string>& result)
{ {
std::map <int, string> ids; std::map <size_t, string> ids;
for (size_t i = 0, n = response->getLineCount() ; i < n ; ++i) for (size_t i = 0, n = response->getLineCount() ; i < n ; ++i)
{ {
@ -53,7 +53,7 @@ void POP3Utils::parseMultiListOrUidlResponse(shared_ptr <POP3Response> response,
if (it != line.end()) if (it != line.end())
{ {
int number = 0; size_t number = 0;
while (it != line.end() && (*it >= '0' && *it <= '9')) while (it != line.end() && (*it >= '0' && *it <= '9'))
{ {
@ -66,7 +66,7 @@ void POP3Utils::parseMultiListOrUidlResponse(shared_ptr <POP3Response> response,
if (it != line.end()) if (it != line.end())
{ {
result.insert(std::map <int, string>::value_type(number, string(it, line.end()))); result.insert(std::map <size_t, string>::value_type(number, string(it, line.end())));
} }
} }
} }
@ -80,7 +80,7 @@ public:
void enumerateNumberMessageRange(const vmime::net::numberMessageRange& range) void enumerateNumberMessageRange(const vmime::net::numberMessageRange& range)
{ {
for (int i = range.getFirst(), last = range.getLast() ; i <= last ; ++i) for (size_t i = range.getFirst(), last = range.getLast() ; i <= last ; ++i)
list.push_back(i); list.push_back(i);
} }
@ -91,12 +91,12 @@ public:
public: public:
std::vector <int> list; std::vector <size_t> list;
}; };
// static // static
const std::vector <int> POP3Utils::messageSetToNumberList(const messageSet& msgs) const std::vector <size_t> POP3Utils::messageSetToNumberList(const messageSet& msgs)
{ {
POP3MessageSetEnumerator en; POP3MessageSetEnumerator en;
msgs.enumerate(en); msgs.enumerate(en);

View File

@ -64,14 +64,14 @@ public:
* number to its corresponding data (either UID or size) * number to its corresponding data (either UID or size)
*/ */
static void parseMultiListOrUidlResponse static void parseMultiListOrUidlResponse
(shared_ptr <POP3Response> response, std::map <int, string>& result); (shared_ptr <POP3Response> response, std::map <size_t, string>& result);
/** Returns a list of message numbers given a message set. /** Returns a list of message numbers given a message set.
* *
* @param msgs message set * @param msgs message set
* @return list of message numbers * @return list of message numbers
*/ */
static const std::vector <int> messageSetToNumberList(const messageSet& msgs); static const std::vector <size_t> messageSetToNumberList(const messageSet& msgs);
}; };

View File

@ -291,7 +291,7 @@ public:
vmime::shared_ptr <vmime::net::folder> folder = store->getFolder vmime::shared_ptr <vmime::net::folder> folder = store->getFolder
(fpath() / "Folder" / "SubFolder" / "SubSubFolder2"); (fpath() / "Folder" / "SubFolder" / "SubSubFolder2");
int count, unseen; vmime::index_t count, unseen;
folder->status(count, unseen); folder->status(count, unseen);
VASSERT_EQ("Message count", 1, count); VASSERT_EQ("Message count", 1, count);

View File

@ -116,7 +116,7 @@ VMIME_TEST_SUITE_BEGIN(messageSetTest)
void testNumberSet_Multiple() void testNumberSet_Multiple()
{ {
std::vector <int> numbers; std::vector <vmime::index_t> numbers;
numbers.push_back(1); // test grouping 1:3 numbers.push_back(1); // test grouping 1:3
numbers.push_back(89); // test sorting numbers.push_back(89); // test sorting
numbers.push_back(2); numbers.push_back(2);

View File

@ -58,7 +58,7 @@ VMIME_TEST_SUITE_BEGIN(POP3UtilsTest)
vmime::shared_ptr <POP3Response> resp = vmime::shared_ptr <POP3Response> resp =
POP3Response::readMultilineResponse(conn); POP3Response::readMultilineResponse(conn);
std::map <int, vmime::string> result; std::map <vmime::index_t, vmime::string> result;
POP3Utils::parseMultiListOrUidlResponse(resp, result); POP3Utils::parseMultiListOrUidlResponse(resp, result);
VASSERT_EQ("Count", 5, result.size()); VASSERT_EQ("Count", 5, result.size());