text
stringlengths
0
234
Zip_Streams.Set_Index (stream, Positive (i));
begin
for j in end_buffer'Range loop
Byte'Read (stream, end_buffer (j));
-- 20 - Jun - 2001 : useless to read more if 1st character is not 'P'
if j = end_buffer'First and then
end_buffer (j) /= Character'Pos ('P')
then
raise bad_end;
end if;
end loop;
Copy_and_check (end_buffer, the_end);
-- at this point, the buffer was successfully read
-- (no exception raised).
the_end.offset_shifting :=
-- This is the real position of the end - of - central - directory block.
Unsigned_32 (Zip_Streams.Index (stream) - 22)
-
-- This is the theoretical position of the end - of - central - directory,
-- block. Should coincide with the real position if the zip file
-- is not appended.
(
1 +
the_end.central_dir_offset +
the_end.central_dir_size
);
return; -- the_end found and filled - > exit
exception
when bad_end =>
if i > min_end_start then
null; -- we will try 1 index before .. .
else
raise; -- definitely no "end - of - central - directory" here
end if;
Function Definition: procedure Init_Buffers;
Function Body: package Decryption is
procedure Set_mode (crypted : Boolean);
function Get_mode return Boolean;
procedure Init (passwrd : String; crc_check : Unsigned_32);
procedure Decode (b : in out Unsigned_8);
pragma Inline (Decode);
end Decryption;
procedure Read_raw_byte (bt : out Unsigned_8);
pragma Inline (Read_raw_byte);
package Bit_buffer is
procedure Init;
-- Read at least n bits into the bit buffer, returns the n first bits
function Read (n : Natural) return Integer;
pragma Inline (Read);
function Read_U32 (n : Natural) return Unsigned_32;
pragma Inline (Read_U32);
-- Inverts (NOT operator) the result before masking by n bits
function Read_inverted (n : Natural) return Integer;
pragma Inline (Read_inverted);
-- Dump n bits no longer needed from the bit buffer
procedure Dump (n : Natural);
pragma Inline (Dump);
procedure Dump_to_byte_boundary;
function Read_and_dump (n : Natural) return Integer;
pragma Inline (Read_and_dump);
function Read_and_dump_U32 (n : Natural) return Unsigned_32;
pragma Inline (Read_and_dump_U32);
end Bit_buffer;
procedure Flush (x : Natural); -- directly from slide to output stream
procedure Flush_if_full (W : in out Integer; unflushed : in out Boolean);
pragma Inline (Flush_if_full);
procedure Flush_if_full (W : in out Integer);
pragma Inline (Flush_if_full);
procedure Copy (distance, copy_length : Natural;
index : in out Natural);
pragma Inline (Copy);
procedure Copy_or_zero (distance, copy_length : Natural;
index : in out Natural;
unflushed : in out Boolean);
pragma Inline (Copy_or_zero);
procedure Delete_output; -- an error has occured (bad compressed data)
end UnZ_IO;
package UnZ_Meth is
procedure Copy_stored;
procedure Unshrink;
subtype Reduction_factor is Integer range 1 .. 4;
procedure Unreduce (factor : Reduction_factor);
procedure Explode (literal_tree, slide_8_KB : Boolean);
deflate_e_mode : Boolean := False;
procedure Inflate;
procedure Bunzip2; -- Nov - 2009
end UnZ_Meth;
------------------------------