@@ -565,15 +565,14 @@ class HitSink {
565565 ThreadSafe _ts (&mutex_); // flush
566566 if (reorder_) {
567567 nchars += ptBufs_[threadId].length ();
568- batch b = { .batchId = batchIds_[threadId], .isWritten = false };
569- ptBufs_[threadId].moveTo (b.btString );
568+ batch b (ptBufs_[threadId], batchIds_[threadId], false /* has batch been written */ );
570569 unwrittenBatches_.push_back (b);
571570 // consider writing if we have enough data to fill the buffer
572571 // or we're ready to output the final batch
573572 if (finalBatch || nchars >= OutFileBuf::BUF_SZ) {
574573 // sort by batch ID
575574 std::sort (unwrittenBatches_.begin (), unwrittenBatches_.end ());
576- for (int i = 0 ; i < unwrittenBatches_.size (); i++) {
575+ for (std::vector<batch>::size_type i = 0 ; i < unwrittenBatches_.size (); i++) {
577576 if (unwrittenBatches_[i].batchId - lastBatchIdSeen == 1 ) {
578577 nchars -= out_.writeString (unwrittenBatches_[i].btString );
579578 lastBatchIdSeen = unwrittenBatches_[i].batchId ;
@@ -635,6 +634,12 @@ class HitSink {
635634 size_t batchId;
636635 bool isWritten;
637636
637+ batch (BTString& s, size_t id, bool b)
638+ : batchId(id), isWritten(b)
639+ {
640+ s.moveTo (btString);
641+ }
642+
638643 bool operator <(const batch& other) const {
639644 return batchId < other.batchId ;
640645 }
0 commit comments