From a23059ee905303defdb87803fa52d24ccdb83279 Mon Sep 17 00:00:00 2001 From: Chris Wilson Date: Sun, 23 Oct 2011 15:51:52 +0000 Subject: Adjust for platforms where sizeof(long) < sizeof(void *), apparently including Visual Studio 64-bit where sizeof(long) == 4. I don't fully understand the code, so I hope this adjustment is correct! --- lib/backupstore/BackupStoreFile.h | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/lib/backupstore/BackupStoreFile.h b/lib/backupstore/BackupStoreFile.h index b390320e..8398429a 100644 --- a/lib/backupstore/BackupStoreFile.h +++ b/lib/backupstore/BackupStoreFile.h @@ -162,9 +162,9 @@ public: uint8_t *a = (uint8_t*)malloc((Size) + (BACKUPSTOREFILE_CODING_BLOCKSIZE * 3)); if(a == 0) return 0; // Align to main block size - ASSERT(sizeof(unsigned long) >= sizeof(void*)); // make sure casting the right pointer size + ASSERT(sizeof(uint64_t) >= 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)(((uint64_t)a) % BACKUPSTOREFILE_CODING_BLOCKSIZE); uint8_t *b = (a + adjustment); // Store adjustment *b = adjustment; @@ -174,8 +174,8 @@ public: inline static void CodingChunkFree(void *Block) { // 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(sizeof(uint64_t) >= sizeof(void*)); // make sure casting the right pointer size + ASSERT((uint8_t)(((uint64_t)Block) % BACKUPSTOREFILE_CODING_BLOCKSIZE) == BACKUPSTOREFILE_CODING_OFFSET); uint8_t *a = (uint8_t*)Block; a -= BACKUPSTOREFILE_CODING_OFFSET; // Adjust downwards... -- cgit v1.2.3