citra-emu
/
citra
Archived
1
0
Fork 0

code: Small cleanups and fixes to lambda captures (#6191)

Co-authored-by: v1993 <v19930312@gmail.com>
Co-authored-by: Morph <39850852+Morph1984@users.noreply.github.com>
This commit is contained in:
Tobias 2022-12-17 16:04:10 +01:00 committed by GitHub
parent 9d5ae8e1c2
commit cb82ffbe20
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
6 changed files with 17 additions and 8 deletions

View File

@ -320,6 +320,12 @@ public:
setData(type(), TypeRole); setData(type(), TypeRole);
setData(size_bytes, SizeRole); setData(size_bytes, SizeRole);
} }
explicit GameListItemSize(const QString& string) {
// This is required to avoid incorrect virtual function call in
// GameListItem's constructor
setText(string);
setData(string, SortRole);
}
void setData(const QVariant& value, int role) override { void setData(const QVariant& value, int role) override {
// By specializing setData for SizeRole, we can ensure that the numerical and string // By specializing setData for SizeRole, we can ensure that the numerical and string

View File

@ -30,12 +30,12 @@ Lobby::Lobby(QWidget* parent, QStandardItemModel* list,
ui->setupUi(this); ui->setupUi(this);
// setup the watcher for background connections // setup the watcher for background connections
watcher = new QFutureWatcher<void>; watcher = new QFutureWatcher<void>(this);
model = new QStandardItemModel(ui->room_list); model = new QStandardItemModel(ui->room_list);
// Create a proxy to the game list to get the list of games owned // Create a proxy to the game list to get the list of games owned
game_list = new QStandardItemModel; game_list = new QStandardItemModel(this);
UpdateGameList(list); UpdateGameList(list);
proxy = new LobbyFilterProxyModel(this, game_list); proxy = new LobbyFilterProxyModel(this, game_list);

View File

@ -156,7 +156,7 @@ void UpdaterPrivate::StopUpdateCheck(int delay, bool async) {
QTimer* timer = new QTimer(this); QTimer* timer = new QTimer(this);
timer->setSingleShot(true); timer->setSingleShot(true);
connect(timer, &QTimer::timeout, [=]() { connect(timer, &QTimer::timeout, [this, timer]() {
StopUpdateCheck(0, false); StopUpdateCheck(0, false);
timer->deleteLater(); timer->deleteLater();
}); });

View File

@ -76,10 +76,12 @@ void CSpinBox::stepBy(int steps) {
}*/ }*/
// Increment "new_value" by "steps", and perform annoying overflow checks, too. // Increment "new_value" by "steps", and perform annoying overflow checks, too.
if (steps < 0 && new_value + steps > new_value) { constexpr qint64 qint64_min = std::numeric_limits<qint64>::min();
new_value = std::numeric_limits<qint64>::min(); constexpr qint64 qint64_max = std::numeric_limits<qint64>::max();
} else if (steps > 0 && new_value + steps < new_value) { if (steps < 0 && new_value < qint64_min - steps) {
new_value = std::numeric_limits<qint64>::max(); new_value = qint64_min;
} else if (steps > 0 && new_value > qint64_max - steps) {
new_value = qint64_max;
} else { } else {
new_value += steps; new_value += steps;
} }

View File

@ -1054,6 +1054,7 @@ void SOC_U::GetAddrInfoImpl(Kernel::HLERequestContext& ctx) {
// if the buffer is not big enough. However the count returned is always correct. // if the buffer is not big enough. However the count returned is always correct.
CTRAddrInfo ctr_addr = CTRAddrInfo::FromPlatform(*cur); CTRAddrInfo ctr_addr = CTRAddrInfo::FromPlatform(*cur);
std::memcpy(out_buff.data() + pos, &ctr_addr, sizeof(ctr_addr)); std::memcpy(out_buff.data() + pos, &ctr_addr, sizeof(ctr_addr));
pos += sizeof(ctr_addr);
} }
cur = cur->ai_next; cur = cur->ai_next;
count++; count++;

View File

@ -233,7 +233,7 @@ CalibrationConfigurationJob::CalibrationConfigurationJob(
std::function<void(Status)> status_callback, std::function<void(Status)> status_callback,
std::function<void(u16, u16, u16, u16)> data_callback) { std::function<void(u16, u16, u16, u16)> data_callback) {
std::thread([=] { std::thread([=, this] {
constexpr u16 CALIBRATION_THRESHOLD = 100; constexpr u16 CALIBRATION_THRESHOLD = 100;
u16 min_x{UINT16_MAX}; u16 min_x{UINT16_MAX};