Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[iQue] Match some fs files #72

Merged
merged 14 commits into from
Apr 28, 2024
Merged

[iQue] Match some fs files #72

merged 14 commits into from
Apr 28, 2024

Conversation

AngheloAlf
Copy link
Collaborator

Matches fsclose.c, fsdelete.c, fsdir.c, fsread.c, fsrename.c and fswrite.c

Copy link
Collaborator

@Thar0 Thar0 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There are some small suggestions but I'll merge this anyway in a little while unless you want to make any further changes / discuss anything

BbFat16* fat;
s32 rv;

if ((u32)fd >= BB_INODE16_NUM) {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
if ((u32)fd >= BB_INODE16_NUM) {
if (fd < 0 || fd >= BB_INODE16_NUM) {

This has matched elsewhere and is a bit more natural

}

bzero(&fat->inode[i], sizeof(fat->inode[i]));
rv = __osBbFsSync(0);
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
rv = __osBbFsSync(0);
rv = __osBbFsSync(FALSE);

}

rv++;
if ((d != NULL) && (j < count)) {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
if ((d != NULL) && (j < count)) {
if (d != NULL && j < count) {

imo parens should only be used where necessary or when operator precedence is unclear. Here it is clear that comparisons come before logical operators.

u16 b = in->block;
i = 0;

for (i = 0; b != 0xFFFF && i < listLen; i++) {
blockList[i] = b;
b = fat[b >> 0xC].entry[(b & 0xFFF)];
b = fat[b / 0x1000].entry[b % 0x1000];
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In one of the fs files I worked on I was unable to get it to match with div and mod. I think we should use shift and mask and probably macro this whole expression, e.g. b = BBFS_NEXT_BLOCK(fat, b), since it comes up so often

src/bb/fs/fswrite.c Outdated Show resolved Hide resolved
AngheloAlf and others added 3 commits April 28, 2024 08:40
Co-authored-by: Tharo <17233964+Thar0@users.noreply.github.com>
@Thar0 Thar0 merged commit ade805e into decompals:ique Apr 28, 2024
21 checks passed
@AngheloAlf AngheloAlf deleted the fs branch April 28, 2024 18:34
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants