summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorChris Wilson <chris+github@qwirx.com>2015-08-15 10:58:21 +0000
committerChris Wilson <chris+github@qwirx.com>2015-08-15 10:58:21 +0000
commitf3123609167c0e2e621c90e6b1248234cebc8a6e (patch)
tree3753395dcd00dced0667154212e333f3ff6a5f74 /lib
parent03c4946547d39d4d3c4f32878c47bbd701c6f690 (diff)
Whitespace, layout and comment cleanups.
Diffstat (limited to 'lib')
-rw-r--r--lib/backupstore/BackupStoreContext.cpp18
-rw-r--r--lib/backupstore/BackupStoreContext.h13
-rw-r--r--lib/httpserver/HTTPResponse.cpp34
-rw-r--r--lib/raidfile/RaidFileWrite.h3
4 files changed, 38 insertions, 30 deletions
diff --git a/lib/backupstore/BackupStoreContext.cpp b/lib/backupstore/BackupStoreContext.cpp
index 22239532..75e78334 100644
--- a/lib/backupstore/BackupStoreContext.cpp
+++ b/lib/backupstore/BackupStoreContext.cpp
@@ -70,6 +70,7 @@ BackupStoreContext::BackupStoreContext(int32_t ClientID,
{
}
+
// --------------------------------------------------------------------------
//
// Function
@@ -83,6 +84,7 @@ BackupStoreContext::~BackupStoreContext()
ClearDirectoryCache();
}
+
void BackupStoreContext::ClearDirectoryCache()
{
// Delete the objects in the cache
@@ -94,6 +96,7 @@ void BackupStoreContext::ClearDirectoryCache()
mDirectoryCache.clear();
}
+
// --------------------------------------------------------------------------
//
// Function
@@ -112,6 +115,7 @@ void BackupStoreContext::CleanUp()
}
}
+
// --------------------------------------------------------------------------
//
// Function
@@ -412,6 +416,7 @@ BackupStoreDirectory &BackupStoreContext::GetDirectoryInternal(int64_t ObjectID,
return *pdir;
}
+
// --------------------------------------------------------------------------
//
// Function
@@ -790,8 +795,11 @@ int64_t BackupStoreContext::AddFile(IOStream &rFile, int64_t InDirectory,
// --------------------------------------------------------------------------
//
// Function
-// Name: BackupStoreContext::DeleteFile(const BackupStoreFilename &, int64_t, int64_t &)
-// Purpose: Deletes a file, returning true if the file existed. Object ID returned too, set to zero if not found.
+// Name: BackupStoreContext::DeleteFile(
+// const BackupStoreFilename &, int64_t, int64_t &)
+// Purpose: Deletes a file by name, returning true if the file
+// existed. Object ID returned too, set to zero if not
+// found.
// Created: 2003/10/21
//
// --------------------------------------------------------------------------
@@ -1201,6 +1209,7 @@ int64_t BackupStoreContext::AddDirectory(int64_t InDirectory,
return id;
}
+
// --------------------------------------------------------------------------
//
// Function
@@ -1278,6 +1287,7 @@ void BackupStoreContext::DeleteDirectory(int64_t ObjectID, bool Undelete)
}
}
+
// --------------------------------------------------------------------------
//
// Function
@@ -1389,7 +1399,6 @@ void BackupStoreContext::DeleteDirectoryRecurse(int64_t ObjectID, bool Undelete)
}
-
// --------------------------------------------------------------------------
//
// Function
@@ -1427,6 +1436,7 @@ void BackupStoreContext::ChangeDirAttributes(int64_t Directory, const Streamable
}
}
+
// --------------------------------------------------------------------------
//
// Function
@@ -1915,7 +1925,6 @@ void BackupStoreContext::MoveObject(int64_t ObjectID, int64_t MoveFromDirectory,
}
-
// --------------------------------------------------------------------------
//
// Function
@@ -1934,4 +1943,3 @@ const BackupStoreInfo &BackupStoreContext::GetBackupStoreInfo() const
return *(mapStoreInfo.get());
}
-
diff --git a/lib/backupstore/BackupStoreContext.h b/lib/backupstore/BackupStoreContext.h
index 21488526..48448360 100644
--- a/lib/backupstore/BackupStoreContext.h
+++ b/lib/backupstore/BackupStoreContext.h
@@ -65,7 +65,7 @@ public:
Phase_Login = 1,
Phase_Commands = 2
};
-
+
int GetPhase() const {return mProtocolPhase;}
std::string GetPhaseName() const
{
@@ -81,7 +81,7 @@ public:
}
}
void SetPhase(int NewPhase) {mProtocolPhase = NewPhase;}
-
+
// Read only locking
bool SessionIsReadOnly() {return mReadOnly;}
bool AttemptToGetWriteLock();
@@ -116,7 +116,7 @@ public:
// Client marker
int64_t GetClientStoreMarker();
void SetClientStoreMarker(int64_t ClientStoreMarker);
-
+
// Usage information
void GetStoreDiscUsageInfo(int64_t &rBlocksUsed, int64_t &rBlocksSoftLimit, int64_t &rBlocksHardLimit);
bool HardLimitExceeded();
@@ -138,7 +138,7 @@ public:
// merely turns the returned directory const.
return GetDirectoryInternal(ObjectID);
}
-
+
// Manipulating files/directories
int64_t AddFile(IOStream &rFile,
int64_t InDirectory,
@@ -191,16 +191,17 @@ private:
bool mClientHasAccount;
std::string mAccountRootDir; // has final directory separator
int mStoreDiscSet;
+
bool mReadOnly;
NamedLock mWriteLock;
int mSaveStoreInfoDelay; // how many times to delay saving the store info
-
+
// Store info
std::auto_ptr<BackupStoreInfo> mapStoreInfo;
// Refcount database
std::auto_ptr<BackupStoreRefCountDatabase> mapRefCount;
-
+
// Directory cache
std::map<int64_t, BackupStoreDirectory*> mDirectoryCache;
diff --git a/lib/httpserver/HTTPResponse.cpp b/lib/httpserver/HTTPResponse.cpp
index 1a8c8447..f757a3c2 100644
--- a/lib/httpserver/HTTPResponse.cpp
+++ b/lib/httpserver/HTTPResponse.cpp
@@ -148,7 +148,7 @@ void HTTPResponse::Send(bool OmitContent)
{
THROW_EXCEPTION(HTTPException, NoStreamConfigured);
}
-
+
if (GetSize() != 0 && mContentType.empty())
{
THROW_EXCEPTION(HTTPException, NoContentTypeSet);
@@ -193,11 +193,11 @@ void HTTPResponse::Send(bool OmitContent)
header += "\r\nConnection: close\r\n\r\n";
}
// NOTE: header ends with blank line in all cases
-
+
// Write to stream
mpStreamToSendTo->Write(header.c_str(), header.size());
}
-
+
// Send content
if(!OmitContent)
{
@@ -227,16 +227,16 @@ void HTTPResponse::ParseHeaders(IOStreamGetLine &rGetLine, int Timeout)
if(rGetLine.IsEOF())
{
// Header terminates unexpectedly
- THROW_EXCEPTION(HTTPException, BadRequest)
+ THROW_EXCEPTION(HTTPException, BadRequest)
}
- std::string currentLine;
+ std::string currentLine;
if(!rGetLine.GetLine(currentLine, false /* no preprocess */, Timeout))
{
// Timeout
THROW_EXCEPTION(HTTPException, RequestReadFailed)
}
-
+
// Is this a continuation of the previous line?
bool processHeader = haveHeader;
if(!currentLine.empty() && (currentLine[0] == ' ' || currentLine[0] == '\t'))
@@ -245,7 +245,7 @@ void HTTPResponse::ParseHeaders(IOStreamGetLine &rGetLine, int Timeout)
processHeader = false;
}
//TRACE3("%d:%d:%s\n", processHeader, haveHeader, currentLine.c_str());
-
+
// Parse the header -- this will actually process the header
// from the previous run around the loop.
if(processHeader)
@@ -263,7 +263,7 @@ void HTTPResponse::ParseHeaders(IOStreamGetLine &rGetLine, int Timeout)
{
++dataStart;
}
-
+
if(p == sizeof("Content-Length")-1
&& ::strncasecmp(h, "Content-Length", sizeof("Content-Length")-1) == 0)
{
@@ -308,7 +308,7 @@ void HTTPResponse::ParseHeaders(IOStreamGetLine &rGetLine, int Timeout)
std::string headerName = header.substr(0, p);
AddHeader(headerName, h + dataStart);
}
-
+
// Unset have header flag, as it's now been processed
haveHeader = false;
}
@@ -329,7 +329,7 @@ void HTTPResponse::ParseHeaders(IOStreamGetLine &rGetLine, int Timeout)
{
// All done!
break;
- }
+ }
}
}
@@ -340,10 +340,10 @@ void HTTPResponse::Receive(IOStream& rStream, int Timeout)
if(rGetLine.IsEOF())
{
// Connection terminated unexpectedly
- THROW_EXCEPTION(HTTPException, BadResponse)
+ THROW_EXCEPTION(HTTPException, BadResponse)
}
- std::string statusLine;
+ std::string statusLine;
if(!rGetLine.GetLine(statusLine, false /* no preprocess */, Timeout))
{
// Timeout
@@ -355,7 +355,7 @@ void HTTPResponse::Receive(IOStream& rStream, int Timeout)
{
// Status line terminated unexpectedly
BOX_ERROR("Bad response status line: " << statusLine);
- THROW_EXCEPTION(HTTPException, BadResponse)
+ THROW_EXCEPTION(HTTPException, BadResponse)
}
if (statusLine[5] == '1' && statusLine[7] == '1')
@@ -363,7 +363,7 @@ void HTTPResponse::Receive(IOStream& rStream, int Timeout)
// HTTP/1.1 default is to keep alive
mKeepAlive = true;
}
-
+
// Decode the status code
long status = ::strtol(statusLine.substr(9, 3).c_str(), NULL, 10);
// returns zero in error case, this is OK
@@ -376,7 +376,7 @@ void HTTPResponse::Receive(IOStream& rStream, int Timeout)
{
return;
}
-
+
ParseHeaders(rGetLine, Timeout);
// push back whatever bytes we have left
@@ -549,7 +549,7 @@ void HTTPResponse::SetAsRedirect(const char *RedirectTo, bool IsLocalURI)
if(IsLocalURI) header += msDefaultURIPrefix;
header += RedirectTo;
mExtraHeaders.push_back(Header("Location", header));
-
+
// Set up some default content
mContentType = "text/html";
#define REDIRECT_HTML_1 "<html><head><title>Redirection</title></head>\n<body><p><a href=\""
@@ -622,7 +622,7 @@ void HTTPResponse::WriteStringDefang(const char *String, unsigned int StringLen)
StringLen -= toWrite;
String += toWrite;
}
-
+
// Is it a bad character next?
while(StringLen > 0)
{
diff --git a/lib/raidfile/RaidFileWrite.h b/lib/raidfile/RaidFileWrite.h
index 4c5e8178..ab9b399a 100644
--- a/lib/raidfile/RaidFileWrite.h
+++ b/lib/raidfile/RaidFileWrite.h
@@ -41,6 +41,7 @@ public:
RaidFileWrite(int SetNumber, const std::string &Filename, int refcount);
~RaidFileWrite();
+
private:
RaidFileWrite(const RaidFileWrite &rToCopy);
@@ -66,8 +67,6 @@ public:
static void CreateDirectory(int SetNumber, const std::string &rDirName, bool Recursive = false, int mode = 0777);
static void CreateDirectory(const RaidFileDiscSet &rSet, const std::string &rDirName, bool Recursive = false, int mode = 0777);
-
-private:
private:
int mSetNumber;