Fix warnings

This commit is contained in:
Daniel Wolf 2021-06-18 18:16:02 +02:00
parent d6fad367fc
commit 2b9d305ea1
7 changed files with 10 additions and 10 deletions

View File

@ -113,7 +113,7 @@ public:
} }
int getStaticSegmentCount() const { int getStaticSegmentCount() const {
return staticSegments.size(); return static_cast<int>(staticSegments.size());
} }
ContinuousTimeline<ShapeRule> getChangedRules() const { ContinuousTimeline<ShapeRule> getChangedRules() const {

View File

@ -20,7 +20,7 @@ void process16bitAudioClip(
// Process entire sound stream // Process entire sound stream
vector<int16_t> buffer; vector<int16_t> buffer;
buffer.reserve(bufferCapacity); buffer.reserve(bufferCapacity);
int sampleCount = 0; size_t sampleCount = 0;
auto it = audioClip.begin(); auto it = audioClip.begin();
const auto end = audioClip.end(); const auto end = audioClip.end();
do { do {
@ -35,7 +35,7 @@ void process16bitAudioClip(
processBuffer(buffer); processBuffer(buffer);
sampleCount += buffer.size(); sampleCount += buffer.size();
progressSink.reportProgress(static_cast<double>(sampleCount) / audioClip.size()); progressSink.reportProgress(static_cast<double>(sampleCount) / static_cast<double>(audioClip.size()));
} while (!buffer.empty()); } while (!buffer.empty());
} }

View File

@ -93,7 +93,7 @@ vector<string> tokenizeText(
vector<string> words = tokenizeViaFlite(text); vector<string> words = tokenizeViaFlite(text);
// Join words separated by apostrophes // Join words separated by apostrophes
for (int i = words.size() - 1; i > 0; --i) { for (int i = static_cast<int>(words.size()) - 1; i > 0; --i) {
if (!words[i].empty() && words[i][0] == '\'') { if (!words[i].empty() && words[i][0] == '\'') {
words[i - 1].append(words[i]); words[i - 1].append(words[i]);
words.erase(words.begin() + i); words.erase(words.begin() + i);

View File

@ -296,7 +296,7 @@ public:
} }
Timeline(const Timeline&) = default; Timeline(const Timeline&) = default;
Timeline(Timeline&&) = default; Timeline(Timeline&&) noexcept = default;
Timeline& operator=(const Timeline&) = default; Timeline& operator=(const Timeline&) = default;
Timeline& operator=(Timeline&&) = default; Timeline& operator=(Timeline&&) = default;

View File

@ -70,8 +70,8 @@ void ProgressBar::update(bool showSpinner) {
void ProgressBar::updateText(const string& text) { void ProgressBar::updateText(const string& text) {
// Get length of common portion // Get length of common portion
int commonPrefixLength = 0; size_t commonPrefixLength = 0;
const int commonLength = std::min(currentText.size(), text.size()); const size_t commonLength = std::min(currentText.size(), text.size());
while (commonPrefixLength < commonLength && text[commonPrefixLength] == currentText[commonPrefixLength]) { while (commonPrefixLength < commonLength && text[commonPrefixLength] == currentText[commonPrefixLength]) {
commonPrefixLength++; commonPrefixLength++;
} }
@ -86,7 +86,7 @@ void ProgressBar::updateText(const string& text) {
output.append(text, commonPrefixLength, text.size() - commonPrefixLength); output.append(text, commonPrefixLength, text.size() - commonPrefixLength);
// ... if the new text is shorter than the old one: delete overlapping characters // ... 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<int>(currentText.size()) - static_cast<int>(text.size());
if (overlapCount > 0) { if (overlapCount > 0) {
output.append(overlapCount, ' '); output.append(overlapCount, ' ');
output.append(overlapCount, '\b'); output.append(overlapCount, '\b');

View File

@ -34,7 +34,7 @@ path getBinPath() {
// Actually, it does. // Actually, it does.
// In case there are situations where it doesn't, we allocate one character more. // In case there are situations where it doesn't, we allocate one character more.
std::vector<char> buffer(pathLength + 1); std::vector<char> buffer(pathLength + 1);
if (wai_getExecutablePath(buffer.data(), buffer.size(), nullptr) == -1) { if (wai_getExecutablePath(buffer.data(), static_cast<int>(buffer.size()), nullptr) == -1) {
throw std::runtime_error("Error reading path."); throw std::runtime_error("Error reading path.");
} }
buffer[pathLength] = 0; buffer[pathLength] = 0;

View File

@ -34,7 +34,7 @@ ProgressSink& ProgressMerger::addSource(const std::string& description, double w
totalWeight += weight; totalWeight += weight;
const int sourceIndex = sources.size(); const int sourceIndex = static_cast<int>(sources.size());
sources.push_back({ sources.push_back({
description, description,
weight, weight,