mirror of
https://github.com/wiiu-env/libromfs_wiiu.git
synced 2024-11-08 19:55:07 +01:00
Fix return values on error and other small optimizations
This commit is contained in:
parent
3bdd79b69e
commit
4b7f2a1e1b
@ -84,7 +84,7 @@ static ssize_t _romfs_read(romfs_mount *mount, uint64_t offset, void *buffer, ui
|
|||||||
if (result < 0) {
|
if (result < 0) {
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
return (ssize_t) result;
|
return result;
|
||||||
}
|
}
|
||||||
return _read;
|
return _read;
|
||||||
}
|
}
|
||||||
@ -205,8 +205,6 @@ static romfs_mount *romfsFindMount(const char *name) {
|
|||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
__attribute__((weak)) const char *__romfs_path = NULL;
|
|
||||||
|
|
||||||
static romfs_mount *romfs_alloc(void) {
|
static romfs_mount *romfs_alloc(void) {
|
||||||
return romfsFindMount(NULL);
|
return romfsFindMount(NULL);
|
||||||
}
|
}
|
||||||
@ -245,7 +243,7 @@ static void romfs_mountclose(romfs_mount *mount) {
|
|||||||
int32_t romfsMount(const char *name, const char *filepath, RomfsSource source) {
|
int32_t romfsMount(const char *name, const char *filepath, RomfsSource source) {
|
||||||
romfs_mount *mount = romfs_alloc();
|
romfs_mount *mount = romfs_alloc();
|
||||||
if (mount == NULL) {
|
if (mount == NULL) {
|
||||||
return 99;
|
return -99;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Regular RomFS
|
// Regular RomFS
|
||||||
@ -343,11 +341,11 @@ int32_t romfsMountCommon(const char *name, romfs_mount *mount) {
|
|||||||
|
|
||||||
fail_oom:
|
fail_oom:
|
||||||
romfs_mountclose(mount);
|
romfs_mountclose(mount);
|
||||||
return 9;
|
return -9;
|
||||||
|
|
||||||
fail_io:
|
fail_io:
|
||||||
romfs_mountclose(mount);
|
romfs_mountclose(mount);
|
||||||
return 10;
|
return -10;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void romfsInitMtime(romfs_mount *mount) {
|
static void romfsInitMtime(romfs_mount *mount) {
|
||||||
|
Loading…
Reference in New Issue
Block a user