ams: use R_SUCCEED, R_THROW globally

This commit is contained in:
Michael Scire
2022-03-26 00:14:36 -07:00
parent e5b1739f65
commit dd78ede99f
370 changed files with 2107 additions and 2107 deletions

View File

@@ -59,7 +59,7 @@ namespace ams::htclow::mux {
AMS_UNREACHABLE_DEFAULT_CASE();
}
return ResultSuccess();
R_SUCCEED();
}
Result Mux::ProcessReceivePacket(const PacketHeader &header, const void *body, size_t body_size) {
@@ -73,7 +73,7 @@ namespace ams::htclow::mux {
if (header.packet_type == PacketType_Data || header.packet_type == PacketType_MaxData) {
this->SendErrorPacket(header.channel);
}
return htclow::ResultChannelNotExist();
R_THROW(htclow::ResultChannelNotExist());
}
}
@@ -143,7 +143,7 @@ namespace ams::htclow::mux {
Result Mux::CheckChannelExist(impl::ChannelInternalType channel) {
R_UNLESS(m_channel_impl_map.Exists(channel), htclow::ResultChannelNotExist());
return ResultSuccess();
R_SUCCEED();
}
Result Mux::SendErrorPacket(impl::ChannelInternalType channel) {
@@ -153,7 +153,7 @@ namespace ams::htclow::mux {
/* Signal our event. */
m_event.Signal();
return ResultSuccess();
R_SUCCEED();
}
bool Mux::IsSendable(PacketType packet_type) const {
@@ -181,7 +181,7 @@ namespace ams::htclow::mux {
/* Set the channel version. */
m_channel_impl_map.GetChannelImpl(channel).SetVersion(m_version);
return ResultSuccess();
R_SUCCEED();
}
Result Mux::Close(impl::ChannelInternalType channel) {
@@ -197,7 +197,7 @@ namespace ams::htclow::mux {
R_ABORT_UNLESS(m_channel_impl_map.RemoveChannel(channel));
}
return ResultSuccess();
R_SUCCEED();
}
Result Mux::ConnectBegin(u32 *out_task_id, impl::ChannelInternalType channel) {
@@ -272,7 +272,7 @@ namespace ams::htclow::mux {
/* Check that we didn't hit a disconnect. */
R_UNLESS(trigger != EventTrigger_Disconnect, htclow::ResultInvalidChannelStateDisconnected());
return ResultSuccess();
R_SUCCEED();
}
os::EventType *Mux::GetTaskEvent(u32 task_id) {
@@ -311,7 +311,7 @@ namespace ams::htclow::mux {
return m_channel_impl_map[it->second].DoReceiveEnd(out, dst, dst_size);
} else {
*out = 0;
return ResultSuccess();
R_SUCCEED();
}
}
@@ -340,7 +340,7 @@ namespace ams::htclow::mux {
/* Check that we didn't hit a disconnect. */
R_UNLESS(trigger != EventTrigger_Disconnect, htclow::ResultInvalidChannelStateDisconnected());
return ResultSuccess();
R_SUCCEED();
}
Result Mux::WaitReceiveBegin(u32 *out_task_id, impl::ChannelInternalType channel, size_t size) {
@@ -360,7 +360,7 @@ namespace ams::htclow::mux {
/* Check that we didn't hit a disconnect. */
R_UNLESS(trigger != EventTrigger_Disconnect, htclow::ResultInvalidChannelStateDisconnected());
return ResultSuccess();
R_SUCCEED();
}
void Mux::SetConfig(impl::ChannelInternalType channel, const ChannelConfig &config) {

View File

@@ -52,15 +52,15 @@ namespace ams::htclow::mux {
/* Otherwise, return appropriate failure error. */
if (m_state == ChannelState_Disconnected) {
return htclow::ResultInvalidChannelStateDisconnected();
R_THROW(htclow::ResultInvalidChannelStateDisconnected());
} else {
return htclow::ResultInvalidChannelState();
R_THROW(htclow::ResultInvalidChannelState());
}
}
Result ChannelImpl::CheckPacketVersion(s16 version) const {
R_UNLESS(version == m_version, htclow::ResultChannelVersionNotMatched());
return ResultSuccess();
R_SUCCEED();
}
@@ -73,7 +73,7 @@ namespace ams::htclow::mux {
case PacketType_Error:
return this->ProcessReceiveErrorPacket();
default:
return htclow::ResultProtocolError();
R_THROW(htclow::ResultProtocolError());
}
}
@@ -110,7 +110,7 @@ namespace ams::htclow::mux {
/* Notify the data was received. */
m_task_manager->NotifyReceiveData(m_channel, m_receive_buffer.GetDataSize());
return ResultSuccess();
R_SUCCEED();
}
Result ChannelImpl::ProcessReceiveMaxDataPacket(s16 version, u64 share) {
@@ -134,14 +134,14 @@ namespace ams::htclow::mux {
this->SignalSendPacketEvent();
}
return ResultSuccess();
R_SUCCEED();
}
Result ChannelImpl::ProcessReceiveErrorPacket() {
if (m_state == ChannelState_Connected || m_state == ChannelState_Disconnected) {
this->ShutdownForce();
}
return ResultSuccess();
R_SUCCEED();
}
bool ChannelImpl::QuerySendPacket(PacketHeader *header, PacketBody *body, int *out_body_size) {
@@ -250,7 +250,7 @@ namespace ams::htclow::mux {
/* Set the output task id. */
*out_task_id = task_id;
return ResultSuccess();
R_SUCCEED();
}
Result ChannelImpl::DoConnectEnd() {
@@ -287,7 +287,7 @@ namespace ams::htclow::mux {
/* Set our state as connected. */
this->SetState(ChannelState_Connected);
return ResultSuccess();
R_SUCCEED();
}
Result ChannelImpl::DoFlush(u32 *out_task_id) {
@@ -308,7 +308,7 @@ namespace ams::htclow::mux {
/* Set the output task id. */
*out_task_id = task_id;
return ResultSuccess();
R_SUCCEED();
}
Result ChannelImpl::DoReceiveBegin(u32 *out_task_id, size_t size) {
@@ -331,7 +331,7 @@ namespace ams::htclow::mux {
/* Set the output task id. */
*out_task_id = task_id;
return ResultSuccess();
R_SUCCEED();
}
Result ChannelImpl::DoReceiveEnd(size_t *out, void *dst, size_t dst_size) {
@@ -341,7 +341,7 @@ namespace ams::htclow::mux {
/* If we have nowhere to receive, we're done. */
if (dst_size == 0) {
*out = 0;
return ResultSuccess();
R_SUCCEED();
}
/* Get the amount of receivable data. */
@@ -381,7 +381,7 @@ namespace ams::htclow::mux {
/* Set the output size. */
*out = received;
return ResultSuccess();
R_SUCCEED();
}
Result ChannelImpl::DoSend(u32 *out_task_id, size_t *out, const void *src, size_t src_size) {
@@ -413,7 +413,7 @@ namespace ams::htclow::mux {
*out_task_id = task_id;
*out = sent;
return ResultSuccess();
R_SUCCEED();
}
Result ChannelImpl::DoShutdown() {
@@ -422,7 +422,7 @@ namespace ams::htclow::mux {
/* Set our state. */
this->SetState(ChannelState_Disconnected);
return ResultSuccess();
R_SUCCEED();
}
void ChannelImpl::SetConfig(const ChannelConfig &config) {

View File

@@ -64,7 +64,7 @@ namespace ams::htclow::mux {
/* Insert into our map. */
m_map.insert(std::pair<const impl::ChannelInternalType, int>{channel, idx});
return ResultSuccess();
R_SUCCEED();
}
Result ChannelImplMap::RemoveChannel(impl::ChannelInternalType channel) {
@@ -88,7 +88,7 @@ namespace ams::htclow::mux {
/* Destroy the channel. */
std::destroy_at(channel_impl);
return ResultSuccess();
R_SUCCEED();
}
}

View File

@@ -39,7 +39,7 @@ namespace ams::htclow::mux {
/* We don't, so push back a new one. */
m_packet_list.push_back(*(ptr.release()));
return ResultSuccess();
R_SUCCEED();
}
void GlobalSendBuffer::RemovePacket() {

View File

@@ -54,7 +54,7 @@ namespace ams::htclow::mux {
/* Discard. */
R_TRY(this->Discard(size));
return ResultSuccess();
R_SUCCEED();
}
Result RingBuffer::Write(const void *data, size_t size) {
@@ -81,7 +81,7 @@ namespace ams::htclow::mux {
/* Update our data size. */
m_data_size += size;
return ResultSuccess();
R_SUCCEED();
}
Result RingBuffer::Copy(void *dst, size_t size) {
@@ -108,7 +108,7 @@ namespace ams::htclow::mux {
/* Mark that we can discard. */
m_can_discard = true;
return ResultSuccess();
R_SUCCEED();
}
Result RingBuffer::Discard(size_t size) {
@@ -127,7 +127,7 @@ namespace ams::htclow::mux {
m_data_size -= size;
m_can_discard = false;
return ResultSuccess();
R_SUCCEED();
}
}

View File

@@ -56,7 +56,7 @@ namespace ams::htclow::mux {
/* Return the task id. */
*out_task_id = task_id;
return ResultSuccess();
R_SUCCEED();
}
void TaskManager::FreeTask(u32 task_id) {