From d4c5386556fe7cb4b301fc79210dde47962c96b7 Mon Sep 17 00:00:00 2001 From: tholdawa Date: Tue, 14 Jan 2014 15:28:58 -0800 Subject: [PATCH 1/2] C++11 std::shared_ptr fixes: Test for C++11 std::shared_ptr was always failing because std::make_shared was calling a constructor of 1 argument which did not exist for the struct A. Changed test code snippet to call default no argument constructor of A. Once C++11 std::shared_ptr support was fixed, contentDispositionField.cpp and contentTypeField.cpp would not compile because std::shared_ptr cannot be implicitly cast to bool (i.e. in a return statement). Added explicit cast to bool. --- CMakeLists.txt | 2 +- src/vmime/contentDispositionField.cpp | 10 +++++----- src/vmime/contentTypeField.cpp | 6 +++--- 3 files changed, 9 insertions(+), 9 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index e20d00d1..25f74e64 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -815,7 +815,7 @@ CHECK_CXX_SOURCE_COMPILES( #include struct A { int foo; }; int main() { - std::shared_ptr a = std::make_shared (a); + std::shared_ptr a = std::make_shared (); return 0; } " diff --git a/src/vmime/contentDispositionField.cpp b/src/vmime/contentDispositionField.cpp index 5a9c1212..33234be8 100644 --- a/src/vmime/contentDispositionField.cpp +++ b/src/vmime/contentDispositionField.cpp @@ -42,7 +42,7 @@ contentDispositionField::contentDispositionField(contentDispositionField&) bool contentDispositionField::hasCreationDate() const { - return findParameter("creation-date"); + return bool(findParameter("creation-date")); } @@ -65,7 +65,7 @@ void contentDispositionField::setCreationDate(const datetime& creationDate) bool contentDispositionField::hasModificationDate() const { - return findParameter("modification-date"); + return bool(findParameter("modification-date")); } @@ -88,7 +88,7 @@ void contentDispositionField::setModificationDate(const datetime& modificationDa bool contentDispositionField::hasReadDate() const { - return findParameter("read-date"); + return bool(findParameter("read-date")); } @@ -111,7 +111,7 @@ void contentDispositionField::setReadDate(const datetime& readDate) bool contentDispositionField::hasFilename() const { - return findParameter("filename"); + return bool(findParameter("filename")); } @@ -134,7 +134,7 @@ void contentDispositionField::setFilename(const word& filename) bool contentDispositionField::hasSize() const { - return findParameter("size"); + return bool(findParameter("size")); } diff --git a/src/vmime/contentTypeField.cpp b/src/vmime/contentTypeField.cpp index 9f38294a..c36535f3 100644 --- a/src/vmime/contentTypeField.cpp +++ b/src/vmime/contentTypeField.cpp @@ -42,7 +42,7 @@ contentTypeField::contentTypeField(contentTypeField&) bool contentTypeField::hasBoundary() const { - return findParameter("boundary"); + return bool(findParameter("boundary")); } @@ -65,7 +65,7 @@ void contentTypeField::setBoundary(const string& boundary) bool contentTypeField::hasCharset() const { - return findParameter("charset"); + return bool(findParameter("charset")); } @@ -88,7 +88,7 @@ void contentTypeField::setCharset(const charset& ch) bool contentTypeField::hasReportType() const { - return findParameter("report-type"); + return bool(findParameter("report-type")); } From 4b1ffebaa929007c70b83abecc45108006f14aea Mon Sep 17 00:00:00 2001 From: tholdawa Date: Wed, 22 Jan 2014 11:26:57 -0800 Subject: [PATCH 2/2] IMAPMessage::processFetchResponse was attempting to set Cc and Bcc header fields to values of type mailboxList. HeaderFieldFactory registers these fields as type adddressList, so a bad_field_value_type exception was thrown when processing a fetch response for a message with either Cc or Bcc fields. Fixed by calling toAddressList on the mailboxList header field values to convert them to expected type. --- src/vmime/net/imap/IMAPMessage.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/vmime/net/imap/IMAPMessage.cpp b/src/vmime/net/imap/IMAPMessage.cpp index c11aafc2..226a55fe 100644 --- a/src/vmime/net/imap/IMAPMessage.cpp +++ b/src/vmime/net/imap/IMAPMessage.cpp @@ -460,14 +460,14 @@ int IMAPMessage::processFetchResponse IMAPUtils::convertAddressList(*(env->env_cc()), cc); if (!cc.isEmpty()) - hdr->Cc()->setValue(cc); + hdr->Cc()->setValue(cc.toAddressList()); // Bcc mailboxList bcc; IMAPUtils::convertAddressList(*(env->env_bcc()), bcc); if (!bcc.isEmpty()) - hdr->Bcc()->setValue(bcc); + hdr->Bcc()->setValue(bcc.toAddressList()); } break;