Commit f4da469b authored by Harald Sitter's avatar Harald Sitter 🌈
Browse files

smb: make all qmin and qmax explicitly typed off_t

also explicitly set the min/max constexprs to off_t explicitly.
this should now make all related calls act exclusively on concretely typed
off_ts and as a result build on all platforms with all compilers 🤞

BUG: 419702
parent 143287d5
......@@ -35,12 +35,12 @@ off_t TransferSegment::segmentSizeForFileSize(const off_t fileSize_)
//
// TODO: perhaps it would actually make sense to read at a multiple of
// the target drive's block size?
const off_t idealSegmentSize = qMin(fileSize / 50, c_maxSegmentSize);
segmentSize = qMax(segmentSize, idealSegmentSize);
const off_t idealSegmentSize = qMin<off_t>(fileSize / 50, c_maxSegmentSize);
segmentSize = qMax<off_t>(segmentSize, idealSegmentSize);
// If the segment size is larger than the file size it appears we can
// actually degrade performance, so pick the smaller of the two.
if (fileSize != 0) {
segmentSize = qMin(segmentSize, fileSize);
segmentSize = qMin<off_t>(segmentSize, fileSize);
}
return segmentSize;
}
......
......@@ -12,8 +12,8 @@
#include <condition_variable>
#include <mutex>
constexpr auto c_minSegmentSize = 64 * 1024; // minimal size on stack
constexpr auto c_maxSegmentSize = 4L * 1024 * 1024; // 4MiB is the largest request we make
constexpr off_t c_minSegmentSize = 64 * 1024; // minimal size on stack
constexpr off_t c_maxSegmentSize = 4L * 1024 * 1024; // 4MiB is the largest request we make
struct TransferSegment
{
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment