More HTTP repository compile tweaks.

This commit is contained in:
James Turner 2016-02-22 21:07:01 +02:00
parent 2b147f7429
commit 935d649096
3 changed files with 7 additions and 10 deletions

View File

@ -198,12 +198,9 @@ public:
{ {
SGPath p(absolutePath()); SGPath p(absolutePath());
if (p.exists()) { if (p.exists()) {
// what is indexValid for?
// bool indexValid = false;
try { try {
// already exists on disk // already exists on disk
parseDirIndex(children); parseDirIndex(children);
// indexValid = true;
std::sort(children.begin(), children.end()); std::sort(children.begin(), children.end());
} catch (sg_exception& e) { } catch (sg_exception& e) {
// parsing cache failed // parsing cache failed
@ -386,7 +383,7 @@ private:
{ {
SGPath p(absolutePath()); SGPath p(absolutePath());
p.append(".dirindex"); p.append(".dirindex");
std::ifstream indexStream( p.str().c_str(), std::ios::in ); std::ifstream indexStream( p.c_str(), std::ios::in );
if ( !indexStream.is_open() ) { if ( !indexStream.is_open() ) {
throw sg_io_exception("cannot open dirIndex file", p); throw sg_io_exception("cannot open dirIndex file", p);
@ -635,7 +632,7 @@ HTTPRepository::failure() const
// dir index data has changed, so write to disk and update // dir index data has changed, so write to disk and update
// the hash accordingly // the hash accordingly
std::ofstream of(pathInRepo().str().c_str(), std::ios::trunc | std::ios::out); std::ofstream of(pathInRepo().c_str(), std::ios::trunc | std::ios::out);
assert(of.is_open()); assert(of.is_open());
of.write(body.data(), body.size()); of.write(body.data(), body.size());
of.close(); of.close();
@ -774,7 +771,7 @@ HTTPRepository::failure() const
SGPath cachePath = basePath; SGPath cachePath = basePath;
cachePath.append(".hashes"); cachePath.append(".hashes");
std::ofstream stream(cachePath.str().c_str(),std::ios::out | std::ios::trunc); std::ofstream stream(cachePath.c_str(),std::ios::out | std::ios::trunc);
HashCache::const_iterator it; HashCache::const_iterator it;
for (it = hashes.begin(); it != hashes.end(); ++it) { for (it = hashes.begin(); it != hashes.end(); ++it) {
stream << it->filePath << ":" << it->modTime << ":" stream << it->filePath << ":" << it->modTime << ":"
@ -792,7 +789,7 @@ HTTPRepository::failure() const
return; return;
} }
std::ifstream stream(cachePath.str().c_str(), std::ios::in); std::ifstream stream(cachePath.c_str(), std::ios::in);
char buf[2048]; char buf[2048];
char* lastToken; char* lastToken;

View File

@ -181,7 +181,7 @@ public:
open(); open();
bind(NULL, 2000); // localhost, any port bind(NULL, 2000); // localhost, any port
listen(5); listen(16);
_poller.addChannel(this); _poller.addChannel(this);
} }

View File

@ -300,7 +300,7 @@ void createFile(const SGPath& basePath, const std::string& relPath, int revision
std::string prName = comps.at(comps.size() - 2); std::string prName = comps.at(comps.size() - 2);
{ {
std::ofstream f(p.str().c_str(), std::ios::trunc | std::ios::out); std::ofstream f(p.c_str(), std::ios::trunc | std::ios::out);
f << dataForFile(prName, comps.back(), revision); f << dataForFile(prName, comps.back(), revision);
} }
} }
@ -378,7 +378,7 @@ void testModifyLocalFiles(HTTP::Client* cl)
SGPath modFile(p); SGPath modFile(p);
modFile.append("dirB/subdirA/fileBAA"); modFile.append("dirB/subdirA/fileBAA");
{ {
std::ofstream of(modFile.str().c_str(), std::ios::out | std::ios::trunc); std::ofstream of(modFile.c_str(), std::ios::out | std::ios::trunc);
of << "complete nonsense"; of << "complete nonsense";
of.close(); of.close();
} }