avro-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From GitBox <...@apache.org>
Subject [GitHub] [avro] emkornfield commented on a change in pull request #1153: AVRO-3051: C++ Reader and writers modernized
Date Tue, 23 Mar 2021 15:42:22 GMT

emkornfield commented on a change in pull request #1153:
URL: https://github.com/apache/avro/pull/1153#discussion_r599690550



##########
File path: lang/c++/impl/DataFile.cc
##########
@@ -243,13 +243,13 @@ void DataFileWriterBase::flush()
     sync();
 }
 
-boost::mt19937 random(static_cast<uint32_t>(time(0)));
+boost::mt19937 random(static_cast<uint32_t>(time(nullptr)));
 
 DataFileSync DataFileWriterBase::makeSync()
 {
     DataFileSync sync;
-    for (size_t i = 0; i < sync.size(); ++i) {
-        sync[i] = random();
+    for (unsigned char & i : sync) {

Review comment:
       this is less straightforward to me than the previous code.  If you want to refactor,
I think `std::generate` would work here and be clearer.




-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



Mime
View raw message