[Box Backup-commit] COMMIT r1029 - box/chris/merge/bin/bbackupd

boxbackup-dev@fluffy.co.uk boxbackup-dev@fluffy.co.uk
Sat, 14 Oct 2006 15:47:07 +0100


Author: chris
Date: 2006-10-14 15:47:06 +0100 (Sat, 14 Oct 2006)
New Revision: 1029

Modified:
   box/chris/merge/bin/bbackupd/BackupDaemon.cpp
Log:
 * Apply Box coding standards (refs #3, replaces [1026])


Modified: box/chris/merge/bin/bbackupd/BackupDaemon.cpp
===================================================================
--- box/chris/merge/bin/bbackupd/BackupDaemon.cpp	2006-10-14 14:44:23 UTC (rev 1028)
+++ box/chris/merge/bin/bbackupd/BackupDaemon.cpp	2006-10-14 14:47:06 UTC (rev 1029)
@@ -383,14 +383,14 @@
 				}
 
 				// Send a response back?
-				if (sendResponse)
+				if(sendResponse)
 				{
 					const char* response = sendOK ? "ok\n" : "error\n";
 					rSocket.Write(
 						response, strlen(response));
 				}
 
-				if (disconnect) 
+				if(disconnect) 
 				{
 					break;
 				}
@@ -954,7 +954,7 @@
 	}
 
 	// Wait and then cleanup child process, if any
