1
0
Fork 0
mirror of https://github.com/zeldaret/oot.git synced 2025-08-13 18:30:35 +00:00

Fix most compiler warnings in the boot and code segments (#674)

* Less warnings in boot & code segments

* few more warnings gone

* Ran formatter

* z_view warning gone

* -> 1

* f31 -> 31

* Remove function casts

* Few more small improvements

* Separate declaration and assignment in func_80091738 and Item_Give

Co-authored-by: Thar0 <maximilianc64@gmail.com>
This commit is contained in:
Tharo 2021-02-14 00:49:40 +00:00 committed by GitHub
parent d615ec4f31
commit f9d96d9f73
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
208 changed files with 1702 additions and 1846 deletions

View file

@ -50,37 +50,29 @@ s32 osPfsReadWriteFile(OSPfs* pfs, s32 fileNo, u8 flag, s32 offset, s32 size, u8
if (!(pfs->status & PFS_INITIALIZED)) {
return PFS_ERR_INVALID;
}
if (__osCheckId(pfs) == PFS_ERR_NEW_PACK) {
return PFS_ERR_NEW_PACK;
}
if (pfs->activebank != 0) {
if ((ret = __osPfsSelectBank(pfs, 0)) != 0) {
return ret;
}
}
if ((ret = __osContRamRead(pfs->queue, pfs->channel, pfs->dir_table + fileNo, &dir)) != 0) {
if (pfs->activebank != 0 && (ret = __osPfsSelectBank(pfs, 0)) != 0) {
return ret;
}
if ((ret = __osContRamRead(pfs->queue, pfs->channel, pfs->dir_table + fileNo, (u8*)&dir)) != 0) {
return ret;
}
if ((dir.company_code == 0) || (dir.game_code == 0)) {
return PFS_ERR_INVALID;
}
if (!CHECK_IPAGE(dir.start_page, *pfs)) {
if (dir.start_page.ipage == PFS_EOF) {
return PFS_ERR_INVALID;
}
return PFS_ERR_INCONSISTENT;
}
if ((flag == PFS_READ) && ((dir.status & PFS_WRITTEN) == 0)) {
return PFS_ERR_BAD_DATA;
}
bank = 255;
curBlock = offset / BLOCKSIZE;
curPage = dir.start_page;
@ -101,11 +93,8 @@ s32 osPfsReadWriteFile(OSPfs* pfs, s32 fileNo, u8 flag, s32 offset, s32 size, u8
}
curBlock = 0;
}
if (pfs->activebank != curPage.inode_t.bank) {
if ((ret = __osPfsSelectBank(pfs, curPage.inode_t.bank)) != 0) {
return ret;
}
if (pfs->activebank != curPage.inode_t.bank && (ret = __osPfsSelectBank(pfs, curPage.inode_t.bank)) != 0) {
return ret;
}
blockno = curPage.inode_t.page * PFS_ONE_PAGE + curBlock;
@ -125,16 +114,13 @@ s32 osPfsReadWriteFile(OSPfs* pfs, s32 fileNo, u8 flag, s32 offset, s32 size, u8
if (flag == PFS_WRITE && !(dir.status & PFS_WRITTEN)) {
dir.status |= PFS_WRITTEN;
if (pfs->activebank != 0) {
if ((ret = __osPfsSelectBank(pfs, 0)) != 0) {
return ret;
}
if (pfs->activebank != 0 && (ret = __osPfsSelectBank(pfs, 0)) != 0) {
return ret;
}
if ((ret = __osContRamWrite(pfs->queue, pfs->channel, pfs->dir_table + fileNo, &dir, 0)) != 0) {
if ((ret = __osContRamWrite(pfs->queue, pfs->channel, pfs->dir_table + fileNo, (u8*)&dir, 0)) != 0) {
return ret;
}
}
ret = __osPfsGetStatus(pfs->queue, pfs->channel);
return ret;
return __osPfsGetStatus(pfs->queue, pfs->channel);
}