From 83e1f97b5beb1eae471e93f792165d0f7bb58c2f Mon Sep 17 00:00:00 2001 From: fincs Date: Thu, 2 Jul 2020 16:34:37 +0200 Subject: [PATCH] Remove superfluous casts in FS_Path usage --- libctru/source/archive_dev.c | 6 +++--- libctru/source/ndsp/ndsp.c | 4 ++-- libctru/source/romfs_dev.c | 9 ++++----- 3 files changed, 9 insertions(+), 10 deletions(-) diff --git a/libctru/source/archive_dev.c b/libctru/source/archive_dev.c index 46044f1..a0edff9 100644 --- a/libctru/source/archive_dev.c +++ b/libctru/source/archive_dev.c @@ -296,7 +296,7 @@ static int _archiveMountDevice(FS_Archive archive, device = archiveFindDevice(NULL); if(device==NULL) goto _fail; - + device->archive = archive; memset(device->name, 0, sizeof(device->name)); strncpy(device->name, deviceName, sizeof(device->name)-1); @@ -356,7 +356,7 @@ Result archiveMountSdmc(void) ssize_t units; uint32_t code; char *p; - FS_Path sdmcPath = { PATH_EMPTY, 1, (u8*)"" }; + FS_Path sdmcPath = { PATH_EMPTY, 1, "" }; FS_Archive sdmcArchive; Result rc = 0; @@ -465,7 +465,7 @@ Result archiveUnmount(const char *deviceName) Result archiveUnmountAll(void) { u32 total = sizeof(archive_devices) / sizeof(archive_fsdevice); - + if(!archive_initialized) return 0; for(u32 i = 0; i < total; i++) diff --git a/libctru/source/ndsp/ndsp.c b/libctru/source/ndsp/ndsp.c index 9e31c4e..16a18ee 100644 --- a/libctru/source/ndsp/ndsp.c +++ b/libctru/source/ndsp/ndsp.c @@ -472,8 +472,8 @@ static bool ndspFindAndLoadComponent(void) do { static const char dsp_filename[] = "/3ds/dspfirm.cdc"; - FS_Path archPath = { PATH_EMPTY, 1, (u8*)"" }; - FS_Path filePath = { PATH_ASCII, sizeof(dsp_filename), (u8*)dsp_filename }; + FS_Path archPath = { PATH_EMPTY, 1, "" }; + FS_Path filePath = { PATH_ASCII, sizeof(dsp_filename), dsp_filename }; rc = FSUSER_OpenFileDirectly(&rsrc, ARCHIVE_SDMC, archPath, filePath, FS_OPEN_READ, 0); if (R_FAILED(rc)) break; diff --git a/libctru/source/romfs_dev.c b/libctru/source/romfs_dev.c index 49f4f43..c280f48 100644 --- a/libctru/source/romfs_dev.c +++ b/libctru/source/romfs_dev.c @@ -216,8 +216,8 @@ Result romfsMount(struct romfs_mount **p) } __utf16path[units] = 0; - FS_Path archPath = { PATH_EMPTY, 1, (u8*)"" }; - FS_Path filePath = { PATH_UTF16, (units+1)*2, (u8*)__utf16path }; + FS_Path archPath = { PATH_EMPTY, 1, "" }; + FS_Path filePath = { PATH_UTF16, (units+1)*2, __utf16path }; Result rc = FSUSER_OpenFileDirectly(&mount->fd, ARCHIVE_SDMC, archPath, filePath, FS_OPEN_READ, 0); if (R_FAILED(rc)) @@ -238,10 +238,9 @@ Result romfsMount(struct romfs_mount **p) else { // Regular RomFS - u8 zeros[0xC]; - memset(zeros, 0, sizeof(zeros)); + u8 zeros[0xC] = {0}; - FS_Path archPath = { PATH_EMPTY, 1, (u8*)"" }; + FS_Path archPath = { PATH_EMPTY, 1, "" }; FS_Path filePath = { PATH_BINARY, sizeof(zeros), zeros }; Result rc = FSUSER_OpenFileDirectly(&mount->fd, ARCHIVE_ROMFS, archPath, filePath, FS_OPEN_READ, 0);