haze: misc style

This commit is contained in:
Liam 2023-04-15 21:52:26 -04:00
commit 014bbcfe56
4 changed files with 16 additions and 15 deletions

View file

@ -75,11 +75,11 @@ namespace haze {
R_RETURN(this->ForwardResult(fsFsOpenFile, m_filesystem, path, mode, out_file)); R_RETURN(this->ForwardResult(fsFsOpenFile, m_filesystem, path, mode, out_file));
} }
Result GetSizeFile(FsFile *file, s64 *out_size) { Result GetFileSize(FsFile *file, s64 *out_size) {
R_RETURN(this->ForwardResult(fsFileGetSize, file, out_size)); R_RETURN(this->ForwardResult(fsFileGetSize, file, out_size));
} }
Result SetSizeFile(FsFile *file, s64 size) { Result SetFileSize(FsFile *file, s64 size) {
R_RETURN(this->ForwardResult(fsFileSetSize, file, size)); R_RETURN(this->ForwardResult(fsFileSetSize, file, size));
} }
@ -111,7 +111,7 @@ namespace haze {
R_RETURN(this->ForwardResult(fsDirRead, d, out_total_entries, max_entries, buf)); R_RETURN(this->ForwardResult(fsDirRead, d, out_total_entries, max_entries, buf));
} }
Result GetEntryCountDirectory(FsDir *d, s64 *out_count) { Result GetDirectoryEntryCount(FsDir *d, s64 *out_count) {
R_RETURN(this->ForwardResult(fsDirGetEntryCount, d, out_count)); R_RETURN(this->ForwardResult(fsDirGetEntryCount, d, out_count));
} }

View file

@ -116,6 +116,7 @@ namespace haze {
m_next_address = this->GetNextAddress() - n; m_next_address = this->GetNextAddress() - n;
} }
/* Otherwise, do nothing. */
/* ... */ /* ... */
} }

View file

@ -19,7 +19,7 @@ namespace haze {
namespace { namespace {
static constinit UsbSession s_usb_session; constinit UsbSession g_usb_session;
} }
@ -27,14 +27,14 @@ namespace haze {
m_reactor = reactor; m_reactor = reactor;
/* Set up a new USB session. */ /* Set up a new USB session. */
R_TRY(s_usb_session.Initialize(interface_info, id_vendor, id_product)); R_TRY(g_usb_session.Initialize(interface_info, id_vendor, id_product));
R_TRY(s_usb_session.SetZeroLengthTermination(false)); R_TRY(g_usb_session.SetZeroLengthTermination(false));
R_SUCCEED(); R_SUCCEED();
} }
void AsyncUsbServer::Finalize() { void AsyncUsbServer::Finalize() {
s_usb_session.Finalize(); g_usb_session.Finalize();
} }
Result AsyncUsbServer::TransferPacketImpl(bool read, void *page, u32 size, u32 *out_size_transferred) const { Result AsyncUsbServer::TransferPacketImpl(bool read, void *page, u32 size, u32 *out_size_transferred) const {
@ -42,7 +42,7 @@ namespace haze {
s32 waiter_idx; s32 waiter_idx;
/* If we're not configured yet, wait to become configured first. */ /* If we're not configured yet, wait to become configured first. */
if (!s_usb_session.GetConfigured()) { if (!g_usb_session.GetConfigured()) {
R_TRY(m_reactor->WaitFor(std::addressof(waiter_idx), waiterForEvent(usbDsGetStateChangeEvent()))); R_TRY(m_reactor->WaitFor(std::addressof(waiter_idx), waiterForEvent(usbDsGetStateChangeEvent())));
R_TRY(eventClear(usbDsGetStateChangeEvent())); R_TRY(eventClear(usbDsGetStateChangeEvent()));
@ -51,13 +51,13 @@ namespace haze {
/* Select the appropriate endpoint and begin a transfer. */ /* Select the appropriate endpoint and begin a transfer. */
UsbSessionEndpoint ep = read ? UsbSessionEndpoint_Read : UsbSessionEndpoint_Write; UsbSessionEndpoint ep = read ? UsbSessionEndpoint_Read : UsbSessionEndpoint_Write;
R_TRY(s_usb_session.TransferAsync(ep, page, size, std::addressof(urb_id))); R_TRY(g_usb_session.TransferAsync(ep, page, size, std::addressof(urb_id)));
/* Try to wait for the event. */ /* Try to wait for the event. */
R_TRY(m_reactor->WaitFor(std::addressof(waiter_idx), waiterForEvent(s_usb_session.GetCompletionEvent(ep)))); R_TRY(m_reactor->WaitFor(std::addressof(waiter_idx), waiterForEvent(g_usb_session.GetCompletionEvent(ep))));
/* Return what we transferred. */ /* Return what we transferred. */
R_RETURN(s_usb_session.GetTransferResult(ep, urb_id, out_size_transferred)); R_RETURN(g_usb_session.GetTransferResult(ep, urb_id, out_size_transferred));
} }
} }

View file

@ -385,7 +385,7 @@ namespace haze {
/* Count how many entries are in the directory. */ /* Count how many entries are in the directory. */
s64 entry_count = 0; s64 entry_count = 0;
R_TRY(m_fs.GetEntryCountDirectory(std::addressof(dir), std::addressof(entry_count))); R_TRY(m_fs.GetDirectoryEntryCount(std::addressof(dir), std::addressof(entry_count)));
/* Begin writing. */ /* Begin writing. */
R_TRY(db.AddDataHeader(m_request_header, sizeof(u32) + (entry_count * sizeof(u32)))); R_TRY(db.AddDataHeader(m_request_header, sizeof(u32) + (entry_count * sizeof(u32))));
@ -451,7 +451,7 @@ namespace haze {
/* Ensure we maintain a clean state on exit. */ /* Ensure we maintain a clean state on exit. */
ON_SCOPE_EXIT { m_fs.CloseFile(std::addressof(file)); }; ON_SCOPE_EXIT { m_fs.CloseFile(std::addressof(file)); };
R_TRY(m_fs.GetSizeFile(std::addressof(file), std::addressof(size))); R_TRY(m_fs.GetFileSize(std::addressof(file), std::addressof(size)));
} }
object_info.filename = std::strrchr(fileobj->GetName(), '/') + 1; object_info.filename = std::strrchr(fileobj->GetName(), '/') + 1;
@ -515,7 +515,7 @@ namespace haze {
/* Get the file's size. */ /* Get the file's size. */
s64 size = 0; s64 size = 0;
R_TRY(m_fs.GetSizeFile(std::addressof(file), std::addressof(size))); R_TRY(m_fs.GetFileSize(std::addressof(file), std::addressof(size)));
/* Send the header and file size. */ /* Send the header and file size. */
R_TRY(db.AddDataHeader(m_request_header, size)); R_TRY(db.AddDataHeader(m_request_header, size));
@ -645,7 +645,7 @@ namespace haze {
/* Truncate the file after locking for write. */ /* Truncate the file after locking for write. */
s64 offset = 0; s64 offset = 0;
R_TRY(m_fs.SetSizeFile(std::addressof(file), 0)); R_TRY(m_fs.SetFileSize(std::addressof(file), 0));
/* Begin writing. */ /* Begin writing. */
while (true) { while (true) {