suppressed a few wasteful string-cstr conversions

This commit is contained in:
dockes 2008-07-01 11:57:36 +00:00
parent 022e0e5f43
commit ffd185c220
4 changed files with 12 additions and 12 deletions

View File

@ -88,7 +88,7 @@ const string &BincStream::str(void) const
//------------------------------------------------------------------------ //------------------------------------------------------------------------
void BincStream::clear(void) void BincStream::clear(void)
{ {
nstr = ""; nstr.clear();
} }
//------------------------------------------------------------------------ //------------------------------------------------------------------------

View File

@ -207,7 +207,7 @@ namespace Binc {
if (delim.find(*i) != std::string::npos) { if (delim.find(*i) != std::string::npos) {
if (!skipempty || token != "") if (!skipempty || token != "")
dest.push_back(token); dest.push_back(token);
token = ""; token.clear();
} else } else
token += *i; token += *i;
} }
@ -230,7 +230,7 @@ namespace Binc {
if (!inquote && delim.find(*i) != std::string::npos) { if (!inquote && delim.find(*i) != std::string::npos) {
if (!skipempty || token != "") if (!skipempty || token != "")
dest.push_back(token); dest.push_back(token);
token = ""; token.clear();
} else } else
token += *i; token += *i;
} }
@ -241,13 +241,13 @@ namespace Binc {
//---------------------------------------------------------------------- //----------------------------------------------------------------------
inline std::string toCanonMailbox(const std::string &s_in) 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) { if (s_in.length() >= 5) {
std::string a = s_in.substr(0, 5); std::string a = s_in.substr(0, 5);
uppercase(a); uppercase(a);
return a == "INBOX" ? 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; return s_in;

View File

@ -126,21 +126,21 @@ int Binc::MimePart::parseOnlyHeader(const string &toboundary) const
mimeSource->ungetChar(); mimeSource->ungetChar();
quit = true; quit = true;
name = ""; name.clear();
break; break;
} }
name += c; name += c;
if (name.length() == 2 && name.substr(0, 2) == "\r\n") { if (name.length() == 2 && name.substr(0, 2) == "\r\n") {
name = ""; name.clear();
quit = true; quit = true;
break; break;
} }
} }
if (name.length() == 1 && name[0] == '\r') { if (name.length() == 1 && name[0] == '\r') {
name = ""; name.clear();
break; break;
} }
@ -175,7 +175,7 @@ int Binc::MimePart::parseOnlyHeader(const string &toboundary) const
h.add(name, content); h.add(name, content);
name = c; name = c;
content = ""; content.clear();
break; break;
} }
} }

View File

@ -107,7 +107,7 @@ void Binc::MimePart::printHeader(int fd, IODevice &output,
// abort printing of header. note that in this case, the // abort printing of header. note that in this case, the
// headers will not end with a seperate \r\n. // headers will not end with a seperate \r\n.
quit = true; quit = true;
name = ""; name.clear();
break; break;
} }
} }
@ -163,8 +163,8 @@ void Binc::MimePart::printHeader(int fd, IODevice &output,
} }
// move on to the next header // move on to the next header
content = ""; content.clear();
name = ""; name.clear();
break; break;
} }