-	if (pid != 0)
+	if(pid != 0)
 	{
 		int status = 0;
 		::waitpid(pid, &status, 0);
@@ -985,7 +985,7 @@
 	{
 		Sleep(1);
 
-		if ( timeout == 0 )
+		if( timeout == 0 )
 		{
 			DoSyncFlagOut = false;
 			SyncIsForcedOut = false;
@@ -1240,7 +1240,7 @@
 #warning race condition: what happens if socket is closed?
 #endif
 
-	if (mpCommandSocketInfo != NULL &&
+	if(mpCommandSocketInfo != NULL &&
 #ifdef WIN32
 	    mpCommandSocketInfo->mListeningSocket.IsConnected()
 #else
@@ -1867,7 +1867,7 @@
 
 	// what happens if the socket is closed by the other thread before
 	// we can write to it? Null pointer deref at best.
-	if (mpCommandSocketInfo && 
+	if(mpCommandSocketInfo && 
 	    mpCommandSocketInfo->mListeningSocket.IsConnected())
 	{
 		try
@@ -2085,12 +2085,12 @@
 	//
 	//
 	mpDirectoryRecord.reset(NULL);
-	if (mpExcludeFiles)
+	if(mpExcludeFiles)
 	{
 		delete mpExcludeFiles;
 		mpExcludeFiles = NULL;
 	}
-	if (mpExcludeDirs)
+	if(mpExcludeDirs)
 	{
 		delete mpExcludeDirs;
 		mpExcludeDirs = NULL;
@@ -2109,15 +2109,17 @@
 	int64_t aMagicMarker = 0;
 	rArchive.Read(aMagicMarker);
 
-	if (aMagicMarker == ARCHIVE_MAGIC_VALUE_NOOP)
+	if(aMagicMarker == ARCHIVE_MAGIC_VALUE_NOOP)
 	{
 		// NOOP
 	}
-	else if (aMagicMarker == ARCHIVE_MAGIC_VALUE_RECURSE)
+	else if(aMagicMarker == ARCHIVE_MAGIC_VALUE_RECURSE)
 	{
 		BackupClientDirectoryRecord *pSubRecord = new BackupClientDirectoryRecord(0, "");
-		if (!pSubRecord)
+		if(!pSubRecord)
+		{
 			throw std::bad_alloc();
+		}
 
 		mpDirectoryRecord.reset(pSubRecord);
 		mpDirectoryRecord->Deserialize(rArchive);
@@ -2133,15 +2135,17 @@
 	//
 	rArchive.Read(aMagicMarker);
 
-	if (aMagicMarker == ARCHIVE_MAGIC_VALUE_NOOP)
+	if(aMagicMarker == ARCHIVE_MAGIC_VALUE_NOOP)
 	{
 		// NOOP
 	}
-	else if (aMagicMarker == ARCHIVE_MAGIC_VALUE_RECURSE)
+	else if(aMagicMarker == ARCHIVE_MAGIC_VALUE_RECURSE)
 	{
 		mpExcludeFiles = new ExcludeList;
-		if (!mpExcludeFiles)
+		if(!mpExcludeFiles)
+		{
 			throw std::bad_alloc();
+		}
 
 		mpExcludeFiles->Deserialize(rArchive);
 	}
@@ -2156,15 +2160,17 @@
 	//
 	rArchive.Read(aMagicMarker);
 
-	if (aMagicMarker == ARCHIVE_MAGIC_VALUE_NOOP)
+	if(aMagicMarker == ARCHIVE_MAGIC_VALUE_NOOP)
 	{
 		// NOOP
 	}
-	else if (aMagicMarker == ARCHIVE_MAGIC_VALUE_RECURSE)
+	else if(aMagicMarker == ARCHIVE_MAGIC_VALUE_RECURSE)
 	{
 		mpExcludeDirs = new ExcludeList;
-		if (!mpExcludeDirs)
+		if(!mpExcludeDirs)
+		{
 			throw std::bad_alloc();
+		}
 
 		mpExcludeDirs->Deserialize(rArchive);
 	}
@@ -2196,7 +2202,7 @@
 	//
 	//
 	//
-	if (mpDirectoryRecord.get() == NULL)
+	if(mpDirectoryRecord.get() == NULL)
 	{
 		int64_t aMagicMarker = ARCHIVE_MAGIC_VALUE_NOOP;
 		rArchive.Write(aMagicMarker);
@@ -2212,7 +2218,7 @@
 	//
 	//
 	//
-	if (!mpExcludeFiles)
+	if(!mpExcludeFiles)
 	{
 		int64_t aMagicMarker = ARCHIVE_MAGIC_VALUE_NOOP;
 		rArchive.Write(aMagicMarker);
@@ -2228,7 +2234,7 @@
 	//
 	//
 	//
-	if (!mpExcludeDirs)
+	if(!mpExcludeDirs)
 	{
 		int64_t aMagicMarker = ARCHIVE_MAGIC_VALUE_NOOP;
 		rArchive.Write(aMagicMarker);
@@ -2297,7 +2303,7 @@
 	std::string StoreObjectInfoFile = 
 		GetConfiguration().GetKeyValue("StoreObjectInfoFile");
 
-	if (StoreObjectInfoFile.size() <= 0)
+	if(StoreObjectInfoFile.size() <= 0)
 	{
 		return false;
 	}
@@ -2326,7 +2332,7 @@
 		int64_t iCount = mLocations.size();
 		anArchive.Write(iCount);
 
-		for (int v = 0; v < iCount; v++)
+		for(int v = 0; v < iCount; v++)
 		{
 			ASSERT(mLocations[v]);
 			mLocations[v]->Serialize(anArchive);
@@ -2338,7 +2344,7 @@
 		iCount = mIDMapMounts.size();
 		anArchive.Write(iCount);
 
-		for (int v = 0; v < iCount; v++)
+		for(int v = 0; v < iCount; v++)
 			anArchive.Write(mIDMapMounts[v]);
 
 		//
@@ -2391,7 +2397,7 @@
 	std::string StoreObjectInfoFile = 
 		GetConfiguration().GetKeyValue("StoreObjectInfoFile");
 
-	if (StoreObjectInfoFile.size() <= 0)
+	if(StoreObjectInfoFile.size() <= 0)
 	{
 		return false;
 	}
@@ -2407,7 +2413,7 @@
 		int iMagicValue = 0;
 		anArchive.Read(iMagicValue);
 
-		if (iMagicValue != STOREOBJECTINFO_MAGIC_ID_VALUE)
+		if(iMagicValue != STOREOBJECTINFO_MAGIC_ID_VALUE)
 		{
 			::syslog(LOG_WARNING, "Store object info file '%s' "
 				"is not a valid or compatible serialised "
@@ -2422,7 +2428,7 @@
 		std::string strMagicValue;
 		anArchive.Read(strMagicValue);
 
-		if (strMagicValue != STOREOBJECTINFO_MAGIC_ID_STRING)
+		if(strMagicValue != STOREOBJECTINFO_MAGIC_ID_STRING)
 		{
 			::syslog(LOG_WARNING, "Store object info file '%s' "
 				"is not a valid or compatible serialised "
@@ -2438,7 +2444,7 @@
 		int iVersion = 0;
 		anArchive.Read(iVersion);
 
-		if (iVersion != STOREOBJECTINFO_VERSION)
+		if(iVersion != STOREOBJECTINFO_VERSION)
 		{
 			::syslog(LOG_WARNING, "Store object info file '%s' "
 				"version %d unsupported. "
@@ -2455,7 +2461,7 @@
 		box_time_t lastKnownConfigModTime;
 		anArchive.Read(lastKnownConfigModTime);
 
-		if (lastKnownConfigModTime != GetLoadedConfigModifiedTime())
+		if(lastKnownConfigModTime != GetLoadedConfigModifiedTime())
 		{
 			::syslog(LOG_WARNING, "Store object info file '%s' "
 				"out of date. Will re-cache from store", 
@@ -2476,11 +2482,13 @@
 		int64_t iCount = 0;
 		anArchive.Read(iCount);
 
-		for (int v = 0; v < iCount; v++)
+		for(int v = 0; v < iCount; v++)
 		{
 			Location* pLocation = new Location;
-			if (!pLocation)
+			if(!pLocation)
+			{
 				throw std::bad_alloc();
+			}
 
 			pLocation->Deserialize(anArchive);
 			mLocations.push_back(pLocation);
@@ -2492,7 +2500,7 @@
 		iCount = 0;
 		anArchive.Read(iCount);
 
-		for (int v = 0; v < iCount; v++)
+		for(int v = 0; v < iCount; v++)
 		{
 			std::string strItem;
 			anArchive.Read(strItem);