code: Use std::span where appropriate (#6658)

* code: Use std::span when possible

* code: Prefix memcpy and memcmp with std::
This commit is contained in:
GPUCode 2023-07-07 01:52:40 +03:00 committed by GitHub
parent 4ccd9f24fb
commit cf9bb90ae3
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
106 changed files with 362 additions and 329 deletions

View file

@ -491,7 +491,7 @@ void SendReply(const char* reply) {
return;
}
memset(command_buffer, 0, sizeof(command_buffer));
std::memset(command_buffer, 0, sizeof(command_buffer));
command_length = static_cast<u32>(strlen(reply));
if (command_length + 4 > sizeof(command_buffer)) {
@ -499,7 +499,7 @@ void SendReply(const char* reply) {
return;
}
memcpy(command_buffer + 1, reply, command_length);
std::memcpy(command_buffer + 1, reply, command_length);
u8 checksum = CalculateChecksum(command_buffer, command_length + 1);
command_buffer[0] = GDB_STUB_START;
@ -639,7 +639,7 @@ static void SendSignal(Kernel::Thread* thread, u32 signal, bool full = true) {
/// Read command from gdb client.
static void ReadCommand() {
command_length = 0;
memset(command_buffer, 0, sizeof(command_buffer));
std::memset(command_buffer, 0, sizeof(command_buffer));
u8 c = ReadByte();
if (c == GDB_STUB_ACK) {
@ -711,7 +711,7 @@ static bool IsDataAvailable() {
/// Send requested register to gdb client.
static void ReadRegister() {
static u8 reply[64];
memset(reply, 0, sizeof(reply));
std::memset(reply, 0, sizeof(reply));
u32 id = HexCharToValue(command_buffer[1]);
if (command_buffer[2] != '\0') {
@ -737,7 +737,7 @@ static void ReadRegister() {
/// Send all registers to the gdb client.
static void ReadRegisters() {
static u8 buffer[GDB_BUFFER_SIZE - 4];
memset(buffer, 0, sizeof(buffer));
std::memset(buffer, 0, sizeof(buffer));
u8* bufptr = buffer;

View file

@ -6,6 +6,7 @@
#pragma once
#include <span>
#include "common/common_types.h"
#include "core/hle/kernel/thread.h"

View file

@ -115,7 +115,7 @@ void HandleHioReply(const u8* const command_buffer, const u32 command_length) {
}
// Skip 'F' header
auto* command_pos = command_buffer + 1;
const u8* command_pos = command_buffer + 1;
if (*command_pos == 0 || *command_pos == ',') {
LOG_WARNING(Debug_GDBStub, "bad HIO packet format position 0: {}", *command_pos);