Skip to content

Commit

Permalink
partially working get_fileinfo:several bugfix
Browse files Browse the repository at this point in the history
  • Loading branch information
soypat committed Jan 27, 2024
1 parent 0b818a6 commit 2d38027
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 1 deletion.
4 changes: 3 additions & 1 deletion fat.go
Original file line number Diff line number Diff line change
Expand Up @@ -728,7 +728,7 @@ func (fsys *FS) pick_lfn(dir []byte) bool {
if binary.LittleEndian.Uint16(dir[ldirFstClusLO_Off:]) != 0 {
return false
}
i := 13 * int((dir[ldirOrdOff]&mskLLEF)-1) // Offset in LFN buffer.
i := 13 * int((dir[ldirOrdOff]&^mskLLEF)-1) // Offset in LFN buffer.
var wc uint16
var s int
for wc = 1; s < 13; s++ {
Expand All @@ -739,6 +739,7 @@ func (fsys *FS) pick_lfn(dir []byte) bool {
}
fsys.lfnbuf[i] = uc
wc = uc
i++
} else if uc != maxu16 {
return false
}
Expand Down Expand Up @@ -1874,6 +1875,7 @@ func (dp *dir) get_fileinfo(fno *fileinfo) {
var hs uint16
for fsys.lfnbuf[si] != 0 {
wc = fsys.lfnbuf[si]
si++
if hs == 0 && isSurrogate(wc) {
hs = wc // Low surrogate.
continue
Expand Down
1 change: 1 addition & 0 deletions fat_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ func TestFileInfo(t *testing.T) {
if fr != frOK {
t.Fatal(fr.Error())
}
t.Errorf("%+v", finfo)
}

func attachLogger(fs *FS) *slog.Logger {
Expand Down

0 comments on commit 2d38027

Please sign in to comment.