Page 1 of 1

Issue of libfat?

Posted: Mon Oct 11, 2010 1:58 pm
by Xenon
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

Re: Issue of libfat?

Posted: Tue Oct 12, 2010 10:25 pm
by WinterMute
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.