citra-emu
/
citra
Archived
1
0
Fork 0

ir:/movie: Replace for-loops with fmt::join

This commit is contained in:
fearlessTobi 2018-11-26 20:04:18 +01:00
parent 210e558bea
commit 5121fadb4f
3 changed files with 7 additions and 17 deletions

View File

@ -165,10 +165,8 @@ void ExtraHID::OnDisconnect() {
void ExtraHID::HandleConfigureHIDPollingRequest(const std::vector<u8>& request) {
if (request.size() != 3) {
std::string request_string;
for (auto request_part : request)
request_string += fmt::format("{:02x} ", request_part);
LOG_ERROR(Service_IR, "Wrong request size ({}): {}", request.size(), request_string);
LOG_ERROR(Service_IR, "Wrong request size ({}): {}", request.size(),
fmt::format("{:02x}", fmt::join(request, " ")));
return;
}
@ -190,11 +188,8 @@ void ExtraHID::HandleReadCalibrationDataRequest(const std::vector<u8>& request_b
"ReadCalibrationDataRequest has wrong size");
if (request_buf.size() != sizeof(ReadCalibrationDataRequest)) {
std::string request_buf_string;
for (auto request_buf_part : request_buf)
request_buf_string += fmt::format("{:02x} ", request_buf_part);
LOG_ERROR(Service_IR, "Wrong request size ({}): {}", request_buf.size(),
request_buf_string);
fmt::format("{:02x}", fmt::join(request_buf, " ")));
return;
}
@ -228,10 +223,7 @@ void ExtraHID::OnReceive(const std::vector<u8>& data) {
HandleReadCalibrationDataRequest(data);
break;
default:
std::string data_string;
for (auto data_part : data)
data_string += fmt::format("{:02x} ", data_part);
LOG_ERROR(Service_IR, "Unknown request: {}", data_string);
LOG_ERROR(Service_IR, "Unknown request: {}", fmt::format("{:02x}", fmt::join(data, " ")));
break;
}
}

View File

@ -183,7 +183,7 @@ private:
/// Wraps the payload into packet and puts it to the receive buffer
void IR_USER::PutToReceive(const std::vector<u8>& payload) {
LOG_TRACE(Service_IR, "called, data={}", Common::ArrayToString(payload.data(), payload.size()));
LOG_TRACE(Service_IR, "called, data={}", fmt::format("{:02x}", fmt::join(payload, " ")));
std::size_t size = payload.size();
std::vector<u8> packet;
@ -361,7 +361,7 @@ void IR_USER::SendIrNop(Kernel::HLERequestContext& ctx) {
ErrorSummary::InvalidState, ErrorLevel::Status));
}
LOG_TRACE(Service_IR, "called, data={}", Common::ArrayToString(buffer.data(), size));
LOG_TRACE(Service_IR, "called, data={}", fmt::format("{:02x}", fmt::join(buffer, " ")));
}
void IR_USER::ReleaseReceivedData(Kernel::HLERequestContext& ctx) {

View File

@ -358,9 +358,7 @@ Movie::ValidationResult Movie::ValidateHeader(const CTMHeader& header, u64 progr
return ValidationResult::Invalid;
}
std::string revision;
for (auto header_part : header.revision)
revision += fmt::format("{:02x}", header_part);
std::string revision = fmt::format("{:02x}", fmt::join(header.revision, ""));
if (!program_id)
Core::System::GetInstance().GetAppLoader().ReadProgramId(program_id);