Skip to content

Commit

Permalink
chore: fix cast
Browse files Browse the repository at this point in the history
  • Loading branch information
variar committed Nov 17, 2024
1 parent a5f8959 commit c80a739
Showing 1 changed file with 8 additions and 5 deletions.
13 changes: 8 additions & 5 deletions src/logdata/include/linepositionarray.h
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@

#include <algorithm>
#include <cstddef>
#include <cstdint>
#include <iterator>
#include <vector>

Expand Down Expand Up @@ -100,10 +101,11 @@ class SimpleLinePositionStorage {
{
klogg::vector<OffsetInFile> result;
result.reserve( count.get() );
size_t beginIndex = firstLine.get();
size_t endIndex = std::min( beginIndex + count.get(), storage_.size() );
const int64_t beginIndex = static_cast<int64_t>( firstLine.get() );
const int64_t endIndex = std::min( beginIndex + static_cast<int64_t>( count.get() ),
static_cast<int64_t>( storage_.size() ) );

std::copy_n( storage_.begin() + static_cast<int64_t>( beginIndex ), endIndex - beginIndex,
std::copy_n( storage_.begin() + beginIndex, endIndex - beginIndex,
std::back_inserter( result ) );

return result;
Expand Down Expand Up @@ -186,8 +188,9 @@ class LinePosition {
return pos;
}

klogg::vector<OffsetInFile> range( LineNumber firstLine, LinesCount count ) const {
return array.range(firstLine, count);
klogg::vector<OffsetInFile> range( LineNumber firstLine, LinesCount count ) const
{
return array.range( firstLine, count );
}

// Set the presence of a fake final LF
Expand Down

0 comments on commit c80a739

Please sign in to comment.