Issue of libfat?

Support for the GBA/DS/Gamecube/Wii media card library
Post Reply
Xenon
Posts: 7
Joined: Tue Jul 20, 2010 2:55 pm

Issue of libfat?

Post by Xenon » Mon Oct 11, 2010 1:58 pm

Today I disassembled MoonShell2.10 to compare FAT_LinkFreeCluster()
and_FAT_fat_linkFreeCluster().
Both "modified gba_nds_fat" and libfat had:
---
if ((curLink >= CLUSTER_FIRST) && (curLink <= fatLastCluster))
{
return curLink; // Return the current link - don't allocate a new one
}
---
But "Update the linked from FAT entry" part was different. libfat uses:
---
if ((cluster >= CLUSTER_FIRST) && (cluster < fatLastCluster))
{
// Update the linked from FAT entry
FAT_WriteFatEntry (cluster, firstFree);
}
---
But "modified gba_nds_fat" uses:
---
if ((cluster >= CLUSTER_FIRST) && (cluster <= fatLastCluster)) //////
{
// Update the linked from FAT entry
FAT_WriteFatEntry (cluster, firstFree);
}
---
So if you check the correctness of cluster param, as fatLastCluster is
a valid cluster, also libfat should use the latter check; I think
libfat has a bug.
So could you check the part?
I hope I'll hear from you soon.

Sincerely, Xenon

WinterMute
Site Admin
Posts: 1986
Joined: Tue Aug 09, 2005 3:21 am
Location: UK
Contact:

Re: Issue of libfat?

Post by WinterMute » Tue Oct 12, 2010 10:25 pm

Would have helped a bit if you'd quoted the actual code from libfat rather than the old gba_nds_fat code. Took me a while to find the code you referred to. A fairly minor issue really, it would only have prevented the last cluster of the card being allocated but it's fixed in svn now.
Help keep devkitPro toolchains free, Donate today

Personal Blog

Post Reply

Who is online

Users browsing this forum: No registered users and 0 guests