mirror of
https://github.com/RPCS3/rpcs3.git
synced 2025-04-16 08:42:32 +00:00
Use empty() instead of comparing size() with 0
Recommendation from Clang-Tidy: https://clang.llvm.org/extra/clang-tidy/checks/readability-container-size-empty.html
This commit is contained in:
parent
bf557ea6e6
commit
09c9996f31
@ -640,7 +640,7 @@ void logs::file_listener::log(u64 stamp, const logs::message& msg, const std::st
|
|||||||
const u64 frac = (stamp % 1'000'000);
|
const u64 frac = (stamp % 1'000'000);
|
||||||
fmt::append(text, "%u:%02u:%02u.%06u ", hours, mins, secs, frac);
|
fmt::append(text, "%u:%02u:%02u.%06u ", hours, mins, secs, frac);
|
||||||
|
|
||||||
if (prefix.size() > 0)
|
if (!prefix.empty())
|
||||||
{
|
{
|
||||||
text += "{";
|
text += "{";
|
||||||
text += prefix;
|
text += prefix;
|
||||||
|
@ -173,7 +173,7 @@ s32 cellMouseGetData(u32 port_no, vm::ptr<CellMouseData> data)
|
|||||||
|
|
||||||
MouseDataList& data_list = handler->GetDataList(port_no);
|
MouseDataList& data_list = handler->GetDataList(port_no);
|
||||||
|
|
||||||
if (data_list.size() == 0)
|
if (data_list.empty())
|
||||||
{
|
{
|
||||||
*data = {};
|
*data = {};
|
||||||
return CELL_OK;
|
return CELL_OK;
|
||||||
|
@ -184,7 +184,7 @@ vm::ptr<void> sys_mempool_allocate_block(ppu_thread& ppu, sys_mempool_t mempool)
|
|||||||
}
|
}
|
||||||
sys_mutex_lock(ppu, memory_pool->mutexid, 0);
|
sys_mutex_lock(ppu, memory_pool->mutexid, 0);
|
||||||
|
|
||||||
while (memory_pool->free_blocks.size() == 0) // while is to guard against spurious wakeups
|
while (memory_pool->free_blocks.empty()) // while is to guard against spurious wakeups
|
||||||
{
|
{
|
||||||
sys_cond_wait(ppu, memory_pool->condid, 0);
|
sys_cond_wait(ppu, memory_pool->condid, 0);
|
||||||
memory_pool = idm::get<memory_pool_t>(mempool);
|
memory_pool = idm::get<memory_pool_t>(mempool);
|
||||||
@ -206,7 +206,7 @@ vm::ptr<void> sys_mempool_try_allocate_block(ppu_thread& ppu, sys_mempool_t memp
|
|||||||
|
|
||||||
auto memory_pool = idm::get<memory_pool_t>(mempool);
|
auto memory_pool = idm::get<memory_pool_t>(mempool);
|
||||||
|
|
||||||
if (!memory_pool || memory_pool->free_blocks.size() == 0)
|
if (!memory_pool || memory_pool->free_blocks.empty())
|
||||||
{
|
{
|
||||||
return vm::null;
|
return vm::null;
|
||||||
}
|
}
|
||||||
|
@ -39,7 +39,7 @@ error_code sys_tty_read(s32 ch, vm::ptr<char> buf, u32 len, vm::ptr<u32> preadle
|
|||||||
{
|
{
|
||||||
std::lock_guard lock(g_tty_mutex);
|
std::lock_guard lock(g_tty_mutex);
|
||||||
|
|
||||||
if (g_tty_input[ch].size() > 0)
|
if (!g_tty_input[ch].empty())
|
||||||
{
|
{
|
||||||
// reference to our first queue element
|
// reference to our first queue element
|
||||||
std::string& input = g_tty_input[ch].front();
|
std::string& input = g_tty_input[ch].front();
|
||||||
@ -62,7 +62,7 @@ error_code sys_tty_read(s32 ch, vm::ptr<char> buf, u32 len, vm::ptr<u32> preadle
|
|||||||
// remove the just read text from the input string
|
// remove the just read text from the input string
|
||||||
input = input.substr(chars_to_read, input.size() - 1);
|
input = input.substr(chars_to_read, input.size() - 1);
|
||||||
|
|
||||||
if (input.size() == 0)
|
if (input.empty())
|
||||||
{
|
{
|
||||||
// pop the first queue element if it was completely consumed
|
// pop the first queue element if it was completely consumed
|
||||||
g_tty_input[ch].pop_front();
|
g_tty_input[ch].pop_front();
|
||||||
|
@ -15,7 +15,7 @@ namespace rsx
|
|||||||
{
|
{
|
||||||
void insert_mem_block_in_map(std::unordered_set<u64>& mem_changes, frame_capture_data::memory_block&& block, frame_capture_data::memory_block_data&& data)
|
void insert_mem_block_in_map(std::unordered_set<u64>& mem_changes, frame_capture_data::memory_block&& block, frame_capture_data::memory_block_data&& data)
|
||||||
{
|
{
|
||||||
if (data.data.size() > 0)
|
if (!data.data.empty())
|
||||||
{
|
{
|
||||||
u64 data_hash = XXH64(data.data.data(), data.data.size(), 0);
|
u64 data_hash = XXH64(data.data.data(), data.data.size(), 0);
|
||||||
block.data_state = data_hash;
|
block.data_state = data_hash;
|
||||||
|
@ -65,7 +65,7 @@ namespace rsx
|
|||||||
u32 currentOffset = 0x10000000;
|
u32 currentOffset = 0x10000000;
|
||||||
for (const auto& rc : frame->replay_commands)
|
for (const auto& rc : frame->replay_commands)
|
||||||
{
|
{
|
||||||
bool hasState = (rc.memory_state.size() > 0) || (rc.display_buffer_state != 0) || (rc.tile_state != 0);
|
bool hasState = (!rc.memory_state.empty()) || (rc.display_buffer_state != 0) || (rc.tile_state != 0);
|
||||||
if (hasState)
|
if (hasState)
|
||||||
{
|
{
|
||||||
if (count != 0)
|
if (count != 0)
|
||||||
@ -197,7 +197,7 @@ namespace rsx
|
|||||||
break;
|
break;
|
||||||
|
|
||||||
// Loop and hunt down our next state change that needs to be done
|
// Loop and hunt down our next state change that needs to be done
|
||||||
if (!((replay_cmd.memory_state.size() > 0) || (replay_cmd.display_buffer_state != 0) || (replay_cmd.tile_state != 0)))
|
if (!(!replay_cmd.memory_state.empty() || (replay_cmd.display_buffer_state != 0) || (replay_cmd.tile_state != 0)))
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
// wait until rsx idle and at our first 'stop' to apply state
|
// wait until rsx idle and at our first 'stop' to apply state
|
||||||
|
@ -304,7 +304,7 @@ public:
|
|||||||
|
|
||||||
bool is_empty() const
|
bool is_empty() const
|
||||||
{
|
{
|
||||||
return db.size() == 0;
|
return db.empty();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
patch_table;
|
patch_table;
|
||||||
|
@ -200,7 +200,7 @@ public:
|
|||||||
|
|
||||||
auto var_blocks = fmt::split(simple_var, { "." });
|
auto var_blocks = fmt::split(simple_var, { "." });
|
||||||
|
|
||||||
verify(HERE), (var_blocks.size() != 0);
|
verify(HERE), (!var_blocks.empty());
|
||||||
|
|
||||||
name = prefix + var_blocks[0];
|
name = prefix + var_blocks[0];
|
||||||
|
|
||||||
|
@ -436,7 +436,7 @@ void GLGSRender::end()
|
|||||||
clear_depth = true;
|
clear_depth = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (clear_depth || buffers_to_clear.size() > 0)
|
if (clear_depth || !buffers_to_clear.empty())
|
||||||
{
|
{
|
||||||
gl_state.enable(GL_FALSE, GL_SCISSOR_TEST);
|
gl_state.enable(GL_FALSE, GL_SCISSOR_TEST);
|
||||||
GLenum mask = 0;
|
GLenum mask = 0;
|
||||||
@ -454,7 +454,7 @@ void GLGSRender::end()
|
|||||||
|
|
||||||
glClear(mask);
|
glClear(mask);
|
||||||
|
|
||||||
if (buffers_to_clear.size() > 0 && !clear_all_color)
|
if (!buffers_to_clear.empty() && !clear_all_color)
|
||||||
{
|
{
|
||||||
GLfloat colors[] = { 0.f, 0.f, 0.f, 0.f };
|
GLfloat colors[] = { 0.f, 0.f, 0.f, 0.f };
|
||||||
//It is impossible for the render target to be type A or B here (clear all would have been flagged)
|
//It is impossible for the render target to be type A or B here (clear all would have been flagged)
|
||||||
|
@ -604,7 +604,7 @@ namespace rsx
|
|||||||
u16 clip_width = clip_text ? w : UINT16_MAX;
|
u16 clip_width = clip_text ? w : UINT16_MAX;
|
||||||
std::vector<vertex> result = renderer->render_text(string, clip_width, wrap_text);
|
std::vector<vertex> result = renderer->render_text(string, clip_width, wrap_text);
|
||||||
|
|
||||||
if (result.size() > 0)
|
if (!result.empty())
|
||||||
{
|
{
|
||||||
for (auto &v : result)
|
for (auto &v : result)
|
||||||
{
|
{
|
||||||
@ -702,7 +702,7 @@ namespace rsx
|
|||||||
cmd_text.config.color = fore_color;
|
cmd_text.config.color = fore_color;
|
||||||
cmd_text.verts = render_text(text.c_str(), (f32)x, (f32)y);
|
cmd_text.verts = render_text(text.c_str(), (f32)x, (f32)y);
|
||||||
|
|
||||||
if (cmd_text.verts.size() > 0)
|
if (!cmd_text.verts.empty())
|
||||||
compiled_resources.add(std::move(compiled_resources_temp), margin_left, margin_top);
|
compiled_resources.add(std::move(compiled_resources_temp), margin_left, margin_top);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -424,7 +424,7 @@ namespace rsx
|
|||||||
void on_draw();
|
void on_draw();
|
||||||
|
|
||||||
// Check for pending writes
|
// Check for pending writes
|
||||||
bool has_pending() const { return (m_pending_writes.size() != 0); }
|
bool has_pending() const { return !m_pending_writes.empty(); }
|
||||||
|
|
||||||
// Backend methods (optional, will return everything as always visible by default)
|
// Backend methods (optional, will return everything as always visible by default)
|
||||||
virtual void begin_occlusion_query(occlusion_query_info* /*query*/) {}
|
virtual void begin_occlusion_query(occlusion_query_info* /*query*/) {}
|
||||||
|
@ -394,7 +394,7 @@ VKGSRender::VKGSRender() : GSRender()
|
|||||||
|
|
||||||
//Actually confirm that the loader found at least one compatible device
|
//Actually confirm that the loader found at least one compatible device
|
||||||
//This should not happen unless something is wrong with the driver setup on the target system
|
//This should not happen unless something is wrong with the driver setup on the target system
|
||||||
if (gpus.size() == 0)
|
if (gpus.empty())
|
||||||
{
|
{
|
||||||
//We can't throw in Emulator::Load, so we show error and return
|
//We can't throw in Emulator::Load, so we show error and return
|
||||||
LOG_FATAL(RSX, "No compatible GPU devices found");
|
LOG_FATAL(RSX, "No compatible GPU devices found");
|
||||||
@ -2167,7 +2167,7 @@ void VKGSRender::clear_surface(u32 mask)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (clear_descriptors.size() > 0)
|
if (!clear_descriptors.empty())
|
||||||
{
|
{
|
||||||
begin_render_pass();
|
begin_render_pass();
|
||||||
vkCmdClearAttachments(*m_current_command_buffer, (u32)clear_descriptors.size(), clear_descriptors.data(), 1, ®ion);
|
vkCmdClearAttachments(*m_current_command_buffer, (u32)clear_descriptors.size(), clear_descriptors.data(), 1, ®ion);
|
||||||
@ -3538,7 +3538,7 @@ bool VKGSRender::check_occlusion_query_status(rsx::reports::occlusion_query_info
|
|||||||
return true;
|
return true;
|
||||||
|
|
||||||
auto &data = found->second;
|
auto &data = found->second;
|
||||||
if (data.indices.size() == 0)
|
if (data.indices.empty())
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
if (data.command_buffer_to_wait == m_current_command_buffer)
|
if (data.command_buffer_to_wait == m_current_command_buffer)
|
||||||
@ -3568,7 +3568,7 @@ void VKGSRender::get_occlusion_query_result(rsx::reports::occlusion_query_info*
|
|||||||
return;
|
return;
|
||||||
|
|
||||||
auto &data = found->second;
|
auto &data = found->second;
|
||||||
if (data.indices.size() == 0)
|
if (data.indices.empty())
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if (query->num_draws)
|
if (query->num_draws)
|
||||||
@ -3618,7 +3618,7 @@ void VKGSRender::discard_occlusion_query(rsx::reports::occlusion_query_info* que
|
|||||||
return;
|
return;
|
||||||
|
|
||||||
auto &data = found->second;
|
auto &data = found->second;
|
||||||
if (data.indices.size() == 0)
|
if (data.indices.empty())
|
||||||
return;
|
return;
|
||||||
|
|
||||||
m_occlusion_query_pool.reset_queries(*m_current_command_buffer, data.indices);
|
m_occlusion_query_pool.reset_queries(*m_current_command_buffer, data.indices);
|
||||||
|
@ -95,7 +95,7 @@ bool ds3_pad_handler::Init()
|
|||||||
LOG_ERROR(HLE, "[DS3] Check https://wiki.rpcs3.net/index.php?title=Help:Controller_Configuration for intructions on how to solve this issue");
|
LOG_ERROR(HLE, "[DS3] Check https://wiki.rpcs3.net/index.php?title=Help:Controller_Configuration for intructions on how to solve this issue");
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
else if (controllers.size() == 0)
|
else if (controllers.empty())
|
||||||
{
|
{
|
||||||
LOG_WARNING(HLE, "[DS3] No controllers found!");
|
LOG_WARNING(HLE, "[DS3] No controllers found!");
|
||||||
}
|
}
|
||||||
|
@ -209,7 +209,7 @@ void ds4_pad_handler::GetNextButtonPress(const std::string& padId, const std::fu
|
|||||||
|
|
||||||
if (get_blacklist)
|
if (get_blacklist)
|
||||||
{
|
{
|
||||||
if (blacklist.size() <= 0)
|
if (blacklist.empty())
|
||||||
LOG_SUCCESS(HLE, "DS4 Calibration: Blacklist is clear. No input spam detected");
|
LOG_SUCCESS(HLE, "DS4 Calibration: Blacklist is clear. No input spam detected");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -786,7 +786,7 @@ bool ds4_pad_handler::Init()
|
|||||||
LOG_ERROR(HLE, "[DS4] Check https://wiki.rpcs3.net/index.php?title=Help:Controller_Configuration for intructions on how to solve this issue");
|
LOG_ERROR(HLE, "[DS4] Check https://wiki.rpcs3.net/index.php?title=Help:Controller_Configuration for intructions on how to solve this issue");
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
else if (controllers.size() == 0)
|
else if (controllers.empty())
|
||||||
{
|
{
|
||||||
LOG_WARNING(HLE, "[DS4] No controllers found!");
|
LOG_WARNING(HLE, "[DS4] No controllers found!");
|
||||||
}
|
}
|
||||||
|
@ -364,7 +364,7 @@ void evdev_joystick_handler::GetNextButtonPress(const std::string& padId, const
|
|||||||
|
|
||||||
if (get_blacklist)
|
if (get_blacklist)
|
||||||
{
|
{
|
||||||
if (blacklist.size() <= 0)
|
if (blacklist.empty())
|
||||||
LOG_SUCCESS(HLE, "Evdev Calibration: Blacklist is clear. No input spam detected");
|
LOG_SUCCESS(HLE, "Evdev Calibration: Blacklist is clear. No input spam detected");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -391,7 +391,7 @@ void mm_joystick_handler::GetNextButtonPress(const std::string& padId, const std
|
|||||||
|
|
||||||
if (get_blacklist)
|
if (get_blacklist)
|
||||||
{
|
{
|
||||||
if (blacklist.size() <= 0)
|
if (blacklist.empty())
|
||||||
LOG_SUCCESS(HLE, "MMJOY Calibration: Blacklist is clear. No input spam detected");
|
LOG_SUCCESS(HLE, "MMJOY Calibration: Blacklist is clear. No input spam detected");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -155,7 +155,7 @@ emu_settings::Render_Creator::Render_Creator()
|
|||||||
device_enum_context.makeCurrentInstance(instance_handle);
|
device_enum_context.makeCurrentInstance(instance_handle);
|
||||||
std::vector<vk::physical_device>& gpus = device_enum_context.enumerateDevices();
|
std::vector<vk::physical_device>& gpus = device_enum_context.enumerateDevices();
|
||||||
|
|
||||||
if (gpus.size() > 0)
|
if (!gpus.empty())
|
||||||
{
|
{
|
||||||
//A device with vulkan support found. Init data
|
//A device with vulkan support found. Init data
|
||||||
supportsVulkan = true;
|
supportsVulkan = true;
|
||||||
|
@ -57,7 +57,7 @@ struct gui_listener : logs::listener
|
|||||||
packet_t p,* _new = &p;
|
packet_t p,* _new = &p;
|
||||||
_new->sev = msg.sev;
|
_new->sev = msg.sev;
|
||||||
|
|
||||||
if (prefix.size() > 0)
|
if (!prefix.empty())
|
||||||
{
|
{
|
||||||
_new->msg += "{";
|
_new->msg += "{";
|
||||||
_new->msg += prefix;
|
_new->msg += prefix;
|
||||||
|
@ -73,7 +73,7 @@ void save_data_info_dialog::UpdateData()
|
|||||||
m_list->setItem(3, 1, new QTableWidgetItem(qstr(m_entry.details)));
|
m_list->setItem(3, 1, new QTableWidgetItem(qstr(m_entry.details)));
|
||||||
|
|
||||||
QImage img;
|
QImage img;
|
||||||
if (m_entry.iconBuf.size() > 0 && img.loadFromData((uchar*)&m_entry.iconBuf[0], m_entry.iconBuf.size(), "PNG"))
|
if (!m_entry.iconBuf.empty() && img.loadFromData((uchar*)&m_entry.iconBuf[0], m_entry.iconBuf.size(), "PNG"))
|
||||||
{
|
{
|
||||||
m_list->insertRow(0);
|
m_list->insertRow(0);
|
||||||
QTableWidgetItem* img_item = new QTableWidgetItem();
|
QTableWidgetItem* img_item = new QTableWidgetItem();
|
||||||
|
@ -46,7 +46,7 @@ save_data_list_dialog::save_data_list_dialog(const std::vector<SaveDataEntry>& e
|
|||||||
// Button Layout
|
// Button Layout
|
||||||
QHBoxLayout* hbox_action = new QHBoxLayout();
|
QHBoxLayout* hbox_action = new QHBoxLayout();
|
||||||
|
|
||||||
if (entries.size() > 0)
|
if (!entries.empty())
|
||||||
{ // If there are no entries, don't add the selection widget or the selection label to the UI.
|
{ // If there are no entries, don't add the selection widget or the selection label to the UI.
|
||||||
QPushButton *push_select = new QPushButton(tr("&Select Entry"), this);
|
QPushButton *push_select = new QPushButton(tr("&Select Entry"), this);
|
||||||
connect(push_select, &QAbstractButton::clicked, this, &save_data_list_dialog::accept);
|
connect(push_select, &QAbstractButton::clicked, this, &save_data_list_dialog::accept);
|
||||||
|
@ -257,7 +257,7 @@ void save_manager_dialog::OnEntryRemove()
|
|||||||
void save_manager_dialog::OnEntriesRemove()
|
void save_manager_dialog::OnEntriesRemove()
|
||||||
{
|
{
|
||||||
QModelIndexList selection(m_list->selectionModel()->selectedRows());
|
QModelIndexList selection(m_list->selectionModel()->selectedRows());
|
||||||
if (selection.size() == 0)
|
if (selection.empty())
|
||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -25,7 +25,7 @@ trophy_notification_frame::trophy_notification_frame(const std::vector<uchar>& i
|
|||||||
trophyImgLabel->setPalette(black_background);
|
trophyImgLabel->setPalette(black_background);
|
||||||
|
|
||||||
QImage trophyImg;
|
QImage trophyImg;
|
||||||
if (imgBuffer.size() > 0 && trophyImg.loadFromData((uchar*)&imgBuffer[0], imgBuffer.size(), "PNG"))
|
if (!imgBuffer.empty() && trophyImg.loadFromData((uchar*)&imgBuffer[0], imgBuffer.size(), "PNG"))
|
||||||
{
|
{
|
||||||
trophyImg = trophyImg.scaledToHeight(height); // I might consider adding ability to change size since on hidpi this will be rather small.
|
trophyImg = trophyImg.scaledToHeight(height); // I might consider adding ability to change size since on hidpi this will be rather small.
|
||||||
trophyImgLabel->setPixmap(QPixmap::fromImage(trophyImg));
|
trophyImgLabel->setPixmap(QPixmap::fromImage(trophyImg));
|
||||||
|
@ -123,7 +123,7 @@ void xinput_pad_handler::GetNextButtonPress(const std::string& padId, const std:
|
|||||||
|
|
||||||
if (get_blacklist)
|
if (get_blacklist)
|
||||||
{
|
{
|
||||||
if (blacklist.size() <= 0)
|
if (blacklist.empty())
|
||||||
LOG_SUCCESS(HLE, "XInput Calibration: Blacklist is clear. No input spam detected");
|
LOG_SUCCESS(HLE, "XInput Calibration: Blacklist is clear. No input spam detected");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user