ams: use R_SUCCEED, R_THROW globally
This commit is contained in:
@@ -43,15 +43,15 @@ namespace ams::htclow::driver {
|
||||
//m_plain_channel_driver.Open();
|
||||
//m_open_driver = std::addressof(m_plain_channel_driver);
|
||||
//break;
|
||||
return htclow::ResultUnknownDriverType();
|
||||
R_THROW(htclow::ResultUnknownDriverType());
|
||||
default:
|
||||
return htclow::ResultUnknownDriverType();
|
||||
R_THROW(htclow::ResultUnknownDriverType());
|
||||
}
|
||||
|
||||
/* Set the driver type. */
|
||||
m_driver_type = driver_type;
|
||||
|
||||
return ResultSuccess();
|
||||
R_SUCCEED();
|
||||
}
|
||||
|
||||
void DriverManager::CloseDriver() {
|
||||
|
||||
@@ -145,7 +145,7 @@ namespace ams::htclow::driver {
|
||||
|
||||
/* This can never happen, as the above loop should be infinite, but completion logic is here for posterity. */
|
||||
socket_guard.Cancel();
|
||||
return ResultSuccess();
|
||||
R_SUCCEED();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -44,7 +44,7 @@ namespace ams::htclow::driver {
|
||||
/* Setup client socket. */
|
||||
R_TRY(this->SetupClientSocket(client_desc));
|
||||
|
||||
return ResultSuccess();
|
||||
R_SUCCEED();
|
||||
}
|
||||
|
||||
Result SocketDriver::CreateServerSocket() {
|
||||
@@ -86,7 +86,7 @@ namespace ams::htclow::driver {
|
||||
m_server_socket = desc;
|
||||
m_server_socket_valid = true;
|
||||
|
||||
return ResultSuccess();
|
||||
R_SUCCEED();
|
||||
}
|
||||
|
||||
void SocketDriver::DestroyServerSocket() {
|
||||
@@ -116,7 +116,7 @@ namespace ams::htclow::driver {
|
||||
m_client_socket = desc;
|
||||
m_client_socket_valid = true;
|
||||
|
||||
return ResultSuccess();
|
||||
R_SUCCEED();
|
||||
}
|
||||
|
||||
bool SocketDriver::IsAutoConnectReserved() {
|
||||
@@ -180,7 +180,7 @@ namespace ams::htclow::driver {
|
||||
|
||||
Result SocketDriver::Open() {
|
||||
m_discovery_manager.OnDriverOpen();
|
||||
return ResultSuccess();
|
||||
R_SUCCEED();
|
||||
}
|
||||
|
||||
void SocketDriver::Close() {
|
||||
@@ -251,7 +251,7 @@ namespace ams::htclow::driver {
|
||||
R_UNLESS(cur_sent > 0, htclow::ResultSocketSendError());
|
||||
}
|
||||
|
||||
return ResultSuccess();
|
||||
R_SUCCEED();
|
||||
}
|
||||
|
||||
Result SocketDriver::Receive(void *dst, int dst_size) {
|
||||
@@ -265,7 +265,7 @@ namespace ams::htclow::driver {
|
||||
R_UNLESS(cur_recv > 0, htclow::ResultSocketReceiveError());
|
||||
}
|
||||
|
||||
return ResultSuccess();
|
||||
R_SUCCEED();
|
||||
}
|
||||
|
||||
void SocketDriver::CancelSendReceive() {
|
||||
|
||||
@@ -69,7 +69,7 @@ namespace ams::htclow::driver {
|
||||
|
||||
/* We're connected. */
|
||||
m_connected = true;
|
||||
return ResultSuccess();
|
||||
R_SUCCEED();
|
||||
}
|
||||
|
||||
void UsbDriver::Shutdown() {
|
||||
@@ -92,7 +92,7 @@ namespace ams::htclow::driver {
|
||||
transferred += cur;
|
||||
}
|
||||
|
||||
return ResultSuccess();
|
||||
R_SUCCEED();
|
||||
}
|
||||
|
||||
Result UsbDriver::Receive(void *dst, int dst_size) {
|
||||
@@ -107,7 +107,7 @@ namespace ams::htclow::driver {
|
||||
transferred += cur;
|
||||
}
|
||||
|
||||
return ResultSuccess();
|
||||
R_SUCCEED();
|
||||
}
|
||||
|
||||
void UsbDriver::CancelSendReceive() {
|
||||
|
||||
@@ -207,11 +207,11 @@ namespace ams::htclow::driver {
|
||||
Result ConvertUsbDriverResult(Result result) {
|
||||
if (result.GetModule() == R_NAMESPACE_MODULE_ID(usb)) {
|
||||
if (usb::ResultResourceBusy::Includes(result)) {
|
||||
return htclow::ResultUsbDriverBusyError();
|
||||
R_THROW(htclow::ResultUsbDriverBusyError());
|
||||
} else if (usb::ResultMemAllocFailure::Includes(result)) {
|
||||
return htclow::ResultOutOfMemory();
|
||||
R_THROW(htclow::ResultOutOfMemory());
|
||||
} else {
|
||||
return htclow::ResultUsbDriverUnknownError();
|
||||
R_THROW(htclow::ResultUsbDriverUnknownError());
|
||||
}
|
||||
} else {
|
||||
return result;
|
||||
@@ -241,7 +241,7 @@ namespace ams::htclow::driver {
|
||||
/* Set binary object store. */
|
||||
R_TRY(g_ds_client.SetBinaryObjectStore(BinaryObjectStore, sizeof(BinaryObjectStore)));
|
||||
|
||||
return ResultSuccess();
|
||||
R_SUCCEED();
|
||||
}
|
||||
|
||||
Result InitializeDsInterface() {
|
||||
@@ -263,13 +263,13 @@ namespace ams::htclow::driver {
|
||||
R_TRY(g_ds_interface.AppendConfigurationData(usb::UsbDeviceSpeed_Super, std::addressof(UsbEndpointDescriptorsSuperSpeed[1]), sizeof(usb::UsbEndpointDescriptor)));
|
||||
R_TRY(g_ds_interface.AppendConfigurationData(usb::UsbDeviceSpeed_Super, std::addressof(UsbEndpointCompanionDescriptor), sizeof(usb::UsbEndpointCompanionDescriptor)));
|
||||
|
||||
return ResultSuccess();
|
||||
R_SUCCEED();
|
||||
}
|
||||
|
||||
Result InitializeDsEndpoints() {
|
||||
R_TRY(g_ds_endpoints[0].Initialize(std::addressof(g_ds_interface), 0x81));
|
||||
R_TRY(g_ds_endpoints[1].Initialize(std::addressof(g_ds_interface), 0x01));
|
||||
return ResultSuccess();
|
||||
R_SUCCEED();
|
||||
}
|
||||
|
||||
void UsbIndicationThreadFunction(void *) {
|
||||
@@ -400,7 +400,7 @@ namespace ams::htclow::driver {
|
||||
|
||||
/* We succeeded! */
|
||||
init_guard.Cancel();
|
||||
return ResultSuccess();
|
||||
R_SUCCEED();
|
||||
}
|
||||
|
||||
void FinalizeUsbInterface() {
|
||||
@@ -432,7 +432,7 @@ namespace ams::htclow::driver {
|
||||
|
||||
/* Set output transferred size. */
|
||||
*out_transferred = src_size;
|
||||
return ResultSuccess();
|
||||
R_SUCCEED();
|
||||
}
|
||||
|
||||
Result ReceiveUsb(int *out_transferred, void *dst, int dst_size) {
|
||||
@@ -449,7 +449,7 @@ namespace ams::htclow::driver {
|
||||
|
||||
/* Set output transferred size. */
|
||||
*out_transferred = dst_size;
|
||||
return ResultSuccess();
|
||||
R_SUCCEED();
|
||||
}
|
||||
|
||||
void CancelUsbSendReceive() {
|
||||
|
||||
Reference in New Issue
Block a user