[Box Backup-commit] COMMIT r3414 - in box/trunk: lib/backupstore test/backupstore test/backupstorefix test/basicserver

subversion at boxbackup.org subversion at boxbackup.org
Fri Oct 31 22:09:34 GMT 2014


Author: chris
Date: 2014-10-31 22:09:34 +0000 (Fri, 31 Oct 2014)
New Revision: 3414

Modified:
   box/trunk/lib/backupstore/BackupCommands.cpp
   box/trunk/lib/backupstore/BackupStoreCheck.cpp
   box/trunk/lib/backupstore/BackupStoreCheck.h
   box/trunk/lib/backupstore/BackupStoreCheck2.cpp
   box/trunk/lib/backupstore/BackupStoreContext.cpp
   box/trunk/lib/backupstore/BackupStoreContext.h
   box/trunk/lib/backupstore/BackupStoreDirectory.cpp
   box/trunk/lib/backupstore/BackupStoreDirectory.h
   box/trunk/lib/backupstore/BackupStoreFilenameClear.h
   box/trunk/lib/backupstore/HousekeepStoreAccount.cpp
   box/trunk/lib/backupstore/backupprotocol.txt
   box/trunk/test/backupstore/testbackupstore.cpp
   box/trunk/test/backupstorefix/testbackupstorefix.cpp
   box/trunk/test/basicserver/testbasicserver.cpp
Log:
Whitespace, comment and readability fixes

