Fix SimGear compile on Linux
This commit is contained in:
parent
dda922a651
commit
da6b395008
@ -149,11 +149,12 @@ public:
|
|||||||
{
|
{
|
||||||
SGPath p(absolutePath());
|
SGPath p(absolutePath());
|
||||||
if (p.exists()) {
|
if (p.exists()) {
|
||||||
bool indexValid = false;
|
// what is indexValid for?
|
||||||
|
// bool indexValid = false;
|
||||||
try {
|
try {
|
||||||
// already exists on disk
|
// already exists on disk
|
||||||
parseDirIndex(children);
|
parseDirIndex(children);
|
||||||
indexValid = true;
|
// 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
|
||||||
@ -336,7 +337,7 @@ private:
|
|||||||
{
|
{
|
||||||
SGPath p(absolutePath());
|
SGPath p(absolutePath());
|
||||||
p.append(".dirindex");
|
p.append(".dirindex");
|
||||||
std::ifstream indexStream( p.str(), std::ios::in );
|
std::ifstream indexStream( p.str().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);
|
||||||
@ -593,7 +594,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(), std::ios::trunc | std::ios::out);
|
std::ofstream of(pathInRepo().str().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();
|
||||||
@ -732,7 +733,7 @@ HTTPRepository::failure() const
|
|||||||
SGPath cachePath = basePath;
|
SGPath cachePath = basePath;
|
||||||
cachePath.append(".hashes");
|
cachePath.append(".hashes");
|
||||||
|
|
||||||
std::ofstream stream(cachePath.str(),std::ios::out | std::ios::trunc);
|
std::ofstream stream(cachePath.str().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 << ":"
|
||||||
@ -750,7 +751,7 @@ HTTPRepository::failure() const
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
std::ifstream stream(cachePath.str(), std::ios::in);
|
std::ifstream stream(cachePath.str().c_str(), std::ios::in);
|
||||||
char buf[2048];
|
char buf[2048];
|
||||||
char* lastToken;
|
char* lastToken;
|
||||||
|
|
||||||
|
@ -21,6 +21,7 @@
|
|||||||
#define SG_IO_HTTP_REPOSITORY_HXX
|
#define SG_IO_HTTP_REPOSITORY_HXX
|
||||||
|
|
||||||
#include <simgear/io/AbstractRepository.hxx>
|
#include <simgear/io/AbstractRepository.hxx>
|
||||||
|
#include <memory>
|
||||||
|
|
||||||
namespace simgear {
|
namespace simgear {
|
||||||
|
|
||||||
|
@ -21,6 +21,7 @@
|
|||||||
#define SG_IO_SVN_REPOSITORY_HXX
|
#define SG_IO_SVN_REPOSITORY_HXX
|
||||||
|
|
||||||
#include <simgear/io/AbstractRepository.hxx>
|
#include <simgear/io/AbstractRepository.hxx>
|
||||||
|
#include <memory>
|
||||||
|
|
||||||
namespace simgear {
|
namespace simgear {
|
||||||
|
|
||||||
|
@ -111,7 +111,7 @@ public:
|
|||||||
TestRepoEntry* childEntry(const std::string& name) const
|
TestRepoEntry* childEntry(const std::string& name) const
|
||||||
{
|
{
|
||||||
assert(isDir);
|
assert(isDir);
|
||||||
for (int i=0; i<children.size(); ++i) {
|
for (size_t i=0; i<children.size(); ++i) {
|
||||||
if (children[i]->name == name) {
|
if (children[i]->name == name) {
|
||||||
return children[i];
|
return children[i];
|
||||||
}
|
}
|
||||||
@ -143,7 +143,7 @@ TestRepoEntry::TestRepoEntry(TestRepoEntry* pr, const std::string& nm, bool d) :
|
|||||||
|
|
||||||
TestRepoEntry::~TestRepoEntry()
|
TestRepoEntry::~TestRepoEntry()
|
||||||
{
|
{
|
||||||
for (int i=0; i<children.size(); ++i) {
|
for (size_t i=0; i<children.size(); ++i) {
|
||||||
delete children[i];
|
delete children[i];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -154,7 +154,7 @@ std::string TestRepoEntry::data() const
|
|||||||
std::ostringstream os;
|
std::ostringstream os;
|
||||||
os << "version:1\n";
|
os << "version:1\n";
|
||||||
os << "path:" << pathInRepo() << "\n";
|
os << "path:" << pathInRepo() << "\n";
|
||||||
for (int i=0; i<children.size(); ++i) {
|
for (size_t i=0; i<children.size(); ++i) {
|
||||||
os << children[i]->indexLine() << "\n";
|
os << children[i]->indexLine() << "\n";
|
||||||
}
|
}
|
||||||
return os.str();
|
return os.str();
|
||||||
@ -184,7 +184,7 @@ void TestRepoEntry::clearRequestCounts()
|
|||||||
{
|
{
|
||||||
requestCount = 0;
|
requestCount = 0;
|
||||||
if (isDir) {
|
if (isDir) {
|
||||||
for (int i=0; i<children.size(); ++i) {
|
for (size_t i=0; i<children.size(); ++i) {
|
||||||
children[i]->clearRequestCounts();
|
children[i]->clearRequestCounts();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -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(), std::ios::trunc | std::ios::out);
|
std::ofstream f(p.str().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(), std::ios::out | std::ios::trunc);
|
std::ofstream of(modFile.str().c_str(), std::ios::out | std::ios::trunc);
|
||||||
of << "complete nonsense";
|
of << "complete nonsense";
|
||||||
of.close();
|
of.close();
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user