Compatibility with 32bit systems

This commit is contained in:
Sebastian Messmer 2015-11-25 15:39:52 +01:00
parent aadc195165
commit 83cac1e32d
2 changed files with 6 additions and 2 deletions

View File

@ -94,7 +94,7 @@ namespace cpputils {
return _readData(size); return _readData(size);
} }
inline Data Deserializer::_readData(uint64_t size) { inline Data Deserializer::_readData(size_t size) {
Data result(size); Data result(size);
std::memcpy(static_cast<char*>(result.data()), static_cast<const char*>(_source->dataOffset(_pos)), size); std::memcpy(static_cast<char*>(result.data()), static_cast<const char*>(_source->dataOffset(_pos)), size);
_pos += size; _pos += size;

View File

@ -191,12 +191,16 @@ TEST_F(DataTest, Inequality_DifferentLastByte) {
EXPECT_TRUE(data1 != data2); EXPECT_TRUE(data1 != data2);
} }
#ifdef __x86_64__
//Needs 64bit for representation. This value isn't in the size param list, because the list is also used for read/write checks. //Needs 64bit for representation. This value isn't in the size param list, because the list is also used for read/write checks.
TEST_F(DataTest, LargesizeSize) { TEST_F(DataTest, LargesizeSize) {
size_t size = 10L*1024*1024*1024; uint64_t size = 10L*1024*1024*1024;
Data data(size); Data data(size);
EXPECT_EQ(size, data.size()); EXPECT_EQ(size, data.size());
} }
#else
#warning This is not a 64bit architecture. Large size data tests are disabled.
#endif
TEST_F(DataTest, LoadingNonexistingFile) { TEST_F(DataTest, LoadingNonexistingFile) {
TempFile file(false); // Pass false to constructor, so the tempfile is not created TempFile file(false); // Pass false to constructor, so the tempfile is not created