Modified: box/trunk/lib/backupstore/BackupCommands.cpp
===================================================================
--- box/trunk/lib/backupstore/BackupCommands.cpp	2014-10-31 22:09:28 UTC (rev 3413)
+++ box/trunk/lib/backupstore/BackupCommands.cpp	2014-10-31 22:09:34 UTC (rev 3414)
@@ -93,7 +93,7 @@
 	// and that the client actually has an account on this machine
 	if(mClientID != rContext.GetClientID())
 	{
-		BOX_WARNING("Failed login from client ID " << 
+		BOX_WARNING("Failed login from client ID " <<
 			BOX_FORMAT_ACCOUNT(mClientID) << ": "
 			"wrong certificate for this account");
 		return PROTOCOL_ERROR(Err_BadLogin);
@@ -101,7 +101,7 @@
 
 	if(!rContext.GetClientHasAccount())
 	{
-		BOX_WARNING("Failed login from client ID " << 
+		BOX_WARNING("Failed login from client ID " <<
 			BOX_FORMAT_ACCOUNT(mClientID) << ": "
 			"no such account on this server");
 		return PROTOCOL_ERROR(Err_BadLogin);
@@ -117,17 +117,17 @@
 				BOX_FORMAT_ACCOUNT(mClientID));
 			return PROTOCOL_ERROR(Err_CannotLockStoreForWriting);
 		}
-		
+
 		// Debug: check we got the lock
 		ASSERT(!rContext.SessionIsReadOnly());
 	}
-	
+
 	// Load the store info
 	rContext.LoadStoreInfo();
 
 	if(!rContext.GetBackupStoreInfo().IsAccountEnabled())
 	{
-		BOX_WARNING("Refused login from disabled client ID " << 
+		BOX_WARNING("Refused login from disabled client ID " <<
 			BOX_FORMAT_ACCOUNT(mClientID));
 		return PROTOCOL_ERROR(Err_DisabledAccount);
 	}
@@ -137,9 +137,9 @@
 
 	// Mark the next phase
 	rContext.SetPhase(BackupStoreContext::Phase_Commands);
-	
+
 	// Log login
-	BOX_NOTICE("Login from Client ID " << 
+	BOX_NOTICE("Login from Client ID " <<
 		BOX_FORMAT_ACCOUNT(mClientID) << " "
 		"(name=" << rContext.GetAccountName() << "): " <<
 		(((mFlags & Flags_ReadOnly) != Flags_ReadOnly)
@@ -166,7 +166,7 @@
 {
 	// can be called in any phase
 
-	BOX_NOTICE("Session finished for Client ID " << 
+	BOX_NOTICE("Session finished for Client ID " <<
 		BOX_FORMAT_ACCOUNT(rContext.GetClientID()) << " "
 		"(name=" << rContext.GetAccountName() << ")");
 
@@ -197,11 +197,11 @@
 		// Ask the context for a directory
 		const BackupStoreDirectory &rdir(
 			rContext.GetDirectory(mObjectID));
-		rdir.WriteToStream(*stream, mFlagsMustBeSet, 
+		rdir.WriteToStream(*stream, mFlagsMustBeSet,
 			mFlagsNotToBeSet, mSendAttributes,
 			false /* never send dependency info to the client */);
 	}
-	catch (RaidFileException &e)
+	catch(RaidFileException &e)
 	{
 		if (e.GetSubType() == RaidFileException::RaidFileDoesntExist)
 		{
@@ -211,7 +211,7 @@
 	}
 
 	stream->SetForReading();
-	
+
 	// Get the protocol to send the stream
 	rProtocol.SendStreamAfterCommand(static_cast< std::auto_ptr<IOStream> > (stream));
 
@@ -240,7 +240,7 @@
 	{
 		return hookResult;
 	}
-	
+
 	// Check that the diff from file actually exists, if it's specified
 	if(mDiffFromFileID != 0)
 	{
@@ -250,7 +250,7 @@
 			return PROTOCOL_ERROR(Err_DiffFromFileDoesNotExist);
 		}
 	}
-	
+
 	// Ask the context to store it
 	int64_t id = 0;
 	try
@@ -275,7 +275,7 @@
 			throw;
 		}
 	}
-	
+
 	// Tell the caller what the file ID was
 	return std::auto_ptr<BackupProtocolMessage>(new BackupProtocolSuccess(id));
 }
@@ -315,7 +315,7 @@
 //
 // Function
 //		Name:    BackupProtocolGetFile::DoCommand(Protocol &, BackupStoreContext &)
-//		Purpose: Command to get an file object from the server -- may have to do a bit of 
+//		Purpose: Command to get an file object from the server -- may have to do a bit of
 //				 work to get the object.
 //		Created: 2003/09/03
 //
@@ -357,13 +357,13 @@
 			en = rdir.FindEntryByID(id);
 			if(en == 0)
 			{
-				BOX_ERROR("Object " << 
+				BOX_ERROR("Object " <<
 					BOX_FORMAT_OBJECTID(mObjectID) <<
-					" in dir " << 
+					" in dir " <<
 					BOX_FORMAT_OBJECTID(mInDirectory) <<
 					" for account " <<
 					BOX_FORMAT_ACCOUNT(rContext.GetClientID()) <<
-					" references object " << 
+					" references object " <<
 					BOX_FORMAT_OBJECTID(id) <<
 					" which does not exist in dir");
 				return PROTOCOL_ERROR(Err_PatchConsistencyError);
@@ -371,46 +371,46 @@
 			id = en->GetDependsNewer();
 		}
 		while(en != 0 && id != 0);
-		
+
 		// OK! The last entry in the chain is the full file, the others are patches back from it.
 		// Open the last one, which is the current from file
 		std::auto_ptr<IOStream> from(rContext.OpenObject(patchChain[patchChain.size() - 1]));
-		
+
 		// Then, for each patch in the chain, do a combine
 		for(int p = ((int)patchChain.size()) - 2; p >= 0; --p)
 		{
 			// ID of patch
 			int64_t patchID = patchChain[p];
-			
+
 			// Open it a couple of times
 			std::auto_ptr<IOStream> diff(rContext.OpenObject(patchID));
 			std::auto_ptr<IOStream> diff2(rContext.OpenObject(patchID));
-			
+
 			// Choose a temporary filename for the result of the combination
 			std::ostringstream fs;
 			fs << rContext.GetAccountRoot() << ".recombinetemp." << p;
-			std::string tempFn = 
+			std::string tempFn =
 				RaidFileController::DiscSetPathToFileSystemPath(
 					rContext.GetStoreDiscSet(), fs.str(),
 					p + 16);
-			
+
 			// Open the temporary file
 			std::auto_ptr<IOStream> combined(
 				new InvisibleTempFileStream(
 					tempFn, O_RDWR | O_CREAT | O_EXCL |
 					O_BINARY | O_TRUNC));
-			
+
 			// Do the combining
 			BackupStoreFile::CombineFile(*diff, *diff2, *from, *combined);
-			
+
 			// Move to the beginning of the combined file
 			combined->Seek(0, IOStream::SeekType_Absolute);
-			
+
 			// Then shuffle round for the next go
 			if (from.get()) from->Close();
 			from = combined;
 		}
-		
+
 		// Now, from contains a nice file to send to the client. Reorder it
 		{
 			// Write nastily to allow this to work with gcc 2.x
@@ -417,7 +417,7 @@
 			std::auto_ptr<IOStream> t(BackupStoreFile::ReorderFileToStreamOrder(from.get(), true /* take ownership */));
 			stream = t;
 		}
-		
+
 		// Release from file to avoid double deletion
 		from.release();
 	}
@@ -424,20 +424,20 @@
 	else
 	{
 		// Simple case: file already exists on disc ready to go
-	
+
 		// Open the object
 		std::auto_ptr<IOStream> object(rContext.OpenObject(mObjectID));
 		BufferedStream buf(*object);
-		
+
 		// Verify it
 		if(!BackupStoreFile::VerifyEncodedFileFormat(buf))
 		{
 			return PROTOCOL_ERROR(Err_FileDoesNotVerify);
 		}
-		
+
 		// Reset stream -- seek to beginning
 		object->Seek(0, IOStream::SeekType_Absolute);
-		
+
 		// Reorder the stream/file into stream order
 		{
 			// Write nastily to allow this to work with gcc 2.x
@@ -445,8 +445,8 @@
 			stream = t;
 		}
 
-		// Object will be deleted when the stream is deleted, 
-		// so can release the object auto_ptr here to avoid 
+		// Object will be deleted when the stream is deleted,
+		// so can release the object auto_ptr here to avoid
 		// premature deletion
 		object.release();
 	}
@@ -453,7 +453,7 @@
 
 	// Stream the reordered stream to the peer
 	rProtocol.SendStreamAfterCommand(stream);
-	
+
 	// Tell the caller what the file was
 	return std::auto_ptr<BackupProtocolMessage>(new BackupProtocolSuccess(mObjectID));
 }
@@ -493,12 +493,12 @@
 {
 	CHECK_PHASE(Phase_Commands)
 	CHECK_WRITEABLE_SESSION
-	
-	// Collect the attributes -- do this now so no matter what the outcome, 
+
+	// Collect the attributes -- do this now so no matter what the outcome,
 	// the data has been absorbed.
 	StreamableMemBlock attr;
 	attr.Set(rDataStream, rProtocol.GetTimeout());
-	
+
 	// Check to see if the hard limit has been exceeded
 	if(rContext.HardLimitExceeded())
 	{
@@ -553,7 +553,7 @@
 	CHECK_PHASE(Phase_Commands)
 	CHECK_WRITEABLE_SESSION
 
-	// Collect the attributes -- do this now so no matter what the outcome, 
+	// Collect the attributes -- do this now so no matter what the outcome,
 	// the data has been absorbed.
 	StreamableMemBlock attr;
 	attr.Set(rDataStream, rProtocol.GetTimeout());
@@ -582,7 +582,7 @@
 	CHECK_PHASE(Phase_Commands)
 	CHECK_WRITEABLE_SESSION
 
-	// Collect the attributes -- do this now so no matter what the outcome, 
+	// Collect the attributes -- do this now so no matter what the outcome,
 	// the data has been absorbed.
 	StreamableMemBlock attr;
 	attr.Set(rDataStream, rProtocol.GetTimeout());
@@ -600,7 +600,6 @@
 }
 
 
-
 // --------------------------------------------------------------------------
 //
 // Function
@@ -671,7 +670,7 @@
 	{
 		rContext.DeleteDirectory(mObjectID);
 	}
-	catch (BackupStoreException &e)
+	catch(BackupStoreException &e)
 	{
 		if(e.GetSubType() == BackupStoreException::MultiplyReferencedObject)
 		{
@@ -745,7 +744,7 @@
 {
 	CHECK_PHASE(Phase_Commands)
 	CHECK_WRITEABLE_SESSION
-	
+
 	// Let context do this, but modify error reporting on exceptions...
 	try
 	{
@@ -785,7 +784,7 @@
 std::auto_ptr<BackupProtocolMessage> BackupProtocolGetObjectName::DoCommand(BackupProtocolReplyable &rProtocol, BackupStoreContext &rContext) const
 {
 	CHECK_PHASE(Phase_Commands)
-	
+
 	// Create a stream for the list of filenames
 	std::auto_ptr<CollectInBufferStream> stream(new CollectInBufferStream);
 
@@ -792,7 +791,7 @@
 	// Object and directory IDs
 	int64_t objectID = mObjectID;
 	int64_t dirID = mContainingDirectoryID;
-	
+
 	// Data to return in the reply
 	int32_t numNameElements = 0;
 	int16_t objectFlags = 0;
@@ -799,7 +798,7 @@
 	int64_t modTime = 0;
 	uint64_t attrModHash = 0;
 	bool haveModTimes = false;
-	
+
 	do
 	{
 		// Check the directory really exists
@@ -822,13 +821,13 @@
 				// Abort!
 				return std::auto_ptr<BackupProtocolMessage>(new BackupProtocolObjectName(BackupProtocolObjectName::NumNameElements_ObjectDoesntExist, 0, 0, 0));
 			}
-			
+
 			// Store flags?
 			if(objectFlags == 0)
 			{
 				objectFlags = en->GetFlags();
 			}
-			
+
 			// Store modification times?
 			if(!haveModTimes)
 			{
@@ -836,14 +835,14 @@
 				attrModHash = en->GetAttributesHash();
 				haveModTimes = true;
 			}
-			
+
 			// Store the name in the stream
 			en->GetName().WriteToStream(*stream);
-			
+
 			// Count of name elements
 			++numNameElements;
 		}
-		
+
 		// Setup for next time round
 		objectID = dirID;
 		dirID = rdir.GetContainerID();
@@ -854,7 +853,7 @@
 	if(numNameElements > 0)
 	{
 		// Get the stream ready to go
-		stream->SetForReading();	
+		stream->SetForReading();
 		// Tell the protocol to send the stream
 		rProtocol.SendStreamAfterCommand(static_cast< std::auto_ptr<IOStream> >(stream));
 	}
@@ -879,10 +878,10 @@
 
 	// Open the file
 	std::auto_ptr<IOStream> stream(rContext.OpenObject(mObjectID));
-	
+
 	// Move the file pointer to the block index
 	BackupStoreFile::MoveStreamPositionToBlockIndex(*stream);
-	
+
 	// Return the stream to the client
 	rProtocol.SendStreamAfterCommand(stream);
 
@@ -905,7 +904,7 @@
 
 	// Get the directory
 	const BackupStoreDirectory &dir(rContext.GetDirectory(mInDirectory));
-	
+
 	// Find the latest object ID within it which has the same name
 	int64_t objectID = 0;
 	BackupStoreDirectory::Iterator i(dir);
@@ -921,7 +920,7 @@
 			}
 		}
 	}
-	
+
 	// Found anything?
 	if(objectID == 0)
 	{
@@ -931,10 +930,10 @@
 
 	// Open the file
 	std::auto_ptr<IOStream> stream(rContext.OpenObject(objectID));
-	
+
 	// Move the file pointer to the block index
 	BackupStoreFile::MoveStreamPositionToBlockIndex(*stream);
-	
+
 	// Return the stream to the client
 	rProtocol.SendStreamAfterCommand(stream);
 
@@ -957,11 +956,11 @@
 
 	// Get store info from context
 	const BackupStoreInfo &rinfo(rContext.GetBackupStoreInfo());
-	
+
 	// Find block size
 	RaidFileController &rcontroller(RaidFileController::GetController());
 	RaidFileDiscSet &rdiscSet(rcontroller.GetDiscSet(rinfo.GetDiscSetNumber()));
-	
+
 	// Return info
 	return std::auto_ptr<BackupProtocolMessage>(new BackupProtocolAccountUsage(
 		rinfo.GetBlocksUsed(),
@@ -1007,11 +1006,11 @@
 
 	// Get store info from context
 	const BackupStoreInfo &info(rContext.GetBackupStoreInfo());
-	
+
 	// Find block size
 	RaidFileController &rcontroller(RaidFileController::GetController());
 	RaidFileDiscSet &rdiscSet(rcontroller.GetDiscSet(info.GetDiscSetNumber()));
-	
+
 	// Return info
 	BackupProtocolAccountUsage2* usage = new BackupProtocolAccountUsage2();
 	std::auto_ptr<BackupProtocolMessage> reply(usage);
@@ -1036,4 +1035,3 @@
 
 	return reply;
 }
-

Modified: box/trunk/lib/backupstore/BackupStoreCheck.cpp
===================================================================
--- box/trunk/lib/backupstore/BackupStoreCheck.cpp	2014-10-31 22:09:28 UTC (rev 3413)
+++ box/trunk/lib/backupstore/BackupStoreCheck.cpp	2014-10-31 22:09:34 UTC (rev 3414)
@@ -112,7 +112,7 @@
 		BOX_INFO("Phase 1, check objects...");
 	}
 	CheckObjects();
-	
+
 	// Phase 2, check directories
 	if(!mQuiet)
 	{
@@ -119,7 +119,7 @@
 		BOX_INFO("Phase 2, check directories...");
 	}
 	CheckDirectories();
-	
+
 	// Phase 3, check root
 	if(!mQuiet)
 	{
@@ -141,7 +141,7 @@
 	}
 	FixDirsWithWrongContainerID();
 	FixDirsWithLostDirs();
-	
+
 	// Phase 6, regenerate store info
 	if(!mQuiet)
 	{
@@ -257,12 +257,12 @@
 		{
 			start.resize(start.size() - 1);
 		}
-	
+
 		maxDir = CheckObjectsScanDir(0, 1, mStoreRoot);
 		BOX_TRACE("Max dir starting ID is " <<
 			BOX_FORMAT_OBJECTID(maxDir));
 	}
-	
+
 	// Then go through and scan all the objects within those directories
 	for(int64_t d = 0; d <= maxDir; d += (1<<STORE_ID_SEGMENT_LENGTH))
 	{
@@ -290,11 +290,11 @@
 		// If any of the directories is missing, create it.
 		RaidFileController &rcontroller(RaidFileController::GetController());
 		RaidFileDiscSet rdiscSet(rcontroller.GetDiscSet(mDiscSetNumber));
-		
+
 		if(!rdiscSet.IsNonRaidSet())
 		{
 			unsigned int numDiscs = rdiscSet.size();
-			
+
 			for(unsigned int l = 0; l < numDiscs; ++l)
 			{
 				// build name
@@ -307,7 +307,7 @@
 					{
 						THROW_SYS_FILE_ERROR("Failed to "
 							"create missing RaidFile "
-							"directory", dn, 
+							"directory", dn,
 							RaidFileException, OSError);
 					}
 				}
@@ -337,7 +337,7 @@
 			else
 			{
 				BOX_ERROR("Spurious or invalid directory " <<
-					rDirName << DIRECTORY_SEPARATOR << 
+					rDirName << DIRECTORY_SEPARATOR <<
 					(*i) << " found, " <<
 					(mFixErrors?"deleting":"delete manually"));
 				++mNumberErrorsFound;
@@ -364,11 +364,11 @@
 	std::string dirName;
 	StoreStructure::MakeObjectFilename(StartID, mStoreRoot, mDiscSetNumber, dirName, false /* don't make sure the dir exists */);
 	// Check expectations
-	ASSERT(dirName.size() > 4 && 
+	ASSERT(dirName.size() > 4 &&
 		dirName[dirName.size() - 4] == DIRECTORY_SEPARATOR_ASCHAR);
 	// Remove the filename from it
 	dirName.resize(dirName.size() - 4); // four chars for "/o00"
-	
+
 	// Check directory exists
 	if(!RaidFileRead::DirectoryExists(mDiscSetNumber, dirName))
 	{
@@ -380,7 +380,7 @@
 	std::vector<std::string> files;
 	RaidFileRead::ReadDirectoryContents(mDiscSetNumber, dirName,
 		RaidFileRead::DirReadType_FilesOnly, files);
-	
+
 	// Array of things present
 	bool idsPresent[(1<<STORE_ID_SEGMENT_LENGTH)];
 	for(int l = 0; l < (1<<STORE_ID_SEGMENT_LENGTH); ++l)
@@ -387,7 +387,7 @@
 	{
 		idsPresent[l] = false;
 	}
-	
+
 	// Parse each entry, building up a list of object IDs which are present in the dir.
 	// This is done so that whatever order is retured from the directory, objects are scanned
 	// in order.
@@ -416,11 +416,11 @@
 		{
 			fileOK = false;
 		}
-		
+
 		if(!fileOK)
 		{
 			// Unexpected or bad file, delete it
-			BOX_ERROR("Spurious file " << dirName << 
+			BOX_ERROR("Spurious file " << dirName <<
 				DIRECTORY_SEPARATOR << (*i) << " found" <<
 				(mFixErrors?", deleting":""));
 			++mNumberErrorsFound;
@@ -431,7 +431,7 @@
 			}
 		}
 	}
-	
+
 	// Check all the objects found in this directory
 	for(int i = 0; i < (1<<STORE_ID_SEGMENT_LENGTH); ++i)
 	{
@@ -483,7 +483,7 @@
 		std::auto_ptr<RaidFileRead> file(
 			RaidFileRead::Open(mDiscSetNumber, rFilename));
 		size = file->GetDiscUsageInBlocks();
-		
+
 		// Read in first four bytes -- don't have to worry about
 		// retrying if not all bytes read as is RaidFile
 		uint32_t signature;
@@ -494,7 +494,7 @@
 		}
 		// Seek back to beginning
 		file->Seek(0, IOStream::SeekType_Absolute);
-		
+
 		// Then... check depending on the type
 		switch(ntohl(signature))
 		{
@@ -522,7 +522,7 @@
 		// Error caught, not a good file then, let it be deleted
 		return false;
 	}
-	
+
 	// Got a container ID? (ie check was successful)
 	if(containerID == -1)
 	{
@@ -541,13 +541,13 @@
 
 	// If it looks like a good object, and it's non-RAID, and
 	// this is a RAID set, then convert it to RAID.
-		
+
 	RaidFileController &rcontroller(RaidFileController::GetController());
 	RaidFileDiscSet rdiscSet(rcontroller.GetDiscSet(mDiscSetNumber));
 	if(!rdiscSet.IsNonRaidSet())
 	{
 		// See if the file exists
-		RaidFileUtil::ExistType existance = 
+		RaidFileUtil::ExistType existance =
 			RaidFileUtil::RaidFileExists(rdiscSet, rFilename);
 		if(existance == RaidFileUtil::NonRaid)
 		{
@@ -568,7 +568,7 @@
 			if(mFixErrors)
 			{
 				std::auto_ptr<RaidFileRead> read(
-					RaidFileRead::Open(mDiscSetNumber, 
+					RaidFileRead::Open(mDiscSetNumber,
 						rFilename));
 				RaidFileWrite write(mDiscSetNumber, rFilename);
 				write.Open(true /* overwrite */);
@@ -578,7 +578,7 @@
 			}
 		}
 	}
-			
+
 	// Report success
 	return true;
 }
@@ -639,7 +639,7 @@
 		// Wrong object ID
 		return -1;
 	}
-	
+
 	// Return container ID
 	return dir.GetContainerID();
 }
@@ -672,7 +672,7 @@
 	{
 		IDBlock *pblock = i->second;
 		int32_t bentries = (pblock == mpInfoLastBlock)?mInfoLastBlockEntries:BACKUPSTORECHECK_BLOCK_SIZE;
-		
+
 		for(int e = 0; e < bentries; ++e)
 		{
 			uint8_t flags = GetFlags(pblock, e);
@@ -706,9 +706,9 @@
 						BOX_FORMAT_OBJECTID(pblock->mID[e]) <<
 						" was OK after fixing");
 				}
-				
+
 				if(isModified && mFixErrors)
-				{	
+				{
 					BOX_WARNING("Writing modified directory to disk: " <<
 						BOX_FORMAT_OBJECTID(pblock->mID[e]));
 					RaidFileWrite fixed(mDiscSetNumber, filename);
@@ -824,14 +824,14 @@
 			{
 				// Just remove the entry
 				badEntry = true;
-				BOX_ERROR("Directory ID " << 
+				BOX_ERROR("Directory ID " <<
 					BOX_FORMAT_OBJECTID(dir.GetObjectID()) <<
-					" references object " << 
+					" references object " <<
 					BOX_FORMAT_OBJECTID(en->GetObjectID()) <<
 					" which does not exist.");
 				++mNumberErrorsFound;
 			}
-			
+
 			// Is this entry worth keeping?
 			if(badEntry)
 			{
@@ -846,16 +846,16 @@
 			{
 				BOX_ERROR("Removing directory entry " <<
 					BOX_FORMAT_OBJECTID(*d) << " from "
-					"directory " << 
+					"directory " <<
 					BOX_FORMAT_OBJECTID(dir.GetObjectID()));
 				++mNumberErrorsFound;
 				dir.DeleteEntry(*d);
 			}
-			
+
 			// Mark as modified
 			restart = true;
 			isModified = true;
-			
+
 			// Errors found
 		}
 	}
@@ -871,7 +871,7 @@
 	ASSERT(piBlock != 0);
 
 	uint8_t iflags = GetFlags(piBlock, IndexInDirBlock);
-	
+
 	// Is the type the same?
 	if(((iflags & Flags_IsDir) == Flags_IsDir) != rEntry.IsDir())
 	{

Modified: box/trunk/lib/backupstore/BackupStoreCheck.h
===================================================================
--- box/trunk/lib/backupstore/BackupStoreCheck.h	2014-10-31 22:09:28 UTC (rev 3413)
+++ box/trunk/lib/backupstore/BackupStoreCheck.h	2014-10-31 22:09:34 UTC (rev 3414)
@@ -131,7 +131,7 @@
 	bool CheckDirectoryEntry(BackupStoreDirectory::Entry& rEntry,
 		int64_t DirectoryID, bool& rIsModified);
 	int64_t CheckFile(int64_t ObjectID, IOStream &rStream);
-	int64_t CheckDirInitial(int64_t ObjectID, IOStream &rStream);	
+	int64_t CheckDirInitial(int64_t ObjectID, IOStream &rStream);
 
 	// Fixing functions
 	bool TryToRecreateDirectory(int64_t MissingDirectoryID);

Modified: box/trunk/lib/backupstore/BackupStoreCheck2.cpp
===================================================================
--- box/trunk/lib/backupstore/BackupStoreCheck2.cpp	2014-10-31 22:09:28 UTC (rev 3413)
+++ box/trunk/lib/backupstore/BackupStoreCheck2.cpp	2014-10-31 22:09:34 UTC (rev 3414)
@@ -40,7 +40,7 @@
 {
 	int32_t index = 0;
 	IDBlock *pblock = LookupID(BACKUPSTORE_ROOT_DIRECTORY_ID, index);
-	
+
 	if(pblock != 0)
 	{
 		// Found it. Which is lucky. Mark it as contained.
@@ -49,9 +49,9 @@
 	else
 	{
 		BOX_WARNING("Root directory doesn't exist");
-		
+
 		++mNumberErrorsFound;
-		
+
 		if(mFixErrors)
 		{
 			// Create a new root directory
@@ -78,7 +78,7 @@
 	}
 
 	BackupStoreDirectory dir(DirectoryID, ContainingDirID);
-	
+
 	// Serialise to disc
 	std::string filename;
 	StoreStructure::MakeObjectFilename(DirectoryID, mStoreRoot, mDiscSetNumber, filename, true /* make sure the dir exists */);
@@ -87,10 +87,10 @@
 	dir.WriteToStream(obj);
 	int64_t size = obj.GetDiscUsageInBlocks();
 	obj.Commit(true /* convert to raid now */);
-	
+
 	// Record the fact we've done this
 	mDirsAdded.insert(DirectoryID);
-	
+
 	// Add to sizes
 	mBlocksUsed += size;
 	mBlocksInDirectories += size;
@@ -131,7 +131,7 @@
 	{
 		IDBlock *pblock = i->second;
 		int32_t bentries = (pblock == mpInfoLastBlock)?mInfoLastBlockEntries:BACKUPSTORECHECK_BLOCK_SIZE;
-		
+
 		for(int e = 0; e < bentries; ++e)
 		{
 			uint8_t flags = GetFlags(pblock, e);
@@ -138,8 +138,9 @@
 			if((flags & Flags_IsContained) == 0)
 			{
 				// Unattached object...
+				int64_t ObjectID = pblock->mID[e];
 				BOX_ERROR("Object " <<
-					BOX_FORMAT_OBJECTID(pblock->mID[e]) <<
+					BOX_FORMAT_OBJECTID(ObjectID) <<
 					" is unattached.");
 				++mNumberErrorsFound;
 
@@ -159,7 +160,9 @@
 					{
 						int64_t diffFromObjectID = 0;
 						std::string filename;
-						StoreStructure::MakeObjectFilename(pblock->mID[e], mStoreRoot, mDiscSetNumber, filename, false /* don't attempt to make sure the dir exists */);
+						StoreStructure::MakeObjectFilename(ObjectID,
+							mStoreRoot, mDiscSetNumber, filename,
+							false /* don't attempt to make sure the dir exists */);
 
 						// The easiest way to do this is to verify it again. Not such a bad penalty, because
 						// this really shouldn't be done very often.
@@ -172,8 +175,8 @@
 						// Just delete it to be safe.
 						if(diffFromObjectID != 0)
 						{
-							BOX_WARNING("Object " << BOX_FORMAT_OBJECTID(pblock->mID[e]) << " is unattached, and is a patch. Deleting, cannot reliably recover.");
-						
+							BOX_WARNING("Object " << BOX_FORMAT_OBJECTID(ObjectID) << " is unattached, and is a patch. Deleting, cannot reliably recover.");
+
 							// Delete this object instead
 							if(mFixErrors)
 							{
@@ -182,12 +185,12 @@
 							}
 
 							mBlocksUsed -= pblock->mObjectSizeInBlocks[e];
-							
+
 							// Move on to next item
 							continue;
 						}
 					}
-					
+
 					// Files contain their original filename, so perhaps the orginal directory still exists,
 					// or we can infer the existance of a directory?
 					// Look for a matching entry in the mDirsWhichContainLostDirs map.
@@ -253,7 +256,7 @@
 				}
 
 				// Add it to the directory
-				pFixer->InsertObject(pblock->mID[e],
+				pFixer->InsertObject(ObjectID,
 					((flags & Flags_IsDir) == Flags_IsDir),
 					lostDirNameSerial);
 			}
@@ -288,7 +291,7 @@
 		// Not a missing directory, can't recreate.
 		return false;
 	}
-	
+
 	// Can recreate this! Wooo!
 	if(!mFixErrors)
 	{
@@ -301,12 +304,12 @@
 
 	BOX_WARNING("Recreating missing directory " << 
 		BOX_FORMAT_OBJECTID(MissingDirectoryID));
-	
+
 	// Create a blank directory
 	BackupStoreDirectory dir(MissingDirectoryID, missing->second /* containing dir ID */);
 	// Note that this directory already contains a directory entry pointing to
 	// this dir, so it doesn't have to be added.
-	
+
 	// Serialise to disc
 	std::string filename;
 	StoreStructure::MakeObjectFilename(MissingDirectoryID, mStoreRoot, mDiscSetNumber, filename, true /* make sure the dir exists */);
@@ -314,10 +317,10 @@
 	root.Open(false /* don't allow overwriting */);
 	dir.WriteToStream(root);
 	root.Commit(true /* convert to raid now */);
-	
+
 	// Record the fact we've done this
 	mDirsAdded.insert(MissingDirectoryID);
-	
+
 	// Remove the entry from the map, so this doesn't happen again
 	mDirsWhichContainLostDirs.erase(missing);
 
@@ -332,7 +335,7 @@
 	// Generate filename
 	StoreStructure::MakeObjectFilename(ID, mStoreRoot, mDiscSetNumber,
 		mFilename, false /* don't make sure the dir exists */);
-	
+
 	// Read it in
 	std::auto_ptr<RaidFileRead> file(
 		RaidFileRead::Open(mDiscSetNumber, mFilename));
@@ -374,7 +377,7 @@
 			(ntohl(hdr.mMagicValue) != OBJECTMAGIC_FILE_MAGIC_VALUE_V1
 #ifndef BOX_DISABLE_BACKWARDS_COMPATIBILITY_BACKUPSTOREFILE
 			&& ntohl(hdr.mMagicValue) != OBJECTMAGIC_FILE_MAGIC_VALUE_V0
-#endif		
+#endif
 			))
 		{
 			// This should never happen, everything has been
@@ -397,7 +400,7 @@
 {
 	// Fix any flags which have been broken, which there's a good chance of doing
 	mDirectory.CheckAndFix();
-	
+
 	// Write it out
 	RaidFileWrite root(mDiscSetNumber, mFilename);
 	root.Open(true /* allow overwriting */);
@@ -457,7 +460,7 @@
 
 	// Create a blank directory
 	CreateBlankDirectory(id, BACKUPSTORE_ROOT_DIRECTORY_ID);
-	
+
 	// Add an entry for it
 	dir.AddEntry(lostAndFound, 0, id, 0, BackupStoreDirectory::Entry::Flags_Dir, 0);
 
@@ -466,7 +469,7 @@
 	root.Open(true /* allow overwriting */);
 	dir.WriteToStream(root);
 	root.Commit(true /* convert to raid now */);
-	
+
 	// Store
 	mLostAndFoundDirectoryID = id;
 
@@ -498,7 +501,7 @@
 		int32_t index = 0;
 		IDBlock *pblock = LookupID(*i, index);
 		if(pblock == 0) continue;
-		
+
 		// Load in
 		BackupStoreDirectory dir;
 		std::string filename;
@@ -510,7 +513,7 @@
 
 		// Adjust container ID
 		dir.SetContainerID(pblock->mContainer[index]);
-		
+
 		// Write it out
 		RaidFileWrite root(mDiscSetNumber, filename);
 		root.Open(true /* allow overwriting */);
@@ -543,7 +546,7 @@
 		int32_t index = 0;
 		IDBlock *pblock = LookupID(i->second, index);
 		if(pblock == 0) continue;
-		
+
 		// Load in
 		BackupStoreDirectory dir;
 		std::string filename;
@@ -555,10 +558,10 @@
 
 		// Delete the dodgy entry
 		dir.DeleteEntry(i->first);
-		
+
 		// Fix it up
 		dir.CheckAndFix();
-		
+
 		// Write it out
 		RaidFileWrite root(mDiscSetNumber, filename);
 		root.Open(true /* allow overwriting */);
@@ -626,7 +629,7 @@
 				"housekeeping doesn't delete files on next run.");
 		}
 	}
-	
+
 	// Object ID
 	int64_t lastObjID = mLastIDInInfo;
 	if(mLostAndFoundDirectoryID != 0)
@@ -705,7 +708,7 @@
 bool BackupStoreDirectory::CheckAndFix()
 {
 	bool changed = false;
-	
+
 	// Check that if a file depends on a new version, that version is in this directory
 	bool restart;
 
@@ -728,11 +731,11 @@
 						"on newer version " <<
 						FMT_OID(dependsNewer) <<
 						" which doesn't exist");
-					
+
 					// Remove
 					delete *i;
 					mEntries.erase(i);
-					
+
 					// Mark as changed
 					changed = true;
 
@@ -761,7 +764,7 @@
 		}
 	}
 	while(restart);
-	
+
 	// Check that if a file has a dependency marked, it exists, and remove it if it doesn't
 	{
 		std::vector<Entry*>::iterator i(mEntries.begin());
@@ -778,7 +781,7 @@
 					"info cleared");
 
 				(*i)->SetDependsOlder(0);
-				
+
 				// Mark as changed
 				changed = true;
 			}
@@ -790,7 +793,7 @@
 	{
 		// Reset change marker
 		ch = false;
-		
+
 		// Search backwards -- so see newer versions first
 		std::vector<Entry*>::iterator i(mEntries.end());
 		if(i == mEntries.begin())
@@ -816,10 +819,8 @@
 			}
 			else
 			{
-				bool isDir = (((*i)->GetFlags() & Entry::Flags_Dir) == Entry::Flags_Dir);
-				
 				// Check mutually exclusive flags
-				if(isDir && (((*i)->GetFlags() & Entry::Flags_File) == Entry::Flags_File))
+				if((*i)->IsDir() && (*i)->IsFile())
 				{
 					// Bad! Unset the file flag
 					BOX_TRACE("Entry " << FMT_i <<
@@ -873,15 +874,15 @@
 					}
 				}
 			}
-			
+
 			if(removeEntry)
 			{
 				// Mark something as changed, in loop
 				ch = true;
-				
+
 				// Mark something as globally changed
 				changed = true;
-				
+
 				// erase the thing from the list
 				Entry *pentry = (*i);
 				mEntries.erase(i);
@@ -888,7 +889,7 @@
 
 				// And delete the entry object
 				delete pentry;
-				
+
 				// Stop going around this loop, as the iterator is now invalid
 				break;
 			}
@@ -895,7 +896,7 @@
 		} while(i != mEntries.begin());
 
 	} while(ch != false);
-	
+
 	return changed;
 }
 

Modified: box/trunk/lib/backupstore/BackupStoreContext.cpp
===================================================================
--- box/trunk/lib/backupstore/BackupStoreContext.cpp	2014-10-31 22:09:28 UTC (rev 3413)
+++ box/trunk/lib/backupstore/BackupStoreContext.cpp	2014-10-31 22:09:34 UTC (rev 3414)
@@ -159,7 +159,7 @@
 
 	// Request the lock
 	bool gotLock = mWriteLock.TryAndGetLock(writeLockFile.c_str(), 0600 /* restrictive file permissions */);
-	
+
 	if(!gotLock && mpHousekeeping)
 	{
 		// The housekeeping process might have the thing open -- ask it to stop
@@ -167,7 +167,7 @@
 		int msgLen = sprintf(msg, "r%x\n", mClientID);
 		// Send message
 		mpHousekeeping->SendMessageToHousekeepingProcess(msg, msgLen);
-		
+
 		// Then try again a few times
 		int tries = MAX_WAIT_FOR_HOUSEKEEPING_TO_RELEASE_ACCOUNT;
 		do
@@ -175,16 +175,16 @@
 			::sleep(1 /* second */);
 			--tries;
 			gotLock = mWriteLock.TryAndGetLock(writeLockFile.c_str(), 0600 /* restrictive file permissions */);
-			
+
 		} while(!gotLock && tries > 0);
 	}
-	
+
 	if(gotLock)
 	{
 		// Got the lock, mark as not read only
 		mReadOnly = false;
 	}
-	
+
 	return gotLock;
 }
 
@@ -203,16 +203,16 @@
 	{
 		THROW_EXCEPTION(BackupStoreException, StoreInfoAlreadyLoaded)
 	}
-	
+
 	// Load it up!
 	std::auto_ptr<BackupStoreInfo> i(BackupStoreInfo::Load(mClientID, mAccountRootDir, mStoreDiscSet, mReadOnly));
-	
+
 	// Check it
 	if(i->GetAccountID() != mClientID)
 	{
 		THROW_EXCEPTION(BackupStoreException, StoreInfoForWrongAccount)
 	}
-	
+
 	// Keep the pointer to it
 	mapStoreInfo = i;
 
@@ -264,7 +264,7 @@
 		}
 	}
 
-	// Want to save now	
+	// Want to save now
 	mapStoreInfo->Save();
 
 	// Set count for next delay
@@ -332,9 +332,9 @@
 		delete item->second;
 		mDirectoryCache.erase(item);
 	}
-	
+
 	// Need to load it up
-	
+
 	// First check to see if the cache is too big
 	if(mDirectoryCache.size() > MAX_CACHE_SIZE)
 	{
@@ -406,12 +406,12 @@
 	// to try for finding an unused ID.
 	// (Sizes used in the store info are fixed by the housekeeping process)
 	int retryLimit = (STORE_INFO_SAVE_DELAY * 2);
-	
+
 	while(retryLimit > 0)
 	{
 		// Attempt to allocate an ID from the store
 		int64_t id = mapStoreInfo->AllocateObjectID();
-		
+
 		// Generate filename
 		std::string filename;
 		MakeObjectFilename(id, filename);
@@ -421,17 +421,17 @@
 			// Success!
 			return id;
 		}
-		
+
 		// Decrement retry count, and try again
 		--retryLimit;
-		
+
 		// Mark that the store info should be saved as soon as possible
 		mSaveStoreInfoDelay = 0;
-		
+
 		BOX_WARNING("When allocating object ID, found that " <<
 			BOX_FORMAT_OBJECTID(id) << " is already in use");
 	}
-	
+
 	THROW_EXCEPTION(BackupStoreException, CouldNotFindUnusedIDDuringAllocation)
 }
 
@@ -470,13 +470,13 @@
 	// be corrected the next time the account has a housekeeping run,
 	// and the object ID allocation code is tolerant of missed IDs.
 	// (the info is written lazily, so these are necessary)
-	
+
 	// Get the directory we want to modify
 	BackupStoreDirectory &dir(GetDirectoryInternal(InDirectory));
-	
+
 	// Allocate the next ID
 	int64_t id = AllocateObjectID();
-	
+
 	// Stream the file to disc
 	std::string fn;
 	MakeObjectFilename(id, fn, true /* make sure the directory it's in exists */);
@@ -509,12 +509,12 @@
 			{
 				THROW_EXCEPTION(BackupStoreException, DiffFromIDNotFoundInDirectory)
 			}
-		
+
 			// Diff file, needs to be recreated.
 			// Choose a temporary filename.
 			std::string tempFn(RaidFileController::DiscSetPathToFileSystemPath(mStoreDiscSet, fn + ".difftemp",
 				1 /* NOT the same disc as the write file, to avoid using lots of space on the same disc unnecessarily */));
-			
+
 			try
 			{
 				// Open it twice
@@ -533,13 +533,13 @@
 					THROW_EXCEPTION(CommonException, OSFileError);
 				}
 #endif
-				
+
 				// Stream the incoming diff to this temporary file
 				if(!rFile.CopyStreamTo(diff, BACKUP_STORE_TIMEOUT))
 				{
 					THROW_EXCEPTION(BackupStoreException, ReadFileFromStreamTimedOut)
 				}
-				
+
 				// Verify the diff
 				diff.Seek(0, IOStream::SeekType_Absolute);
 				if(!BackupStoreFile::VerifyEncodedFileFormat(diff))
@@ -553,7 +553,7 @@
 				// Filename of the old version
 				std::string oldVersionFilename;
 				MakeObjectFilename(DiffFromFileID, oldVersionFilename, false /* no need to make sure the directory it's in exists */);
-				
+
 				// Reassemble that diff -- open previous file, and combine the patch and file
 				std::auto_ptr<RaidFileRead> from(RaidFileRead::Open(mStoreDiscSet, oldVersionFilename));
 				BackupStoreFile::CombineFile(diff, diff2, *from, storeFile);
@@ -566,10 +566,10 @@
 				diff.Seek(0, IOStream::SeekType_Absolute);
 				BackupStoreFile::ReverseDiffFile(diff, *from, *from2, *ppreviousVerStoreFile,
 						DiffFromFileID, &reversedDiffIsCompletelyDifferent);
-				
+
 				// Store disc space used
 				oldVersionNewBlocksUsed = ppreviousVerStoreFile->GetDiscUsageInBlocks();
-				
+
 				// And make a space adjustment for the size calculation
 				spaceSavedByConversionToPatch =
 					from->GetDiscUsageInBlocks() - 
@@ -595,13 +595,13 @@
 				throw;
 			}
 		}
-		
+
 		// Get the blocks used
 		newObjectBlocksUsed = storeFile.GetDiscUsageInBlocks();
 		adjustment.mBlocksUsed += newObjectBlocksUsed;
 		adjustment.mBlocksInCurrentFiles += newObjectBlocksUsed;
 		adjustment.mNumCurrentFiles++;
-		
+
 		// Exceeds the hard limit?
 		int64_t newTotalBlocksUsed = mapStoreInfo->GetBlocksUsed() +
 			adjustment.mBlocksUsed;
@@ -637,7 +637,7 @@
 			// Error! Delete the file
 			RaidFileWrite del(mStoreDiscSet, fn);
 			del.Delete();
-			
+
 			// Exception
 			THROW_EXCEPTION(BackupStoreException, AddedFileDoesNotVerify)
 		}
