Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

refactor: Misc int sign change fixes #806

Merged
merged 3 commits into from
Apr 18, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions src/qt/notificator.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -112,10 +112,10 @@ FreedesktopImage::FreedesktopImage(const QImage &img):

for(unsigned int ptr = 0; ptr < num_pixels; ++ptr)
{
image[ptr*BYTES_PER_PIXEL+0] = data[ptr] >> 16; // R
image[ptr*BYTES_PER_PIXEL+1] = data[ptr] >> 8; // G
image[ptr*BYTES_PER_PIXEL+2] = data[ptr]; // B
image[ptr*BYTES_PER_PIXEL+3] = data[ptr] >> 24; // A
image[ptr * BYTES_PER_PIXEL + 0] = char(data[ptr] >> 16); // R
image[ptr * BYTES_PER_PIXEL + 1] = char(data[ptr] >> 8); // G
image[ptr * BYTES_PER_PIXEL + 2] = char(data[ptr]); // B
image[ptr * BYTES_PER_PIXEL + 3] = char(data[ptr] >> 24); // A
Comment on lines +115 to +118
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: since we are touching this, perhaps we could use static_cast<char> instead of the C-style?

Suggested change
image[ptr * BYTES_PER_PIXEL + 0] = char(data[ptr] >> 16); // R
image[ptr * BYTES_PER_PIXEL + 1] = char(data[ptr] >> 8); // G
image[ptr * BYTES_PER_PIXEL + 2] = char(data[ptr]); // B
image[ptr * BYTES_PER_PIXEL + 3] = char(data[ptr] >> 24); // A
image[ptr * BYTES_PER_PIXEL + 0] = static_cast<char>(data[ptr] >> 16); // R
image[ptr * BYTES_PER_PIXEL + 1] = static_cast<char>(data[ptr] >> 8); // G
image[ptr * BYTES_PER_PIXEL + 2] = static_cast<char>(data[ptr]); // B
image[ptr * BYTES_PER_PIXEL + 3] = static_cast<char>(data[ptr] >> 24); // A

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think there is a difference for integral values, other than one being more to type and read

}
}

Expand Down
2 changes: 1 addition & 1 deletion src/qt/walletview.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -134,7 +134,7 @@ void WalletView::processNewTransaction(const QModelIndex& parent, int start, int
return;

QString date = ttm->index(start, TransactionTableModel::Date, parent).data().toString();
qint64 amount = ttm->index(start, TransactionTableModel::Amount, parent).data(Qt::EditRole).toULongLong();
qint64 amount = ttm->index(start, TransactionTableModel::Amount, parent).data(Qt::EditRole).toLongLong();
QString type = ttm->index(start, TransactionTableModel::Type, parent).data().toString();
QModelIndex index = ttm->index(start, 0, parent);
QString address = ttm->data(index, TransactionTableModel::AddressRole).toString();
Expand Down
2 changes: 1 addition & 1 deletion src/wallet/interfaces.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -286,7 +286,7 @@ class WalletImpl : public Wallet
if (!res) return util::Error{util::ErrorString(res)};
const auto& txr = *res;
fee = txr.fee;
change_pos = txr.change_pos ? *txr.change_pos : -1;
change_pos = txr.change_pos ? int(*txr.change_pos) : -1;

return txr.tx;
}
Expand Down