Fix a few narrowing conversions (#761)

* Fix narrowing conversion in album cover loader

* Fix narrowing conversions in discogs cover provider

* Fix narrowing conversions in spotify cover provider

* Add explicit conversion in moodbarbuilder

* Fix narrowing conversions in osd dbus

* Make WordyTimeNanosec use unsigned quint64

* Fix narrowing conversions in song

* Fix narrowing conversions in qobuz stream url request

* Make ConnectionInfo.msgLen use unsigned quint64

* Make AnalizerBase.timeout to signed int

* Fix narrowing conversions in album cover fetcher

* Make fht type be unsigned int

* Correct for type in blockanalizer and use std::fill where possible

* Revert "Fix narrowing conversions in song"

This reverts commit 3de291394d.
This commit is contained in:
Emmanuel
2021-09-12 16:24:22 -03:00
committed by GitHub
parent e77e914f44
commit 0637b65846
20 changed files with 53 additions and 55 deletions

View File

@@ -57,11 +57,11 @@ class Base : public QWidget {
public:
~Base() override { delete fht_; }
uint timeout() const { return timeout_; }
int timeout() const { return timeout_; }
void set_engine(EngineBase *engine) { engine_ = engine; }
void changeTimeout(uint newTimeout) {
void changeTimeout(int newTimeout) {
timeout_ = newTimeout;
if (timer_.isActive()) {
timer_.stop();
@@ -90,7 +90,7 @@ class Base : public QWidget {
protected:
QBasicTimer timer_;
uint timeout_;
int timeout_;
FHT *fht_;
EngineBase *engine_;
Scope lastscope_;

View File

@@ -62,7 +62,7 @@ BlockAnalyzer::BlockAnalyzer(QWidget *parent)
setMaximumWidth(kMaxColumns * (kWidth + 1) - 1);
// mxcl says null pixmaps cause crashes, so let's play it safe
for (uint i = 0; i < kFadeSize; ++i) fade_bars_[i] = QPixmap(1, 1);
std::fill(fade_bars_.begin(), fade_bars_.end(), QPixmap(1, 1));
}
@@ -78,7 +78,7 @@ void BlockAnalyzer::resizeEvent(QResizeEvent *e) {
// all is explained in analyze()..
// +1 to counter -1 in maxSizes, trust me we need this!
columns_ = qMin(static_cast<int>(static_cast<double>(width() + 1) / (kWidth + 1)) + 1, kMaxColumns);
rows_ = static_cast<uint>(static_cast<double>(height() + 1) / (kHeight + 1));
rows_ = static_cast<int>(static_cast<double>(height() + 1) / (kHeight + 1));
// this is the y-offset for drawing from the top of the widget
y_ = (height() - (rows_ * (kHeight + 1)) + 2) / 2;
@@ -88,9 +88,7 @@ void BlockAnalyzer::resizeEvent(QResizeEvent *e) {
if (rows_ != oldRows) {
barpixmap_ = QPixmap(kWidth, rows_ * (kHeight + 1));
for (uint i = 0; i < kFadeSize; ++i) {
fade_bars_[i] = QPixmap(kWidth, rows_ * (kHeight + 1));
}
std::fill(fade_bars_.begin(), fade_bars_.end(), QPixmap(kWidth, rows_ * (kHeight + 1)));
yscale_.resize(rows_ + 1);
@@ -373,7 +371,7 @@ void BlockAnalyzer::paletteChange(const QPalette&) {
const int r2 = bg2.red(), g2 = bg2.green(), b2 = bg2.blue();
// Precalculate all fade-bar pixmaps
for (uint y = 0; y < kFadeSize; ++y) {
for (int y = 0; y < kFadeSize; ++y) {
fade_bars_[y].fill(palette().color(QPalette::Window));
QPainter f(&fade_bars_[y]);
for (int z = 0; z < rows_; ++z) {

View File

@@ -28,7 +28,7 @@
#include <QVector>
#include <QtMath>
FHT::FHT(int n) : num_((n < 3) ? 0 : 1 << n), exp2_((n < 3) ? -1 : n) {
FHT::FHT(uint n) : num_((n < 3) ? 0 : 1 << n), exp2_((n < 3) ? int(-1) : int(n)) {
if (n > 3) {
buf_vector_.resize(num_);

View File

@@ -63,7 +63,7 @@ class FHT {
* should be at least 3. Values of more than 3 need a trigonometry table.
* @see makeCasTable()
*/
explicit FHT(int);
explicit FHT(uint);
~FHT();
int sizeExp() const;