@@ -665,7 +665,6 @@
 		if(MarkFileWithSameNameAsOldVersions)
 		{
 			BackupStoreDirectory::Iterator i(dir);
-
 			BackupStoreDirectory::Entry *e = 0;
 			while((e = i.Next()) != 0)
 			{
@@ -824,7 +823,7 @@
 					mapStoreInfo->AdjustNumCurrentFiles(-1);
 					mapStoreInfo->ChangeBlocksInCurrentFiles(-blocks);
 				}
-					
+
 				// Is this the last version?
 				if((e->GetFlags() & BackupStoreDirectory::Entry::Flags_OldVersion) == 0)
 				{
@@ -834,7 +833,7 @@
 				}
 			}
 		}
-		
+
 		// Save changes?
 		if(madeChanges)
 		{
@@ -1124,7 +1123,7 @@
 		dirSize = dirFile.GetDiscUsageInBlocks();
 
 		// Exceeds the hard limit?
-		int64_t newTotalBlocksUsed = mapStoreInfo->GetBlocksUsed() + 
+		int64_t newTotalBlocksUsed = mapStoreInfo->GetBlocksUsed() +
 			dirSize;
 		if(newTotalBlocksUsed > mapStoreInfo->GetBlocksHardLimit())
 		{
@@ -1204,7 +1203,7 @@
 		{
 			// In block, because dir may not be valid after the delete directory call
 			BackupStoreDirectory &dir(GetDirectoryInternal(ObjectID));
-			
+
 			// Store the directory it's in for later
 			InDirectory = dir.GetContainerID();
 		
@@ -1297,20 +1296,20 @@
 			// Done with the directory for now. Recurse to sub directories
 			for(std::vector<int64_t>::const_iterator i = subDirs.begin(); i != subDirs.end(); ++i)
 			{
-				DeleteDirectoryRecurse(*i, Undelete);	
+				DeleteDirectoryRecurse(*i, Undelete);
 			}
 		}
-		
+
 		// Then, delete the files. Will need to load the directory again because it might have
 		// been removed from the cache.
 		{
 			// Get the directory...
 			BackupStoreDirectory &dir(GetDirectoryInternal(ObjectID));
-	
+
 			// Changes made?
 			bool changesMade = false;
-	
-			// Run through files		
+
+			// Run through files
 			BackupStoreDirectory::Iterator i(dir);
 			BackupStoreDirectory::Entry *en = 0;
 
@@ -1346,7 +1345,7 @@
 				// Did something
 				changesMade = true;
 			}
-			
+
 			// Save the directory
 			if(changesMade)
 			{
@@ -1383,13 +1382,13 @@
 	}
 
 	try
-	{	
+	{
 		// Get the directory we want to modify
 		BackupStoreDirectory &dir(GetDirectoryInternal(Directory));
-	
+
 		// Set attributes
 		dir.SetAttributes(Attributes, AttributesModTime);
-		
+
 		// Save back
 		SaveDirectory(dir);
 	}
@@ -1423,7 +1422,7 @@
 	{
 		// Get the directory we want to modify
 		BackupStoreDirectory &dir(GetDirectoryInternal(InDirectory));
-	
+
 		// Find the file entry
 		BackupStoreDirectory::Entry *en = 0;
 		// Iterate through current versions of files, only
@@ -1437,10 +1436,10 @@
 			{
 				// Set attributes
 				en->SetAttributes(Attributes, AttributesHash);
-				
+
 				// Tell caller the object ID
 				rObjectIDOut = en->GetObjectID();
-				
+
 				// Done
 				break;
 			}
@@ -1450,7 +1449,7 @@
 			// Didn't find it
 			return false;
 		}
-	
+
 		// Save back
 		SaveDirectory(dir);
 	}
@@ -1459,7 +1458,7 @@
 		RemoveDirectoryFromCache(InDirectory);
 		throw;
 	}
-	
+
 	// Changed, everything OK
 	return true;
 }
