diff options
author | Jannis M. Hoffmann <jannis@fehcom.de> | 2023-10-07 22:33:50 +0200 |
---|---|---|
committer | Jannis M. Hoffmann <jannis@fehcom.de> | 2023-10-08 11:35:51 +0200 |
commit | 1978c49bea5b439d993067c055cec47e70db8fd6 (patch) | |
tree | 255caea96a13f95564e6b631be9a4ac55ce33cd9 /src/mime-printheader.cc | |
parent | 3b1278f5459514a6d6364f068ff97b8a0432057b (diff) |
minor refactoring
Diffstat (limited to 'src/mime-printheader.cc')
-rw-r--r-- | src/mime-printheader.cc | 31 |
1 files changed, 17 insertions, 14 deletions
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 <stdio.h> #include <string.h> -using namespace ::std; +using std::string; +using std::vector; -//------------------------------------------------------------------------ void Binc::MimePart::printHeader(int fd, IODevice &output, vector<string> headers, @@ -116,8 +117,7 @@ void Binc::MimePart::printHeader(int fd, trim(lowername, ": \t"); bool foundMatch = false; - for (vector<string>::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<string>::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; + } + } } } } |