const string cleanup

This commit is contained in:
Jean-Francois Dockes
2011-10-01 16:39:38 +02:00
parent 7f0ca13e7f
commit 38e0957962
29 changed files with 268 additions and 170 deletions
+9 -8
View File
@@ -34,6 +34,7 @@
#include <iostream>
#include <map>
#include "cstr.h"
#include "circache.h"
#include "conftree.h"
#include "debuglog.h"
@@ -356,27 +357,27 @@ public:
string s(bf, CIRCACHE_FIRSTBLOCK_SIZE);
ConfSimple conf(s, 1);
string value;
if (!conf.get("maxsize", value, "")) {
if (!conf.get("maxsize", value, cstr_null)) {
m_reason << "readfirstblock: conf get maxsize failed";
return false;
}
m_maxsize = atol(value.c_str());
if (!conf.get("oheadoffs", value, "")) {
if (!conf.get("oheadoffs", value, cstr_null)) {
m_reason << "readfirstblock: conf get oheadoffs failed";
return false;
}
m_oheadoffs = atol(value.c_str());
if (!conf.get("nheadoffs", value, "")) {
if (!conf.get("nheadoffs", value, cstr_null)) {
m_reason << "readfirstblock: conf get nheadoffs failed";
return false;
}
m_nheadoffs = atol(value.c_str());
if (!conf.get("npadsize", value, "")) {
if (!conf.get("npadsize", value, cstr_null)) {
m_reason << "readfirstblock: conf get npadsize failed";
return false;
}
m_npadsize = atol(value.c_str());
if (!conf.get("unient", value, "")) {
if (!conf.get("unient", value, cstr_null)) {
m_uniquentries = false;
} else {
m_uniquentries = stringToBool(value);
@@ -478,7 +479,7 @@ public:
string b(bf, d.dicsize);
ConfSimple conf(b, 1);
if (!conf.get("udi", udi, "")) {
if (!conf.get("udi", udi, cstr_null)) {
m_reason << "scan: no udi in dic";
return CCScanHook::Error;
}
@@ -1100,7 +1101,7 @@ bool CirCache::getCurrent(string& udi, string& dic, string& data)
return false;
ConfSimple conf(dic, 1);
conf.get("udi", udi, "");
conf.get("udi", udi, cstr_null);
return true;
}
@@ -1300,7 +1301,7 @@ int main(int argc, char **argv)
exit(1);
}
string udi;
make_udi(fn, "", udi);
make_udi(fn, cstr_null, udi);
sprintf(dic, "#whatever...\nmimetype = text/plain\nudi=%s\n",
udi.c_str());
string sdic;
+6 -4
View File
@@ -31,6 +31,7 @@
#include <list>
#include <set>
#include "cstr.h"
#include "debuglog.h"
#include "pathut.h"
#include "fstreewalk.h"
@@ -222,7 +223,7 @@ FsTreeWalker::Status FsTreeWalker::walk(const string& _top,
// back
dir = data->dirs.front();
data->dirs.pop_front();
if (dir == "") {
if (dir.empty()) {
// Father change marker.
if (data->dirs.empty())
break;
@@ -244,7 +245,7 @@ FsTreeWalker::Status FsTreeWalker::walk(const string& _top,
// Depth first, pop and process latest dir
dir = data->dirs.back();
data->dirs.pop_back();
if (dir == "") {
if (dir.empty()) {
// Father change marker.
if (data->dirs.empty())
break;
@@ -374,8 +375,9 @@ FsTreeWalker::Status FsTreeWalker::iwalk(const string &top,
// from entries for other dir. This is to help
// with generating DirReturn callbacks
if (!nullpush) {
if (!data->dirs.empty() && data->dirs.back() != "")
data->dirs.push_back("");
if (!data->dirs.empty() &&
!data->dirs.back().empty())
data->dirs.push_back(cstr_null);
nullpush = true;
}
data->dirs.push_back(fn);