summaryrefslogtreecommitdiff
path: root/contrib/ada/zlib-thin.adb
diff options
context:
space:
mode:
Diffstat (limited to 'contrib/ada/zlib-thin.adb')
-rw-r--r--contrib/ada/zlib-thin.adb70
1 files changed, 13 insertions, 57 deletions
diff --git a/contrib/ada/zlib-thin.adb b/contrib/ada/zlib-thin.adb
index 163bd5b..0ca4a71 100644
--- a/contrib/ada/zlib-thin.adb
+++ b/contrib/ada/zlib-thin.adb
@@ -6,12 +6,11 @@
6-- Open source license information is in the zlib.ads file. -- 6-- Open source license information is in the zlib.ads file. --
7---------------------------------------------------------------- 7----------------------------------------------------------------
8 8
9-- $Id: zlib-thin.adb,v 1.6 2003/01/21 15:26:37 vagul Exp $ 9-- $Id: zlib-thin.adb,v 1.8 2003/12/14 18:27:31 vagul Exp $
10 10
11package body ZLib.Thin is 11package body ZLib.Thin is
12 12
13 ZLIB_VERSION : constant Chars_Ptr := 13 ZLIB_VERSION : constant Chars_Ptr := zlibVersion;
14 Interfaces.C.Strings.New_String ("1.1.4");
15 14
16 Z_Stream_Size : constant Int := Z_Stream'Size / System.Storage_Unit; 15 Z_Stream_Size : constant Int := Z_Stream'Size / System.Storage_Unit;
17 16
@@ -38,14 +37,6 @@ package body ZLib.Thin is
38 ------------------ 37 ------------------
39 38
40 function Deflate_Init 39 function Deflate_Init
41 (strm : in Z_Streamp;
42 level : in Int := Z_DEFAULT_COMPRESSION)
43 return Int is
44 begin
45 return deflateInit (strm, level, ZLIB_VERSION, Z_Stream_Size);
46 end Deflate_Init;
47
48 function Deflate_Init
49 (strm : Z_Streamp; 40 (strm : Z_Streamp;
50 level : Int; 41 level : Int;
51 method : Int; 42 method : Int;
@@ -69,16 +60,15 @@ package body ZLib.Thin is
69 -- Inflate_Init -- 60 -- Inflate_Init --
70 ------------------ 61 ------------------
71 62
72 function Inflate_Init (strm : Z_Streamp) return Int is
73 begin
74 return inflateInit (strm, ZLIB_VERSION, Z_Stream_Size);
75 end Inflate_Init;
76
77 function Inflate_Init (strm : Z_Streamp; windowBits : Int) return Int is 63 function Inflate_Init (strm : Z_Streamp; windowBits : Int) return Int is
78 begin 64 begin
79 return inflateInit2 (strm, windowBits, ZLIB_VERSION, Z_Stream_Size); 65 return inflateInit2 (strm, windowBits, ZLIB_VERSION, Z_Stream_Size);
80 end Inflate_Init; 66 end Inflate_Init;
81 67
68 ------------------------
69 -- Last_Error_Message --
70 ------------------------
71
82 function Last_Error_Message (Strm : in Z_Stream) return String is 72 function Last_Error_Message (Strm : in Z_Stream) return String is
83 use Interfaces.C.Strings; 73 use Interfaces.C.Strings;
84 begin 74 begin
@@ -89,54 +79,28 @@ package body ZLib.Thin is
89 end if; 79 end if;
90 end Last_Error_Message; 80 end Last_Error_Message;
91 81
92 -------------
93 -- Need_In --
94 -------------
95
96 function Need_In (strm : Z_Stream) return Boolean is
97 begin
98 return strm.Avail_In = 0;
99 end Need_In;
100
101 --------------
102 -- Need_Out --
103 --------------
104
105 function Need_Out (strm : Z_Stream) return Boolean is
106 begin
107 return strm.Avail_Out = 0;
108 end Need_Out;
109
110 ------------ 82 ------------
111 -- Set_In -- 83 -- Set_In --
112 ------------ 84 ------------
113 85
114 procedure Set_In 86 procedure Set_In
115 (Strm : in out Z_Stream; 87 (Strm : in out Z_Stream;
116 Buffer : in Byte_Access; 88 Buffer : in Voidp;
117 Size : in UInt) is 89 Size : in UInt) is
118 begin 90 begin
119 Strm.Next_In := Buffer; 91 Strm.Next_In := Buffer;
120 Strm.Avail_In := Size; 92 Strm.Avail_In := Size;
121 end Set_In; 93 end Set_In;
122 94
123 procedure Set_In
124 (Strm : in out Z_Stream;
125 Buffer : in Voidp;
126 Size : in UInt) is
127 begin
128 Set_In (Strm, Bytes.To_Pointer (Buffer), Size);
129 end Set_In;
130
131 ------------------ 95 ------------------
132 -- Set_Mem_Func -- 96 -- Set_Mem_Func --
133 ------------------ 97 ------------------
134 98
135 procedure Set_Mem_Func 99 procedure Set_Mem_Func
136 (Strm : in out Z_Stream; 100 (Strm : in out Z_Stream;
137 Opaque : in Voidp; 101 Opaque : in Voidp;
138 Alloc : in alloc_func; 102 Alloc : in alloc_func;
139 Free : in free_func) is 103 Free : in free_func) is
140 begin 104 begin
141 Strm.opaque := Opaque; 105 Strm.opaque := Opaque;
142 Strm.zalloc := Alloc; 106 Strm.zalloc := Alloc;
@@ -149,21 +113,13 @@ package body ZLib.Thin is
149 113
150 procedure Set_Out 114 procedure Set_Out
151 (Strm : in out Z_Stream; 115 (Strm : in out Z_Stream;
152 Buffer : in Byte_Access; 116 Buffer : in Voidp;
153 Size : in UInt) is 117 Size : in UInt) is
154 begin 118 begin
155 Strm.Next_Out := Buffer; 119 Strm.Next_Out := Buffer;
156 Strm.Avail_Out := Size; 120 Strm.Avail_Out := Size;
157 end Set_Out; 121 end Set_Out;
158 122
159 procedure Set_Out
160 (Strm : in out Z_Stream;
161 Buffer : in Voidp;
162 Size : in UInt) is
163 begin
164 Set_Out (Strm, Bytes.To_Pointer (Buffer), Size);
165 end Set_Out;
166
167 -------------- 123 --------------
168 -- Total_In -- 124 -- Total_In --
169 -------------- 125 --------------