This is an automated email from the ASF dual-hosted git repository.
mgrigorov pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/avro.git
The following commit(s) were added to refs/heads/main by this push:
new 163671461 AVRO-4085: Fix file size extraction error on windows
platform (#3229)
163671461 is described below
commit 16367146182b7a7f35f4d83d224d8f1636c9f773
Author: glywk <[email protected]>
AuthorDate: Tue Oct 29 10:45:12 2024 +0100
AVRO-4085: Fix file size extraction error on windows platform (#3229)
---
lang/c++/test/DataFileTests.cc | 8 +++-----
1 file changed, 3 insertions(+), 5 deletions(-)
diff --git a/lang/c++/test/DataFileTests.cc b/lang/c++/test/DataFileTests.cc
index ad6796fbc..7e2c78f94 100644
--- a/lang/c++/test/DataFileTests.cc
+++ b/lang/c++/test/DataFileTests.cc
@@ -471,9 +471,7 @@ public:
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
@@ -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);
@@ -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);
}
{