Zygo / bees

Best-Effort Extent-Same, a btrfs dedupe agent
GNU General Public License v3.0
692 stars 56 forks source link

Test error on i686 and armhf (easy fix) #248

Closed MorganJamesSmith closed 1 year ago

MorganJamesSmith commented 1 year ago

The function at test/seeker.cc:31 seeker_test has a size_t argument. Looking at all the places it's used, I really think it should be a uint64_t instead. This would also fix the following error that occurs on i686 and armhf platforms:

seeker.cc: In function ‘void test_seeker()’:
seeker.cc:86:68: error: conversion from ‘long long unsigned int’ to ‘size_t’ {aka ‘unsigned int’} changes value from ‘18446744073709551615’ to ‘4294967295’ [-Werror=overflow]
   86 |  seeker_test(vector<uint64_t> { 55 }, numeric_limits<uint64_t>::max());
      |                                       ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~
seeker.cc:87:71: error: conversion from ‘long long unsigned int’ to ‘size_t’ {aka ‘unsigned int’} changes value from ‘18446744073709551614’ to ‘4294967294’ [-Werror=overflow]
   87 |  seeker_test(vector<uint64_t> { 55 }, numeric_limits<uint64_t>::max() - 1);
      |                                       ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~
seeker.cc:88:65: error: conversion from ‘long long unsigned int’ to ‘size_t’ {aka ‘unsigned int’} changes value from ‘18446744073709551615’ to ‘4294967295’ [-Werror=overflow]
   88 |  seeker_test(vector<uint64_t> { }, numeric_limits<uint64_t>::max());
      |                                    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~
seeker.cc:89:100: error: conversion from ‘long long unsigned int’ to ‘size_t’ {aka ‘unsigned int’} changes value from ‘18446744073709551615’ to ‘4294967295’ [-Werror=overflow]
   89 |  seeker_test(vector<uint64_t> { 0, numeric_limits<uint64_t>::max() }, numeric_limits<uint64_t>::max());
      |                                                                       ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~
seeker.cc:90:103: error: conversion from ‘long long unsigned int’ to ‘size_t’ {aka ‘unsigned int’} changes value from ‘18446744073709551614’ to ‘4294967294’ [-Werror=overflow]
   90 |  seeker_test(vector<uint64_t> { 0, numeric_limits<uint64_t>::max() }, numeric_limits<uint64_t>::max() - 1);
      |                                                                       ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~
seeker.cc:91:104: error: conversion from ‘long long unsigned int’ to ‘size_t’ {aka ‘unsigned int’} changes value from ‘18446744073709551615’ to ‘4294967295’ [-Werror=overflow]
   91 |  seeker_test(vector<uint64_t> { 0, numeric_limits<uint64_t>::max() - 1 }, numeric_limits<uint64_t>::max());
      |                                                                           ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~