@@ -1479,7 +1478,7 @@
 	{
 		THROW_EXCEPTION(BackupStoreException, StoreInfoNotLoaded)
 	}
-	
+
 	// Note that we need to allow object IDs a little bit greater than the last one in the store info,
 	// because the store info may not have got saved in an error condition. Max greater ID is
 	// STORE_INFO_SAVE_DELAY in this case, *2 to be safe.
@@ -1488,7 +1487,7 @@
 		// Obviously bad object ID
 		return false;
 	}
-	
+
 	// Test to see if it exists on the disc
 	std::string filename;
 	MakeObjectFilename(ObjectID, filename);
@@ -1497,7 +1496,7 @@
 		// RaidFile reports no file there
 		return false;
 	}
-	
+
 	// Do we need to be more specific?
 	if(MustBe != ObjectExists_Anything)
 	{
@@ -1522,16 +1521,16 @@
 
 		// Right one?
 		u_int32_t requiredMagic = (MustBe == ObjectExists_File)?OBJECTMAGIC_FILE_MAGIC_VALUE_V1:OBJECTMAGIC_DIR_MAGIC_VALUE;
-	
+
 		// Check
 		if(ntohl(magic) != requiredMagic)
 		{
 			return false;
 		}
-		
+
 		// File is implicitly closed
 	}
-	
+
 	return true;
 }
 
@@ -1550,7 +1549,7 @@
 	{
 		THROW_EXCEPTION(BackupStoreException, StoreInfoNotLoaded)
 	}
-	
+
 	// Attempt to open the file
 	std::string fn;
 	MakeObjectFilename(ObjectID, fn);
@@ -1572,7 +1571,7 @@
 	{
 		THROW_EXCEPTION(BackupStoreException, StoreInfoNotLoaded)
 	}
-	
+
 	return mapStoreInfo->GetClientStoreMarker();
 }
 
@@ -1635,7 +1634,7 @@
 	{
 		THROW_EXCEPTION(BackupStoreException, ContextIsReadOnly)
 	}
-	
+
 	mapStoreInfo->SetClientStoreMarker(ClientStoreMarker);
 	SaveStoreInfo(false /* don't delay saving this */);
 }
@@ -1662,7 +1661,7 @@
 	int64_t targetSearchExcludeFlags = (AllowMoveOverDeletedObject)
 		?(BackupStoreDirectory::Entry::Flags_Deleted)
 		:(BackupStoreDirectory::Entry::Flags_EXCLUDE_NOTHING);
