KDE Frameworks 5.54.0

OBS-URL: https://build.opensuse.org/package/show/KDE:Frameworks5/kio?expand=0&rev=243
This commit is contained in:
Fabian Vogt 2019-01-14 13:31:32 +00:00 committed by Git OBS Bridge
parent 594eaca304
commit 9a8b2f55a9
6 changed files with 196 additions and 6 deletions

View File

@ -0,0 +1,29 @@
From 0362f77d51b2fc9c784ab8fa751ee6ffac33eb00 Mon Sep 17 00:00:00 2001
From: Fabian Vogt <fabian@ritter-vogt.de>
Date: Mon, 14 Jan 2019 13:31:39 +0100
Subject: [PATCH 1/2] Revert "Fix elapsed time check"
This reverts commit cd2f67c39b25de026390bfe2bc1c7aa269f78ccb.
In preparation for reverting the calcSpeed rewrite.
---
src/core/slaveinterface.cpp | 4 +---
1 file changed, 1 insertion(+), 3 deletions(-)
diff --git a/src/core/slaveinterface.cpp b/src/core/slaveinterface.cpp
index d79b498d..6eb2b08d 100644
--- a/src/core/slaveinterface.cpp
+++ b/src/core/slaveinterface.cpp
@@ -103,9 +103,7 @@ void SlaveInterface::calcSpeed()
// using first and last item from the list.
const qint64 elapsed_time = d->elapsed_timer.elapsed();
- const qint64 last_time = d->transfer_details.isEmpty() ? 0 : d->transfer_details.last().time;
-
- if (elapsed_time - last_time >= 900) {
+ if (elapsed_time >= 900) {
if (d->transfer_details.count() == max_count) {
d->transfer_details.removeFirst();
}
--
2.20.1

View File

@ -0,0 +1,144 @@
From b8a5f34b34b6c4e37684fe2782b8cf39c38cd928 Mon Sep 17 00:00:00 2001
From: Fabian Vogt <fabian@ritter-vogt.de>
Date: Mon, 14 Jan 2019 13:32:52 +0100
Subject: [PATCH 2/2] Revert "Refactor SlaveInterface::calcSpeed"
This reverts commit 4e2a815b9a107663a3d75e9d9d1be336adea888e.
This commit causes crashes due to improper division and there are some
outstanding code review issues as well.
BUG: 402665
---
src/core/slaveinterface.cpp | 48 ++++++++++++++++++++++++-------------
src/core/slaveinterface_p.h | 19 +++++++--------
2 files changed, 39 insertions(+), 28 deletions(-)
diff --git a/src/core/slaveinterface.cpp b/src/core/slaveinterface.cpp
index 6eb2b08d..88f649c8 100644
--- a/src/core/slaveinterface.cpp
+++ b/src/core/slaveinterface.cpp
@@ -45,7 +45,6 @@ SlaveInterface::SlaveInterface(SlaveInterfacePrivate &dd, QObject *parent)
: QObject(parent), d_ptr(&dd)
{
connect(&d_ptr->speed_timer, &QTimer::timeout, this, &SlaveInterface::calcSpeed);
- d_ptr->transfer_details.reserve(max_count);
}
SlaveInterface::~SlaveInterface()
@@ -98,24 +97,36 @@ void SlaveInterface::calcSpeed()
return;
}
- // Note for future reference: A list is maintained for sizes and times.
- // Minimum list size is 1 and maximum list size is 8. Delta is calculated
- // using first and last item from the list.
-
- const qint64 elapsed_time = d->elapsed_timer.elapsed();
- if (elapsed_time >= 900) {
- if (d->transfer_details.count() == max_count) {
- d->transfer_details.removeFirst();
+ const qint64 currentTime = QDateTime::currentMSecsSinceEpoch();
+ const qint64 diff = currentTime - d->start_time;
+ if (diff - d->last_time >= 900) {
+ d->last_time = diff;
+ if (d->nums == max_nums) {
+ // let's hope gcc can optimize that well enough
+ // otherwise I'd try memcpy :)
+ for (unsigned int i = 1; i < max_nums; ++i) {
+ d->times[i - 1] = d->times[i];
+ d->sizes[i - 1] = d->sizes[i];
+ }
+ d->nums--;
}
+ d->times[d->nums] = diff;
+ d->sizes[d->nums++] = d->filesize - d->offset;
+
+ KIO::filesize_t lspeed = 1000 * (d->sizes[d->nums - 1] - d->sizes[0]) / (d->times[d->nums - 1] - d->times[0]);
+
+//qDebug() << (long)d->filesize << diff
+// << long(d->sizes[d->nums-1] - d->sizes[0])
+// << d->times[d->nums-1] - d->times[0]
+// << long(lspeed) << double(d->filesize) / diff
+// << convertSize(lspeed)
+// << convertSize(long(double(d->filesize) / diff) * 1000);
- const SlaveInterfacePrivate::TransferInfo first = d->transfer_details.first();
- const SlaveInterfacePrivate::TransferInfo last = {elapsed_time, (d->filesize - d->offset)};
- KIO::filesize_t lspeed = 1000 * (last.size - first.size) / (last.time - first.time);
if (!lspeed) {
- d->transfer_details.clear();
+ d->nums = 1;
+ d->times[0] = diff;
+ d->sizes[0] = d->filesize - d->offset;
}
- d->transfer_details.append(last);
-
emit speed(lspeed);
}
}
@@ -198,10 +209,13 @@ bool SlaveInterface::dispatch(int _cmd, const QByteArray &rawdata)
}
case INF_TOTAL_SIZE: {
KIO::filesize_t size = readFilesize_t(stream);
+ d->start_time = QDateTime::currentMSecsSinceEpoch();
+ d->last_time = 0;
d->filesize = d->offset;
- d->transfer_details.append({0, 0});
+ d->sizes[0] = d->filesize - d->offset;
+ d->times[0] = 0;
+ d->nums = 1;
d->speed_timer.start(1000);
- d->elapsed_timer.start();
d->slave_calcs_speed = false;
emit totalSize(size);
break;
diff --git a/src/core/slaveinterface_p.h b/src/core/slaveinterface_p.h
index efb17d0f..a4cb5d3f 100644
--- a/src/core/slaveinterface_p.h
+++ b/src/core/slaveinterface_p.h
@@ -29,19 +29,17 @@
#include <QTimer>
#include <QPointer>
#include <QHostInfo>
-#include <QVector>
-#include <QElapsedTimer>
#include "kiocoredebug.h"
-static const unsigned int max_count = 8;
+static const unsigned int max_nums = 8;
class KIO::SlaveInterfacePrivate
{
public:
SlaveInterfacePrivate()
- : connection(nullptr), filesize(0), offset(0),
- slave_calcs_speed(false)
+ : connection(nullptr), filesize(0), offset(0), last_time(0), start_time(0),
+ nums(0), slave_calcs_speed(false)
{
}
virtual ~SlaveInterfacePrivate()
@@ -55,14 +53,13 @@ public:
// We need some metadata here for our SSL code in messageBox() and for sslMetaData().
MetaData sslMetaData;
- struct TransferInfo {
- qint64 time;
- KIO::filesize_t size;
- };
- QVector<TransferInfo> transfer_details;
- QElapsedTimer elapsed_timer;
+ KIO::filesize_t sizes[max_nums];
+ qint64 times[max_nums];
KIO::filesize_t filesize, offset;
+ size_t last_time;
+ qint64 start_time;
+ uint nums;
bool slave_calcs_speed;
void slotHostInfo(const QHostInfo &info);
--
2.20.1

View File

@ -1,3 +0,0 @@
version https://git-lfs.github.com/spec/v1
oid sha256:7320df009b19ab9ad3acfeb0d8cf9e0824d5779930fb85f59208deb0cb4124c3
size 3143732

3
kio-5.54.0.tar.xz Normal file
View File

@ -0,0 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:3cf05a021e6431c2d2b16525dd130a02269cb6fc2cf99ce3b4725d33c0bf5c7d
size 3150624

View File

@ -1,3 +1,16 @@
-------------------------------------------------------------------
Mon Jan 14 06:08:48 UTC 2019 - lbeltrame@kde.org
- Update to 5.54.0
* New feature release
* For more details please see:
* https://www.kde.org/announcements/kde-frameworks-5.54.0.php
- Changes since 5.53.0:
* Too many changes to list here
- Add upstream patches to prevent crashes in KIO (kde#402665)
* 0001-Revert-Fix-elapsed-time-check.patch
* 0002-Revert-Refactor-SlaveInterface-calcSpeed.patch
------------------------------------------------------------------- -------------------------------------------------------------------
Sun Dec 09 19:43:44 UTC 2018 - lbeltrame@kde.org Sun Dec 09 19:43:44 UTC 2018 - lbeltrame@kde.org

View File

@ -1,7 +1,7 @@
# #
# spec file for package kio # spec file for package kio
# #
# Copyright (c) 2018 SUSE LINUX GmbH, Nuernberg, Germany. # Copyright (c) 2019 SUSE LINUX GmbH, Nuernberg, Germany.
# #
# All modifications and additions to the file contributed by third parties # All modifications and additions to the file contributed by third parties
# remain the property of their copyright owners, unless otherwise agreed # remain the property of their copyright owners, unless otherwise agreed
@ -16,14 +16,14 @@
# #
%define _tar_path 5.53 %define _tar_path 5.54
# Full KF5 version (e.g. 5.33.0) # Full KF5 version (e.g. 5.33.0)
%{!?_kf5_version: %global _kf5_version %{version}} %{!?_kf5_version: %global _kf5_version %{version}}
# Last major and minor KF5 version (e.g. 5.33) # Last major and minor KF5 version (e.g. 5.33)
%{!?_kf5_bugfix_version: %define _kf5_bugfix_version %(echo %{_kf5_version} | awk -F. '{print $1"."$2}')} %{!?_kf5_bugfix_version: %define _kf5_bugfix_version %(echo %{_kf5_version} | awk -F. '{print $1"."$2}')}
%bcond_without lang %bcond_without lang
Name: kio Name: kio
Version: 5.53.0 Version: 5.54.0
Release: 0 Release: 0
Summary: Network transparent access to files and data Summary: Network transparent access to files and data
License: LGPL-2.1-or-later License: LGPL-2.1-or-later
@ -33,6 +33,10 @@ Source: http://download.kde.org/stable/frameworks/%{_tar_path}/%{name}-%
Source1: baselibs.conf Source1: baselibs.conf
# PATCH-FIX-OPENSUSE kio_help-fallback-to-kde4-docs.patch -- allow kio_help to see into kde4 documentation, needed especially for khelpcenter5 # PATCH-FIX-OPENSUSE kio_help-fallback-to-kde4-docs.patch -- allow kio_help to see into kde4 documentation, needed especially for khelpcenter5
Patch0: kio_help-fallback-to-kde4-docs.patch Patch0: kio_help-fallback-to-kde4-docs.patch
# PATCH-FIX-UPSTREAM
Patch1: 0001-Revert-Fix-elapsed-time-check.patch
# PATCH-FIX-UPSTREAM
Patch2: 0002-Revert-Refactor-SlaveInterface-calcSpeed.patch
BuildRequires: cmake >= 3.0 BuildRequires: cmake >= 3.0
BuildRequires: extra-cmake-modules >= %{_kf5_bugfix_version} BuildRequires: extra-cmake-modules >= %{_kf5_bugfix_version}
BuildRequires: fdupes BuildRequires: fdupes