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-printheader.cc | 31 +++++++++++++++++-------------- 1 file changed, 17 insertions(+), 14 deletions(-) (limited to 'src/mime-printheader.cc') diff --git a/src/mime-printheader.cc b/src/mime-printheader.cc index 9fb168e..34f1b99 100644 --- a/src/mime-printheader.cc +++ b/src/mime-printheader.cc @@ -1,9 +1,10 @@ -/** -------------------------------------------------------------------- +/** * @file mime-printheader.cc * @brief Implementation of main mime parser components * @author Andreas Aardal Hanssen * @date 2002-2005 - * ----------------------------------------------------------------- **/ + */ + #include "convert.h" #include "iodevice.h" #include "iofactory.h" @@ -22,9 +23,9 @@ #include #include -using namespace ::std; +using std::string; +using std::vector; -//------------------------------------------------------------------------ void Binc::MimePart::printHeader(int fd, IODevice &output, vector headers, @@ -116,8 +117,7 @@ void Binc::MimePart::printHeader(int fd, trim(lowername, ": \t"); bool foundMatch = false; - for (vector::const_iterator i = headers.begin(); i != headers.end(); ++i) { - string nametmp = *i; + for (auto nametmp : headers) { lowercase(nametmp); if (nametmp == lowername) { foundMatch = true; @@ -127,14 +127,16 @@ void Binc::MimePart::printHeader(int fd, if (foundMatch == includeheaders || headers.size() == 0) { string out = name + content; - for (string::const_iterator i = out.begin(); i != out.end(); ++i) + for (char i : out) { if (processedbytes >= startoffset && wrotebytes < length) { if (processedbytes >= startoffset) { - store += *i; + store += i; ++wrotebytes; } - } else + } else { ++processedbytes; + } + } } // move on to the next header @@ -151,8 +153,7 @@ void Binc::MimePart::printHeader(int fd, lowercase(lowername); trim(lowername, ": \t"); bool foundMatch = false; - for (vector::const_iterator i = headers.begin(); i != headers.end(); ++i) { - string nametmp = *i; + for (auto nametmp : headers) { lowercase(nametmp); if (nametmp == lowername) { foundMatch = true; @@ -162,12 +163,14 @@ void Binc::MimePart::printHeader(int fd, if (hasHeaderSeparator || foundMatch == includeheaders || headers.size() == 0) { string out = name + content; - for (string::const_iterator i = out.begin(); i != out.end(); ++i) + for (char i : out) { if (processedbytes >= startoffset && wrotebytes < length) { - store += *i; + store += i; ++wrotebytes; - } else + } else { ++processedbytes; + } + } } } } -- cgit v1.2.3