-	
+
 	// Special case if the directories are the same...
 	if(MoveFromDirectory == MoveToDirectory)
 	{
@@ -1670,16 +1669,16 @@
 		{
 			// Get the first directory
 			BackupStoreDirectory &dir(GetDirectoryInternal(MoveFromDirectory));
-		
+
 			// Find the file entry
 			BackupStoreDirectory::Entry *en = dir.FindEntryByID(ObjectID);
-	
+
 			// Error if not found
 			if(en == 0)
 			{
 				THROW_EXCEPTION(BackupStoreException, CouldNotFindEntryInDirectory)
 			}
-			
+
 			// Check the new name doens't already exist (optionally ignoring deleted files)
 			{
 				BackupStoreDirectory::Iterator i(dir);
@@ -1692,7 +1691,7 @@
 					}
 				}
 			}
-			
+
 			// Need to get all the entries with the same name?
 			if(MoveAllWithSameName)
 			{
@@ -1713,7 +1712,7 @@
 				// Just copy this one
 				en->SetName(rNewFilename);
 			}
-			
+
 			// Save the directory back
 			SaveDirectory(dir);
 		}
@@ -1722,7 +1721,7 @@
 			RemoveDirectoryFromCache(MoveToDirectory); // either will do, as they're the same
 			throw;
 		}
-	
+
 		return;
 	}
 
@@ -1732,7 +1731,7 @@
 
 	// List of entries to move
 	std::vector<BackupStoreDirectory::Entry *> moving;
-	
+
 	// list of directory IDs which need to have containing dir id changed
 	std::vector<int64_t> dirsToChangeContainingID;
 
@@ -1739,20 +1738,20 @@
 	try
 	{
 		// First of all, get copies of the entries to move to the to directory.
-		
+
 		{
 			// Get the first directory
 			BackupStoreDirectory &from(GetDirectoryInternal(MoveFromDirectory));
-		
+
 			// Find the file entry
 			BackupStoreDirectory::Entry *en = from.FindEntryByID(ObjectID);
-	
+
 			// Error if not found
 			if(en == 0)
 			{
 				THROW_EXCEPTION(BackupStoreException, CouldNotFindEntryInDirectory)
 			}
-			
+
 			// Need to get all the entries with the same name?
 			if(MoveAllWithSameName)
 			{
@@ -1765,7 +1764,7 @@
 					{
 						// Copy
 						moving.push_back(new BackupStoreDirectory::Entry(*c));
-						
+
 						// Check for containing directory correction
 						if(c->GetFlags() & BackupStoreDirectory::Entry::Flags_Dir) dirsToChangeContainingID.push_back(c->GetObjectID());
 					}
@@ -1781,13 +1780,13 @@
 				if(en->GetFlags() & BackupStoreDirectory::Entry::Flags_Dir) dirsToChangeContainingID.push_back(en->GetObjectID());
 			}
 		}
-		
+
 		// Secondly, insert them into the to directory, and save it
-		
+
 		{
 			// To directory
 			BackupStoreDirectory &to(GetDirectoryInternal(MoveToDirectory));
-	
+
 			// Check the new name doens't already exist
 			{
 				BackupStoreDirectory::Iterator i(to);
@@ -1800,7 +1799,7 @@
 					}
 				}
 			}
-			
+
 			// Copy the entries into it, changing the name as we go
 			for(std::vector<BackupStoreDirectory::Entry *>::iterator i(moving.begin()); i != moving.end(); ++i)
 			{
@@ -1808,7 +1807,7 @@
 				en->SetName(rNewFilename);
 				to.AddEntry(*en);	// adds copy
 			}
-	
+
 			// Save back
 			SaveDirectory(to);
 		}
@@ -1818,13 +1817,13 @@
 		{
 			// Get directory
 			BackupStoreDirectory &from(GetDirectoryInternal(MoveFromDirectory));
-		
+
 			// Delete each one
 			for(std::vector<BackupStoreDirectory::Entry *>::iterator i(moving.begin()); i != moving.end(); ++i)
 			{
 				from.DeleteEntry((*i)->GetObjectID());
 			}
-	
+
 			// Save back
 			SaveDirectory(from);
 		}
@@ -1831,16 +1830,16 @@
 		catch(...)
 		{
 			// UNDO modification to To directory
-					
+
 			// Get directory
 			BackupStoreDirectory &to(GetDirectoryInternal(MoveToDirectory));
-		
+
 			// Delete each one
 			for(std::vector<BackupStoreDirectory::Entry *>::iterator i(moving.begin()); i != moving.end(); ++i)
 			{
 				to.DeleteEntry((*i)->GetObjectID());
 			}
-	
+
 			// Save back
 			SaveDirectory(to);
 
@@ -1847,16 +1846,16 @@
 			// Throw the error
 			throw;
 		}
-		
+
 		// Finally... for all the directories we moved, modify their containing directory ID
 		for(std::vector<int64_t>::iterator i(dirsToChangeContainingID.begin()); i != dirsToChangeContainingID.end(); ++i)
 		{
 			// Load the directory
 			BackupStoreDirectory &change(GetDirectoryInternal(*i));
-			
+
 			// Modify containing dir ID
 			change.SetContainerID(MoveToDirectory);
-			
+
 			// Save it back
 			SaveDirectory(change);
 		}
@@ -1863,12 +1862,12 @@
 	}
 	catch(...)
 	{
-		// Make sure directories aren't in the cache, as they may have been modified		
+		// Make sure directories aren't in the cache, as they may have been modified
 		RemoveDirectoryFromCache(MoveToDirectory);
 		RemoveDirectoryFromCache(MoveFromDirectory);
 		for(std::vector<int64_t>::iterator i(dirsToChangeContainingID.begin()); i != dirsToChangeContainingID.end(); ++i)
 		{
-			RemoveDirectoryFromCache(*i);			
+			RemoveDirectoryFromCache(*i);
 		}
 
 		while(!moving.empty())
@@ -1877,7 +1876,7 @@
 			moving.pop_back();
 		}
 		throw;
-	}	
+	}
 
 	// Clean up
 	while(!moving.empty())
@@ -1903,7 +1902,7 @@
 	{
 		THROW_EXCEPTION(BackupStoreException, StoreInfoNotLoaded)
 	}
-	
+
 	return *(mapStoreInfo.get());
 }
 

Modified: box/trunk/lib/backupstore/BackupStoreContext.h
===================================================================
--- box/trunk/lib/backupstore/BackupStoreContext.h	2014-10-31 22:09:28 UTC (rev 3413)
+++ box/trunk/lib/backupstore/BackupStoreContext.h	2014-10-31 22:09:34 UTC (rev 3414)
@@ -135,12 +135,18 @@
 	const BackupStoreDirectory &GetDirectory(int64_t ObjectID)
 	{
 		// External callers aren't allowed to change it -- this function
-		// merely turns the the returned directory const.
+		// merely turns the returned directory const.
 		return GetDirectoryInternal(ObjectID);
 	}
 	
 	// Manipulating files/directories
-	int64_t AddFile(IOStream &rFile, int64_t InDirectory, int64_t ModificationTime, int64_t AttributesHash, int64_t DiffFromFileID, const BackupStoreFilename &rFilename, bool MarkFileWithSameNameAsOldVersions);
+	int64_t AddFile(IOStream &rFile,
+		int64_t InDirectory,
+		int64_t ModificationTime,
+		int64_t AttributesHash,
+		int64_t DiffFromFileID,
+		const BackupStoreFilename &rFilename,
+		bool MarkFileWithSameNameAsOldVersions);
 	int64_t AddDirectory(int64_t InDirectory,
 		const BackupStoreFilename &rFilename,
 		const StreamableMemBlock &Attributes,

Modified: box/trunk/lib/backupstore/BackupStoreDirectory.cpp
===================================================================
--- box/trunk/lib/backupstore/BackupStoreDirectory.cpp	2014-10-31 22:09:28 UTC (rev 3413)
+++ box/trunk/lib/backupstore/BackupStoreDirectory.cpp	2014-10-31 22:09:34 UTC (rev 3414)
@@ -139,21 +139,21 @@
 			BOX_FORMAT_HEX32(ntohl(hdr.mMagicValue)) << " in " <<
 			rStream.ToString());
 	}
-	
+
 	// Get data
 	mObjectID = box_ntoh64(hdr.mObjectID);
 	mContainerID = box_ntoh64(hdr.mContainerID);
 	mAttributesModTime = box_ntoh64(hdr.mAttributesModTime);
-	
+
 	// Options
 	int32_t options = ntohl(hdr.mOptionsPresent);
-	
+
 	// Get attributes
 	mAttributes.ReadFromStream(rStream, Timeout);
-	
+
 	// Decode count
 	int count = ntohl(hdr.mNumEntries);
-	
+
 	// Clear existing list
 	for(std::vector<Entry*>::iterator i = mEntries.begin(); 
 		i != mEntries.end(); i++)
@@ -161,7 +161,7 @@
 		delete (*i);
 	}
 	mEntries.clear();
-	
+
 	// Read them in!
 	for(int c = 0; c < count; ++c)
 	{
@@ -170,7 +170,7 @@
 		{
 			// Read from stream
 			pen->ReadFromStream(rStream, Timeout);
-			
+
 			// Add to list
 			mEntries.push_back(pen);
 		}
@@ -180,7 +180,7 @@
 			throw;
 		}
 	}
-	
+
 	// Read in dependency info?
 	if(options & Option_DependencyInfoPresent)
 	{
@@ -214,11 +214,11 @@
 			count++;
 		}
 	}
-	
+
 	// Check that sensible IDs have been set
 	ASSERT(mObjectID != 0);
 	ASSERT(mContainerID != 0);
-	
+
 	// Need dependency info?
 	bool dependencyInfoRequired = false;
 	if(StreamDependencyInfo)
@@ -231,9 +231,9 @@
 			{
 				dependencyInfoRequired = true;
 			}
-		}	
+		}
 	}
-	
+
 	// Options
 	int32_t options = 0;
 	if(dependencyInfoRequired) options |= Option_DependencyInfoPresent;
@@ -246,10 +246,10 @@
 	hdr.mContainerID = box_hton64(mContainerID);
 	hdr.mAttributesModTime = box_hton64(mAttributesModTime);
 	hdr.mOptionsPresent = htonl(options);
-	
+
 	// Write header
 	rStream.Write(&hdr, sizeof(hdr));
-	
+
 	// Write the attributes?
 	if(StreamAttributes)
 	{
@@ -268,7 +268,7 @@
 	{
 		pen->WriteToStream(rStream);
 	}
-	
+
 	// Write dependency info?
 	if(dependencyInfoRequired)
 	{
@@ -277,7 +277,7 @@
 		while((pen = i.Next(FlagsMustBeSet, FlagsNotToBeSet)) != 0)
 		{
 			pen->WriteToStreamDependencyInfo(rStream);
-		}	
+		}
 	}
 }
 
@@ -301,7 +301,7 @@
 		delete pnew;
 		throw;
 	}
-	
+
 	return pnew;
 }
 
@@ -329,7 +329,7 @@
 		delete pnew;
 		throw;
 	}
-	
+
 	return pnew;
 }
 
@@ -356,9 +356,11 @@
 			return;
 		}
 	}
-	
+
 	// Not found
-	THROW_EXCEPTION(BackupStoreException, CouldNotFindEntryInDirectory)
+	THROW_EXCEPTION_MESSAGE(BackupStoreException, CouldNotFindEntryInDirectory,
+		"Failed to find entry " << BOX_FORMAT_OBJECTID(ObjectID) <<
+		" in directory " << BOX_FORMAT_OBJECTID(mObjectID));
 }
 
 
@@ -396,15 +398,16 @@
 //
 // --------------------------------------------------------------------------
 BackupStoreDirectory::Entry::Entry()
-	: mModificationTime(0),
-	  mObjectID(0),
-	  mSizeInBlocks(0),
-	  mFlags(0),
-	  mAttributesHash(0),
-	  mMinMarkNumber(0),
-	  mMarkNumber(0),
-	  mDependsNewer(0),
-	  mDependsOlder(0)
+:
+  mModificationTime(0),
+  mObjectID(0),
+  mSizeInBlocks(0),
+  mFlags(0),
+  mAttributesHash(0),
+  mMinMarkNumber(0),
+  mMarkNumber(0),
+  mDependsNewer(0),
+  mDependsOlder(0)
 {
 }
 
@@ -429,17 +432,18 @@
 //
 // --------------------------------------------------------------------------
 BackupStoreDirectory::Entry::Entry(const Entry &rToCopy)
-	: mName(rToCopy.mName),
-	  mModificationTime(rToCopy.mModificationTime),
-	  mObjectID(rToCopy.mObjectID),
-	  mSizeInBlocks(rToCopy.mSizeInBlocks),
-	  mFlags(rToCopy.mFlags),
-	  mAttributesHash(rToCopy.mAttributesHash),
-	  mAttributes(rToCopy.mAttributes),
-	  mMinMarkNumber(rToCopy.mMinMarkNumber),
-	  mMarkNumber(rToCopy.mMarkNumber),
-	  mDependsNewer(rToCopy.mDependsNewer),
-	  mDependsOlder(rToCopy.mDependsOlder)
+:
+  mName(rToCopy.mName),
+  mModificationTime(rToCopy.mModificationTime),
+  mObjectID(rToCopy.mObjectID),
+  mSizeInBlocks(rToCopy.mSizeInBlocks),
+  mFlags(rToCopy.mFlags),
+  mAttributesHash(rToCopy.mAttributesHash),
+  mAttributes(rToCopy.mAttributes),
+  mMinMarkNumber(rToCopy.mMinMarkNumber),
+  mMarkNumber(rToCopy.mMarkNumber),
+  mDependsNewer(rToCopy.mDependsNewer),
+  mDependsOlder(rToCopy.mDependsOlder)
 {
 }
 
