summaryrefslogtreecommitdiff
path: root/src/libultra_code_O2/contpfs.c
diff options
context:
space:
mode:
authorTharo <17233964+Thar0@users.noreply.github.com>2021-02-14 00:49:40 +0000
committerGitHub <noreply@github.com>2021-02-13 19:49:40 -0500
commitf9d96d9f73ac090245a518ec04f3fa0e50655d1e (patch)
tree9dc905fce276cbfb07a05fc2bf0883bcedddcf23 /src/libultra_code_O2/contpfs.c
parentd615ec4f31563b939f8c0dce1c20c79e137c2043 (diff)
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>
Diffstat (limited to 'src/libultra_code_O2/contpfs.c')
-rw-r--r--src/libultra_code_O2/contpfs.c24
1 files changed, 11 insertions, 13 deletions
diff --git a/src/libultra_code_O2/contpfs.c b/src/libultra_code_O2/contpfs.c
index a9b2028ee..f111e051d 100644
--- a/src/libultra_code_O2/contpfs.c
+++ b/src/libultra_code_O2/contpfs.c
@@ -8,9 +8,8 @@ u8 __osPfsInodeCacheBank = 250;
u16 __osSumcalc(u8* ptr, s32 length) {
s32 i;
u32 sum = 0;
- u8* temp;
+ u8* temp = ptr;
- temp = ptr;
for (i = 0; i < length; i++) {
sum += *temp++;
}
@@ -18,7 +17,6 @@ u16 __osSumcalc(u8* ptr, s32 length) {
}
s32 __osIdCheckSum(u16* ptr, u16* checkSum, u16* idSum) {
-
u16 data = 0;
u32 i;
@@ -99,14 +97,14 @@ s32 __osRepairPackId(OSPfs* pfs, __OSPackId* badid, __OSPackId* newid) {
newid->deviceid = (badid->deviceid & 0xFFFE) | mask;
newid->banks = j;
newid->version = badid->version;
- __osIdCheckSum(newid, &newid->checksum, &newid->invertedChecksum);
+ __osIdCheckSum((u16*)newid, &newid->checksum, &newid->invertedChecksum);
index[0] = PFS_ID_0AREA;
index[1] = PFS_ID_1AREA;
index[2] = PFS_ID_2AREA;
index[3] = PFS_ID_3AREA;
for (i = 0; i < 4; i++) {
- if ((ret = __osContRamWrite(pfs->queue, pfs->channel, index[i], newid, PFS_FORCE)) != 0) {
+ if ((ret = __osContRamWrite(pfs->queue, pfs->channel, index[i], (u8*)newid, PFS_FORCE)) != 0) {
return ret;
}
}
@@ -121,8 +119,7 @@ s32 __osRepairPackId(OSPfs* pfs, __OSPackId* badid, __OSPackId* newid) {
return 0;
}
-s32 __osCheckPackId(OSPfs* pfs, __OSPackId* temp) {
-
+s32 __osCheckPackId(OSPfs* pfs, __OSPackId* check) {
u16 index[4];
s32 ret = 0;
u16 sum;
@@ -139,11 +136,11 @@ s32 __osCheckPackId(OSPfs* pfs, __OSPackId* temp) {
index[2] = PFS_ID_2AREA;
index[3] = PFS_ID_3AREA;
for (i = 1; i < 4; i++) {
- if ((ret = __osContRamRead(pfs->queue, pfs->channel, index[i], temp)) != 0) {
+ if ((ret = __osContRamRead(pfs->queue, pfs->channel, index[i], (u8*)check)) != 0) {
return ret;
}
- __osIdCheckSum(temp, &sum, &idSum);
- if ((temp->checksum == sum) && (temp->invertedChecksum == idSum)) {
+ __osIdCheckSum((u16*)check, &sum, &idSum);
+ if ((check->checksum == sum) && (check->invertedChecksum == idSum)) {
break;
}
}
@@ -153,7 +150,7 @@ s32 __osCheckPackId(OSPfs* pfs, __OSPackId* temp) {
for (j = 0; j < 4; j++) {
if (j != i) {
- if ((ret = __osContRamWrite(pfs->queue, pfs->channel, index[j], temp, PFS_FORCE)) != 0) {
+ if ((ret = __osContRamWrite(pfs->queue, pfs->channel, index[j], (u8*)check, PFS_FORCE)) != 0) {
return ret;
}
}
@@ -274,7 +271,7 @@ s32 __osPfsRWInode(OSPfs* pfs, __OSInode* inode, u8 flag, u8 bank) {
if (flag == PFS_WRITE) {
inode->inodePage[0].inode_t.page =
- __osSumcalc(inode->inodePage + offset, (PFS_INODE_SIZE_PER_PAGE - offset) * 2);
+ __osSumcalc((u8*)(inode->inodePage + offset), (PFS_INODE_SIZE_PER_PAGE - offset) * 2);
}
for (j = 0; j < PFS_ONE_PAGE; j++) {
@@ -297,7 +294,7 @@ s32 __osPfsRWInode(OSPfs* pfs, __OSInode* inode, u8 flag, u8 bank) {
addr = (u8*)(((u8*)inode) + (j * BLOCKSIZE));
ret = __osContRamRead(pfs->queue, pfs->channel, pfs->minode_table + (bank * PFS_ONE_PAGE) + j, addr);
}
- sum = __osSumcalc(inode->inodePage + offset, (PFS_INODE_SIZE_PER_PAGE - offset) * 2);
+ sum = __osSumcalc((u8*)(inode->inodePage + offset), (PFS_INODE_SIZE_PER_PAGE - offset) * 2);
if (sum != inode->inodePage[0].inode_t.page) {
return PFS_ERR_INCONSISTENT;
}
@@ -310,5 +307,6 @@ s32 __osPfsRWInode(OSPfs* pfs, __OSInode* inode, u8 flag, u8 bank) {
__osPfsInodeCacheBank = bank;
bcopy(inode, &__osPfsInodeCache, sizeof(__OSInode));
__osPfsInodeCacheChannel = pfs->channel;
+
return 0;
}