PR feedback + constification
This commit is contained in:
parent
b9f9d0a642
commit
d885dd5b64
8 changed files with 62 additions and 60 deletions
|
@ -270,10 +270,10 @@ void BSD::GetSockOpt(HLERequestContext& ctx) {
|
|||
|
||||
std::vector<u8> optval(ctx.GetWriteBufferSize());
|
||||
|
||||
LOG_WARNING(Service, "called. fd={} level={} optname=0x{:x} len=0x{:x}", fd, level, optname,
|
||||
optval.size());
|
||||
LOG_DEBUG(Service, "called. fd={} level={} optname=0x{:x} len=0x{:x}", fd, level, optname,
|
||||
optval.size());
|
||||
|
||||
Errno err = GetSockOptImpl(fd, level, optname, optval);
|
||||
const Errno err = GetSockOptImpl(fd, level, optname, optval);
|
||||
|
||||
ctx.WriteBuffer(optval);
|
||||
|
||||
|
@ -447,7 +447,7 @@ void BSD::DuplicateSocket(HLERequestContext& ctx) {
|
|||
const s32 fd = rp.Pop<s32>();
|
||||
[[maybe_unused]] const u64 unused = rp.Pop<u64>();
|
||||
|
||||
Common::Expected<s32, Errno> res = DuplicateSocketImpl(fd);
|
||||
Expected<s32, Errno> res = DuplicateSocketImpl(fd);
|
||||
IPC::ResponseBuilder rb{ctx, 4};
|
||||
rb.Push(ResultSuccess);
|
||||
rb.Push(res.value_or(0)); // ret
|
||||
|
|
|
@ -49,7 +49,7 @@ static ResultVal<std::string> ResolveImpl(const std::string& fqdn_in) {
|
|||
// The real implementation makes various substitutions.
|
||||
// For now we just return the string as-is, which is good enough when not
|
||||
// connecting to real Nintendo servers.
|
||||
LOG_WARNING(Service, "(STUBBED) called({})", fqdn_in);
|
||||
LOG_WARNING(Service, "(STUBBED) called, fqdn_in={}", fqdn_in);
|
||||
return fqdn_in;
|
||||
}
|
||||
|
||||
|
@ -69,7 +69,7 @@ void NSD::Resolve(HLERequestContext& ctx) {
|
|||
const std::string fqdn_in = Common::StringFromBuffer(ctx.ReadBuffer(0));
|
||||
|
||||
std::array<char, 0x100> fqdn_out{};
|
||||
Result res = ResolveCommon(fqdn_in, fqdn_out);
|
||||
const Result res = ResolveCommon(fqdn_in, fqdn_out);
|
||||
|
||||
ctx.WriteBuffer(fqdn_out);
|
||||
IPC::ResponseBuilder rb{ctx, 2};
|
||||
|
@ -80,7 +80,7 @@ void NSD::ResolveEx(HLERequestContext& ctx) {
|
|||
const std::string fqdn_in = Common::StringFromBuffer(ctx.ReadBuffer(0));
|
||||
|
||||
std::array<char, 0x100> fqdn_out;
|
||||
Result res = ResolveCommon(fqdn_in, fqdn_out);
|
||||
const Result res = ResolveCommon(fqdn_in, fqdn_out);
|
||||
|
||||
if (res.IsError()) {
|
||||
IPC::ResponseBuilder rb{ctx, 2};
|
||||
|
|
|
@ -88,15 +88,15 @@ static Errno GetAddrInfoErrorToErrno(GetAddrInfoError result) {
|
|||
|
||||
template <typename T>
|
||||
static void Append(std::vector<u8>& vec, T t) {
|
||||
size_t off = vec.size();
|
||||
vec.resize(off + sizeof(T));
|
||||
std::memcpy(vec.data() + off, &t, sizeof(T));
|
||||
const size_t offset = vec.size();
|
||||
vec.resize(offset + sizeof(T));
|
||||
std::memcpy(vec.data() + offset, &t, sizeof(T));
|
||||
}
|
||||
|
||||
static void AppendNulTerminated(std::vector<u8>& vec, std::string_view str) {
|
||||
size_t off = vec.size();
|
||||
vec.resize(off + str.size() + 1);
|
||||
std::memmove(vec.data() + off, str.data(), str.size());
|
||||
const size_t offset = vec.size();
|
||||
vec.resize(offset + str.size() + 1);
|
||||
std::memmove(vec.data() + offset, str.data(), str.size());
|
||||
}
|
||||
|
||||
// We implement gethostbyname using the host's getaddrinfo rather than the
|
||||
|
@ -154,8 +154,8 @@ static std::pair<u32, GetAddrInfoError> GetHostByNameRequestImpl(HLERequestConte
|
|||
return {0, Translate(res.error())};
|
||||
}
|
||||
|
||||
std::vector<u8> data = SerializeAddrInfoAsHostEnt(res.value(), host);
|
||||
u32 data_size = static_cast<u32>(data.size());
|
||||
const std::vector<u8> data = SerializeAddrInfoAsHostEnt(res.value(), host);
|
||||
const u32 data_size = static_cast<u32>(data.size());
|
||||
ctx.WriteBuffer(data, 0);
|
||||
|
||||
return {data_size, GetAddrInfoError::SUCCESS};
|
||||
|
@ -243,7 +243,7 @@ static std::pair<u32, GetAddrInfoError> GetAddrInfoRequestImpl(HLERequestContext
|
|||
|
||||
std::optional<std::string> service = std::nullopt;
|
||||
if (ctx.CanReadBuffer(1)) {
|
||||
std::span<const u8> service_buffer = ctx.ReadBuffer(1);
|
||||
const std::span<const u8> service_buffer = ctx.ReadBuffer(1);
|
||||
service = Common::StringFromBuffer(service_buffer);
|
||||
}
|
||||
|
||||
|
@ -254,8 +254,8 @@ static std::pair<u32, GetAddrInfoError> GetAddrInfoRequestImpl(HLERequestContext
|
|||
return {0, Translate(res.error())};
|
||||
}
|
||||
|
||||
std::vector<u8> data = SerializeAddrInfo(res.value(), host);
|
||||
u32 data_size = static_cast<u32>(data.size());
|
||||
const std::vector<u8> data = SerializeAddrInfo(res.value(), host);
|
||||
const u32 data_size = static_cast<u32>(data.size());
|
||||
ctx.WriteBuffer(data, 0);
|
||||
|
||||
return {data_size, GetAddrInfoError::SUCCESS};
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue