summaryrefslogtreecommitdiff
path: root/src/mime-getpart.cc
diff options
context:
space:
mode:
authorJannis M. Hoffmann <jannis@fehcom.de>2023-10-07 22:33:50 +0200
committerJannis M. Hoffmann <jannis@fehcom.de>2023-10-08 11:35:51 +0200
commit1978c49bea5b439d993067c055cec47e70db8fd6 (patch)
tree255caea96a13f95564e6b631be9a4ac55ce33cd9 /src/mime-getpart.cc
parent3b1278f5459514a6d6364f068ff97b8a0432057b (diff)
minor refactoring
Diffstat (limited to 'src/mime-getpart.cc')
-rw-r--r--src/mime-getpart.cc22
1 files changed, 9 insertions, 13 deletions
diff --git a/src/mime-getpart.cc b/src/mime-getpart.cc
index 02a1ec5..42f6c60 100644
--- a/src/mime-getpart.cc
+++ b/src/mime-getpart.cc
@@ -1,9 +1,10 @@
-/** --------------------------------------------------------------------
+/**
* @file mime-getpart.cc
* @brief Implementation of main mime parser components
* @author Andreas Aardal Hanssen
* @date 2002-2005
- * ----------------------------------------------------------------- **/
+ */
+
#include "convert.h"
#include "mime.h"
@@ -18,32 +19,27 @@
#include <stdio.h>
#include <string.h>
-using namespace ::std;
-
-//------------------------------------------------------------------------
-const Binc::MimePart *Binc::MimePart::getPart(const string &findpart,
- string genpart,
+const Binc::MimePart *Binc::MimePart::getPart(const std::string &findpart,
+ std::string genpart,
FetchType fetchType) const
{
if (findpart == genpart) return this;
if (isMultipart()) {
if (members.size() != 0) {
- vector<MimePart>::const_iterator i = members.begin();
int part = 1;
- while (i != members.end()) {
+ for (const auto &i : members) {
BincStream ss;
ss << genpart;
if (genpart != "") ss << ".";
ss << part;
const MimePart *m;
- if ((m = (*i).getPart(findpart, ss.str())) != 0) {
+ if ((m = i.getPart(findpart, ss.str())) != nullptr) {
if (fetchType == FetchHeader && m->isMessageRFC822()) m = &m->members[0];
return m;
}
- ++i;
++part;
}
}
@@ -52,7 +48,7 @@ const Binc::MimePart *Binc::MimePart::getPart(const string &findpart,
const MimePart *m = members[0].getPart(findpart, genpart);
return m;
} else {
- return 0;
+ return nullptr;
}
} else {
// Singlepart
@@ -62,5 +58,5 @@ const Binc::MimePart *Binc::MimePart::getPart(const string &findpart,
if (findpart == genpart) return this;
}
- return 0;
+ return nullptr;
}