[Box Backup-dev] COMMIT r337 - in box/chris/win32/type-changes/lib: backupclient common server
boxbackup-dev at fluffy.co.uk
boxbackup-dev at fluffy.co.uk
Fri Jan 27 22:23:36 GMT 2006
Author: chris
Date: 2006-01-27 22:23:29 +0000 (Fri, 27 Jan 2006)
New Revision: 337
Modified:
box/chris/win32/type-changes/lib/backupclient/BackupClientRestore.cpp
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/CollectInBufferStream.h
box/chris/win32/type-changes/lib/common/FdGetLine.cpp
box/chris/win32/type-changes/lib/common/MemBlockStream.h
box/chris/win32/type-changes/lib/server/Protocol.h
Log:
* lib/backupclient/BackupClientRestore.cpp
* lib/backupclient/BackupStoreFile.cpp
* lib/backupclient/BackupStoreFile.h
* lib/server/Protocol.h
* lib/common/FdGetLine.cpp
* lib/common/MemBlockStream.h
* lib/common/CollectInBufferStream.h
- Changes suggested by Martin (type fixes)
Modified: box/chris/win32/type-changes/lib/backupclient/BackupClientRestore.cpp
===================================================================
--- box/chris/win32/type-changes/lib/backupclient/BackupClientRestore.cpp 2006-01-27 21:46:46 UTC (rev 336)
+++ box/chris/win32/type-changes/lib/backupclient/BackupClientRestore.cpp 2006-01-27 22:23:29 UTC (rev 337)
@@ -101,7 +101,7 @@
// ID
rWrite.Write(&mNextLevelID, sizeof(mNextLevelID));
// Name string
- std::string::size_type nsize = mNextLevelLocalName.size();
+ int32_t nsize = (int32_t)( mNextLevelLocalName.size() );
rWrite.Write(&nsize, sizeof(nsize));
rWrite.Write(mNextLevelLocalName.c_str(), nsize);
// And then the level itself
Modified: box/chris/win32/type-changes/lib/backupclient/BackupStoreFile.cpp
===================================================================
--- box/chris/win32/type-changes/lib/backupclient/BackupStoreFile.cpp 2006-01-27 21:46:46 UTC (rev 336)
+++ box/chris/win32/type-changes/lib/backupclient/BackupStoreFile.cpp 2006-01-27 22:23:29 UTC (rev 337)
@@ -932,7 +932,7 @@
}
// Check alignment of the block
- ASSERT((((long long)rOutput.mpBuffer) % BACKUPSTOREFILE_CODING_BLOCKSIZE) == BACKUPSTOREFILE_CODING_OFFSET);
+ ASSERT((((uint64_t)rOutput.mpBuffer) % BACKUPSTOREFILE_CODING_BLOCKSIZE) == BACKUPSTOREFILE_CODING_OFFSET);
// Want to compress it?
bool compressChunk = (ChunkSize >= BACKUP_FILE_MIN_COMPRESSED_CHUNK_SIZE);
@@ -1020,7 +1020,7 @@
int BackupStoreFile::DecodeChunk(const void *Encoded, int EncodedSize, void *Output, int OutputSize)
{
// Check alignment of the encoded block
- ASSERT((((long long)Encoded) % BACKUPSTOREFILE_CODING_BLOCKSIZE) == BACKUPSTOREFILE_CODING_OFFSET);
+ ASSERT((((uint64_t)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-27 21:46:46 UTC (rev 336)
+++ box/chris/win32/type-changes/lib/backupclient/BackupStoreFile.h 2006-01-27 22:23:29 UTC (rev 337)
@@ -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 long)a) % BACKUPSTOREFILE_CODING_BLOCKSIZE);
+ - (uint8_t)(((uint64_t)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 long)Block) % BACKUPSTOREFILE_CODING_BLOCKSIZE) == BACKUPSTOREFILE_CODING_OFFSET);
+ ASSERT((uint8_t)(((uint64_t)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/CollectInBufferStream.h
===================================================================
--- box/chris/win32/type-changes/lib/common/CollectInBufferStream.h 2006-01-27 21:46:46 UTC (rev 336)
+++ box/chris/win32/type-changes/lib/common/CollectInBufferStream.h 2006-01-27 22:23:29 UTC (rev 337)
@@ -52,7 +52,7 @@
MemoryBlockGuard<char*> mBuffer;
int mBufferSize;
int mBytesInBuffer;
- pos_type mReadPosition;
+ int mReadPosition;
bool mInWritePhase;
};
Modified: box/chris/win32/type-changes/lib/common/FdGetLine.cpp
===================================================================
--- box/chris/win32/type-changes/lib/common/FdGetLine.cpp 2006-01-27 21:46:46 UTC (rev 336)
+++ box/chris/win32/type-changes/lib/common/FdGetLine.cpp 2006-01-27 22:23:29 UTC (rev 337)
@@ -151,11 +151,11 @@
else
{
// Check for comment char, but char before must be whitespace
- int end = 0; // can be negative
+ std::string::size_type end = 1;
std::string::size_type size = r.size();
- while(end < size)
+ while(end - 1 < size)
{
- if(r[end] == '#' && (end == 0 || (iw(r[end-1]))))
+ if(r[end - 1] == '#' && (end == 1 || (iw(r[end-2]))))
{
break;
}
@@ -163,19 +163,19 @@
}
// Remove whitespace
- int begin = 0; // should be positive, but compared with "end"
+ std::string::size_type begin = 0;
while(begin < size && iw(r[begin]))
{
begin++;
}
- if(!iw(r[end])) end--;
- while(end > begin && iw(r[end]))
+ if(!iw(r[end - 1])) end--;
+ while(end - 1> begin && iw(r[end - 1]))
{
end--;
}
// Return a sub string
- return r.substr(begin, end - begin + 1);
+ return r.substr(begin, end - begin);
}
}
Modified: box/chris/win32/type-changes/lib/common/MemBlockStream.h
===================================================================
--- box/chris/win32/type-changes/lib/common/MemBlockStream.h 2006-01-27 21:46:46 UTC (rev 336)
+++ box/chris/win32/type-changes/lib/common/MemBlockStream.h 2006-01-27 22:23:29 UTC (rev 337)
@@ -45,7 +45,7 @@
private:
const char *mpBuffer;
int mBytesInBuffer;
- pos_type mReadPosition;
+ int mReadPosition;
};
#endif // MEMBLOCKSTREAM__H
Modified: box/chris/win32/type-changes/lib/server/Protocol.h
===================================================================
--- box/chris/win32/type-changes/lib/server/Protocol.h 2006-01-27 21:46:46 UTC (rev 336)
+++ box/chris/win32/type-changes/lib/server/Protocol.h 2006-01-27 22:23:29 UTC (rev 337)
@@ -94,7 +94,7 @@
void Read(int32_t &rOut);
void Read(int16_t &rOut);
void Read(int8_t &rOut);
- void Read(bool &rOut) {bool read; Read(read); rOut = (read == true);}
+ void Read(bool &rOut) {int8_t read; Read(read); rOut = (read == (int8_t)true);}
void Read(std::string &rOut);
template<typename type>
void Read(type &rOut)
More information about the Boxbackup-dev
mailing list