Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion src/falco.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -536,7 +536,8 @@ main(int argc, char *argv[]) {
// restrict buffer size to avoid using a possibly harmful amount of memory
const auto get_sz = [](const auto &i) { return i.size; };
const auto max_sz = std::ranges::max(std::views::transform(infos, get_sz));
buffer_size = buffer_size < max_sz ? buffer_size : min_buf_size;
buffer_size =
buffer_size < max_sz ? buffer_size : std::max(max_sz, min_buf_size);

const auto min_buffer_size = get_min_buffer_size(max_read_length);
if (std::cmp_greater(min_buffer_size, buffer_size)) {
Expand Down
4 changes: 2 additions & 2 deletions src/fastq_bgzf_file.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -144,8 +144,8 @@ fastq_bgzf_file::get_chunks(std::int64_t n_chunks,
const auto n_bytes_available = output_last;
n_chunks = std::min((n_bytes_available + min_chunk_size - 1) / min_chunk_size,
n_chunks);
const auto [chunk_size, remainder] = std::div(n_bytes_available, n_chunks);
assert(n_chunks > 0);
const auto [chunk_size, remainder] = std::div(
n_bytes_available, std::max(static_cast<std::int64_t>(1), n_chunks));
std::int64_t start_pos{};
std::int64_t chunk_end{};
for (const auto chunk_idx : std::views::iota(0, n_chunks)) {
Expand Down
Loading