diff options
author | Arno <arno@disconnect.de> | 2018-12-09 05:54:30 +0100 |
---|---|---|
committer | Arno <arno@disconnect.de> | 2018-12-09 05:54:30 +0100 |
commit | 3a4a4a779d4066b9c89e948fb58db3d17f6e5fc3 (patch) | |
tree | 342bbff8c9360abaa789ed15a1fe0b8f2e569cfd /helper.cpp | |
parent | 7591758968121d6b59bb090e8f1e6ca65ffa10d8 (diff) | |
download | ShemovCleaner-3a4a4a779d4066b9c89e948fb58db3d17f6e5fc3.tar.gz ShemovCleaner-3a4a4a779d4066b9c89e948fb58db3d17f6e5fc3.tar.bz2 ShemovCleaner-3a4a4a779d4066b9c89e948fb58db3d17f6e5fc3.zip |
Fix implicit casts in FileDisplay
Turn Duration(qint64) into Duration(int) to avoid implicit casts.
INT_MAX is good for 68 years of video, that should be enough for
everyone :)
Diffstat (limited to 'helper.cpp')
-rw-r--r-- | helper.cpp | 11 |
1 files changed, 5 insertions, 6 deletions
@@ -33,14 +33,14 @@ namespace Helper { do { read = file.read(data.data(), 4096); if(read > 0){ - h.addData(data.data(), read); + h.addData(data.data(), static_cast<int>(read)); } } while (read == 4096); QByteArray res = h.result(); retval = res.toHex().toLower(); }else{ QByteArray data(512, '\0'); - int offset = info.size() / 3; + qint64 offset = info.size() / 3; file.seek(offset); int numBytes = 512 * 1024; int readBytes = 0; @@ -51,7 +51,7 @@ namespace Helper { }else{ return QString(); } - h.addData(data.data(), read); + h.addData(data.data(), static_cast<int>(read)); } while(readBytes < numBytes); QByteArray res = h.result(); retval = res.toHex().toLower(); @@ -79,14 +79,13 @@ namespace Helper { QJsonDocument jDoc = ffpmegData(file); QJsonObject jObj = jDoc.object(); QJsonValue durationV = jObj["format"].toObject()["duration"]; - int seconds = durationV.toVariant().toDouble(); + int seconds = static_cast<int>(durationV.toVariant().toDouble()); int interval = seconds / 4; QImage img1 = snapshot(file, 60); QImage img2 = snapshot(file, interval * 2); QImage img3 = snapshot(file, interval * 3); QImage img4 = snapshot(file, seconds - 60); QImage retval(640 * 2 + 10, img1.height() * 2 + 10, QImage::Format_ARGB32); - //retval.fill(Qt::red); QPainter p(&retval); p.drawImage(0, 0, img1); p.drawImage(650, 0, img2); @@ -174,7 +173,7 @@ namespace Helper { Duration::Duration() : mHours(0), mMinutes(0), mSeconds(0) {} - Duration::Duration(qint64 seconds){ + Duration::Duration(int seconds){ int sec(0), min(0), h(0); // get hours h = (seconds / 60 / 60); |