diff options
author | Brad King <brad.king@kitware.com> | 2014-03-17 15:05:34 (GMT) |
---|---|---|
committer | Brad King <brad.king@kitware.com> | 2014-03-17 15:05:34 (GMT) |
commit | 413282c0cfb0bafc6ab325c6d4798e4765e021fa (patch) | |
tree | 67fbc2366fd549798a9e4d64284b01532e9c0b31 /Source | |
parent | fb4aff058d2595078300b682dc477f0ccba6d31b (diff) | |
download | CMake-413282c0cfb0bafc6ab325c6d4798e4765e021fa.zip CMake-413282c0cfb0bafc6ab325c6d4798e4765e021fa.tar.gz CMake-413282c0cfb0bafc6ab325c6d4798e4765e021fa.tar.bz2 |
file: Avoid runaway DOWNLOAD/UPLOAD progress reports (#14807)
Curl makes progress callbacks frequently but we round to the nearest
percent and report only when that changes so that we make at most 101
progress reports. However, when unexpected data beyond the total are
transferred the progress can get beyond 100% and lead to unlimited
reports. Avoid this case by capping the reported progress to 100%.
Diffstat (limited to 'Source')
-rw-r--r-- | Source/cmFileCommand.cxx | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/Source/cmFileCommand.cxx b/Source/cmFileCommand.cxx index 9fabdc7..5bfb664 100644 --- a/Source/cmFileCommand.cxx +++ b/Source/cmFileCommand.cxx @@ -2539,6 +2539,11 @@ namespace { if (total > 0.0) { this->CurrentPercentage = static_cast<int>(value/total*100.0 + 0.5); + if(this->CurrentPercentage > 100) + { + // Avoid extra progress reports for unexpected data beyond total. + this->CurrentPercentage = 100; + } } bool updated = (OldPercentage != this->CurrentPercentage); |