Skip to content

Commit 96d3bb4

Browse files
committed
[mongocxx/gridfs/bucket] Fix the cursor limit value in _open_download_stream
1 parent 2b21417 commit 96d3bb4

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

src/mongocxx/gridfs/bucket.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -372,8 +372,8 @@ downloader bucket::_open_download_stream(const client_session* session,
372372
"expected end to not be greater than the file length"};
373373
}
374374
if (file_len >= 0 && end_i64 < file_len) {
375-
const int64_t num_chunks =
376-
1 + ((end_i64 - start_i64) / static_cast<int64_t>(chunk_size));
375+
const int64_t num_chunks = (end_i64 / static_cast<int64_t>(chunk_size)) -
376+
(start_i64 / static_cast<int64_t>(chunk_size)) + 1;
377377
chunks_options.limit(num_chunks);
378378
}
379379
}

0 commit comments

Comments
 (0)