text
stringlengths
0
234
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_nolit");
pragma Warnings (On, "this code can never be executed and has been deleted");
end if;
UnZ_IO.Bit_buffer.Init;
S := UnZ_Glob.uncompsize;
while S > 0 and then not UnZ_Glob.Zip_EOF loop
if UnZ_IO.Bit_buffer.Read_and_dump (1) /= 0 then -- 1 : Litteral
S := S - 1;
UnZ_Glob.slide (W) :=
Zip.Byte (UnZ_IO.Bit_buffer.Read_and_dump (8));
W := W + 1;
UnZ_IO.Flush_if_full (W, unflushed);
else -- 0 : Copy
D := UnZ_IO.Bit_buffer.Read_and_dump (Needed);
Ct := Td.all.table;
Ci := UnZ_IO.Bit_buffer.Read_inverted (Bd);
loop
E := Ct.all (Ci).extra_bits;
exit when E <= 16;
if E = invalid then
raise Zip.Zip_file_Error;
end if;
UnZ_IO.Bit_buffer.Dump (Ct.all (Ci).bits);
E := E - 16;
Ct := Ct.all (Ci).next_table;
Ci := UnZ_IO.Bit_buffer.Read_inverted (E);
end loop;
UnZ_IO.Bit_buffer.Dump (Ct.all (Ci).bits);
D := D + Ct.all (Ci).n;
Ct := Tl.all.table;
Ci := UnZ_IO.Bit_buffer.Read_inverted (Bl);
loop
E := Ct.all (Ci).extra_bits;
exit when E <= 16;
if E = invalid then
raise Zip.Zip_file_Error;
end if;
UnZ_IO.Bit_buffer.Dump (Ct.all (Ci).bits);
E := E - 16;
Ct := Ct.all (Ci).next_table;
Ci := UnZ_IO.Bit_buffer.Read_inverted (E);
end loop;
UnZ_IO.Bit_buffer.Dump (Ct.all (Ci).bits);
N := Ct.all (Ci).n;
if E /= 0 then
N := N + UnZ_IO.Bit_buffer.Read_and_dump (8);
end if;
S := S - Unsigned_32 (N);
UnZ_IO.Copy_or_zero (
distance => D,
copy_length => N,
index => W,
unflushed => unflushed
);
end if;
end loop;
UnZ_IO.Flush (W);
if UnZ_Glob.Zip_EOF then
raise UnZip.Read_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 Explode_nolit");
pragma Warnings (On, "this code can never be executed and has been deleted");
end if;
end Explode_Nolit;
procedure Explode (literal_tree, slide_8_KB : Boolean) is
Tb, Tl, Td : p_Table_list;
Bb, Bl, Bd : Integer;
L : Length_array (0 .. 255);
huft_incomplete : Boolean;