summaryrefslogtreecommitdiff
path: root/lib/backupclient
diff options
context:
space:
mode:
Diffstat (limited to 'lib/backupclient')
-rwxr-xr-xlib/backupclient/BackupClientCryptoKeys.cpp2
-rwxr-xr-xlib/backupclient/BackupClientFileAttributes.cpp20
-rwxr-xr-xlib/backupclient/BackupStoreDirectory.cpp40
-rwxr-xr-xlib/backupclient/BackupStoreFile.cpp36
-rwxr-xr-xlib/backupclient/BackupStoreFile.h2
-rw-r--r--lib/backupclient/BackupStoreFileCmbDiff.cpp16
-rw-r--r--lib/backupclient/BackupStoreFileCmbIdx.cpp10
-rwxr-xr-xlib/backupclient/BackupStoreFileCombine.cpp20
-rwxr-xr-xlib/backupclient/BackupStoreFileCryptVar.cpp2
-rwxr-xr-xlib/backupclient/BackupStoreFileCryptVar.h2
-rwxr-xr-xlib/backupclient/BackupStoreFileDiff.cpp12
-rwxr-xr-xlib/backupclient/BackupStoreFileEncodeStream.cpp22
-rw-r--r--lib/backupclient/BackupStoreFileRevDiff.cpp14
-rwxr-xr-xlib/backupclient/BackupStoreFileWire.h4
-rwxr-xr-xlib/backupclient/BackupStoreFilename.h2
-rw-r--r--lib/backupclient/BackupStoreObjectDump.cpp12
16 files changed, 108 insertions, 108 deletions
diff --git a/lib/backupclient/BackupClientCryptoKeys.cpp b/lib/backupclient/BackupClientCryptoKeys.cpp
index 015dadd2..46b77f0a 100755
--- a/lib/backupclient/BackupClientCryptoKeys.cpp
+++ b/lib/backupclient/BackupClientCryptoKeys.cpp
@@ -54,7 +54,7 @@ void BackupClientCryptoKeys_Setup(const char *KeyMaterialFilename)
// Tell the files how to encrypt
BackupStoreFile::SetBlowfishKeys(KeyMaterial + BACKUPCRYPTOKEYS_ATTRIBUTES_KEY_START, BACKUPCRYPTOKEYS_ATTRIBUTES_KEY_LENGTH,
KeyMaterial + BACKUPCRYPTOKEYS_FILE_BLOCK_ENTRY_KEY_START, BACKUPCRYPTOKEYS_FILE_BLOCK_ENTRY_KEY_LENGTH);
-#ifndef PLATFORM_OLD_OPENSSL
+#ifndef HAVE_OLD_SSL
// Use AES where available
BackupStoreFile::SetAESKey(KeyMaterial + BACKUPCRYPTOKEYS_FILE_AES_KEY_START, BACKUPCRYPTOKEYS_FILE_AES_KEY_LENGTH);
#endif
diff --git a/lib/backupclient/BackupClientFileAttributes.cpp b/lib/backupclient/BackupClientFileAttributes.cpp
index 24e90697..adc3a91c 100755
--- a/lib/backupclient/BackupClientFileAttributes.cpp
+++ b/lib/backupclient/BackupClientFileAttributes.cpp
@@ -17,7 +17,7 @@
#include <algorithm>
#include <new>
#include <vector>
-#ifdef PLATFORM_HAVE_XATTR
+#ifdef HAVE_SYS_XATTR_H
#include <cerrno>
#include <sys/xattr.h>
#endif
@@ -34,7 +34,7 @@
#include "MemLeakFindOn.h"
// set packing to one byte
-#ifdef STRUCTURE_PATCKING_FOR_WIRE_USE_HEADERS
+#ifdef STRUCTURE_PACKING_FOR_WIRE_USE_HEADERS
#include "BeginStructPackForWire.h"
#else
BEGIN_STRUCTURE_PACKING_FOR_WIRE
@@ -73,7 +73,7 @@ typedef struct
} attributeHashData;
// Use default packing
-#ifdef STRUCTURE_PATCKING_FOR_WIRE_USE_HEADERS
+#ifdef STRUCTURE_PACKING_FOR_WIRE_USE_HEADERS
#include "EndStructPackForWire.h"
#else
END_STRUCTURE_PACKING_FOR_WIRE
@@ -359,12 +359,12 @@ void BackupClientFileAttributes::FillAttributes(StreamableMemBlock &outputBlock,
}
else
{
- pattr->ModificationTime = hton64(FileModificationTime(st));
- pattr->AttrModificationTime = hton64(FileAttrModificationTime(st));
+ pattr->ModificationTime = box_hton64(FileModificationTime(st));
+ pattr->AttrModificationTime = box_hton64(FileAttrModificationTime(st));
}
pattr->Mode = htons(st.st_mode);
-#ifdef PLATFORM_stat_NO_st_flags
+#ifndef HAVE_STRUCT_STAT_ST_FLAGS
pattr->UserDefinedFlags = 0;
pattr->FileGenerationNumber = 0;
#else
@@ -413,7 +413,7 @@ void BackupClientFileAttributes::FillAttributesLink(StreamableMemBlock &outputBl
// --------------------------------------------------------------------------
void BackupClientFileAttributes::FillExtendedAttr(StreamableMemBlock &outputBlock, const char *Filename)
{
-#ifdef PLATFORM_HAVE_XATTR
+#ifdef HAVE_SYS_XATTR_H
int listBufferSize = 1000;
char* list = new char[listBufferSize];
@@ -587,7 +587,7 @@ void BackupClientFileAttributes::WriteAttributes(const char *Filename) const
// If working as root, set user IDs
if(::geteuid() == 0)
{
- #ifdef PLATFORM_LCHOWN_NOT_SUPPORTED
+ #ifndef HAVE_LCHOWN
// only if not a link, can't set their owner on this platform
if((mode & S_IFMT) != S_IFLNK)
{
@@ -617,7 +617,7 @@ void BackupClientFileAttributes::WriteAttributes(const char *Filename) const
}
// Set modification time?
- box_time_t modtime = ntoh64(pattr->ModificationTime);
+ box_time_t modtime = box_ntoh64(pattr->ModificationTime);
if(modtime != 0)
{
// Work out times as timevals
@@ -718,7 +718,7 @@ void BackupClientFileAttributes::EnsureClearAvailable() const
// --------------------------------------------------------------------------
void BackupClientFileAttributes::WriteExtendedAttr(const char *Filename, int xattrOffset) const
{
-#ifdef PLATFORM_HAVE_XATTR
+#ifdef HAVE_SYS_XATTR_H
const char* buffer = static_cast<char*>(mpClearAttributes->GetBuffer());
u_int32_t xattrBlockLength = 0;
diff --git a/lib/backupclient/BackupStoreDirectory.cpp b/lib/backupclient/BackupStoreDirectory.cpp
index 31fed78d..6b5a55d1 100755
--- a/lib/backupclient/BackupStoreDirectory.cpp
+++ b/lib/backupclient/BackupStoreDirectory.cpp
@@ -19,7 +19,7 @@
#include "MemLeakFindOn.h"
// set packing to one byte
-#ifdef STRUCTURE_PATCKING_FOR_WIRE_USE_HEADERS
+#ifdef STRUCTURE_PACKING_FOR_WIRE_USE_HEADERS
#include "BeginStructPackForWire.h"
#else
BEGIN_STRUCTURE_PACKING_FOR_WIRE
@@ -59,7 +59,7 @@ typedef struct
} en_StreamFormatDepends;
// Use default packing
-#ifdef STRUCTURE_PATCKING_FOR_WIRE_USE_HEADERS
+#ifdef STRUCTURE_PACKING_FOR_WIRE_USE_HEADERS
#include "EndStructPackForWire.h"
#else
END_STRUCTURE_PACKING_FOR_WIRE
@@ -135,9 +135,9 @@ void BackupStoreDirectory::ReadFromStream(IOStream &rStream, int Timeout)
}
// Get data
- mObjectID = ntoh64(hdr.mObjectID);
- mContainerID = ntoh64(hdr.mContainerID);
- mAttributesModTime = ntoh64(hdr.mAttributesModTime);
+ mObjectID = box_ntoh64(hdr.mObjectID);
+ mContainerID = box_ntoh64(hdr.mContainerID);
+ mAttributesModTime = box_ntoh64(hdr.mAttributesModTime);
// Options
int32_t options = ntohl(hdr.mOptionsPresent);
@@ -231,9 +231,9 @@ void BackupStoreDirectory::WriteToStream(IOStream &rStream, int16_t FlagsMustBeS
dir_StreamFormat hdr;
hdr.mMagicValue = htonl(OBJECTMAGIC_DIR_MAGIC_VALUE);
hdr.mNumEntries = htonl(count);
- hdr.mObjectID = hton64(mObjectID);
- hdr.mContainerID = hton64(mContainerID);
- hdr.mAttributesModTime = hton64(mAttributesModTime);
+ hdr.mObjectID = box_hton64(mObjectID);
+ hdr.mContainerID = box_hton64(mContainerID);
+ hdr.mAttributesModTime = box_hton64(mAttributesModTime);
hdr.mOptionsPresent = htonl(options);
// Write header
@@ -480,10 +480,10 @@ void BackupStoreDirectory::Entry::ReadFromStream(IOStream &rStream, int Timeout)
mAttributes.ReadFromStream(rStream, Timeout);
// Store the rest of the bits
- mModificationTime = ntoh64(entry.mModificationTime);
- mObjectID = ntoh64(entry.mObjectID);
- mSizeInBlocks = ntoh64(entry.mSizeInBlocks);
- mAttributesHash = ntoh64(entry.mAttributesHash);
+ mModificationTime = box_ntoh64(entry.mModificationTime);
+ mObjectID = box_ntoh64(entry.mObjectID);
+ mSizeInBlocks = box_ntoh64(entry.mSizeInBlocks);
+ mAttributesHash = box_ntoh64(entry.mAttributesHash);
mFlags = ntohs(entry.mFlags);
mName = name;
}
@@ -501,10 +501,10 @@ void BackupStoreDirectory::Entry::WriteToStream(IOStream &rStream) const
{
// Build a structure
en_StreamFormat entry;
- entry.mModificationTime = hton64(mModificationTime);
- entry.mObjectID = hton64(mObjectID);
- entry.mSizeInBlocks = hton64(mSizeInBlocks);
- entry.mAttributesHash = hton64(mAttributesHash);
+ entry.mModificationTime = box_hton64(mModificationTime);
+ entry.mObjectID = box_hton64(mObjectID);
+ entry.mSizeInBlocks = box_hton64(mSizeInBlocks);
+ entry.mAttributesHash = box_hton64(mAttributesHash);
entry.mFlags = htons(mFlags);
// Write it
@@ -536,8 +536,8 @@ void BackupStoreDirectory::Entry::ReadFromStreamDependencyInfo(IOStream &rStream
}
// Store the data
- mDependsNewer = ntoh64(depends.mDependsNewer);
- mDependsOlder = ntoh64(depends.mDependsOlder);
+ mDependsNewer = box_ntoh64(depends.mDependsNewer);
+ mDependsOlder = box_ntoh64(depends.mDependsOlder);
}
@@ -553,8 +553,8 @@ void BackupStoreDirectory::Entry::WriteToStreamDependencyInfo(IOStream &rStream)
{
// Build structure
en_StreamFormatDepends depends;
- depends.mDependsNewer = hton64(mDependsNewer);
- depends.mDependsOlder = hton64(mDependsOlder);
+ depends.mDependsNewer = box_hton64(mDependsNewer);
+ depends.mDependsOlder = box_hton64(mDependsOlder);
// Write
rStream.Write(&depends, sizeof(depends));
}
diff --git a/lib/backupclient/BackupStoreFile.cpp b/lib/backupclient/BackupStoreFile.cpp
index e1a8fde7..d31b53bb 100755
--- a/lib/backupclient/BackupStoreFile.cpp
+++ b/lib/backupclient/BackupStoreFile.cpp
@@ -154,7 +154,7 @@ bool BackupStoreFile::VerifyEncodedFileFormat(IOStream &rFile, int64_t *pDiffFro
int64_t headerEnd = rFile.GetPosition();
// Get number of blocks
- int64_t numBlocks = ntoh64(hdr.mNumBlocks);
+ int64_t numBlocks = box_ntoh64(hdr.mNumBlocks);
// Calculate where the block index will be, check it's reasonable
int64_t blockIndexLoc = fileSize - ((numBlocks * sizeof(file_BlockIndexEntry)) + sizeof(file_BlockIndexHeader));
@@ -179,7 +179,7 @@ bool BackupStoreFile::VerifyEncodedFileFormat(IOStream &rFile, int64_t *pDiffFro
&& ntohl(blkhdr.mMagicValue) != OBJECTMAGIC_FILE_BLOCKS_MAGIC_VALUE_V0
#endif
)
- || (int64_t)ntoh64(blkhdr.mNumBlocks) != numBlocks)
+ || (int64_t)box_ntoh64(blkhdr.mNumBlocks) != numBlocks)
{
// Bad header -- either magic value or number of blocks is wrong
return false;
@@ -201,7 +201,7 @@ bool BackupStoreFile::VerifyEncodedFileFormat(IOStream &rFile, int64_t *pDiffFro
}
// Check size and location
- int64_t blkSize = ntoh64(blk.mEncodedSize);
+ int64_t blkSize = box_ntoh64(blk.mEncodedSize);
if(blkSize <= 0)
{
// Mark that this file references another file
@@ -228,7 +228,7 @@ bool BackupStoreFile::VerifyEncodedFileFormat(IOStream &rFile, int64_t *pDiffFro
}
// Check that if another block is references, then the ID is there, and if one isn't there is no ID.
- int64_t otherID = ntoh64(blkhdr.mOtherFileID);
+ int64_t otherID = box_ntoh64(blkhdr.mOtherFileID);
if((otherID != 0 && blockFromOtherFileReferenced == false)
|| (otherID == 0 && blockFromOtherFileReferenced == true))
{
@@ -245,7 +245,7 @@ bool BackupStoreFile::VerifyEncodedFileFormat(IOStream &rFile, int64_t *pDiffFro
// Does the caller want the container ID?
if(pContainerIDOut)
{
- *pContainerIDOut = ntoh64(hdr.mContainerID);
+ *pContainerIDOut = box_ntoh64(hdr.mContainerID);
}
// Passes all tests
@@ -494,7 +494,7 @@ void BackupStoreFile::DecodedStream::Setup(const BackupClientFileAttributes *pAl
int64_t endOfHeaderPos = mrEncodedFile.GetPosition();
// Work out where the index is
- int64_t numBlocks = ntoh64(hdr.mNumBlocks);
+ int64_t numBlocks = box_ntoh64(hdr.mNumBlocks);
int64_t blockHeaderPos = fileSize - ((numBlocks * sizeof(file_BlockIndexEntry)) + sizeof(file_BlockIndexHeader));
// Seek to that position
@@ -508,7 +508,7 @@ void BackupStoreFile::DecodedStream::Setup(const BackupClientFileAttributes *pAl
}
// Check view of blocks from block header and file header match
- if(mNumBlocks != (int64_t)ntoh64(hdr.mNumBlocks))
+ if(mNumBlocks != (int64_t)box_ntoh64(hdr.mNumBlocks))
{
THROW_EXCEPTION(BackupStoreException, BadBackupStoreFile)
}
@@ -523,7 +523,7 @@ void BackupStoreFile::DecodedStream::Setup(const BackupClientFileAttributes *pAl
for(int64_t e = 0; e < mNumBlocks; e++)
{
// Get the clear and encoded size
- int32_t encodedSize = ntoh64(entry[e].mEncodedSize);
+ int32_t encodedSize = box_ntoh64(entry[e].mEncodedSize);
ASSERT(encodedSize > 0);
// Larger?
@@ -587,10 +587,10 @@ void BackupStoreFile::DecodedStream::ReadBlockIndex(bool MagicAlreadyRead)
}
// Get the number of blocks out of the header
- mNumBlocks = ntoh64(blkhdr.mNumBlocks);
+ mNumBlocks = box_ntoh64(blkhdr.mNumBlocks);
// Read the IV base
- mEntryIVBase = ntoh64(blkhdr.mEntryIVBase);
+ mEntryIVBase = box_ntoh64(blkhdr.mEntryIVBase);
// Load the block entries in?
if(mNumBlocks > 0)
@@ -673,7 +673,7 @@ int BackupStoreFile::DecodedStream::Read(void *pBuffer, int NBytes, int Timeout)
// Get the size from the block index
const file_BlockIndexEntry *entry = (file_BlockIndexEntry *)mpBlockIndex;
- int32_t encodedSize = ntoh64(entry[mCurrentBlock].mEncodedSize);
+ int32_t encodedSize = box_ntoh64(entry[mCurrentBlock].mEncodedSize);
if(encodedSize <= 0)
{
// The caller is attempting to decode a file which is the direct result of a diff
@@ -697,7 +697,7 @@ int BackupStoreFile::DecodedStream::Read(void *pBuffer, int NBytes, int Timeout)
iv += mCurrentBlock;
// Convert to network byte order before encrypting with it, so that restores work on
// platforms with different endiannesses.
- iv = hton64(iv);
+ iv = box_hton64(iv);
sBlowfishDecryptBlockEntry.SetIV(&iv);
// Decrypt the encrypted section
@@ -865,7 +865,7 @@ void BackupStoreFile::SetBlowfishKeys(const void *pKey, int KeyLength, const voi
}
-#ifndef PLATFORM_OLD_OPENSSL
+#ifndef HAVE_OLD_SSL
// --------------------------------------------------------------------------
//
// Function
@@ -1036,7 +1036,7 @@ int BackupStoreFile::DecodeChunk(const void *Encoded, int EncodedSize, void *Out
THROW_EXCEPTION(BackupStoreException, ChunkHasUnknownEncoding)
}
-#ifndef PLATFORM_OLD_OPENSSL
+#ifndef HAVE_OLD_SSL
// Choose cipher
CipherContext &cipher((encodingType == HEADER_AES_ENCODING)?sAESDecrypt:sBlowfishDecrypt);
#else
@@ -1177,7 +1177,7 @@ std::auto_ptr<IOStream> BackupStoreFile::ReorderFileToStreamOrder(IOStream *pStr
}
// Get number of blocks
- int64_t numBlocks = ntoh64(hdr.mNumBlocks);
+ int64_t numBlocks = box_ntoh64(hdr.mNumBlocks);
// Calculate where the block index will be, check it's reasonable
int64_t blockIndexSize = ((numBlocks * sizeof(file_BlockIndexEntry)) + sizeof(file_BlockIndexHeader));
@@ -1277,8 +1277,8 @@ bool BackupStoreFile::CompareFileContentsAgainstBlockIndex(const char *Filename,
#endif
// Get basic information
- int64_t numBlocks = ntoh64(hdr.mNumBlocks);
- uint64_t entryIVBase = ntoh64(hdr.mEntryIVBase);
+ int64_t numBlocks = box_ntoh64(hdr.mNumBlocks);
+ uint64_t entryIVBase = box_ntoh64(hdr.mEntryIVBase);
//TODO: Verify that these sizes look reasonable
@@ -1303,7 +1303,7 @@ bool BackupStoreFile::CompareFileContentsAgainstBlockIndex(const char *Filename,
// Calculate IV for this entry
uint64_t iv = entryIVBase;
iv += b;
- iv = hton64(iv);
+ iv = box_hton64(iv);
#ifndef BOX_DISABLE_BACKWARDS_COMPATIBILITY_BACKUPSTOREFILE
if(isOldVersion)
{
diff --git a/lib/backupclient/BackupStoreFile.h b/lib/backupclient/BackupStoreFile.h
index de37e8c8..627de4ce 100755
--- a/lib/backupclient/BackupStoreFile.h
+++ b/lib/backupclient/BackupStoreFile.h
@@ -113,7 +113,7 @@ public:
// Crypto setup
static void SetBlowfishKeys(const void *pKey, int KeyLength, const void *pBlockEntryKey, int BlockEntryKeyLength);
-#ifndef PLATFORM_OLD_OPENSSL
+#ifndef HAVE_OLD_SSL
static void SetAESKey(const void *pKey, int KeyLength);
#endif
diff --git a/lib/backupclient/BackupStoreFileCmbDiff.cpp b/lib/backupclient/BackupStoreFileCmbDiff.cpp
index 039b00eb..1a88fa3f 100644
--- a/lib/backupclient/BackupStoreFileCmbDiff.cpp
+++ b/lib/backupclient/BackupStoreFileCmbDiff.cpp
@@ -63,7 +63,7 @@ void BackupStoreFile::CombineDiffs(IOStream &rDiff1, IOStream &rDiff2, IOStream
// Record position
diff1DataStarts = rDiff1.GetPosition();
// Skip to index
- rDiff1.Seek(0 - (((ntoh64(diff1Hdr.mNumBlocks)) * sizeof(file_BlockIndexEntry)) + sizeof(file_BlockIndexHeader)), IOStream::SeekType_End);
+ rDiff1.Seek(0 - (((box_ntoh64(diff1Hdr.mNumBlocks)) * sizeof(file_BlockIndexEntry)) + sizeof(file_BlockIndexHeader)), IOStream::SeekType_End);
}
// Read the index of the first diff
@@ -77,7 +77,7 @@ void BackupStoreFile::CombineDiffs(IOStream &rDiff1, IOStream &rDiff2, IOStream
{
THROW_EXCEPTION(BackupStoreException, BadBackupStoreFile)
}
- int64_t diff1NumBlocks = ntoh64(diff1IdxHdr.mNumBlocks);
+ int64_t diff1NumBlocks = box_ntoh64(diff1IdxHdr.mNumBlocks);
// Allocate some memory
int64_t *diff1BlockStartPositions = (int64_t*)::malloc((diff1NumBlocks + 1) * sizeof(int64_t));
if(diff1BlockStartPositions == 0)
@@ -106,7 +106,7 @@ void BackupStoreFile::CombineDiffs(IOStream &rDiff1, IOStream &rDiff2, IOStream
}
// Where's the block?
- int64_t blockEn = ntoh64(e.mEncodedSize);
+ int64_t blockEn = box_ntoh64(e.mEncodedSize);
if(blockEn <= 0)
{
// Just store the negated block number
@@ -157,7 +157,7 @@ void BackupStoreFile::CombineDiffs(IOStream &rDiff1, IOStream &rDiff2, IOStream
{
THROW_EXCEPTION(BackupStoreException, BadBackupStoreFile)
}
- int64_t diff2NumBlocks = ntoh64(diff2IdxHdr.mNumBlocks);
+ int64_t diff2NumBlocks = box_ntoh64(diff2IdxHdr.mNumBlocks);
int64_t diff2IndexEntriesStart = rDiff2b.GetPosition();
// Then read all the entries
@@ -177,7 +177,7 @@ void BackupStoreFile::CombineDiffs(IOStream &rDiff1, IOStream &rDiff2, IOStream
bool fromFileDiff1 = false;
// Where's the block?
- int64_t blockEn = ntoh64(e.mEncodedSize);
+ int64_t blockEn = box_ntoh64(e.mEncodedSize);
if(blockEn > 0)
{
// Block is present in this file -- copy to out
@@ -274,7 +274,7 @@ void BackupStoreFile::CombineDiffs(IOStream &rDiff1, IOStream &rDiff2, IOStream
}
// Where's the block?
- int64_t blockEn = ntoh64(e.mEncodedSize);
+ int64_t blockEn = box_ntoh64(e.mEncodedSize);
// If it's not in this file, it needs modification...
if(blockEn <= 0)
@@ -292,12 +292,12 @@ void BackupStoreFile::CombineDiffs(IOStream &rDiff1, IOStream &rDiff2, IOStream
ASSERT(nb <= diff1NumBlocks);
}
int64_t size = diff1BlockStartPositions[nb] - diff1BlockStartPositions[blockIndex];
- e.mEncodedSize = hton64(size);
+ e.mEncodedSize = box_hton64(size);
}
else
{
// Block in the original file, use translated value
- e.mEncodedSize = hton64(diff1BlockStartPositions[blockIndex]);
+ e.mEncodedSize = box_hton64(diff1BlockStartPositions[blockIndex]);
}
}
diff --git a/lib/backupclient/BackupStoreFileCmbIdx.cpp b/lib/backupclient/BackupStoreFileCmbIdx.cpp
index 253001c2..c8bcc3b9 100644
--- a/lib/backupclient/BackupStoreFileCmbIdx.cpp
+++ b/lib/backupclient/BackupStoreFileCmbIdx.cpp
@@ -156,10 +156,10 @@ void BSFCombinedIndexStream::Initialise(IOStream &rFrom)
}
// Read relevant data.
- mNumEntriesToGo = ntoh64(mHeader.mNumBlocks);
+ mNumEntriesToGo = box_ntoh64(mHeader.mNumBlocks);
// Adjust a bit to reflect the fact it's no longer a diff
- mHeader.mOtherFileID = hton64(0);
+ mHeader.mOtherFileID = box_hton64(0);
// Now look at the from file: Read header
file_BlockIndexHeader fromHdr;
@@ -173,7 +173,7 @@ void BSFCombinedIndexStream::Initialise(IOStream &rFrom)
}
// Then... allocate memory for the list of sizes
- mNumEntriesInFromFile = ntoh64(fromHdr.mNumBlocks);
+ mNumEntriesInFromFile = box_ntoh64(fromHdr.mNumBlocks);
mFromBlockSizes = (int64_t*)::malloc(mNumEntriesInFromFile * sizeof(int64_t));
if(mFromBlockSizes == 0)
{
@@ -190,7 +190,7 @@ void BSFCombinedIndexStream::Initialise(IOStream &rFrom)
}
// Check that the from file isn't a delta in itself
- if(ntoh64(e.mEncodedSize) <= 0)
+ if(box_ntoh64(e.mEncodedSize) <= 0)
{
THROW_EXCEPTION(BackupStoreException, OnCombineFromFileIsIncomplete)
}
@@ -256,7 +256,7 @@ int BSFCombinedIndexStream::Read(void *pBuffer, int NBytes, int Timeout)
}
// Does this need adjusting?
- int s = ntoh64(poutput[b].mEncodedSize);
+ int s = box_ntoh64(poutput[b].mEncodedSize);
if(s <= 0)
{
// A reference to a block in the from file
diff --git a/lib/backupclient/BackupStoreFileCombine.cpp b/lib/backupclient/BackupStoreFileCombine.cpp
index 562a32d9..baa331f0 100755
--- a/lib/backupclient/BackupStoreFileCombine.cpp
+++ b/lib/backupclient/BackupStoreFileCombine.cpp
@@ -94,7 +94,7 @@ void BackupStoreFile::CombineFile(IOStream &rDiff, IOStream &rDiff2, IOStream &r
}
// Allocate memory for the block index of the From file
- int64_t fromNumBlocks = ntoh64(fromHdr.mNumBlocks);
+ int64_t fromNumBlocks = box_ntoh64(fromHdr.mNumBlocks);
// NOTE: An extra entry is required so that the length of the last block can be calculated
FromIndexEntry *pFromIndex = (FromIndexEntry*)::malloc((fromNumBlocks+1) * sizeof(FromIndexEntry));
if(pFromIndex == 0)
@@ -110,7 +110,7 @@ void BackupStoreFile::CombineFile(IOStream &rDiff, IOStream &rDiff2, IOStream &r
// Read in the block index of the Diff file in small chunks, and output data
// for each block, either from this file, or the other file.
- int64_t diffNumBlocks = ntoh64(hdr.mNumBlocks);
+ int64_t diffNumBlocks = box_ntoh64(hdr.mNumBlocks);
CopyData(rDiff /* positioned at start of data */, rDiff2, diffNumBlocks, rFrom, pFromIndex, fromNumBlocks, rOut);
// Read in the block index again, and output the new block index, simply
@@ -160,7 +160,7 @@ static void LoadFromIndex(IOStream &rFrom, FromIndexEntry *pIndex, int64_t NumEn
THROW_EXCEPTION(BackupStoreException, FailedToReadBlockOnCombine)
}
if(ntohl(blkhdr.mMagicValue) != OBJECTMAGIC_FILE_BLOCKS_MAGIC_VALUE_V1
- || (int64_t)ntoh64(blkhdr.mNumBlocks) != NumEntries)
+ || (int64_t)box_ntoh64(blkhdr.mNumBlocks) != NumEntries)
{
THROW_EXCEPTION(BackupStoreException, BadBackupStoreFile)
}
@@ -179,7 +179,7 @@ static void LoadFromIndex(IOStream &rFrom, FromIndexEntry *pIndex, int64_t NumEn
pIndex[b].mFilePosition = filePos;
// Encoded size?
- int64_t encodedSize = ntoh64(en.mEncodedSize);
+ int64_t encodedSize = box_ntoh64(en.mEncodedSize);
// Check that the block is actually there
if(encodedSize <= 0)
{
@@ -220,7 +220,7 @@ static void CopyData(IOStream &rDiffData, IOStream &rDiffIndex, int64_t DiffNumB
THROW_EXCEPTION(BackupStoreException, FailedToReadBlockOnCombine)
}
if(ntohl(diffBlkhdr.mMagicValue) != OBJECTMAGIC_FILE_BLOCKS_MAGIC_VALUE_V1
- || (int64_t)ntoh64(diffBlkhdr.mNumBlocks) != DiffNumBlocks)
+ || (int64_t)box_ntoh64(diffBlkhdr.mNumBlocks) != DiffNumBlocks)
{
THROW_EXCEPTION(BackupStoreException, BadBackupStoreFile)
}
@@ -245,7 +245,7 @@ static void CopyData(IOStream &rDiffData, IOStream &rDiffIndex, int64_t DiffNumB
}
// What's the size value stored in the entry
- int64_t encodedSize = ntoh64(en.mEncodedSize);
+ int64_t encodedSize = box_ntoh64(en.mEncodedSize);
// How much data will be read?
int32_t blockSize = 0;
@@ -362,13 +362,13 @@ static void WriteNewIndex(IOStream &rDiff, int64_t DiffNumBlocks, FromIndexEntry
THROW_EXCEPTION(BackupStoreException, FailedToReadBlockOnCombine)
}
if(ntohl(diffBlkhdr.mMagicValue) != OBJECTMAGIC_FILE_BLOCKS_MAGIC_VALUE_V1
- || (int64_t)ntoh64(diffBlkhdr.mNumBlocks) != DiffNumBlocks)
+ || (int64_t)box_ntoh64(diffBlkhdr.mNumBlocks) != DiffNumBlocks)
{
THROW_EXCEPTION(BackupStoreException, BadBackupStoreFile)
}
// Write it out with a blanked out other file ID
- diffBlkhdr.mOtherFileID = hton64(0);
+ diffBlkhdr.mOtherFileID = box_hton64(0);
rOut.Write(&diffBlkhdr, sizeof(diffBlkhdr));
// Rewrite the index
@@ -381,7 +381,7 @@ static void WriteNewIndex(IOStream &rDiff, int64_t DiffNumBlocks, FromIndexEntry
}
// What's the size value stored in the entry
- int64_t encodedSize = ntoh64(en.mEncodedSize);
+ int64_t encodedSize = box_ntoh64(en.mEncodedSize);
// Need to adjust it?
if(encodedSize <= 0)
@@ -396,7 +396,7 @@ static void WriteNewIndex(IOStream &rDiff, int64_t DiffNumBlocks, FromIndexEntry
// Calculate size. This operation is safe because of the extra entry at the end
int32_t blockSize = pFromIndex[blockIdx + 1].mFilePosition - pFromIndex[blockIdx].mFilePosition;
// Then replace entry
- en.mEncodedSize = hton64(((uint64_t)blockSize));
+ en.mEncodedSize = box_hton64(((uint64_t)blockSize));
}
// Write entry
diff --git a/lib/backupclient/BackupStoreFileCryptVar.cpp b/lib/backupclient/BackupStoreFileCryptVar.cpp
index eeed64e4..e826de4e 100755
--- a/lib/backupclient/BackupStoreFileCryptVar.cpp
+++ b/lib/backupclient/BackupStoreFileCryptVar.cpp
@@ -17,7 +17,7 @@
CipherContext BackupStoreFileCryptVar::sBlowfishEncrypt;
CipherContext BackupStoreFileCryptVar::sBlowfishDecrypt;
-#ifndef PLATFORM_OLD_OPENSSL
+#ifndef HAVE_OLD_SSL
CipherContext BackupStoreFileCryptVar::sAESEncrypt;
CipherContext BackupStoreFileCryptVar::sAESDecrypt;
#endif
diff --git a/lib/backupclient/BackupStoreFileCryptVar.h b/lib/backupclient/BackupStoreFileCryptVar.h
index 00a34f71..566813c8 100755
--- a/lib/backupclient/BackupStoreFileCryptVar.h
+++ b/lib/backupclient/BackupStoreFileCryptVar.h
@@ -22,7 +22,7 @@ namespace BackupStoreFileCryptVar
extern CipherContext sBlowfishEncrypt;
extern CipherContext sBlowfishDecrypt;
// Use AES when available
-#ifndef PLATFORM_OLD_OPENSSL
+#ifndef HAVE_OLD_SSL
extern CipherContext sAESEncrypt;
extern CipherContext sAESDecrypt;
#endif
diff --git a/lib/backupclient/BackupStoreFileDiff.cpp b/lib/backupclient/BackupStoreFileDiff.cpp
index 22395151..3699eb49 100755
--- a/lib/backupclient/BackupStoreFileDiff.cpp
+++ b/lib/backupclient/BackupStoreFileDiff.cpp
@@ -105,7 +105,7 @@ void BackupStoreFile::MoveStreamPositionToBlockIndex(IOStream &rStream)
}
// Work out where the index is
- int64_t numBlocks = ntoh64(hdr.mNumBlocks);
+ int64_t numBlocks = box_ntoh64(hdr.mNumBlocks);
int64_t blockHeaderPosFromEnd = ((numBlocks * sizeof(file_BlockIndexEntry)) + sizeof(file_BlockIndexHeader));
// Sanity check
@@ -298,7 +298,7 @@ static void LoadIndex(IOStream &rBlockIndex, int64_t ThisID, BlocksAvailableEntr
}
// Check that we're not trying to diff against a file which references blocks from another file
- if(((int64_t)ntoh64(hdr.mOtherFileID)) != 0)
+ if(((int64_t)box_ntoh64(hdr.mOtherFileID)) != 0)
{
THROW_EXCEPTION(BackupStoreException, CannotDiffAnIncompleteStoreFile)
}
@@ -307,8 +307,8 @@ static void LoadIndex(IOStream &rBlockIndex, int64_t ThisID, BlocksAvailableEntr
rCanDiffFromThis = true;
// Get basic information
- int64_t numBlocks = ntoh64(hdr.mNumBlocks);
- uint64_t entryIVBase = ntoh64(hdr.mEntryIVBase);
+ int64_t numBlocks = box_ntoh64(hdr.mNumBlocks);
+ uint64_t entryIVBase = box_ntoh64(hdr.mEntryIVBase);
//TODO: Verify that these sizes look reasonable
@@ -335,7 +335,7 @@ static void LoadIndex(IOStream &rBlockIndex, int64_t ThisID, BlocksAvailableEntr
uint64_t iv = entryIVBase;
iv += b;
// Network byte order
- iv = hton64(iv);
+ iv = box_hton64(iv);
sBlowfishDecryptBlockEntry.SetIV(&iv);
// Decrypt the encrypted section
@@ -348,7 +348,7 @@ static void LoadIndex(IOStream &rBlockIndex, int64_t ThisID, BlocksAvailableEntr
}
// Check that we're not trying to diff against a file which references blocks from another file
- if(((int64_t)ntoh64(entry.mEncodedSize)) <= 0)
+ if(((int64_t)box_ntoh64(entry.mEncodedSize)) <= 0)
{
THROW_EXCEPTION(BackupStoreException, CannotDiffAnIncompleteStoreFile)
}
diff --git a/lib/backupclient/BackupStoreFileEncodeStream.cpp b/lib/backupclient/BackupStoreFileEncodeStream.cpp
index 20e1fd80..c692f18e 100755
--- a/lib/backupclient/BackupStoreFileEncodeStream.cpp
+++ b/lib/backupclient/BackupStoreFileEncodeStream.cpp
@@ -178,9 +178,9 @@ void BackupStoreFileEncodeStream::Setup(const char *Filename, BackupStoreFileEnc
// Header
file_StreamFormat hdr;
hdr.mMagicValue = htonl(OBJECTMAGIC_FILE_MAGIC_VALUE_V1);
- hdr.mNumBlocks = (mSendData)?(hton64(mTotalBlocks)):(0);
- hdr.mContainerID = hton64(ContainerID);
- hdr.mModificationTime = hton64(modTime);
+ hdr.mNumBlocks = (mSendData)?(box_hton64(mTotalBlocks)):(0);
+ hdr.mContainerID = box_hton64(ContainerID);
+ hdr.mModificationTime = box_hton64(modTime);
// add a bit to make it harder to tell what's going on -- try not to give away too much info about file size
hdr.mMaxBlockClearSize = htonl(maxBlockClearSize + 128);
hdr.mOptions = 0; // no options defined yet
@@ -221,9 +221,9 @@ void BackupStoreFileEncodeStream::Setup(const char *Filename, BackupStoreFileEnc
// Write an empty block index for the symlink
file_BlockIndexHeader blkhdr;
blkhdr.mMagicValue = htonl(OBJECTMAGIC_FILE_BLOCKS_MAGIC_VALUE_V1);
- blkhdr.mOtherFileID = hton64(0); // not other file ID
- blkhdr.mEntryIVBase = hton64(0);
- blkhdr.mNumBlocks = hton64(0);
+ blkhdr.mOtherFileID = box_hton64(0); // not other file ID
+ blkhdr.mEntryIVBase = box_hton64(0);
+ blkhdr.mNumBlocks = box_hton64(0);
mData.Write(&blkhdr, sizeof(blkhdr));
}
@@ -338,12 +338,12 @@ int BackupStoreFileEncodeStream::Read(void *pBuffer, int NBytes, int Timeout)
file_BlockIndexHeader blkhdr;
blkhdr.mMagicValue = htonl(OBJECTMAGIC_FILE_BLOCKS_MAGIC_VALUE_V1);
ASSERT(mpRecipe != 0);
- blkhdr.mOtherFileID = hton64(mpRecipe->GetOtherFileID());
- blkhdr.mNumBlocks = hton64(mTotalBlocks);
+ blkhdr.mOtherFileID = box_hton64(mpRecipe->GetOtherFileID());
+ blkhdr.mNumBlocks = box_hton64(mTotalBlocks);
// Generate the IV base
Random::Generate(&mEntryIVBase, sizeof(mEntryIVBase));
- blkhdr.mEntryIVBase = hton64(mEntryIVBase);
+ blkhdr.mEntryIVBase = box_hton64(mEntryIVBase);
mData.Write(&blkhdr, sizeof(blkhdr));
}
@@ -568,7 +568,7 @@ void BackupStoreFileEncodeStream::StoreBlockIndexEntry(int64_t EncSizeOrBlkIndex
// Then the clear section
file_BlockIndexEntry entry;
- entry.mEncodedSize = hton64(((uint64_t)EncSizeOrBlkIndex));
+ entry.mEncodedSize = box_hton64(((uint64_t)EncSizeOrBlkIndex));
// Then encrypt the encryted section
// Generate the IV from the block number
@@ -580,7 +580,7 @@ void BackupStoreFileEncodeStream::StoreBlockIndexEntry(int64_t EncSizeOrBlkIndex
iv += mAbsoluteBlockNumber;
// Convert to network byte order before encrypting with it, so that restores work on
// platforms with different endiannesses.
- iv = hton64(iv);
+ iv = box_hton64(iv);
sBlowfishEncryptBlockEntry.SetIV(&iv);
// Encode the data
diff --git a/lib/backupclient/BackupStoreFileRevDiff.cpp b/lib/backupclient/BackupStoreFileRevDiff.cpp
index f1dc52d8..509eef61 100644
--- a/lib/backupclient/BackupStoreFileRevDiff.cpp
+++ b/lib/backupclient/BackupStoreFileRevDiff.cpp
@@ -59,7 +59,7 @@ void BackupStoreFile::ReverseDiffFile(IOStream &rDiff, IOStream &rFrom, IOStream
// Build an index of common blocks.
// For each block in the from file, we want to know it's index in the
// diff file. Allocate memory for this information.
- int64_t fromNumBlocks = ntoh64(hdr.mNumBlocks);
+ int64_t fromNumBlocks = box_ntoh64(hdr.mNumBlocks);
int64_t *pfromIndexInfo = (int64_t*)::malloc(fromNumBlocks * sizeof(int64_t));
if(pfromIndexInfo == 0)
{
@@ -96,7 +96,7 @@ void BackupStoreFile::ReverseDiffFile(IOStream &rDiff, IOStream &rFrom, IOStream
}
// And then read in each entry
- int64_t diffNumBlocks = ntoh64(diffIdxHdr.mNumBlocks);
+ int64_t diffNumBlocks = box_ntoh64(diffIdxHdr.mNumBlocks);
for(int64_t b = 0; b < diffNumBlocks; ++b)
{
file_BlockIndexEntry e;
@@ -106,7 +106,7 @@ void BackupStoreFile::ReverseDiffFile(IOStream &rDiff, IOStream &rFrom, IOStream
}
// Where's the block?
- int64_t blockEn = ntoh64(e.mEncodedSize);
+ int64_t blockEn = box_ntoh64(e.mEncodedSize);
if(blockEn > 0)
{
// Block is in the delta file, is ignored for now -- not relevant to rebuilding the from file
@@ -136,7 +136,7 @@ void BackupStoreFile::ReverseDiffFile(IOStream &rDiff, IOStream &rFrom, IOStream
THROW_EXCEPTION(BackupStoreException, CouldntReadEntireStructureFromStream)
}
if(ntohl(fromIdxHdr.mMagicValue) != OBJECTMAGIC_FILE_BLOCKS_MAGIC_VALUE_V1
- || ntoh64(fromIdxHdr.mOtherFileID) != 0)
+ || box_ntoh64(fromIdxHdr.mOtherFileID) != 0)
{
THROW_EXCEPTION(BackupStoreException, BadBackupStoreFile)
}
@@ -153,7 +153,7 @@ void BackupStoreFile::ReverseDiffFile(IOStream &rDiff, IOStream &rFrom, IOStream
}
// Get size
- int64_t blockSize = hton64(e.mEncodedSize);
+ int64_t blockSize = box_hton64(e.mEncodedSize);
if(blockSize < 0)
{
THROW_EXCEPTION(BackupStoreException, BadBackupStoreFile)
@@ -204,7 +204,7 @@ void BackupStoreFile::ReverseDiffFile(IOStream &rDiff, IOStream &rFrom, IOStream
}
// Then write the index, modified header first
- fromIdxHdr.mOtherFileID = isCompletelyDifferent?0:(hton64(ObjectIDOfFrom));
+ fromIdxHdr.mOtherFileID = isCompletelyDifferent?0:(box_hton64(ObjectIDOfFrom));
rOut.Write(&fromIdxHdr, sizeof(fromIdxHdr));
// Move to start of index entries
@@ -225,7 +225,7 @@ void BackupStoreFile::ReverseDiffFile(IOStream &rDiff, IOStream &rFrom, IOStream
// Adjust to reflect real block index (remember 0 has a different meaning here)
if(s < 0) ++s;
// Insert
- e.mEncodedSize = hton64(s);
+ e.mEncodedSize = box_hton64(s);
// Write
rOut.Write(&e, sizeof(e));
}
diff --git a/lib/backupclient/BackupStoreFileWire.h b/lib/backupclient/BackupStoreFileWire.h
index 5b1bc819..49e94aa5 100755
--- a/lib/backupclient/BackupStoreFileWire.h
+++ b/lib/backupclient/BackupStoreFileWire.h
@@ -13,7 +13,7 @@
#include "MD5Digest.h"
// set packing to one byte
-#ifdef STRUCTURE_PATCKING_FOR_WIRE_USE_HEADERS
+#ifdef STRUCTURE_PACKING_FOR_WIRE_USE_HEADERS
#include "BeginStructPackForWire.h"
#else
BEGIN_STRUCTURE_PACKING_FOR_WIRE
@@ -57,7 +57,7 @@ typedef struct
} file_BlockIndexEntry;
// Use default packing
-#ifdef STRUCTURE_PATCKING_FOR_WIRE_USE_HEADERS
+#ifdef STRUCTURE_PACKING_FOR_WIRE_USE_HEADERS
#include "EndStructPackForWire.h"
#else
END_STRUCTURE_PACKING_FOR_WIRE
diff --git a/lib/backupclient/BackupStoreFilename.h b/lib/backupclient/BackupStoreFilename.h
index 4c951b6f..a7b6c437 100755
--- a/lib/backupclient/BackupStoreFilename.h
+++ b/lib/backupclient/BackupStoreFilename.h
@@ -30,7 +30,7 @@ class IOStream;
// If this is changed, change GetClearFilename() back to returning a reference.
#else
typedef std::string BackupStoreFilename_base;
-#endif // PLATFORM_HAVE_STL_MALLOC_ALLOC
+#endif
// --------------------------------------------------------------------------
//
diff --git a/lib/backupclient/BackupStoreObjectDump.cpp b/lib/backupclient/BackupStoreObjectDump.cpp
index caa0e82f..5f902831 100644
--- a/lib/backupclient/BackupStoreObjectDump.cpp
+++ b/lib/backupclient/BackupStoreObjectDump.cpp
@@ -152,9 +152,9 @@ void BackupStoreFile::DumpFile(void *clibFileHandle, bool ToTrace, IOStream &rFi
}
OutputLine(file, ToTrace, "File object.\nContainer ID: %llx\nModification time: %llx\n"\
- "Max block clear size: %d\nOptions: %08x\nNum blocks: %d\n", ntoh64(hdr.mContainerID),
- ntoh64(hdr.mModificationTime), ntohl(hdr.mMaxBlockClearSize), ntohl(hdr.mOptions),
- ntoh64(hdr.mNumBlocks));
+ "Max block clear size: %d\nOptions: %08x\nNum blocks: %d\n", box_ntoh64(hdr.mContainerID),
+ box_ntoh64(hdr.mModificationTime), ntohl(hdr.mMaxBlockClearSize), ntohl(hdr.mOptions),
+ box_ntoh64(hdr.mNumBlocks));
// Read the next two objects
BackupStoreFilename fn;
@@ -178,9 +178,9 @@ void BackupStoreFile::DumpFile(void *clibFileHandle, bool ToTrace, IOStream &rFi
OutputLine(file, ToTrace, "WARNING: Block header doesn't have the correct magic\n");
}
// number of blocks
- int64_t nblocks = ntoh64(bhdr.mNumBlocks);
+ int64_t nblocks = box_ntoh64(bhdr.mNumBlocks);
OutputLine(file, ToTrace, "Other file ID (for block refs): %llx\nNum blocks (in blk hdr): %lld\n",
- ntoh64(bhdr.mOtherFileID), nblocks);
+ box_ntoh64(bhdr.mOtherFileID), nblocks);
// Dump info about each block
OutputLine(file, ToTrace, "======== ===== ==========\n Index Where EncSz/Idx\n");
@@ -193,7 +193,7 @@ void BackupStoreFile::DumpFile(void *clibFileHandle, bool ToTrace, IOStream &rFi
OutputLine(file, ToTrace, "Didn't manage to read block %lld from file\n", b);
continue;
}
- int64_t s = ntoh64(en.mEncodedSize);
+ int64_t s = box_ntoh64(en.mEncodedSize);
if(s > 0)
{
nnew++;