text
stringlengths
0
234
when distance =>
unreduce_length := unreduce_length + 3;
S := S - UnZip.File_size_type (unreduce_length);
UnZ_IO.Copy_or_zero (
distance => char_read + 1 + Integer (Shift_Right (V, 8 - factor) * 2**8),
copy_length => unreduce_length,
index => UnZ_Glob.slide_index,
unflushed => unflushed
);
state := normal;
end case;
last_char := char_read; -- store character for next iteration
end loop;
UnZ_IO.Flush (UnZ_Glob.slide_index);
end Unreduce;
--------[ Method : Explode ] --------
-- C code by info - zip group, translated to Pascal by Christian Ghisler
-- based on unz51g.zip
use UnZip.Decompress.Huffman;
procedure Get_Tree (L : out Length_array) is
I, K, J, B : Unsigned_32;
N : constant Unsigned_32 := L'Length;
L_Idx : Integer := L'First;
Bytebuf : Zip.Byte;
begin
if full_trace then
pragma Warnings (Off, "this code can never be executed and has been deleted");
Ada.Text_IO.Put_Line ("Begin UnZ_Expl.Get_tree");
pragma Warnings (On, "this code can never be executed and has been deleted");
end if;
UnZ_IO.Read_raw_byte (Bytebuf);
I := Unsigned_32 (Bytebuf) + 1;
K := 0;
loop
UnZ_IO.Read_raw_byte (Bytebuf);
J := Unsigned_32 (Bytebuf);
B := (J and 16#0F#) + 1;
J := (J and 16#F0#) / 16 + 1;
if K + J > N then
raise Zip.Zip_file_Error;
end if;
loop
L (L_Idx) := Natural (B);
L_Idx := L_Idx + 1;
K := K + 1;
J := J - 1;
exit when J = 0;
end loop;
I := I - 1;
exit when I = 0;
end loop;
if K /= N then
raise Zip.Zip_file_Error;
end if;
if full_trace then
pragma Warnings (Off, "this code can never be executed and has been deleted");
Ada.Text_IO.Put_Line ("End UnZ_Expl.Get_tree");
pragma Warnings (On, "this code can never be executed and has been deleted");
end if;
end Get_Tree;
procedure Explode_Lit ( -- method with 3 trees
Needed : Integer;
Tb, Tl, Td : p_Table_list;
Bb, Bl, Bd : Integer
)
is
S : Unsigned_32;
E, N, D : Integer;
W : Integer := 0;
Ct : p_HufT_table; -- current table
Ci : Natural; -- current index
unflushed : Boolean := True; -- true while slide not yet unflushed
begin
if full_trace then
pragma Warnings (Off, "this code can never be executed and has been deleted");
Ada.Text_IO.Put_Line ("Begin Explode_lit");
pragma Warnings (On, "this code can never be executed and has been deleted");
end if;
UnZ_IO.Bit_buffer.Init;