From 1978c49bea5b439d993067c055cec47e70db8fd6 Mon Sep 17 00:00:00 2001 From: "Jannis M. Hoffmann" Date: Sat, 7 Oct 2023 22:33:50 +0200 Subject: minor refactoring --- src/mime-getpart.cc | 22 +++++++++------------- 1 file changed, 9 insertions(+), 13 deletions(-) (limited to 'src/mime-getpart.cc') 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 #include -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::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; } -- cgit v1.2.3