[Box Backup-dev] COMMIT r307 - in box/chris/win32/type-changes/lib: backupclient common
boxbackup-dev at fluffy.co.uk
boxbackup-dev at fluffy.co.uk
Fri Jan 6 20:17:44 GMT 2006
Author: chris
Date: 2006-01-06 20:17:39 +0000 (Fri, 06 Jan 2006)
New Revision: 307
Modified:
box/chris/win32/type-changes/lib/backupclient/BackupStoreFile.cpp
box/chris/win32/type-changes/lib/backupclient/BackupStoreFile.h
box/chris/win32/type-changes/lib/common/FdGetLine.cpp
Log:
* lib/backupclient/BackupStoreFile.cpp
* lib/backupclient/BackupStoreFile.h
- Re-added potentially serious cross-platform changes to this branch
* lib/common/FdGetLine.cpp
- Undid changes to "begin" and "end" in lib/common/FdGetLine.cpp
Modified: box/chris/win32/type-changes/lib/backupclient/BackupStoreFile.cpp
===================================================================
--- box/chris/win32/type-changes/lib/backupclient/BackupStoreFile.cpp 2006-01-06 19:52:51 UTC (rev 306)
+++ box/chris/win32/type-changes/lib/backupclient/BackupStoreFile.cpp 2006-01-06 20:17:39 UTC (rev 307)
@@ -519,17 +519,18 @@
if(mNumBlocks > 0)
{
// Find the maximum encoded data size
- int32_t maxEncodedDataSize = 0;
+ uint64_t maxEncodedDataSize = 0;
const file_BlockIndexEntry *entry = (file_BlockIndexEntry *)mpBlockIndex;
ASSERT(entry != 0);
for(int64_t e = 0; e < mNumBlocks; e++)
{
// Get the clear and encoded size
- int32_t encodedSize = box_ntoh64(entry[e].mEncodedSize);
+ uint64_t encodedSize = box_ntoh64(entry[e].mEncodedSize);
ASSERT(encodedSize > 0);
// Larger?
- if(encodedSize > maxEncodedDataSize) maxEncodedDataSize = encodedSize;
+ if(encodedSize > maxEncodedDataSize)
+ maxEncodedDataSize = encodedSize;
}
// Allocate those blocks!
@@ -675,7 +676,7 @@
// Get the size from the block index
const file_BlockIndexEntry *entry = (file_BlockIndexEntry *)mpBlockIndex;
- int32_t encodedSize = box_ntoh64(entry[mCurrentBlock].mEncodedSize);
+ uint64_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
@@ -931,7 +932,7 @@
}
// Check alignment of the block
- ASSERT((((uint32_t)(long)rOutput.mpBuffer) % BACKUPSTOREFILE_CODING_BLOCKSIZE) == BACKUPSTOREFILE_CODING_OFFSET);
+ ASSERT((((long long)rOutput.mpBuffer) % BACKUPSTOREFILE_CODING_BLOCKSIZE) == BACKUPSTOREFILE_CODING_OFFSET);
// Want to compress it?
bool compressChunk = (ChunkSize >= BACKUP_FILE_MIN_COMPRESSED_CHUNK_SIZE);
@@ -1019,7 +1020,7 @@
int BackupStoreFile::DecodeChunk(const void *Encoded, int EncodedSize, void *Output, int OutputSize)
{
// Check alignment of the encoded block
- ASSERT((((uint32_t)(long)Encoded) % BACKUPSTOREFILE_CODING_BLOCKSIZE) == BACKUPSTOREFILE_CODING_OFFSET);
+ ASSERT((((long long)Encoded) % BACKUPSTOREFILE_CODING_BLOCKSIZE) == BACKUPSTOREFILE_CODING_OFFSET);
// First check
if(EncodedSize < 1)
Modified: box/chris/win32/type-changes/lib/backupclient/BackupStoreFile.h
===================================================================
--- box/chris/win32/type-changes/lib/backupclient/BackupStoreFile.h 2006-01-06 19:52:51 UTC (rev 306)
+++ box/chris/win32/type-changes/lib/backupclient/BackupStoreFile.h 2006-01-06 20:17:39 UTC (rev 307)
@@ -125,7 +125,7 @@
// Align to main block size
ASSERT(sizeof(unsigned long) >= sizeof(void*)); // make sure casting the right pointer size
uint8_t adjustment = BACKUPSTOREFILE_CODING_BLOCKSIZE
- - (uint8_t)(((unsigned long)a) % BACKUPSTOREFILE_CODING_BLOCKSIZE);
+ - (uint8_t)(((unsigned long long)a) % BACKUPSTOREFILE_CODING_BLOCKSIZE);
uint8_t *b = (a + adjustment);
// Store adjustment
*b = adjustment;
@@ -136,7 +136,7 @@
{
// Check alignment is as expected
ASSERT(sizeof(unsigned long) >= sizeof(void*)); // make sure casting the right pointer size
- ASSERT((uint8_t)(((unsigned long)Block) % BACKUPSTOREFILE_CODING_BLOCKSIZE) == BACKUPSTOREFILE_CODING_OFFSET);
+ ASSERT((uint8_t)(((unsigned long long)Block) % BACKUPSTOREFILE_CODING_BLOCKSIZE) == BACKUPSTOREFILE_CODING_OFFSET);
uint8_t *a = (uint8_t*)Block;
a -= BACKUPSTOREFILE_CODING_OFFSET;
// Adjust downwards...
Modified: box/chris/win32/type-changes/lib/common/FdGetLine.cpp
===================================================================
--- box/chris/win32/type-changes/lib/common/FdGetLine.cpp 2006-01-06 19:52:51 UTC (rev 306)
+++ box/chris/win32/type-changes/lib/common/FdGetLine.cpp 2006-01-06 20:17:39 UTC (rev 307)
@@ -151,7 +151,7 @@
else
{
// Check for comment char, but char before must be whitespace
- std::string::size_type end = 0;
+ int end = 0; // can be negative
std::string::size_type size = r.size();
while(end < size)
{
@@ -163,7 +163,7 @@
}
// Remove whitespace
- std::string::size_type begin = 0;
+ int begin = 0; // should be positive, but compared with "end"
while(begin < size && iw(r[begin]))
{
begin++;
More information about the Boxbackup-dev
mailing list