text
stringlengths 0
234
|
|---|
loop
|
Blocks := Blocks + 1;
|
Inflate_Block (Is_Last_Block, Blocks_Fix, Blocks_Dyn);
|
exit when Is_Last_Block;
|
end loop;
|
Unz_Io.Flush (Unz_Glob.Slide_Index);
|
Unz_Glob.Slide_Index := 0;
|
end Inflate;
|
end Unz_Meth;
|
procedure Process_Descriptor_Store (Descriptor : out Zip.Headers.Data_Descriptor) is
|
Buffer : Ada.Streams.Stream_Element_Array (1 .. 16);
|
begin
|
Zip.Blockread (Zip_File, Buffer);
|
Zip.Headers.Copy_And_Check (Buffer, Descriptor);
|
end Process_Descriptor_Store;
|
procedure Process_Descriptor_Deflate (Descriptor : out Zip.Headers.Data_Descriptor) is
|
Buffer : Ada.Streams.Stream_Element_Array (1 .. 16);
|
begin
|
Unz_Io.Bit_Buffer.Dump_To_Byte_Boundary;
|
for I in Buffer'Range loop
|
Buffer (I) := Ada.Streams.Stream_Element (Unz_Io.Read_Byte_Decrypted);
|
end loop;
|
Zip.Headers.Copy_And_Check (Buffer, Descriptor);
|
end Process_Descriptor_Deflate;
|
use Zip;
|
begin
|
Unz_Io.Init_Buffers;
|
-- Unzip correct type
|
case Format is
|
when Store =>
|
Unz_Meth.Copy_Stored (Ada.Streams.Stream_Element_Offset (Compressed_Size));
|
when Deflate =>
|
Unz_Meth.Inflate;
|
end case;
|
if Verify_Integrity then
|
CRC_Value := Zip.CRC.Final (CRC_Value);
|
end if;
|
if Data_Descriptor_After_Data then -- Sizes and CRC at the end
|
declare
|
Memo_Uncomp_Size : constant Unsigned_32 := Hint.Dd.Uncompressed_Size;
|
begin
|
case Format is
|
when Store =>
|
Process_Descriptor_Store (Hint.Dd);
|
when Deflate =>
|
Process_Descriptor_Deflate (Hint.Dd);
|
end case;
|
-- CRC is for checking; sizes are for informing user
|
if Memo_Uncomp_Size < Unsigned_32'Last
|
and then Memo_Uncomp_Size /= Hint.Dd.Uncompressed_Size
|
then
|
raise Uncompressed_Size_Error;
|
end if;
|
exception
|
when Zip.Headers.Bad_Data_Descriptor =>
|
raise Zip.Archive_Corrupted;
|
Function Definition: procedure UnzipDCF is
|
Function Body: package Dirs renames Ada.Directories;
|
package SU renames Ada.Strings.Unbounded;
|
List_Files : Boolean := False;
|
Test_Data : Boolean := False;
|
Comment : Boolean := False;
|
Quiet : Boolean := False;
|
No_Directories : Boolean := False;
|
Lower_Case : Boolean := False;
|
Last_Option : Natural := 0;
|
Extraction_Directory : SU.Unbounded_String
|
:= SU.To_Unbounded_String (Dirs.Current_Directory);
|
Name_Conflict_Decision : DCF.Unzip.Name_Conflict_Intervention := DCF.Unzip.Yes;
|
procedure Help is
|
begin
|
Put_Line ("UnZipDCF " & DCF.Zip.Version & " - unzip document container files");
|
New_Line;
|
Put_Line ("Usage: unzipdcf [-options[modifiers]] [-d exdir] file [list]");
|
New_Line;
|
Put_Line (" -l list files");
|
Put_Line (" -t test integrity of files, no write");
|
Put_Line (" -z display archive comment only");
|
Put_Line (" -d extract to ""exdir""");
|
Put_Line ("modifiers:");
|
Put_Line (" -n never overwrite existing files -q quiet mode");
|
Put_Line (" -o always overwrite existing files");
|
Put_Line (" -j junk archived directory structure -L make names lower case");
|
end Help;
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.