mirror of
https://github.com/RPCS3/rpcs3.git
synced 2025-03-19 16:21:30 +00:00
Fix some static analysis warnings
This commit is contained in:
parent
5491fbee5b
commit
657ab4261c
@ -79,10 +79,13 @@ flow_layout::~flow_layout()
|
||||
|
||||
void flow_layout::clear()
|
||||
{
|
||||
while (QLayoutItem* item = takeAt(0))
|
||||
for (QLayoutItem* item : m_item_list)
|
||||
{
|
||||
delete item->widget();
|
||||
delete item;
|
||||
if (item)
|
||||
{
|
||||
delete item->widget();
|
||||
delete item;
|
||||
}
|
||||
}
|
||||
m_item_list.clear();
|
||||
m_positions.clear();
|
||||
@ -185,8 +188,8 @@ int flow_layout::doLayout(const QRect& rect, bool testOnly) const
|
||||
int x = effectiveRect.x();
|
||||
int y = effectiveRect.y();
|
||||
int lineHeight = 0;
|
||||
int rows = 0;
|
||||
int cols = 0;
|
||||
int row_count = 0;
|
||||
int col_count = 0;
|
||||
|
||||
if (m_dynamic_spacing)
|
||||
{
|
||||
@ -259,8 +262,8 @@ int flow_layout::doLayout(const QRect& rect, bool testOnly) const
|
||||
pos.row = row;
|
||||
pos.col = col++;
|
||||
|
||||
rows = std::max(rows, pos.row + 1);
|
||||
cols = std::max(cols, pos.col + 1);
|
||||
row_count = std::max(row_count, pos.row + 1);
|
||||
col_count = std::max(col_count, pos.col + 1);
|
||||
|
||||
if (!testOnly)
|
||||
item->setGeometry(QRect(QPoint(x, y), item->sizeHint()));
|
||||
@ -269,8 +272,8 @@ int flow_layout::doLayout(const QRect& rect, bool testOnly) const
|
||||
lineHeight = qMax(lineHeight, item->sizeHint().height());
|
||||
}
|
||||
|
||||
m_rows = rows;
|
||||
m_cols = cols;
|
||||
m_rows = row_count;
|
||||
m_cols = col_count;
|
||||
|
||||
return y + lineHeight - rect.y() + bottom;
|
||||
}
|
||||
|
@ -11,16 +11,11 @@ struct gui_save
|
||||
|
||||
gui_save()
|
||||
{
|
||||
key = "";
|
||||
name = "";
|
||||
def = QVariant();
|
||||
}
|
||||
|
||||
gui_save(const QString& k, const QString& n, const QVariant& d)
|
||||
: key(k), name(n), def(d)
|
||||
{
|
||||
key = k;
|
||||
name = n;
|
||||
def = d;
|
||||
}
|
||||
|
||||
bool operator==(const gui_save& rhs) const noexcept
|
||||
|
@ -14,9 +14,9 @@ class user_account
|
||||
public:
|
||||
explicit user_account(const std::string& user_id = "00000001");
|
||||
|
||||
std::string GetUserId() const { return m_user_id; }
|
||||
std::string GetUserDir() const { return m_user_dir; }
|
||||
std::string GetUsername() const { return m_username; }
|
||||
const std::string& GetUserId() const { return m_user_id; }
|
||||
const std::string& GetUserDir() const { return m_user_dir; }
|
||||
const std::string& GetUsername() const { return m_username; }
|
||||
|
||||
static std::map<u32, user_account> GetUserAccounts(const std::string& base_dir);
|
||||
|
||||
|
@ -989,14 +989,14 @@ template <typename To, typename From> requires (std::is_integral_v<decltype(std:
|
||||
constexpr bool is_from_signed = std::is_signed_v<CommonFrom>;
|
||||
constexpr bool is_to_signed = std::is_signed_v<CommonTo>;
|
||||
|
||||
constexpr auto from_mask = is_from_signed > is_to_signed ? UnFrom{umax} >> 1 : UnFrom{umax};
|
||||
constexpr auto to_mask = is_to_signed > is_from_signed ? UnTo{umax} >> 1 : UnTo{umax};
|
||||
constexpr auto from_mask = (is_from_signed && !is_to_signed) ? UnFrom{umax} >> 1 : UnFrom{umax};
|
||||
constexpr auto to_mask = (is_to_signed && !is_from_signed) ? UnTo{umax} >> 1 : UnTo{umax};
|
||||
|
||||
constexpr auto mask = ~(from_mask & to_mask);
|
||||
|
||||
// Signed to unsigned always require test
|
||||
// Otherwise, this is bit-wise narrowing or conversion between types of different signedness of the same size
|
||||
if constexpr (is_from_signed > is_to_signed || to_mask < from_mask)
|
||||
if constexpr ((is_from_signed && !is_to_signed) || to_mask < from_mask)
|
||||
{
|
||||
// Try to optimize test if both are of the same signedness
|
||||
if (is_from_signed != is_to_signed ? !!(value & mask) : static_cast<CommonTo>(value) != value) [[unlikely]]
|
||||
|
Loading…
x
Reference in New Issue
Block a user