From 2b9d305ea1c06936c142821ef4865fdd04f755fb Mon Sep 17 00:00:00 2001 From: Daniel Wolf Date: Fri, 18 Jun 2021 18:16:02 +0200 Subject: [PATCH] Fix warnings --- rhubarb/src/animation/staticSegments.cpp | 2 +- rhubarb/src/audio/processing.cpp | 4 ++-- rhubarb/src/recognition/tokenization.cpp | 2 +- rhubarb/src/time/Timeline.h | 2 +- rhubarb/src/tools/ProgressBar.cpp | 6 +++--- rhubarb/src/tools/platformTools.cpp | 2 +- rhubarb/src/tools/progress.cpp | 2 +- 7 files changed, 10 insertions(+), 10 deletions(-) diff --git a/rhubarb/src/animation/staticSegments.cpp b/rhubarb/src/animation/staticSegments.cpp index 3cc093a..84a0d2c 100644 --- a/rhubarb/src/animation/staticSegments.cpp +++ b/rhubarb/src/animation/staticSegments.cpp @@ -113,7 +113,7 @@ public: } int getStaticSegmentCount() const { - return staticSegments.size(); + return static_cast(staticSegments.size()); } ContinuousTimeline getChangedRules() const { diff --git a/rhubarb/src/audio/processing.cpp b/rhubarb/src/audio/processing.cpp index 7667445..5a93f6f 100644 --- a/rhubarb/src/audio/processing.cpp +++ b/rhubarb/src/audio/processing.cpp @@ -20,7 +20,7 @@ void process16bitAudioClip( // Process entire sound stream vector buffer; buffer.reserve(bufferCapacity); - int sampleCount = 0; + size_t sampleCount = 0; auto it = audioClip.begin(); const auto end = audioClip.end(); do { @@ -35,7 +35,7 @@ void process16bitAudioClip( processBuffer(buffer); sampleCount += buffer.size(); - progressSink.reportProgress(static_cast(sampleCount) / audioClip.size()); + progressSink.reportProgress(static_cast(sampleCount) / static_cast(audioClip.size())); } while (!buffer.empty()); } diff --git a/rhubarb/src/recognition/tokenization.cpp b/rhubarb/src/recognition/tokenization.cpp index 79db0fe..3b93faa 100644 --- a/rhubarb/src/recognition/tokenization.cpp +++ b/rhubarb/src/recognition/tokenization.cpp @@ -93,7 +93,7 @@ vector tokenizeText( vector words = tokenizeViaFlite(text); // Join words separated by apostrophes - for (int i = words.size() - 1; i > 0; --i) { + for (int i = static_cast(words.size()) - 1; i > 0; --i) { if (!words[i].empty() && words[i][0] == '\'') { words[i - 1].append(words[i]); words.erase(words.begin() + i); diff --git a/rhubarb/src/time/Timeline.h b/rhubarb/src/time/Timeline.h index 18eb1e1..ee65c4b 100644 --- a/rhubarb/src/time/Timeline.h +++ b/rhubarb/src/time/Timeline.h @@ -296,7 +296,7 @@ public: } Timeline(const Timeline&) = default; - Timeline(Timeline&&) = default; + Timeline(Timeline&&) noexcept = default; Timeline& operator=(const Timeline&) = default; Timeline& operator=(Timeline&&) = default; diff --git a/rhubarb/src/tools/ProgressBar.cpp b/rhubarb/src/tools/ProgressBar.cpp index 462fd09..6b0a3dc 100644 --- a/rhubarb/src/tools/ProgressBar.cpp +++ b/rhubarb/src/tools/ProgressBar.cpp @@ -70,8 +70,8 @@ void ProgressBar::update(bool showSpinner) { void ProgressBar::updateText(const string& text) { // Get length of common portion - int commonPrefixLength = 0; - const int commonLength = std::min(currentText.size(), text.size()); + size_t commonPrefixLength = 0; + const size_t commonLength = std::min(currentText.size(), text.size()); while (commonPrefixLength < commonLength && text[commonPrefixLength] == currentText[commonPrefixLength]) { commonPrefixLength++; } @@ -86,7 +86,7 @@ void ProgressBar::updateText(const string& text) { output.append(text, commonPrefixLength, text.size() - commonPrefixLength); // ... if the new text is shorter than the old one: delete overlapping characters - const int overlapCount = currentText.size() - text.size(); + const int overlapCount = static_cast(currentText.size()) - static_cast(text.size()); if (overlapCount > 0) { output.append(overlapCount, ' '); output.append(overlapCount, '\b'); diff --git a/rhubarb/src/tools/platformTools.cpp b/rhubarb/src/tools/platformTools.cpp index 4199b85..2e51ea9 100644 --- a/rhubarb/src/tools/platformTools.cpp +++ b/rhubarb/src/tools/platformTools.cpp @@ -34,7 +34,7 @@ path getBinPath() { // Actually, it does. // In case there are situations where it doesn't, we allocate one character more. std::vector buffer(pathLength + 1); - if (wai_getExecutablePath(buffer.data(), buffer.size(), nullptr) == -1) { + if (wai_getExecutablePath(buffer.data(), static_cast(buffer.size()), nullptr) == -1) { throw std::runtime_error("Error reading path."); } buffer[pathLength] = 0; diff --git a/rhubarb/src/tools/progress.cpp b/rhubarb/src/tools/progress.cpp index c313092..4fa1f73 100644 --- a/rhubarb/src/tools/progress.cpp +++ b/rhubarb/src/tools/progress.cpp @@ -34,7 +34,7 @@ ProgressSink& ProgressMerger::addSource(const std::string& description, double w totalWeight += weight; - const int sourceIndex = sources.size(); + const int sourceIndex = static_cast(sources.size()); sources.push_back({ description, weight,