DEV9: Fix function parameter should be passed by const reference warnings.

Codacy.
This commit is contained in:
lightningterror 2023-08-07 22:19:14 +02:00
parent 57f118a5b5
commit 424158b28d
6 changed files with 9 additions and 9 deletions

View File

@ -286,5 +286,5 @@ private:
static void WriteUInt16(u8* data, int* index, u16 value);
static void WriteUInt32(u8* data, int* index, u32 value);
static void WriteUInt64(u8* data, int* index, u64 value);
static void WritePaddedString(u8* data, int* index, std::string value, u32 len);
static void WritePaddedString(u8* data, int* index, const std::string& value, u32 len);
};

View File

@ -37,7 +37,7 @@ void ATA::WriteUInt64(u8* data, int* index, u64 value)
}
//No null char
void ATA::WritePaddedString(u8* data, int* index, std::string value, u32 len)
void ATA::WritePaddedString(u8* data, int* index, const std::string& value, u32 len)
{
memset(&data[*index], (u8)' ', len);
memcpy(&data[*index], value.c_str(), value.length() < len ? value.length() : len);

View File

@ -39,7 +39,7 @@ void HddCreate::Start()
Cleanup();
}
void HddCreate::WriteImage(std::string hddPath, u64 fileBytes, u64 zeroSizeBytes)
void HddCreate::WriteImage(const std::string& hddPath, u64 fileBytes, u64 zeroSizeBytes)
{
constexpr int buffsize = 4 * 1024;
const u8 buff[buffsize] = {0}; // 4kb.

View File

@ -49,5 +49,5 @@ protected:
void SetCanceled();
private:
void WriteImage(std::string hddPath, u64 fileBytes, u64 zeroSizeBytes);
void WriteImage(const std::string& hddPath, u64 fileBytes, u64 zeroSizeBytes);
};

View File

@ -277,7 +277,7 @@ namespace InternalServers
}
#ifdef _WIN32
void DNS_Server::GetHost(std::string url, DNS_State* state)
void DNS_Server::GetHost(const std::string& url, DNS_State* state)
{
//Need to convert to UTF16
const int size = MultiByteToWideChar(CP_UTF8, 0, url.c_str(), -1, nullptr, 0);
@ -347,7 +347,7 @@ namespace InternalServers
delete data;
}
#elif defined(__POSIX__)
void DNS_Server::GetHost(std::string url, DNS_State* state)
void DNS_Server::GetHost(const std::string& url, DNS_State* state)
{
//Need to spin up thread, pass the parms to it
@ -357,7 +357,7 @@ namespace InternalServers
GetHostThread.detach();
}
void DNS_Server::GetAddrInfoThread(std::string url, DNS_State* state)
void DNS_Server::GetAddrInfoThread(const std::string& url, DNS_State* state)
{
addrinfo hints{0};
hints.ai_family = AF_INET;

View File

@ -95,7 +95,7 @@ namespace InternalServers
private:
void LoadHostList();
bool CheckHostList(std::string url, DNS_State* state);
void GetHost(std::string url, DNS_State* state);
void GetHost(const std::string& url, DNS_State* state);
void FinaliseDNS(DNS_State* state);
#ifdef _WIN32
@ -111,7 +111,7 @@ namespace InternalServers
static void __stdcall GetAddrInfoExCallback(DWORD dwError, DWORD dwBytes, OVERLAPPED* lpOverlapped);
#elif defined(__POSIX__)
void GetAddrInfoThread(std::string url, DNS_State* state);
void GetAddrInfoThread(const std::string& url, DNS_State* state);
#endif
};
} // namespace InternalServers