Merge pull request #9271 from leoetlino/warnings

Fix several warnings and only enable extra warnings for our own code
This commit is contained in:
Léo Lam
2020-11-22 02:04:53 +01:00
committed by GitHub
10 changed files with 48 additions and 33 deletions

View File

@ -99,7 +99,7 @@ u32 HashEctor(const u8* ptr, size_t length)
{
u32 crc = 0;
for (int i = 0; i < length; i++)
for (size_t i = 0; i < length; i++)
{
crc ^= ptr[i];
crc = (crc << 3) | (crc >> 29);

View File

@ -16,7 +16,7 @@ namespace Gecko
class GeckoCode
{
public:
GeckoCode() : enabled(false) {}
GeckoCode() = default;
struct Code
{
u32 address = 0;
@ -28,8 +28,8 @@ public:
std::string name, creator;
std::vector<std::string> notes;
bool enabled;
bool user_defined;
bool enabled = false;
bool user_defined = false;
bool Exist(u32 address, u32 data) const;
};

View File

@ -199,6 +199,8 @@ s32 WiiSocket::Shutdown(u32 how)
if (shut_write)
op.Abort(-SO_ENOTCONN);
break;
default:
break;
}
}
return ret;

View File

@ -1049,10 +1049,10 @@ NetPlayDialog::FindGameFile(const NetPlay::SyncIdentifier& sync_identifier,
RunOnObject(this, [this, &sync_identifier, found] {
for (int i = 0; i < m_game_list_model.rowCount(QModelIndex()); i++)
{
auto game_file = m_game_list_model.GetGameFile(i);
*found = std::min(*found, game_file->CompareSyncIdentifier(sync_identifier));
auto file = m_game_list_model.GetGameFile(i);
*found = std::min(*found, file->CompareSyncIdentifier(sync_identifier));
if (*found == NetPlay::SyncIdentifierComparison::SameGame)
return game_file;
return file;
}
return static_cast<std::shared_ptr<const UICommon::GameFile>>(nullptr);
});

View File

@ -6,7 +6,7 @@
#include "Common/StringUtil.h"
UTF8CodePointCountValidator::UTF8CodePointCountValidator(int max_count, QObject* parent)
UTF8CodePointCountValidator::UTF8CodePointCountValidator(std::size_t max_count, QObject* parent)
: QValidator(parent), m_max_count(max_count)
{
}

View File

@ -4,6 +4,8 @@
#pragma once
#include <cstddef>
#include <QString>
#include <QValidator>
@ -11,9 +13,10 @@ class UTF8CodePointCountValidator : public QValidator
{
Q_OBJECT
public:
explicit UTF8CodePointCountValidator(int max_count, QObject* parent = nullptr);
explicit UTF8CodePointCountValidator(std::size_t max_count, QObject* parent = nullptr);
QValidator::State validate(QString& input, int& pos) const override;
int m_max_count;
private:
std::size_t m_max_count;
};

View File

@ -20,7 +20,7 @@ bool TASCheckBox::GetValue() const
if (checkState() == Qt::PartiallyChecked)
{
const u64 frames_elapsed = Movie::GetCurrentFrame() - m_frame_turbo_started;
return frames_elapsed % m_turbo_total_frames < m_turbo_press_frames;
return static_cast<int>(frames_elapsed % m_turbo_total_frames) < m_turbo_press_frames;
}
return isChecked();

View File

@ -32,13 +32,13 @@ struct ImagePixelData
{
ImagePixelData() = default;
explicit ImagePixelData(std::vector<Pixel> image_pixels, u32 width, u32 height)
: pixels(std::move(image_pixels)), width(width), height(height)
explicit ImagePixelData(std::vector<Pixel> image_pixels, u32 width_, u32 height_)
: pixels(std::move(image_pixels)), width(width_), height(height_)
{
}
explicit ImagePixelData(u32 width, u32 height, const Pixel& default_color = Pixel{0, 0, 0, 0})
: pixels(width * height, default_color), width(width), height(height)
explicit ImagePixelData(u32 width_, u32 height_, const Pixel& default_color = Pixel{0, 0, 0, 0})
: pixels(width_ * height_, default_color), width(width_), height(height_)
{
}
std::vector<Pixel> pixels;