@@ -453,16 +457,17 @@
 //
 // --------------------------------------------------------------------------
 BackupStoreDirectory::Entry::Entry(const BackupStoreFilename &rName, box_time_t ModificationTime, int64_t ObjectID, int64_t SizeInBlocks, int16_t Flags, uint64_t AttributesHash)
-	: mName(rName),
-	  mModificationTime(ModificationTime),
-	  mObjectID(ObjectID),
-	  mSizeInBlocks(SizeInBlocks),
-	  mFlags(Flags),
-	  mAttributesHash(AttributesHash),
-	  mMinMarkNumber(0),
-	  mMarkNumber(0),
-	  mDependsNewer(0),
-	  mDependsOlder(0)
+:
+  mName(rName),
+  mModificationTime(ModificationTime),
+  mObjectID(ObjectID),
+  mSizeInBlocks(SizeInBlocks),
+  mFlags(Flags),
+  mAttributesHash(AttributesHash),
+  mMinMarkNumber(0),
+  mMarkNumber(0),
+  mDependsNewer(0),
+  mDependsOlder(0)
 {
 }
 
@@ -487,11 +492,11 @@
 	}
 
 	// Do reading first before modifying the variables, to be more exception safe
-	
+
 	// Get the filename
 	BackupStoreFilename name;
 	name.ReadFromStream(rStream, Timeout);
-	
+
 	// Get the attributes
 	mAttributes.ReadFromStream(rStream, Timeout);
 
@@ -522,13 +527,13 @@
 	entry.mSizeInBlocks = 		box_hton64(mSizeInBlocks);
 	entry.mAttributesHash =		box_hton64(mAttributesHash);
 	entry.mFlags = 				htons(mFlags);
-	
+
 	// Write it
 	rStream.Write(&entry, sizeof(entry));
-	
+
 	// Write the filename
 	mName.WriteToStream(rStream);
-	
+
 	// Write any attributes
 	mAttributes.WriteToStream(rStream);
 }
@@ -568,12 +573,9 @@
 void BackupStoreDirectory::Entry::WriteToStreamDependencyInfo(IOStream &rStream) const
 {
 	// Build structure
-	en_StreamFormatDepends depends;	
+	en_StreamFormatDepends depends;
 	depends.mDependsNewer = box_hton64(mDependsNewer);
 	depends.mDependsOlder = box_hton64(mDependsOlder);
 	// Write
 	rStream.Write(&depends, sizeof(depends));
 }
-
-
-

Modified: box/trunk/lib/backupstore/BackupStoreDirectory.h
===================================================================
--- box/trunk/lib/backupstore/BackupStoreDirectory.h	2014-10-31 22:09:28 UTC (rev 3413)
+++ box/trunk/lib/backupstore/BackupStoreDirectory.h	2014-10-31 22:09:34 UTC (rev 3414)
@@ -58,7 +58,7 @@
 		~Entry();
 		Entry(const Entry &rToCopy);
 		Entry(const BackupStoreFilename &rName, box_time_t ModificationTime, int64_t ObjectID, int64_t SizeInBlocks, int16_t Flags, uint64_t AttributesHash);
-		
+
 		void ReadFromStream(IOStream &rStream, int Timeout);
 		void WriteToStream(IOStream &rStream) const;
 		
@@ -148,7 +148,7 @@
 		StreamableMemBlock mAttributes;
 		uint32_t mMinMarkNumber;
 		uint32_t mMarkNumber;
-		
+
 		uint64_t mDependsNewer;	// new version this depends on
 		uint64_t mDependsOlder;	// older version which depends on this
 	};
@@ -196,7 +196,7 @@
 			: mrDir(rDir), i(rDir.mEntries.begin())
 		{
 		}
-		
+
 		BackupStoreDirectory::Entry *Next(int16_t FlagsMustBeSet = Entry::Flags_INCLUDE_EVERYTHING, int16_t FlagsNotToBeSet = Entry::Flags_EXCLUDE_NOTHING)
 		{
 			// Skip over things which don't match the required flags
@@ -238,7 +238,7 @@
 		const BackupStoreDirectory &mrDir;
 		std::vector<Entry*>::const_iterator i;
 	};
-		
+
 	friend class Iterator;
 
 	class ReverseIterator
@@ -248,7 +248,7 @@
 			: mrDir(rDir), i(rDir.mEntries.rbegin())
 		{
 		}
-		
+
 		BackupStoreDirectory::Entry *Next(int16_t FlagsMustBeSet = Entry::Flags_INCLUDE_EVERYTHING, int16_t FlagsNotToBeSet = Entry::Flags_EXCLUDE_NOTHING)
 		{
 			// Skip over things which don't match the required flags
@@ -264,12 +264,12 @@
 			// Return entry, and increment
 			return (*(i++));
 		}
-	
+
 	private:
 		const BackupStoreDirectory &mrDir;
 		std::vector<Entry*>::const_reverse_iterator i;
 	};
-		
+
 	friend class ReverseIterator;
 
 	// For recovery of the store
@@ -297,4 +297,3 @@
 };
 
 #endif // BACKUPSTOREDIRECTORY__H
-

Modified: box/trunk/lib/backupstore/BackupStoreFilenameClear.h
===================================================================
--- box/trunk/lib/backupstore/BackupStoreFilenameClear.h	2014-10-31 22:09:28 UTC (rev 3413)
+++ box/trunk/lib/backupstore/BackupStoreFilenameClear.h	2014-10-31 22:09:34 UTC (rev 3414)
@@ -42,7 +42,7 @@
 #endif
 	void SetClearFilename(const std::string &rToEncode);
 
-	// Setup for encryption of filenames	
+	// Setup for encryption of filenames
 	static void SetBlowfishKey(const void *pKey, int KeyLength, const void *pIV, int IVLength);
 	static void SetEncodingMethod(int Method);
 	

Modified: box/trunk/lib/backupstore/HousekeepStoreAccount.cpp
===================================================================
--- box/trunk/lib/backupstore/HousekeepStoreAccount.cpp	2014-10-31 22:09:28 UTC (rev 3413)
+++ box/trunk/lib/backupstore/HousekeepStoreAccount.cpp	2014-10-31 22:09:34 UTC (rev 3414)
@@ -243,7 +243,7 @@
 
 	// Go and delete items from the accounts
 	bool deleteInterrupted = DeleteFiles(*info);
-	
+
 	// If that wasn't interrupted, remove any empty directories which 
 	// are also marked as deleted in their containing directory
 	if(!deleteInterrupted)
@@ -250,7 +250,7 @@
 	{
 		deleteInterrupted = DeleteEmptyDirectories(*info);
 	}
-	
+
 	// Log deletion if anything was deleted
 	if(mFilesDeleted > 0 || mEmptyDirectoriesDeleted > 0)
 	{
@@ -272,17 +272,17 @@
 	}
 	if(mBlocksInOldFilesDelta < (0 - info->GetBlocksInOldFiles()))
 	{
- 		mBlocksInOldFilesDelta = (0 - info->GetBlocksInOldFiles());
+		mBlocksInOldFilesDelta = (0 - info->GetBlocksInOldFiles());
 	}
 	if(mBlocksInDeletedFilesDelta < (0 - info->GetBlocksInDeletedFiles()))
 	{
-	 	mBlocksInDeletedFilesDelta = (0 - info->GetBlocksInDeletedFiles());
+		mBlocksInDeletedFilesDelta = (0 - info->GetBlocksInDeletedFiles());
 	}
 	if(mBlocksInDirectoriesDelta < (0 - info->GetBlocksInDirectories()))
 	{
 		mBlocksInDirectoriesDelta = (0 - info->GetBlocksInDirectories());
 	}
-	
+
 	// Update the usage counts in the store
 	info->ChangeBlocksUsed(mBlocksUsedDelta);
 	info->ChangeBlocksInOldFiles(mBlocksInOldFilesDelta);
@@ -291,7 +291,7 @@
 
 	// Save the store info back
 	info->Save();
-	
+
 	// force file to be saved and closed before releasing the lock below
 	mapNewRefs->Commit();
 	mapNewRefs.reset();
@@ -358,12 +358,12 @@
 	// Open it.
 	std::auto_ptr<RaidFileRead> dirStream(RaidFileRead::Open(mStoreDiscSet,
 		objectFilename));
-	
+
 	// Add the size of the directory on disc to the size being calculated
 	int64_t originalDirSizeInBlocks = dirStream->GetDiscUsageInBlocks();
 	mBlocksInDirectories += originalDirSizeInBlocks;
 	mBlocksUsed += originalDirSizeInBlocks;
-	
+
 	// Read the directory in
 	BackupStoreDirectory dir;
 	BufferedStream buf(*dirStream);
@@ -370,7 +370,7 @@
 	dir.ReadFromStream(buf, IOStream::TimeOutInfinite);
 	dir.SetUserInfo1_SizeInBlocks(originalDirSizeInBlocks);
 	dirStream->Close();
-	
+
 	// Is it empty?
 	if(dir.GetNumberOfEntries() == 0)
 	{
@@ -415,7 +415,7 @@
 					
 					// flag as having done something
 					deletedSomething = true;
-					
+
 					// Must start the loop from the beginning again, as iterator is now
 					// probably invalid.
 					break;
@@ -423,7 +423,7 @@
 			}
 		} while(deletedSomething);
 	}
-	
+
 	// BLOCK
 	{
 		// Add files to the list of potential deletions
@@ -443,9 +443,9 @@
 			int16_t enFlags = en->GetFlags();
 			int64_t enSizeInBlocks = en->GetSizeInBlocks();
 			mBlocksUsed += enSizeInBlocks;
-			if(enFlags & BackupStoreDirectory::Entry::Flags_OldVersion) mBlocksInOldFiles += enSizeInBlocks;
-			if(enFlags & BackupStoreDirectory::Entry::Flags_Deleted) mBlocksInDeletedFiles += enSizeInBlocks;
-					
+			if(en->IsOld()) mBlocksInOldFiles += enSizeInBlocks;
+			if(en->IsDeleted()) mBlocksInDeletedFiles += enSizeInBlocks;
+
 			// Work out ages of this version from the last mark
 			int32_t enVersionAge = 0;
 			std::map<version_t, int32_t>::iterator enVersionAgeI(
@@ -462,9 +462,9 @@
 				markVersionAges[version_t(en->GetName().GetEncodedFilename(), en->GetMarkNumber())] = enVersionAge;
 			}
 			// enVersionAge is now the age of this version.
-			
+
 			// Potentially add it to the list if it's deleted, if it's an old version or deleted
-			if((enFlags & (BackupStoreDirectory::Entry::Flags_Deleted | BackupStoreDirectory::Entry::Flags_OldVersion)) != 0)
+			if(en->IsOld() || en->IsDeleted())
 			{
 				// Is deleted / old version.
 				DelEn d;
@@ -473,17 +473,15 @@
 				d.mSizeInBlocks = en->GetSizeInBlocks();
 				d.mMarkNumber = en->GetMarkNumber();
 				d.mVersionAgeWithinMark = enVersionAge;
-				d.mIsFlagDeleted = (enFlags &
-					BackupStoreDirectory::Entry::Flags_Deleted)
-					? true : false;
-				
+				d.mIsFlagDeleted = en->IsDeleted();
+
 				// Add it to the list
 				mPotentialDeletions.insert(d);
-				
+
 				// Update various counts
 				mPotentialDeletionsTotalSize += d.mSizeInBlocks;
 				if(d.mSizeInBlocks > mMaxSizeInPotentialDeletions) mMaxSizeInPotentialDeletions = d.mSizeInBlocks;
-				
+
 				// Too much in the list of potential deletions?
 				// (check against the deletion target + the max size in deletions, so that we never delete things
 				// and take the total size below the deletion size target)
@@ -491,7 +489,7 @@
 				{
 					int64_t sizeToRemove = mPotentialDeletionsTotalSize - (mDeletionSizeTarget + mMaxSizeInPotentialDeletions);
 					bool recalcMaxSize = false;
-					
+
 					while(sizeToRemove > 0)
 					{
 						// Make iterator for the last element, while checking that there's something there in the first place.
@@ -503,7 +501,7 @@
 						}
 						// Make this into an iterator pointing to the last element in the set
 						--i;
-						
+
 						// Delete this one?
 						if(sizeToRemove > i->mSizeInBlocks)
 						{
@@ -521,7 +519,7 @@
 							break;
 						}
 					}
-					
+
 					if(recalcMaxSize)
 					{
 						// Because an object which was the maximum size recorded was deleted from the set
@@ -541,14 +539,13 @@
 		}
 	}
 
+	// Recurse into subdirectories
 	{
-		// Recurse into subdirectories
 		BackupStoreDirectory::Iterator i(dir);
 		BackupStoreDirectory::Entry *en = 0;
 		while((en = i.Next(BackupStoreDirectory::Entry::Flags_Dir)) != 0)
 		{
-			// Next level
-			ASSERT((en->GetFlags() & BackupStoreDirectory::Entry::Flags_Dir) == BackupStoreDirectory::Entry::Flags_Dir);
+			ASSERT(en->IsDir());
 			
 			if(!ScanDirectory(en->GetObjectID(), rBackupStoreInfo))
 			{
@@ -557,7 +554,7 @@
 			}
 		}
 	}
-	
+
 	return true;
 }
 
