mirror of
https://github.com/RPCS3/rpcs3.git
synced 2025-04-20 03:25:16 +00:00
Replace std::string::npos with umax
This commit is contained in:
parent
0a41999818
commit
7a8772dafa
18 changed files with 42 additions and 42 deletions
|
@ -342,7 +342,7 @@ std::string fmt::replace_first(const std::string& src, const std::string& from,
|
|||
{
|
||||
auto pos = src.find(from);
|
||||
|
||||
if (pos == std::string::npos)
|
||||
if (pos == umax)
|
||||
{
|
||||
return src;
|
||||
}
|
||||
|
@ -353,7 +353,7 @@ std::string fmt::replace_first(const std::string& src, const std::string& from,
|
|||
std::string fmt::replace_all(const std::string& src, const std::string& from, const std::string& to)
|
||||
{
|
||||
std::string target = src;
|
||||
for (auto pos = target.find(from); pos != std::string::npos; pos = target.find(from, pos + 1))
|
||||
for (auto pos = target.find(from); pos != umax; pos = target.find(from, pos + 1))
|
||||
{
|
||||
target = (pos ? target.substr(0, pos) + to : to) + std::string(target.c_str() + pos + from.length());
|
||||
pos += to.length();
|
||||
|
|
|
@ -2024,11 +2024,11 @@ void thread_ctrl::detect_cpu_layout()
|
|||
return;
|
||||
|
||||
const auto system_id = utils::get_system_info();
|
||||
if (system_id.find("Ryzen") != std::string::npos)
|
||||
if (system_id.find("Ryzen") != umax)
|
||||
{
|
||||
g_native_core_layout.store(native_core_arrangement::amd_ccx);
|
||||
}
|
||||
else if (system_id.find("Intel") != std::string::npos)
|
||||
else if (system_id.find("Intel") != umax)
|
||||
{
|
||||
#ifdef _WIN32
|
||||
const LOGICAL_PROCESSOR_RELATIONSHIP relationship = LOGICAL_PROCESSOR_RELATIONSHIP::RelationProcessorCore;
|
||||
|
@ -2098,7 +2098,7 @@ u64 thread_ctrl::get_affinity_mask(thread_class group)
|
|||
const auto system_id = utils::get_system_info();
|
||||
if (thread_count >= 32)
|
||||
{
|
||||
if (system_id.find("3950X") != std::string::npos)
|
||||
if (system_id.find("3950X") != umax)
|
||||
{
|
||||
// zen2
|
||||
// Ryzen 9 3950X
|
||||
|
@ -2107,7 +2107,7 @@ u64 thread_ctrl::get_affinity_mask(thread_class group)
|
|||
spu_mask = 0b00000000111111110000000000000000;
|
||||
rsx_mask = 0b00000000000000001111111100000000;
|
||||
}
|
||||
else if (system_id.find("2970WX") != std::string::npos)
|
||||
else if (system_id.find("2970WX") != umax)
|
||||
{
|
||||
// zen+
|
||||
// Threadripper 2970WX
|
||||
|
@ -2129,7 +2129,7 @@ u64 thread_ctrl::get_affinity_mask(thread_class group)
|
|||
}
|
||||
else if (thread_count == 24)
|
||||
{
|
||||
if (system_id.find("3900X") != std::string::npos)
|
||||
if (system_id.find("3900X") != umax)
|
||||
{
|
||||
// zen2
|
||||
// Ryzen 9 3900X
|
||||
|
@ -2150,7 +2150,7 @@ u64 thread_ctrl::get_affinity_mask(thread_class group)
|
|||
}
|
||||
else if (thread_count == 16)
|
||||
{
|
||||
if (system_id.find("3700X") != std::string::npos || system_id.find("3800X") != std::string::npos)
|
||||
if (system_id.find("3700X") != umax || system_id.find("3800X") != umax)
|
||||
{
|
||||
// Ryzen 7 3700/3800 (x)
|
||||
// Assign threads 1-16
|
||||
|
@ -2170,7 +2170,7 @@ u64 thread_ctrl::get_affinity_mask(thread_class group)
|
|||
}
|
||||
else if (thread_count == 12)
|
||||
{
|
||||
if (system_id.find("3600") != std::string::npos)
|
||||
if (system_id.find("3600") != umax)
|
||||
{
|
||||
// zen2
|
||||
// R5 3600 (x)
|
||||
|
|
|
@ -599,7 +599,7 @@ bool gdb_thread::cmd_write_register(gdb_cmd& cmd)
|
|||
if (th->id_type() == 1) {
|
||||
auto ppu = static_cast<named_thread<ppu_thread>*>(th.get());
|
||||
size_t eq_pos = cmd.data.find('=');
|
||||
if (eq_pos == std::string::npos) {
|
||||
if (eq_pos == umax) {
|
||||
GDB.warning("Wrong write_register cmd data '%s'.", cmd.data);
|
||||
return send_cmd_ack("E02");
|
||||
}
|
||||
|
@ -641,7 +641,7 @@ bool gdb_thread::cmd_write_memory(gdb_cmd& cmd)
|
|||
{
|
||||
size_t s = cmd.data.find(',');
|
||||
size_t s2 = cmd.data.find(':');
|
||||
if ((s == std::string::npos) || (s2 == std::string::npos)) {
|
||||
if ((s == umax) || (s2 == umax)) {
|
||||
GDB.warning("Malformed write memory request received: '%s'.", cmd.data);
|
||||
return send_cmd_ack("E01");
|
||||
}
|
||||
|
@ -778,7 +778,7 @@ bool gdb_thread::cmd_set_breakpoint(gdb_cmd& cmd)
|
|||
//software breakpoint
|
||||
if (type == '0') {
|
||||
u32 addr = INVALID_PTR;
|
||||
if (cmd.data.find(';') != std::string::npos) {
|
||||
if (cmd.data.find(';') != umax) {
|
||||
GDB.warning("Received request to set breakpoint with condition, but they are not supported.");
|
||||
return send_cmd_ack("E01");
|
||||
}
|
||||
|
|
|
@ -421,17 +421,17 @@ void FragmentProgramDecompiler::AddCodeCond(const std::string& lhs, const std::s
|
|||
|
||||
bool src_is_fp16 = false;
|
||||
if ((opflags & (OPFLAGS::texture_ref | OPFLAGS::src_cast_f32)) == 0 &&
|
||||
rhs.find("$0") != std::string::npos)
|
||||
rhs.find("$0") != umax)
|
||||
{
|
||||
// Texture sample operations are full-width and are exempt
|
||||
src_is_fp16 = (src0.fp16 && src0.reg_type == RSX_FP_REGISTER_TYPE_TEMP);
|
||||
|
||||
if (src_is_fp16 && rhs.find("$1") != std::string::npos)
|
||||
if (src_is_fp16 && rhs.find("$1") != umax)
|
||||
{
|
||||
// References operand 1
|
||||
src_is_fp16 = (src1.fp16 && src1.reg_type == RSX_FP_REGISTER_TYPE_TEMP);
|
||||
|
||||
if (src_is_fp16 && rhs.find("$2") != std::string::npos)
|
||||
if (src_is_fp16 && rhs.find("$2") != umax)
|
||||
{
|
||||
// References operand 2
|
||||
src_is_fp16 = (src2.fp16 && src2.reg_type == RSX_FP_REGISTER_TYPE_TEMP);
|
||||
|
|
|
@ -184,7 +184,7 @@ public:
|
|||
std::string simple_var;
|
||||
const auto eq_pos = var.find('=');
|
||||
|
||||
if (eq_pos != std::string::npos)
|
||||
if (eq_pos != umax)
|
||||
{
|
||||
simple_var = var.substr(0, eq_pos - 1);
|
||||
}
|
||||
|
@ -195,7 +195,7 @@ public:
|
|||
|
||||
const auto brace_pos = var.find_last_of(')');
|
||||
std::string prefix;
|
||||
if (brace_pos != std::string::npos)
|
||||
if (brace_pos != umax)
|
||||
{
|
||||
prefix = simple_var.substr(0, brace_pos);
|
||||
simple_var = simple_var.substr(brace_pos);
|
||||
|
|
|
@ -234,7 +234,7 @@ namespace gl
|
|||
vendor_string = "intel"; //lowest acceptable value
|
||||
}
|
||||
|
||||
if (vendor_string.find("intel") != std::string::npos)
|
||||
if (vendor_string.find("intel") != umax)
|
||||
{
|
||||
int version_major = 0;
|
||||
int version_minor = 0;
|
||||
|
@ -258,16 +258,16 @@ namespace gl
|
|||
if (!EXT_dsa_supported && glGetTextureImageEXT && glTextureBufferRangeEXT)
|
||||
EXT_dsa_supported = true;
|
||||
}
|
||||
else if (vendor_string.find("nvidia") != std::string::npos)
|
||||
else if (vendor_string.find("nvidia") != umax)
|
||||
{
|
||||
vendor_NVIDIA = true;
|
||||
}
|
||||
else if (vendor_string.find("x.org") != std::string::npos)
|
||||
else if (vendor_string.find("x.org") != umax)
|
||||
{
|
||||
vendor_MESA = true;
|
||||
}
|
||||
#ifdef _WIN32
|
||||
else if (vendor_string.find("amd") != std::string::npos || vendor_string.find("ati") != std::string::npos)
|
||||
else if (vendor_string.find("amd") != umax || vendor_string.find("ati") != umax)
|
||||
{
|
||||
vendor_AMD = true;
|
||||
}
|
||||
|
|
|
@ -174,7 +174,7 @@ namespace rsx
|
|||
|
||||
std::string extension;
|
||||
if (const auto extension_start = font_file.find_last_of('.');
|
||||
extension_start != std::string::npos)
|
||||
extension_start != umax)
|
||||
{
|
||||
extension = font_file.substr(extension_start + 1);
|
||||
}
|
||||
|
|
|
@ -627,7 +627,7 @@ private:
|
|||
rsx_log.notice("Found vulkan-compatible GPU: '%s' running on driver %s", get_name(), get_driver_version());
|
||||
|
||||
if (get_driver_vendor() == driver_vendor::RADV &&
|
||||
get_name().find("LLVM 8.0.0") != std::string::npos)
|
||||
get_name().find("LLVM 8.0.0") != umax)
|
||||
{
|
||||
// Serious driver bug causing black screens
|
||||
// See https://bugs.freedesktop.org/show_bug.cgi?id=110970
|
||||
|
@ -651,22 +651,22 @@ private:
|
|||
if (!driver_properties.driverID)
|
||||
{
|
||||
const auto gpu_name = get_name();
|
||||
if (gpu_name.find("Radeon") != std::string::npos)
|
||||
if (gpu_name.find("Radeon") != umax)
|
||||
{
|
||||
return driver_vendor::AMD;
|
||||
}
|
||||
|
||||
if (gpu_name.find("NVIDIA") != std::string::npos || gpu_name.find("GeForce") != std::string::npos)
|
||||
if (gpu_name.find("NVIDIA") != umax || gpu_name.find("GeForce") != umax)
|
||||
{
|
||||
return driver_vendor::NVIDIA;
|
||||
}
|
||||
|
||||
if (gpu_name.find("RADV") != std::string::npos)
|
||||
if (gpu_name.find("RADV") != umax)
|
||||
{
|
||||
return driver_vendor::RADV;
|
||||
}
|
||||
|
||||
if (gpu_name.find("Intel") != std::string::npos)
|
||||
if (gpu_name.find("Intel") != umax)
|
||||
{
|
||||
return driver_vendor::INTEL;
|
||||
}
|
||||
|
|
|
@ -57,18 +57,18 @@ namespace vk
|
|||
// Link step is only useful for rasterizer programs, compute programs do not need this
|
||||
for (const auto &uniform : uniforms[program_input_type::input_type_texture])
|
||||
{
|
||||
if (const auto name_start = uniform.name.find("tex"); name_start != std::string::npos)
|
||||
if (const auto name_start = uniform.name.find("tex"); name_start != umax)
|
||||
{
|
||||
const auto name_end = uniform.name.find("_stencil");
|
||||
const auto index_start = name_start + 3; // Skip 'tex' part
|
||||
const auto index_length = (name_end != std::string::npos) ? name_end - index_start : name_end;
|
||||
const auto index_length = (name_end != umax) ? name_end - index_start : name_end;
|
||||
const auto index_part = uniform.name.substr(index_start, index_length);
|
||||
const auto index = std::stoi(index_part);
|
||||
|
||||
if (name_start == 0)
|
||||
{
|
||||
// Fragment texture (tex...)
|
||||
if (name_end == std::string::npos)
|
||||
if (name_end == umax)
|
||||
{
|
||||
// Normal texture
|
||||
fs_texture_bindings[index] = uniform.location;
|
||||
|
|
|
@ -1034,7 +1034,7 @@ game_boot_result Emulator::Load(const std::string& title_id, bool add_only, bool
|
|||
const std::string hdd0_disc = vfs::get("/dev_hdd0/disc/");
|
||||
const std::size_t game_dir_size = 8; // size of PS3_GAME and PS3_GMXX
|
||||
const std::size_t bdvd_pos = m_cat == "DG" && bdvd_dir.empty() && disc.empty() ? elf_dir.rfind("/USRDIR") - game_dir_size : 0;
|
||||
const bool from_hdd0_game = m_path.find(hdd0_game) != std::string::npos;
|
||||
const bool from_hdd0_game = m_path.find(hdd0_game) != umax;
|
||||
|
||||
if (bdvd_pos && from_hdd0_game)
|
||||
{
|
||||
|
|
|
@ -219,7 +219,7 @@ std::shared_ptr<ds3_pad_handler::ds3_device> ds3_pad_handler::get_ds3_device(con
|
|||
return nullptr;
|
||||
|
||||
size_t pos = padId.find(m_name_string);
|
||||
if (pos == std::string::npos)
|
||||
if (pos == umax)
|
||||
return nullptr;
|
||||
|
||||
int pad_number = std::stoi(padId.substr(pos + 9));
|
||||
|
|
|
@ -225,7 +225,7 @@ std::shared_ptr<ds4_pad_handler::DS4Device> ds4_pad_handler::GetDS4Device(const
|
|||
return nullptr;
|
||||
|
||||
size_t pos = padId.find(m_name_string);
|
||||
if (pos == std::string::npos)
|
||||
if (pos == umax)
|
||||
return nullptr;
|
||||
|
||||
std::string pad_serial = padId.substr(pos + 9);
|
||||
|
|
|
@ -327,9 +327,9 @@ void evdev_joystick_handler::get_next_button_press(const std::string& padId, con
|
|||
std::string name = button.second;
|
||||
|
||||
// Handle annoying useless buttons
|
||||
if (padId.find("Xbox 360") != std::string::npos && code >= BTN_TRIGGER_HAPPY)
|
||||
if (padId.find("Xbox 360") != umax && code >= BTN_TRIGGER_HAPPY)
|
||||
continue;
|
||||
if (padId.find("Sony") != std::string::npos && (code == BTN_TL2 || code == BTN_TR2))
|
||||
if (padId.find("Sony") != umax && (code == BTN_TL2 || code == BTN_TR2))
|
||||
continue;
|
||||
|
||||
if (!get_blacklist && std::find(blacklist.begin(), blacklist.end(), name) != blacklist.end())
|
||||
|
|
|
@ -146,7 +146,7 @@ int xinput_pad_handler::GetDeviceNumber(const std::string& padId)
|
|||
return -1;
|
||||
|
||||
size_t pos = padId.find(m_name_string);
|
||||
if (pos == std::string::npos)
|
||||
if (pos == umax)
|
||||
return -1;
|
||||
|
||||
int device_number = std::stoul(padId.substr(pos + 12)) - 1; // Controllers 1-n in GUI
|
||||
|
|
|
@ -68,7 +68,7 @@ fs::file tar_object::get_file(std::string path)
|
|||
{
|
||||
TARHeader header = read_header(largest_offset);
|
||||
|
||||
if (std::string(header.magic).find("ustar") != std::string::npos)
|
||||
if (std::string(header.magic).find("ustar") != umax)
|
||||
m_map[header.name] = largest_offset;
|
||||
|
||||
int size = octalToDecimal(atoi(header.size));
|
||||
|
|
|
@ -626,12 +626,12 @@ void main_window::HandlePupInstallation(QString file_path)
|
|||
auto updatefilenames = update_files.get_filenames();
|
||||
|
||||
updatefilenames.erase(std::remove_if(
|
||||
updatefilenames.begin(), updatefilenames.end(), [](std::string s) { return s.find("dev_flash_") == std::string::npos; }),
|
||||
updatefilenames.begin(), updatefilenames.end(), [](std::string s) { return s.find("dev_flash_") == umax; }),
|
||||
updatefilenames.end());
|
||||
|
||||
std::string version_string = pup.get_file(0x100).to_string();
|
||||
size_t version_pos = version_string.find('\n');
|
||||
if (version_pos != std::string::npos)
|
||||
if (version_pos != umax)
|
||||
{
|
||||
version_string.erase(version_pos);
|
||||
}
|
||||
|
|
|
@ -123,7 +123,7 @@ void register_editor_dialog::updateRegister(const QString& text)
|
|||
auto& spu = *static_cast<spu_thread*>(cpu.get());
|
||||
|
||||
std::string::size_type first_brk = reg.find('[');
|
||||
if (first_brk != std::string::npos)
|
||||
if (first_brk != umax)
|
||||
{
|
||||
long reg_index;
|
||||
reg_index = atol(reg.substr(first_brk + 1, reg.length() - 2).c_str());
|
||||
|
|
|
@ -502,7 +502,7 @@ bool update_manager::handle_rpcs3(const QByteArray& rpcs3_data, bool /*automatic
|
|||
break;
|
||||
}
|
||||
|
||||
if (size_t pos = name.find_last_of('/'); pos != std::string::npos)
|
||||
if (size_t pos = name.find_last_of('/'); pos != umax)
|
||||
{
|
||||
update_log.trace("Creating path: %s", name.substr(0, pos));
|
||||
fs::create_path(name.substr(0, pos));
|
||||
|
@ -521,7 +521,7 @@ bool update_manager::handle_rpcs3(const QByteArray& rpcs3_data, bool /*automatic
|
|||
// File failed to open, probably because in use, rename existing file and try again
|
||||
const auto pos = name.find_last_of('/');
|
||||
std::string filename;
|
||||
if (pos == std::string::npos)
|
||||
if (pos == umax)
|
||||
filename = name;
|
||||
else
|
||||
filename = name.substr(pos + 1);
|
||||
|
|
Loading…
Add table
Reference in a new issue