From ffd185c220663a8d42f7c6b61ee6606d7e350d85 Mon Sep 17 00:00:00 2001 From: dockes Date: Tue, 1 Jul 2008 11:57:36 +0000 Subject: [PATCH] suppressed a few wasteful string-cstr conversions --- src/bincimapmime/convert.cc | 2 +- src/bincimapmime/convert.h | 8 ++++---- src/bincimapmime/mime-parseonlyheader.cc | 8 ++++---- src/bincimapmime/mime-printheader.cc | 6 +++--- 4 files changed, 12 insertions(+), 12 deletions(-) diff --git a/src/bincimapmime/convert.cc b/src/bincimapmime/convert.cc index 80738e80..90e7c1ca 100644 --- a/src/bincimapmime/convert.cc +++ b/src/bincimapmime/convert.cc @@ -88,7 +88,7 @@ const string &BincStream::str(void) const //------------------------------------------------------------------------ void BincStream::clear(void) { - nstr = ""; + nstr.clear(); } //------------------------------------------------------------------------ diff --git a/src/bincimapmime/convert.h b/src/bincimapmime/convert.h index c780479f..69bf8f03 100644 --- a/src/bincimapmime/convert.h +++ b/src/bincimapmime/convert.h @@ -207,7 +207,7 @@ namespace Binc { if (delim.find(*i) != std::string::npos) { if (!skipempty || token != "") dest.push_back(token); - token = ""; + token.clear(); } else token += *i; } @@ -230,7 +230,7 @@ namespace Binc { if (!inquote && delim.find(*i) != std::string::npos) { if (!skipempty || token != "") dest.push_back(token); - token = ""; + token.clear(); } else token += *i; } @@ -241,13 +241,13 @@ namespace Binc { //---------------------------------------------------------------------- inline std::string toCanonMailbox(const std::string &s_in) { - if (s_in.find("..") != std::string::npos) return ""; + if (s_in.find("..") != std::string::npos) return string(); if (s_in.length() >= 5) { std::string a = s_in.substr(0, 5); uppercase(a); return a == "INBOX" ? - a + (s_in.length() > 5 ? s_in.substr(5) : "") : s_in; + a + (s_in.length() > 5 ? s_in.substr(5) : string() : s_in; } return s_in; diff --git a/src/bincimapmime/mime-parseonlyheader.cc b/src/bincimapmime/mime-parseonlyheader.cc index 5b6b871f..f4726b55 100644 --- a/src/bincimapmime/mime-parseonlyheader.cc +++ b/src/bincimapmime/mime-parseonlyheader.cc @@ -126,21 +126,21 @@ int Binc::MimePart::parseOnlyHeader(const string &toboundary) const mimeSource->ungetChar(); quit = true; - name = ""; + name.clear(); break; } name += c; if (name.length() == 2 && name.substr(0, 2) == "\r\n") { - name = ""; + name.clear(); quit = true; break; } } if (name.length() == 1 && name[0] == '\r') { - name = ""; + name.clear(); break; } @@ -175,7 +175,7 @@ int Binc::MimePart::parseOnlyHeader(const string &toboundary) const h.add(name, content); name = c; - content = ""; + content.clear(); break; } } diff --git a/src/bincimapmime/mime-printheader.cc b/src/bincimapmime/mime-printheader.cc index ac0b551d..7178af35 100644 --- a/src/bincimapmime/mime-printheader.cc +++ b/src/bincimapmime/mime-printheader.cc @@ -107,7 +107,7 @@ void Binc::MimePart::printHeader(int fd, IODevice &output, // abort printing of header. note that in this case, the // headers will not end with a seperate \r\n. quit = true; - name = ""; + name.clear(); break; } } @@ -163,8 +163,8 @@ void Binc::MimePart::printHeader(int fd, IODevice &output, } // move on to the next header - content = ""; - name = ""; + content.clear(); + name.clear(); break; }