summaryrefslogtreecommitdiff
path: root/cpp/src/IcePatch2/FileServerI.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'cpp/src/IcePatch2/FileServerI.cpp')
-rw-r--r--cpp/src/IcePatch2/FileServerI.cpp58
1 files changed, 29 insertions, 29 deletions
diff --git a/cpp/src/IcePatch2/FileServerI.cpp b/cpp/src/IcePatch2/FileServerI.cpp
index 3c647faf16c..c8fdcc2366c 100644
--- a/cpp/src/IcePatch2/FileServerI.cpp
+++ b/cpp/src/IcePatch2/FileServerI.cpp
@@ -35,7 +35,7 @@ IcePatch2::FileServerI::getFileInfoSeq(Int node0, const Current&) const
{
if(node0 < 0 || node0 > 255)
{
- throw PartitionOutOfRangeException();
+ throw PartitionOutOfRangeException();
}
return _tree0.nodes[node0].files;
@@ -48,7 +48,7 @@ IcePatch2::FileServerI::getChecksumSeq(const Current&) const
for(int node0 = 0; node0 < 256; ++node0)
{
- checksums[node0] = _tree0.nodes[node0].checksum;
+ checksums[node0] = _tree0.nodes[node0].checksum;
}
return checksums;
@@ -62,14 +62,14 @@ IcePatch2::FileServerI::getChecksum(const Current&) const
void
IcePatch2::FileServerI::getFileCompressed_async(const AMD_FileServer_getFileCompressedPtr& cb,
- const string& pa, Int pos, Int num, const Current&) const
+ const string& pa, Int pos, Int num, const Current&) const
{
if(isAbsolute(pa))
{
- FileAccessException ex;
- ex.reason = "illegal absolute path `" + pa + "'";
- cb->ice_exception(ex);
- return;
+ FileAccessException ex;
+ ex.reason = "illegal absolute path `" + pa + "'";
+ cb->ice_exception(ex);
+ return;
}
string path = simplify(pa);
@@ -78,39 +78,39 @@ IcePatch2::FileServerI::getFileCompressed_async(const AMD_FileServer_getFileComp
path.find("/../") != string::npos ||
path.size() >= 3 && (path.substr(0, 3) == "../" || path.substr(path.size() - 3, 3) == "/.."))
{
- FileAccessException ex;
- ex.reason = "illegal `..' component in path `" + path + "'";
- cb->ice_exception(ex);
- return;
+ FileAccessException ex;
+ ex.reason = "illegal `..' component in path `" + path + "'";
+ cb->ice_exception(ex);
+ return;
}
pair<const Byte*, const Byte*> ret(0, 0);
if(num <= 0 || pos < 0)
- {
+ {
cb->ice_response(ret);
- return;
+ return;
}
int fd = OS::open(_dataDir + '/' + path + ".bz2", O_RDONLY|O_BINARY);
if(fd == -1)
{
- FileAccessException ex;
- ex.reason = "cannot open `" + path + "' for reading: " + strerror(errno);
- cb->ice_exception(ex);
- return;
+ FileAccessException ex;
+ ex.reason = "cannot open `" + path + "' for reading: " + strerror(errno);
+ cb->ice_exception(ex);
+ return;
}
if(lseek(fd, static_cast<off_t>(pos), SEEK_SET) != static_cast<off_t>(pos))
{
- close(fd);
+ close(fd);
- ostringstream posStr;
- posStr << pos;
+ ostringstream posStr;
+ posStr << pos;
- FileAccessException ex;
- ex.reason = "cannot seek position " + posStr.str() + " in file `" + path + "': " + strerror(errno);
- cb->ice_exception(ex);
- return;
+ FileAccessException ex;
+ ex.reason = "cannot seek position " + posStr.str() + " in file `" + path + "': " + strerror(errno);
+ cb->ice_exception(ex);
+ return;
}
IceUtil::ScopedArray<Byte> bytes(new Byte[num]);
@@ -122,12 +122,12 @@ IcePatch2::FileServerI::getFileCompressed_async(const AMD_FileServer_getFileComp
if((r = read(fd, bytes.get(), static_cast<size_t>(num))) == -1)
#endif
{
- close(fd);
+ close(fd);
- FileAccessException ex;
- ex.reason = "cannot read `" + path + "': " + strerror(errno);
- cb->ice_exception(ex);
- return;
+ FileAccessException ex;
+ ex.reason = "cannot read `" + path + "': " + strerror(errno);
+ cb->ice_exception(ex);
+ return;
}
close(fd);