[Box Backup-commit] COMMIT r2972 - box/trunk/lib/backupstore

subversion at boxbackup.org subversion at boxbackup.org
Wed Jun 22 18:48:19 BST 2011


Author: chris
Date: 2011-06-22 18:48:18 +0100 (Wed, 22 Jun 2011)
New Revision: 2972

Modified:
   box/trunk/lib/backupstore/BackupClientFileAttributes.cpp
Log:
Fix type aliasing that's strictly speaking incompatible and may actually be skipped by the compiler
(according to http://blog.worldofcoding.com/2010/02/solving-gcc-44-strict-aliasing-problems.html).


Modified: box/trunk/lib/backupstore/BackupClientFileAttributes.cpp
===================================================================
--- box/trunk/lib/backupstore/BackupClientFileAttributes.cpp	2011-06-20 22:13:48 UTC (rev 2971)
+++ box/trunk/lib/backupstore/BackupClientFileAttributes.cpp	2011-06-22 17:48:18 UTC (rev 2972)
@@ -1183,6 +1183,7 @@
 	digest.Finish();
 	
 	// Return the first 64 bits of the hash
-	uint64_t result = *((uint64_t *)(digest.DigestAsData()));
+	uint64_t result;
+	memcpy(&result, digest.DigestAsData(), sizeof(result));
 	return result;
 }




More information about the Boxbackup-commit mailing list