[Box Backup-dev] COMMIT r436 - in box/trunk: . lib/raidfile

boxbackup-dev@fluffy.co.uk boxbackup-dev@fluffy.co.uk
Sun, 12 Feb 2006 03:16:59 +0000 (GMT)


Author: martin
Date: 2006-02-12 03:16:57 +0000 (Sun, 12 Feb 2006)
New Revision: 436

Modified:
   box/trunk/configure.ac
   box/trunk/lib/raidfile/RaidFileWrite.cpp
Log:
This ppc problem is clearly a common big-endian platform issue.
Remove ppc hack and configure option. Replace dubious casts with clearer use of memcpy to make this work on all platforms all of the time.
Note that there isn't really a call to memcpy, the compiler inlines it as 2 int copies which is an insignificant overhead (even true with -O0).


Modified: box/trunk/configure.ac
===================================================================
--- box/trunk/configure.ac	2006-02-12 01:02:38 UTC (rev 435)
+++ box/trunk/configure.ac	2006-02-12 03:16:57 UTC (rev 436)
@@ -10,17 +10,6 @@
 AC_CANONICAL_SYSTEM
 test -s install-sh || rm install-sh
 
-
-### Temporary hacks
-AC_ARG_ENABLE(
-  [ppc-workaround],
-  [AC_HELP_STRING([--enable-ppc-workaround],
-                  [Enable a workaround for a compiler bug in GCC on PPC platforms (raidfile tests fail).])])
-if test "x$enable_ppc_workaround" = "xyes"; then
-  AC_DEFINE([HAVE_PPC_WORKAROUND], 1, [Define to 1 to workaround a GCC compiler bug on PPC])
-fi
-
-
 ### Checks for programs.
 
 AC_LANG([C++])

Modified: box/trunk/lib/raidfile/RaidFileWrite.cpp
===================================================================
--- box/trunk/lib/raidfile/RaidFileWrite.cpp	2006-02-12 01:02:38 UTC (rev 435)
+++ box/trunk/lib/raidfile/RaidFileWrite.cpp	2006-02-12 03:16:57 UTC (rev 436)
@@ -462,10 +462,8 @@
 						ASSERT(sizeof(RaidFileRead::FileSizeType) >= sizeof(off_t));
 						int sizePos = (blockSize/sizeof(unsigned int)) - 2;
 						RaidFileRead::FileSizeType sw = box_hton64(writeFileStat.st_size);
-#ifdef HAVE_PPC_WORKAROUND
-                                                static RaidFileRead::FileSizeType ppcWorkaround = sw;
-#endif
-						unsigned int *psize = (unsigned int *)(&sw);
+						unsigned int psize[2];
+						::memcpy(psize, &sw, sizeof(RaidFileRead::FileSizeType));
 						pparity[sizePos+0] = pstripe1[sizePos+0] ^ psize[0];
 						pparity[sizePos+1] = pstripe1[sizePos+1] ^ psize[1];
 					}