text stringlengths 0 234 |
|---|
Block_Offset |
(FAT_File_Size (Current_Index * 32) / FS.Block_Size); |
end if; |
else |
Block_Off := Natural |
(FAT_File_Size (Current_Index * 32) mod FS.Block_Size); |
-- Check if we're on a block boundare |
if Unsigned_32 (Block_Off) = 0 and then Current_Index /= 0 then |
Current_Block := Current_Block + 1; |
end if; |
-- Check if we're on the boundary of a new cluster |
if Current_Block - FS.Cluster_To_Block (Current_Cluster) |
= FS.Blocks_Per_Cluster |
then |
-- The block we need to read is outside of the current cluster. |
-- Let's move on to the next |
-- Read the FAT table to determine the next cluster |
Current_Cluster := FS.Get_FAT (Current_Cluster); |
if Current_Cluster = 1 |
or else FS.Is_Last_Cluster (Current_Cluster) |
then |
return Internal_Error; |
end if; |
Current_Block := FS.Cluster_To_Block (Current_Cluster); |
end if; |
end if; |
Ret := FS.Ensure_Block (Current_Block); |
if Ret /= OK then |
return Ret; |
end if; |
if FS.Window (Block_Off) = 0 then |
-- End of entries: we stick the index here to make sure that further |
-- calls to Next_Entry always end-up here |
return No_More_Entries; |
end if; |
DEntry := To_Entry (FS.Window (Block_Off .. Block_Off + 31)); |
Current_Index := Current_Index + 1; |
return OK; |
end Next_Entry; |
---------------- |
-- Next_Entry -- |
---------------- |
function Next_Entry |
(FS : access FAT_Filesystem; |
Current_Cluster : in out Cluster_Type; |
Current_Block : in out Block_Offset; |
Current_Index : in out Entry_Index; |
DEntry : out FAT_Node) return Status_Code |
is |
procedure Prepend |
(Name : Wide_String; |
Full : in out String; |
Idx : in out Natural); |
-- Prepends Name to Full |
------------- |
-- Prepend -- |
------------- |
procedure Prepend |
(Name : Wide_String; |
Full : in out String; |
Idx : in out Natural) |
is |
Val : Unsigned_16; |
begin |
for J in reverse Name'Range loop |
Val := Wide_Character'Pos (Name (J)); |
if Val /= 16#FFFF# |
and then Val /= 0 |
then |
Idx := Idx - 1; |
exit when Idx not in Full'Range; |
if Val < 255 then |
Full (Idx) := Character'Val (Val); |
elsif Val = 16#F029# then |
-- Path ends with a '.' |
Full (Idx) := '.'; |
elsif Val = 16#F028# then |
-- Path ends with a ' ' |
Full (Idx) := ' '; |
else |
Full (Idx) := '?'; |
end if; |
end if; |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.