From 952cafc3b7225f2cef68b3945bfa94a2d7ea8466 Mon Sep 17 00:00:00 2001 From: Mike Buland Date: Mon, 3 Feb 2014 15:22:25 +0000 Subject: Corrected Myriad unit test on 64 bit platforms. I assumed a long would be 4 bytes, that was silly! --- src/unit/myriad.unit | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/src/unit/myriad.unit b/src/unit/myriad.unit index 3a6376e..1f900f4 100644 --- a/src/unit/myriad.unit +++ b/src/unit/myriad.unit @@ -50,8 +50,8 @@ Bu::ArchiveBase &operator<<( Bu::ArchiveBase &ar, const VerifyObject &vo ) { Md5 sum; ar << vo.iUnits; - vo.iBytesWritten = 4; - sum.addData( &vo.iUnits, 4 ); + vo.iBytesWritten = sizeof(int); + sum.addData( &vo.iUnits, sizeof(int) ); for( int j = 0; j < vo.iUnits; j++ ) { int iRand = random()%128; @@ -60,13 +60,13 @@ Bu::ArchiveBase &operator<<( Bu::ArchiveBase &ar, const VerifyObject &vo ) for( int j = 0; j < iRand; j++ ) sDat[j] = (char)((uint8_t)(random()%256)); ar << sDat; - sum.addData( &iRand, 4 ); + sum.addData( &iRand, sizeof(int) ); sum.addData( sDat.getStr(), iRand ); - vo.iBytesWritten += 4 + iRand; + vo.iBytesWritten += sizeof(long) + iRand; } Bu::String sRes = sum.getResult(); ar << sRes; - vo.iBytesWritten += 4 + sRes.getSize(); + vo.iBytesWritten += sizeof(long) + sRes.getSize(); return ar; } @@ -74,7 +74,7 @@ Bu::ArchiveBase &operator>>( Bu::ArchiveBase &ar, VerifyObject &vo ) { Md5 sum; ar >> vo.iUnits; - sum.addData( &vo.iUnits, 4 ); + sum.addData( &vo.iUnits, sizeof(int) ); for( int j = 0; j < vo.iUnits; j++ ) { int iRand; @@ -82,7 +82,7 @@ Bu::ArchiveBase &operator>>( Bu::ArchiveBase &ar, VerifyObject &vo ) Bu::String sStr; ar >> sStr; iRand = sStr.getSize(); - sum.addData( &iRand, 4 ); + sum.addData( &iRand, sizeof(int) ); sum.addData( sStr.getStr(), iRand ); } Bu::String sSum; -- cgit v1.2.3