diff --git a/vrs/FileFormat.cpp b/vrs/FileFormat.cpp index 677a2b26..2a7a2718 100644 --- a/vrs/FileFormat.cpp +++ b/vrs/FileFormat.cpp @@ -111,20 +111,9 @@ void FileHeader::enableFrontIndexRecordSupport() { int64_t FileHeader::getEndOfUserRecordsOffset(int64_t fileSize) const { if (looksLikeAVRSFile()) { - switch (fileFormatVersion.get()) { - case kOriginalFileFormatVersion: - // index record always in the back, firstUserRecordOffset is 0 - if (indexRecordOffset.get() > 0) { - return min(fileSize, indexRecordOffset.get()); - } - break; - case kFrontIndexFileFormatVersion: - case kZstdFormatVersion: - // index maybe before or after the user records, and firstUserRecordOffset should be valid. - if (indexRecordOffset.get() > 0 && indexRecordOffset.get() > firstUserRecordOffset.get()) { - return min(fileSize, indexRecordOffset.get()); - } - break; + // index maybe before or after the user records + if (indexRecordOffset.get() > firstUserRecordOffset.get()) { + return min(fileSize, indexRecordOffset.get()); } } return fileSize; diff --git a/vrs/RecordFileReader.cpp b/vrs/RecordFileReader.cpp index 0c87f4a8..aec118f8 100644 --- a/vrs/RecordFileReader.cpp +++ b/vrs/RecordFileReader.cpp @@ -507,10 +507,8 @@ const vector& RecordFileReader::getRecordBoundaries() const { } lastOffset = r.fileOffset; } - int64_t fileSize = file_->getTotalSize(); - recordBoundaries_.emplace_back( - endOfUserRecordsOffset_ < fileSize ? endOfUserRecordsOffset_ : fileSize); - if (sortNeeded || recordBoundaries_.back() < lastOffset) { + recordBoundaries_.emplace_back(endOfUserRecordsOffset_); + if (sortNeeded) { sort(recordBoundaries_.begin(), recordBoundaries_.end()); } }