Skip to content

Commit

Permalink
AVRO-4085: Fix file size extraction error on windows platform
Browse files Browse the repository at this point in the history
  • Loading branch information
glywk committed Oct 28, 2024
1 parent ea1bd2d commit 1b9df8a
Showing 1 changed file with 3 additions and 5 deletions.
8 changes: 3 additions & 5 deletions lang/c++/test/DataFileTests.cc
Original file line number Diff line number Diff line change
Expand Up @@ -471,9 +471,7 @@ class DataFileTest {
void testReaderSplits() {
boost::mt19937 random(static_cast<uint32_t>(time(nullptr)));
avro::DataFileReader<ComplexInteger> df(filename, writerSchema);
std::ifstream just_for_length(
filename, std::ifstream::ate | std::ifstream::binary);
int length = static_cast<int>(just_for_length.tellg());
int length = static_cast<int>(boost::filesystem::file_size(filename));
int splits = 10;
int end = length; // end of split
int remaining = end; // bytes remaining
Expand Down Expand Up @@ -696,7 +694,7 @@ struct codec_traits<ReaderObj> {
if (auto *rd =
dynamic_cast<avro::ResolvingDecoder *>(&d)) {
const std::vector<size_t> fo = rd->fieldOrder();
for (unsigned long it : fo) {
for (const auto it : fo) {
switch (it) {
case 0: {
avro::decode(d, v.s2);
Expand Down Expand Up @@ -1097,7 +1095,7 @@ init_unit_test_suite(int, char *[]) {
shared_ptr<DataFileTest> t9(new DataFileTest("test9.df", sch, sch));
ts->add(BOOST_CLASS_TEST_CASE(&DataFileTest::testWrite, t9));
ts->add(BOOST_CLASS_TEST_CASE(&DataFileTest::testReaderSyncSeek, t9));
//ts->add(BOOST_CLASS_TEST_CASE(&DataFileTest::testCleanup, t9));
ts->add(BOOST_CLASS_TEST_CASE(&DataFileTest::testCleanup, t9));
boost::unit_test::framework::master_test_suite().add(ts);
}
{
Expand Down

0 comments on commit 1b9df8a

Please sign in to comment.