@@ -578,7 +575,7 @@
 
 	// The sort order here is intended to preserve the entries of most value, that is, the newest objects
 	// which are on a mark boundary.
-	
+
 	// Reverse order age, so oldest goes first
 	if(x.mVersionAgeWithinMark > y.mVersionAgeWithinMark)
 	{
@@ -650,7 +647,7 @@
 			dir.ReadFromStream(*dirStream, IOStream::TimeOutInfinite);
 			dir.SetUserInfo1_SizeInBlocks(dirStream->GetDiscUsageInBlocks());
 		}
-		
+
 		// Delete the file
 		BackupStoreRefCountDatabase::refcount_t refs =
 			DeleteFile(i->mInDirectory, i->mObjectID, dir,
@@ -729,7 +726,7 @@
 			mErrorCount++;
 			return refs;
 		}
-		
+
 		// Record the flags it's got set
 		wasDeleted = pentry->IsDeleted();
 		wasOldVersion = pentry->IsOld();
@@ -739,7 +736,7 @@
 			// Things changed size we were last around
 			return refs;
 		}
-		
+
 		// Record size
 		deletedFileSizeInBlocks = pentry->GetSizeInBlocks();
 
@@ -794,7 +791,7 @@
 			else
 			{
 				// This entry is in the middle of a chain, and two patches need combining.
-				
+
 				// First, adjust the directory entries
 				BackupStoreDirectory::Entry *pnewer = rDirectory.FindEntryByID(pentry->GetDependsNewer());
 				if(pnewer == 0 || pnewer->GetDependsOlder() != ObjectID
@@ -806,7 +803,7 @@
 				pnewer->SetDependsOlder(pentry->GetDependsOlder());
 				polder->SetDependsNewer(pentry->GetDependsNewer());
 			}
-			
+
 			// COMMON CODE to both cases
 
 			// Generate the filename of the older version
@@ -835,7 +832,7 @@
 				BackupStoreFile::CombineDiffs(*pobjectBeingDeleted, *pdiff, *pdiff2, *padjustedEntry);
 			}
 			// The file will be committed later when the directory is safely commited.
-			
+
 			// Work out the adjusted size
 			int64_t newSize = padjustedEntry->GetDiscUsageInBlocks();
 			int64_t sizeDelta = newSize - polder->GetSizeInBlocks();
@@ -850,13 +847,13 @@
 			}
 			polder->SetSizeInBlocks(newSize);
 		}
-		
+
 		// pentry no longer valid
 	}
-	
+
 	// Delete it from the directory
 	rDirectory.DeleteEntry(ObjectID);
-	
+
 	// Save directory back to disc
 	// BLOCK
 	{
@@ -884,7 +881,7 @@
 	if(padjustedEntry.get() != 0)
 	{
 		padjustedEntry->Commit(BACKUP_STORE_CONVERT_TO_RAID_IMMEDIATELY);
-		padjustedEntry.reset();	// delete it now
+		padjustedEntry.reset(); // delete it now
 	}
 
 	// Drop reference count by one. Must now be zero, to delete the file.
@@ -913,7 +910,7 @@
 		mBlocksInOldFilesDelta -= deletedFileSizeInBlocks;
 		rBackupStoreInfo.AdjustNumOldFiles(-1);
 	}
-	
+
 	// Delete the directory?
 	// Do this if... dir has zero entries, and is marked as deleted in it's containing directory
 	if(rDirectory.GetNumberOfEntries() == 0)
@@ -1040,7 +1037,7 @@
 		// Swap in new, so it's examined next time round
 		mEmptyDirectories.swap(toExamine);
 	}
-	
+
 	// Not interrupted
 	return false;
 }

Modified: box/trunk/lib/backupstore/backupprotocol.txt
===================================================================
--- box/trunk/lib/backupstore/backupprotocol.txt	2014-10-31 22:09:28 UTC (rev 3413)
+++ box/trunk/lib/backupstore/backupprotocol.txt	2014-10-31 22:09:34 UTC (rev 3414)
@@ -159,6 +159,7 @@
 DeleteDirectory	23	Command(Success)
 	int64		ObjectID
 
+
 UndeleteDirectory	24	Command(Success)
 	int64		ObjectID
 	# may not have exactly the desired effect if files within in have been deleted before the directory was deleted.

Modified: box/trunk/test/backupstore/testbackupstore.cpp
===================================================================
--- box/trunk/test/backupstore/testbackupstore.cpp	2014-10-31 22:09:28 UTC (rev 3413)
+++ box/trunk/test/backupstore/testbackupstore.cpp	2014-10-31 22:09:34 UTC (rev 3414)
@@ -641,7 +641,6 @@
 	TEST_THAT(en == 0);
 }
 
-
 typedef struct
 {
 	int objectsNotDel;
@@ -1159,7 +1158,7 @@
 		subdirid,
 		modtime,
 		modtime, /* use for attr hash too */
-		0,							/* diff from ID */
+		0, /* diff from ID */
 		remote_filename_encoded,
 		upload));
 
