suppressed a few wasteful string-cstr conversions
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
#ifndef lint
|
||||
static char rcsid [] = "@(#$Id: conftree.cpp,v 1.15 2007-12-13 06:58:22 dockes Exp $ (C) 2003 J.F.Dockes";
|
||||
static char rcsid [] = "@(#$Id: conftree.cpp,v 1.16 2008-07-01 11:51:51 dockes Exp $ (C) 2003 J.F.Dockes";
|
||||
#endif
|
||||
/*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
@@ -389,7 +389,7 @@ ConfSimple::sortwalk(WalkerCode (*walker)(void *,const string&,const string&),
|
||||
sit != m_submaps.end(); sit++) {
|
||||
|
||||
// Possibly emit submap name:
|
||||
if (!sit->first.empty() && walker(clidata, "", sit->first.c_str())
|
||||
if (!sit->first.empty() && walker(clidata, string(), sit->first.c_str())
|
||||
== WALK_STOP)
|
||||
return WALK_STOP;
|
||||
|
||||
@@ -539,7 +539,7 @@ int ConfTree::get(const std::string &name, string &value, const string &sk)
|
||||
return 1;
|
||||
string::size_type pos = msk.rfind("/");
|
||||
if (pos != string::npos) {
|
||||
msk.replace(pos, string::npos, "");
|
||||
msk.replace(pos, string::npos, string());
|
||||
} else
|
||||
break;
|
||||
}
|
||||
|
||||
@@ -95,9 +95,9 @@ public:
|
||||
enum StatusCode {STATUS_ERROR=0, STATUS_RO=1, STATUS_RW=2};
|
||||
virtual ~ConfNull() {};
|
||||
virtual int get(const string &name, string &value,
|
||||
const string &sk = "") = 0;
|
||||
const string &sk = string()) = 0;
|
||||
virtual int set(const string &nm, const string &val,
|
||||
const string &sk = "") = 0;
|
||||
const string &sk = string()) = 0;
|
||||
virtual bool ok() = 0;
|
||||
virtual list<string> getNames(const string &sk) = 0;
|
||||
virtual int erase(const string &, const string &) = 0;
|
||||
@@ -156,13 +156,13 @@ public:
|
||||
* global space if sk is empty).
|
||||
* @return 0 if name not found, 1 else
|
||||
*/
|
||||
virtual int get(const string &name, string &value, const string &sk = "");
|
||||
virtual int get(const string &name, string &value, const string &sk = string());
|
||||
|
||||
/**
|
||||
* Set value for named parameter in specified subsection (or global)
|
||||
* @return 0 for error, 1 else
|
||||
*/
|
||||
virtual int set(const string &nm, const string &val, const string &sk = "");
|
||||
virtual int set(const string &nm, const string &val, const string &sk = string());
|
||||
|
||||
/**
|
||||
* Remove name and value from config
|
||||
@@ -363,7 +363,7 @@ public:
|
||||
return false;
|
||||
}
|
||||
|
||||
virtual int set(const string &nm, const string &val, const string &sk = "")
|
||||
virtual int set(const string &nm, const string &val, const string &sk = string())
|
||||
{
|
||||
if (!m_ok)
|
||||
return 0;
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
#ifndef lint
|
||||
static char rcsid[] = "@(#$Id: idfile.cpp,v 1.8 2008-05-21 07:21:37 dockes Exp $ (C) 2005 J.F.Dockes";
|
||||
static char rcsid[] = "@(#$Id: idfile.cpp,v 1.9 2008-07-01 11:51:51 dockes Exp $ (C) 2005 J.F.Dockes";
|
||||
#endif
|
||||
/*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
@@ -68,7 +68,7 @@ string idFile(const char *fn)
|
||||
input.open(fn, ios::in);
|
||||
if (!input.is_open()) {
|
||||
LOGERR(("idFile: could not open [%s]\n", fn));
|
||||
return string("");
|
||||
return string();
|
||||
}
|
||||
|
||||
bool line1HasFrom = false;
|
||||
@@ -88,7 +88,7 @@ string idFile(const char *fn)
|
||||
if (input.fail()) {
|
||||
if (input.bad()) {
|
||||
LOGERR(("idfile: error while reading [%s]\n", fn));
|
||||
return string("");
|
||||
return string();
|
||||
}
|
||||
// Must be eof ?
|
||||
break;
|
||||
@@ -121,7 +121,7 @@ string idFile(const char *fn)
|
||||
// emacs vm can insert VERY long header lines.
|
||||
if (ll > 800) {
|
||||
LOGDEB2(("idFile: Line too long\n"));
|
||||
return string("");
|
||||
return string();
|
||||
}
|
||||
|
||||
// Check for mbox 'From ' line
|
||||
@@ -159,7 +159,7 @@ string idFile(const char *fn)
|
||||
if (lookslikemail >= wantnhead)
|
||||
return line1HasFrom ? string("text/x-mail") : string("message/rfc822");
|
||||
|
||||
return string("");
|
||||
return string();
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
#ifndef lint
|
||||
static char rcsid[] = "@(#$Id: mimeparse.cpp,v 1.20 2007-12-13 06:58:22 dockes Exp $ (C) 2004 J.F.Dockes";
|
||||
static char rcsid[] = "@(#$Id: mimeparse.cpp,v 1.21 2008-07-01 11:51:51 dockes Exp $ (C) 2004 J.F.Dockes";
|
||||
#endif
|
||||
/*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
@@ -360,7 +360,7 @@ bool parseMimeHeaderValue(const string& value, MimeHeaderValue& parsed)
|
||||
string nm = it->first;
|
||||
// Create the name entry
|
||||
if (parsed.params.find(nm) == parsed.params.end())
|
||||
parsed.params[nm] = "";
|
||||
parsed.params[nm].clear();
|
||||
// Concatenate all chunks and decode the whole if the first one needs
|
||||
// to. Yes, this is not quite right.
|
||||
string value;
|
||||
@@ -437,7 +437,7 @@ static bool rfc2047_decodeParsed(const std::string& charset,
|
||||
{
|
||||
DPRINT((stderr, "DecodeParsed: charset [%s] enc [%s] val [%s]\n",
|
||||
charset.c_str(), encoding.c_str(), value.c_str()));
|
||||
utf8 = "";
|
||||
utf8.clear();
|
||||
|
||||
string decoded;
|
||||
if (!stringlowercmp("b", encoding)) {
|
||||
@@ -485,7 +485,7 @@ bool rfc2047_decode(const std::string& in, std::string &out)
|
||||
Rfc2047States state = rfc2047ready;
|
||||
string encoding, charset, value, utf8;
|
||||
|
||||
out = "";
|
||||
out.clear();
|
||||
|
||||
for (string::size_type ii = 0; ii < in.length(); ii++) {
|
||||
char ch = in[ii];
|
||||
@@ -523,7 +523,7 @@ bool rfc2047_decode(const std::string& in, std::string &out)
|
||||
if (value.length() > 0) {
|
||||
transcode(value, utf8, "ISO-8859-1", "UTF-8");
|
||||
out += utf8;
|
||||
value = "";
|
||||
value.clear();
|
||||
}
|
||||
state = rfc2047charset;
|
||||
}
|
||||
@@ -568,7 +568,9 @@ bool rfc2047_decode(const std::string& in, std::string &out)
|
||||
return false;
|
||||
}
|
||||
out += utf8;
|
||||
charset = encoding = value = "";
|
||||
charset.clear();
|
||||
encoding.clear();
|
||||
value.clear();
|
||||
}
|
||||
break;
|
||||
default: state = rfc2047value; value += '?';value += ch;break;
|
||||
@@ -583,7 +585,7 @@ bool rfc2047_decode(const std::string& in, std::string &out)
|
||||
if (value.length() > 0) {
|
||||
transcode(value, utf8, "ISO-8859-1", "UTF-8");
|
||||
out += utf8;
|
||||
value = "";
|
||||
value.clear();
|
||||
}
|
||||
if (state != rfc2047base)
|
||||
return false;
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
#ifndef lint
|
||||
static char rcsid[] = "@(#$Id: pathut.cpp,v 1.21 2008-07-01 08:26:08 dockes Exp $ (C) 2004 J.F.Dockes";
|
||||
static char rcsid[] = "@(#$Id: pathut.cpp,v 1.22 2008-07-01 11:51:51 dockes Exp $ (C) 2004 J.F.Dockes";
|
||||
#endif
|
||||
/*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
@@ -273,7 +273,7 @@ extern std::string path_absolute(const std::string &is)
|
||||
if (s[0] != '/') {
|
||||
char buf[MAXPATHLEN];
|
||||
if (!getcwd(buf, MAXPATHLEN)) {
|
||||
return "";
|
||||
return string();
|
||||
}
|
||||
s = path_cat(string(buf), s);
|
||||
}
|
||||
@@ -289,7 +289,7 @@ extern std::string path_canon(const std::string &is)
|
||||
if (s[0] != '/') {
|
||||
char buf[MAXPATHLEN];
|
||||
if (!getcwd(buf, MAXPATHLEN)) {
|
||||
return "";
|
||||
return string();
|
||||
}
|
||||
s = path_cat(string(buf), s);
|
||||
}
|
||||
|
||||
+2
-2
@@ -16,7 +16,7 @@
|
||||
*/
|
||||
#ifndef _PATHUT_H_INCLUDED_
|
||||
#define _PATHUT_H_INCLUDED_
|
||||
/* @(#$Id: pathut.h,v 1.14 2008-07-01 08:26:08 dockes Exp $ (C) 2004 J.F.Dockes */
|
||||
/* @(#$Id: pathut.h,v 1.15 2008-07-01 11:51:51 dockes Exp $ (C) 2004 J.F.Dockes */
|
||||
|
||||
#include <string>
|
||||
#include <list>
|
||||
@@ -34,7 +34,7 @@ extern string path_cat(const string &s1, const string &s2);
|
||||
/// Get the simple file name (get rid of any directory path prefix
|
||||
extern string path_getsimple(const string &s);
|
||||
/// Simple file name + optional suffix stripping
|
||||
extern string path_basename(const string &s, const string &suff="");
|
||||
extern string path_basename(const string &s, const string &suff=string());
|
||||
/// Get the father directory
|
||||
extern string path_getfather(const string &s);
|
||||
/// Get the current user's home directory
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
#ifndef lint
|
||||
static char rcsid[] = "@(#$Id: smallut.cpp,v 1.28 2008-05-08 09:57:29 dockes Exp $ (C) 2004 J.F.Dockes";
|
||||
static char rcsid[] = "@(#$Id: smallut.cpp,v 1.29 2008-07-01 11:51:51 dockes Exp $ (C) 2004 J.F.Dockes";
|
||||
#endif
|
||||
/*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
@@ -185,7 +185,7 @@ template <class T> bool stringToStrings(const string &s, T &tokens)
|
||||
continue;
|
||||
case INQUOTE:
|
||||
tokens.push_back(current);
|
||||
current = "";
|
||||
current.clear();
|
||||
state = SPACE;
|
||||
continue;
|
||||
case ESCAPE:
|
||||
@@ -220,7 +220,7 @@ template <class T> bool stringToStrings(const string &s, T &tokens)
|
||||
continue;
|
||||
case TOKEN:
|
||||
tokens.push_back(current);
|
||||
current = "";
|
||||
current.clear();
|
||||
state = SPACE;
|
||||
continue;
|
||||
case INQUOTE:
|
||||
@@ -336,14 +336,14 @@ void trimstring(string &s, const char *ws)
|
||||
{
|
||||
string::size_type pos = s.find_first_not_of(ws);
|
||||
if (pos == string::npos) {
|
||||
s = "";
|
||||
s.clear();
|
||||
return;
|
||||
}
|
||||
s.replace(0, pos, "");
|
||||
s.replace(0, pos, string());
|
||||
|
||||
pos = s.find_last_not_of(ws);
|
||||
if (pos != string::npos && pos != s.length()-1)
|
||||
s.replace(pos+1, string::npos, "");
|
||||
s.replace(pos+1, string::npos, string());
|
||||
}
|
||||
|
||||
// Remove some chars and replace them with spaces
|
||||
|
||||
Reference in New Issue
Block a user