@@ -1213,11 +1212,10 @@
 	for(int l = 0; l < 3; ++l)
 	{
 		// Command
-		std::auto_ptr<BackupProtocolSuccess> dirreply(
-			apProtocol->QueryListDirectory(
-				BACKUPSTORE_ROOT_DIRECTORY_ID,
-				BackupProtocolListDirectory::Flags_INCLUDE_EVERYTHING,
-				BackupProtocolListDirectory::Flags_EXCLUDE_NOTHING, false /* no attributes */));
+		apProtocol->QueryListDirectory(
+			BACKUPSTORE_ROOT_DIRECTORY_ID,
+			BackupProtocolListDirectory::Flags_INCLUDE_EVERYTHING,
+			BackupProtocolListDirectory::Flags_EXCLUDE_NOTHING, false /* no attributes */);
 		// Stream
 		BackupStoreDirectory dir(apProtocol->ReceiveStream(),
 			apProtocol->GetTimeout());
@@ -1226,12 +1224,11 @@
 
 	// Read the dir from the readonly connection (make sure it gets in the cache)
 	// Command
-	std::auto_ptr<BackupProtocolSuccess> dirreply(
-		protocolReadOnly.QueryListDirectory(
-			BACKUPSTORE_ROOT_DIRECTORY_ID,
-			BackupProtocolListDirectory::Flags_INCLUDE_EVERYTHING,
-			BackupProtocolListDirectory::Flags_EXCLUDE_NOTHING,
-			false /* no attributes */));
+	protocolReadOnly.QueryListDirectory(
+		BACKUPSTORE_ROOT_DIRECTORY_ID,
+		BackupProtocolListDirectory::Flags_INCLUDE_EVERYTHING,
+		BackupProtocolListDirectory::Flags_EXCLUDE_NOTHING,
+		false /* no attributes */);
 	// Stream
 	BackupStoreDirectory dir(protocolReadOnly.ReceiveStream(),
 		protocolReadOnly.GetTimeout());
@@ -1501,11 +1498,11 @@
 		BOX_TRACE("Checking root directory using read-only connection");
 		{
 			// Command
-			std::auto_ptr<BackupProtocolSuccess> dirreply(
-				protocolReadOnly.QueryListDirectory(
-					BACKUPSTORE_ROOT_DIRECTORY_ID,
-					BackupProtocolListDirectory::Flags_INCLUDE_EVERYTHING,
-					BackupProtocolListDirectory::Flags_EXCLUDE_NOTHING, false /* no attributes! */)); // Stream
+			protocolReadOnly.QueryListDirectory(
+				BACKUPSTORE_ROOT_DIRECTORY_ID,
+				BackupProtocolListDirectory::Flags_INCLUDE_EVERYTHING,
+				BackupProtocolListDirectory::Flags_EXCLUDE_NOTHING,
+				false /* no attributes! */); // Stream
 			BackupStoreDirectory dir(protocolReadOnly.ReceiveStream(),
 				SHORT_TIMEOUT);
 
@@ -1541,12 +1538,12 @@
 		BOX_TRACE("Checking subdirectory using read-only connection");
 		{
 			// Command
-			std::auto_ptr<BackupProtocolSuccess> dirreply(
+			TEST_EQUAL(subdirid,
 				protocolReadOnly.QueryListDirectory(
 					subdirid,
 					BackupProtocolListDirectory::Flags_INCLUDE_EVERYTHING,
-					BackupProtocolListDirectory::Flags_EXCLUDE_NOTHING, true /* get attributes */));
-			TEST_THAT(dirreply->GetObjectID() == subdirid);
+					BackupProtocolListDirectory::Flags_EXCLUDE_NOTHING,
+					true /* get attributes */)->GetObjectID());
 			BackupStoreDirectory dir(protocolReadOnly.ReceiveStream(),
 				SHORT_TIMEOUT);
 			TEST_THAT(dir.GetNumberOfEntries() == 1);
@@ -1575,10 +1572,11 @@
 		BOX_TRACE("Checking that we don't get attributes if we don't ask for them");
 		{
 			// Command
-			std::auto_ptr<BackupProtocolSuccess> dirreply(protocolReadOnly.QueryListDirectory(
-					subdirid,
-					BackupProtocolListDirectory::Flags_INCLUDE_EVERYTHING,
-					BackupProtocolListDirectory::Flags_EXCLUDE_NOTHING, false /* no attributes! */));
+			protocolReadOnly.QueryListDirectory(
+				subdirid,
+				BackupProtocolListDirectory::Flags_INCLUDE_EVERYTHING,
+				BackupProtocolListDirectory::Flags_EXCLUDE_NOTHING,
+				false /* no attributes! */);
 			// Stream
 			BackupStoreDirectory dir(protocolReadOnly.ReceiveStream(),
 				SHORT_TIMEOUT);
@@ -1604,10 +1602,11 @@
 		// Check the new attributes
 		{
 			// Command
-			std::auto_ptr<BackupProtocolSuccess> dirreply(protocolReadOnly.QueryListDirectory(
-					subdirid,
-					0,	// no flags
-					BackupProtocolListDirectory::Flags_EXCLUDE_EVERYTHING, true /* get attributes */));
+			protocolReadOnly.QueryListDirectory(
+				subdirid,
+				0,	// no flags
+				BackupProtocolListDirectory::Flags_EXCLUDE_EVERYTHING,
+				true /* get attributes */);
 			// Stream
 			BackupStoreDirectory dir(protocolReadOnly.ReceiveStream(),
 				SHORT_TIMEOUT);
@@ -1713,10 +1712,11 @@
 			BackupStoreFilenameClear lookFor("moved-files-x");
 
 			// Command
-			std::auto_ptr<BackupProtocolSuccess> dirreply(protocolReadOnly.QueryListDirectory(
-					subdirid,
-					BackupProtocolListDirectory::Flags_INCLUDE_EVERYTHING,
-					BackupProtocolListDirectory::Flags_EXCLUDE_NOTHING, false /* no attributes */));
+			protocolReadOnly.QueryListDirectory(
+				subdirid,
+				BackupProtocolListDirectory::Flags_INCLUDE_EVERYTHING,
+				BackupProtocolListDirectory::Flags_EXCLUDE_NOTHING,
+				false /* no attributes */);
 
 			// Stream
 			BackupStoreDirectory dir(protocolReadOnly.ReceiveStream(),
@@ -1871,10 +1871,12 @@
 		// Get the root dir, checking for deleted items
 		{
 			// Command
-			std::auto_ptr<BackupProtocolSuccess> dirreply(protocolReadOnly.QueryListDirectory(
-					BACKUPSTORE_ROOT_DIRECTORY_ID,
-					BackupProtocolListDirectory::Flags_Dir | BackupProtocolListDirectory::Flags_Deleted,
-					BackupProtocolListDirectory::Flags_EXCLUDE_NOTHING, false /* no attributes */));
+			protocolReadOnly.QueryListDirectory(
+				BACKUPSTORE_ROOT_DIRECTORY_ID,
+				BackupProtocolListDirectory::Flags_Dir |
+				BackupProtocolListDirectory::Flags_Deleted,
+				BackupProtocolListDirectory::Flags_EXCLUDE_NOTHING,
+				false /* no attributes */);
 			// Stream
 			BackupStoreDirectory dir(protocolReadOnly.ReceiveStream(),
 				SHORT_TIMEOUT);
@@ -2458,7 +2460,6 @@
 	// make sure something is written to it
 	std::auto_ptr<BackupStoreAccountDatabase> apAccounts(
 		BackupStoreAccountDatabase::Read("testfiles/accounts.txt"));
-
 	std::auto_ptr<BackupStoreRefCountDatabase> apReferences(
 		BackupStoreRefCountDatabase::Load(
 			apAccounts->GetEntry(0x1234567), true));

Modified: box/trunk/test/backupstorefix/testbackupstorefix.cpp
===================================================================
--- box/trunk/test/backupstorefix/testbackupstorefix.cpp	2014-10-31 22:09:28 UTC (rev 3413)
+++ box/trunk/test/backupstorefix/testbackupstorefix.cpp	2014-10-31 22:09:34 UTC (rev 3414)
@@ -103,7 +103,7 @@
 	std::map<std::string, int32_t>::iterator i(nameToID.find(std::string(name)));
 	TEST_THAT(i != nameToID.end());
 	if(i == nameToID.end()) return -1;
-	
+
 	return i->second;
 }
 
@@ -167,11 +167,12 @@
 	int flags;
 } dir_en_check;
 
-void check_dir(BackupStoreDirectory &dir, dir_en_check *ck)
+bool check_dir(BackupStoreDirectory &dir, dir_en_check *ck)
 {
 	BackupStoreDirectory::Iterator i(dir);
 	BackupStoreDirectory::Entry *en;
-	
+	bool ok = true;
+
 	while((en = i.Next()) != 0)
 	{
 		BackupStoreFilenameClear clear(en->GetName());
@@ -186,9 +187,10 @@
 		TEST_THAT(en->GetFlags() == ck->flags);
 		++ck;
 	}
-	
-	TEST_THAT(en == 0);
-	TEST_THAT(ck->name == -1);
+
+	TEST_EQUAL_OR(en, 0, ok = false);
+	TEST_EQUAL_OR(ck->name, -1, ok = false);
+	return ok;
 }
 
 typedef struct
@@ -200,7 +202,7 @@
 {
 	BackupStoreDirectory::Iterator i(dir);
 	BackupStoreDirectory::Entry *en;
-	
+
 	while((en = i.Next()) != 0)
 	{
 		TEST_THAT(ck->id != -1);
@@ -216,7 +218,7 @@
 			"Wrong Older dependency for " << BOX_FORMAT_OBJECTID(ck->id));
 		++ck;
 	}
-	
+
 	TEST_THAT(en == 0);
 	TEST_THAT(ck->id == -1);
 }
@@ -230,7 +232,7 @@
 			2 /* id */, 1, BackupStoreDirectory::Entry::Flags_File |
 			BackupStoreDirectory::Entry::Flags_OldVersion, 2);
 		e->SetDependsNewer(3);
-		
+
 		TEST_THAT(dir.CheckAndFix() == true);
 		TEST_THAT(dir.CheckAndFix() == false);
 
@@ -237,12 +239,18 @@
 		dir_en_check ck[] = {
 			{-1, 0, 0}
 		};
-		
-		check_dir(dir, ck);
+
+		TEST_THAT(check_dir(dir, ck));
 	}
 
 	{
 		BackupStoreDirectory dir;
+		/*
+		Entry *AddEntry(const BackupStoreFilename &rName,
+			box_time_t ModificationTime, int64_t ObjectID,
+			int64_t SizeInBlocks, int16_t Flags,
+			uint64_t AttributesHash);
+		*/
 		dir.AddEntry(fnames[0], 12, 2 /* id */, 1, 
 			BackupStoreDirectory::Entry::Flags_File, 2);
 		dir.AddEntry(fnames[1], 12, 2 /* id */, 1,
@@ -252,7 +260,16 @@
 		dir.AddEntry(fnames[0], 12, 5 /* id */, 1,
 			BackupStoreDirectory::Entry::Flags_File | 
 			BackupStoreDirectory::Entry::Flags_OldVersion, 2);
-		
+
+		/*
+		typedef struct
+		{
+			int name;
+			int64_t id;
+			int flags;
+		} dir_en_check;
+		*/
+
 		dir_en_check ck[] = {
 			{1, 2, BackupStoreDirectory::Entry::Flags_File},
 			{0, 3, BackupStoreDirectory::Entry::Flags_File | BackupStoreDirectory::Entry::Flags_OldVersion},
@@ -259,7 +276,7 @@
 			{0, 5, BackupStoreDirectory::Entry::Flags_File},
 			{-1, 0, 0}
 		};
-		
+
 		TEST_THAT(dir.CheckAndFix() == true);
 		TEST_THAT(dir.CheckAndFix() == false);
 		check_dir(dir, ck);
@@ -271,7 +288,7 @@
 		dir.AddEntry(fnames[1], 12, 10 /* id */, 1, BackupStoreDirectory::Entry::Flags_File | BackupStoreDirectory::Entry::Flags_Dir | BackupStoreDirectory::Entry::Flags_OldVersion, 2);
 		dir.AddEntry(fnames[0], 12, 3 /* id */, 1, BackupStoreDirectory::Entry::Flags_File | BackupStoreDirectory::Entry::Flags_OldVersion, 2);
 		dir.AddEntry(fnames[0], 12, 5 /* id */, 1, BackupStoreDirectory::Entry::Flags_File | BackupStoreDirectory::Entry::Flags_OldVersion, 2);
-		
+
 		dir_en_check ck[] = {
 			{0, 2, BackupStoreDirectory::Entry::Flags_File | BackupStoreDirectory::Entry::Flags_OldVersion},
 			{1, 10, BackupStoreDirectory::Entry::Flags_Dir},
@@ -279,7 +296,7 @@
 			{0, 5, BackupStoreDirectory::Entry::Flags_File},
 			{-1, 0, 0}
 		};
-		
+
 		TEST_THAT(dir.CheckAndFix() == true);
 		TEST_THAT(dir.CheckAndFix() == false);
 		check_dir(dir, ck);
@@ -310,7 +327,7 @@
 			5 /* id */, 1, BackupStoreDirectory::Entry::Flags_File, 2);
 		TEST_THAT(e5 != 0);
 		e5->SetDependsOlder(4);
-		
+
 		// This should all be nice and valid
 		TEST_THAT(dir.CheckAndFix() == false);
 		static checkdepinfoen c1[] = {{2, 3, 0}, {3, 4, 2}, {4, 5, 3}, {5, 0, 4}, {-1, 0, 0}};
@@ -399,7 +416,7 @@
 	check_dir_dep(dir, start_deps);
 
 	read_bb_dir(1 /* root */, dir);
-	
+
 	// Everything should be OK at the moment
 	TEST_THAT(dir.CheckAndFix() == false);
 
@@ -419,7 +436,7 @@
 	// Check the store, check that the error is detected and
 	// repaired, by removing x1 from the directory.
 	RUN_CHECK_INTERNAL(0);
-	
+
 	// Read the directory back in, check that it's empty
 	BackupStoreDirectory dir;
 	read_bb_dir(1 /* root */, dir);
@@ -555,10 +572,10 @@
 	{
 		BackupStoreDirectory dir;
 		read_bb_dir(1 /* root */, dir);
-		
+
 		dir.AddEntry(fnames[0], 12, 0x1234567890123456LL /* id */, 1,
 			BackupStoreDirectory::Entry::Flags_File, 2);
-		
+
 		std::string fn;
 		StoreStructure::MakeObjectFilename(1 /* root */, accountRootDir,
 			discSetNum, fn, true /* EnsureDirectoryExists */);
@@ -590,7 +607,7 @@
 	}
 
 	if (failures > 0) return 1;
-	
+
 	// Generate a list of all the object IDs
 	TEST_THAT_ABORTONFAIL(::system(BBACKUPQUERY " -Wwarning "
 		"-c testfiles/bbackupd.conf \"list -R\" quit "
@@ -617,7 +634,7 @@
 		::fclose(f);
 	}
 
-	// ------------------------------------------------------------------------------------------------		
+	// ------------------------------------------------------------------------------------------------
 	BOX_INFO("  === Delete store info, add random file");
 	{
 		// Delete store info
@@ -645,7 +662,7 @@
 			accountRootDir + "01/randomfile"));
 	}
 
-	// ------------------------------------------------------------------------------------------------		
+	// ------------------------------------------------------------------------------------------------
 	BOX_INFO("  === Delete an entry for an object from dir, change that "
 		"object to be a patch, check it's deleted");
 	{
@@ -662,7 +679,7 @@
 			dir.DeleteEntry(delID);
 			SaveDirectory("Test1/cannes/ict/metegoguered", dir);
 		}
-		
+
 		// Adjust that entry
 		//
 		// IMPORTANT NOTE: There's a special hack in testbackupstorefix.pl to make sure that
@@ -784,8 +801,8 @@
 		TEST_EQUAL(RaidFileUtil::AsRaid, RaidFileUtil::RaidFileExists(
 			rdiscSet, "backup/01234567/02/01/01/o03"));
 	}
-	
-	// ------------------------------------------------------------------------------------------------		
+
+	// ------------------------------------------------------------------------------------------------
 	BOX_INFO("  === Delete directory, change container ID of another, "
 		"duplicate entry in dir, spurious file size, delete file");
 	{
@@ -824,8 +841,8 @@
 	// Delete a file
 	DeleteObject("Test1/cannes/ict/scely");
 
-	// We don't know quite how good the checker is (or will become) at 
-	// spotting errors! But asserting an exact number will help us catch 
+	// We don't know quite how good the checker is (or will become) at
+	// spotting errors! But asserting an exact number will help us catch
 	// changes in checker behaviour, so it's not a bad thing to test.
 
 	// The 11 errors are:
@@ -875,7 +892,7 @@
 		}
 	}
 
-	// ------------------------------------------------------------------------------------------------		
+	// ------------------------------------------------------------------------------------------------
 	BOX_INFO("  === Modify the obj ID of dir, delete dir with no members, "
 		"add extra reference to a file");
 	// Set bad object ID
@@ -909,11 +926,11 @@
 		LoadDirectory("Test1/foreomizes/stemptinevidate/ict", dir);
 		TEST_THAT(dir.GetObjectID() == getID("Test1/foreomizes/stemptinevidate/ict"));
 	}
-	
-	// ------------------------------------------------------------------------------------------------		
+
+	// ------------------------------------------------------------------------------------------------
 	BOX_INFO("  === Orphan files and dirs without being recoverable");
-	DeleteObject("Test1/dir1");		
-	DeleteObject("Test1/dir1/dir2");		
+	DeleteObject("Test1/dir1");
+	DeleteObject("Test1/dir1/dir2");
 	// Fix it
 	RUN_CHECK
 	// Check everything is where it is predicted to be
@@ -920,7 +937,7 @@
 	TEST_THAT(::system(PERL_EXECUTABLE 
 		" testfiles/testbackupstorefix.pl check 4") == 0);
 
-	// ------------------------------------------------------------------------------------------------		
+	// ------------------------------------------------------------------------------------------------
 	BOX_INFO("  === Corrupt file and dir");
 	// File
 	CorruptObject("Test1/foreomizes/stemptinevidate/algoughtnerge",
@@ -934,7 +951,7 @@
 	TEST_THAT(::system(PERL_EXECUTABLE 
 		" testfiles/testbackupstorefix.pl check 5") == 0);
 
-	// ------------------------------------------------------------------------------------------------		
+	// ------------------------------------------------------------------------------------------------
 	BOX_INFO("  === Overwrite root with a file");
 	{
 		std::auto_ptr<RaidFileRead> r(RaidFileRead::Open(discSetNum, getObjectName(getID("Test1/pass/shuted/brightinats/milamptimaskates"))));

Modified: box/trunk/test/basicserver/testbasicserver.cpp
===================================================================
--- box/trunk/test/basicserver/testbasicserver.cpp	2014-10-31 22:09:28 UTC (rev 3413)
+++ box/trunk/test/basicserver/testbasicserver.cpp	2014-10-31 22:09:34 UTC (rev 3414)
@@ -192,9 +192,9 @@
 	static ConfigurationVerify verifyserver[] = 
 	{
 		{
-			"Server",
-			0,
-			verifyserverkeys,
+			"Server", /* mName */
+			0, /* mpSubConfigurations */
+			verifyserverkeys, /* mpKeys */
 			ConfigTest_Exists | ConfigTest_LastEntry,
 			0
 		}
@@ -202,9 +202,9 @@
 
 	static ConfigurationVerify verify =
 	{
-		"root",
-		verifyserver,
-		0,
+		"root", /* mName */
+		verifyserver, /* mpSubConfigurations */
+		0, /* mpKeys */
 		ConfigTest_Exists | ConfigTest_LastEntry,
 		0
 	};




More information about the Boxbackup-commit mailing list