diff --git a/packages/base/paszlib/example.pas b/packages/base/paszlib/example.pas index a2b6968f27..e2ec803ce6 100644 --- a/packages/base/paszlib/example.pas +++ b/packages/base/paszlib/example.pas @@ -195,9 +195,6 @@ var len : integer; begin len := strlen(hello)+1; - c_stream.zalloc := NIL; {alloc_func(0);} - c_stream.zfree := NIL; {free_func(0);} - c_stream.opaque := NIL; {voidpf(0);} err := deflateInit(c_stream, Z_DEFAULT_COMPRESSION); CHECK_ERR(err, 'deflateInit'); @@ -241,10 +238,6 @@ var begin strcopy(PChar(uncompr), 'garbage'); - d_stream.zalloc := NIL; {alloc_func(0);} - d_stream.zfree := NIL; {free_func(0);} - d_stream.opaque := NIL; {voidpf(0);} - d_stream.next_in := compr; d_stream.avail_in := 0; d_stream.next_out := uncompr; @@ -289,10 +282,6 @@ var c_stream : z_stream; { compression stream } err : integer; begin - c_stream.zalloc := NIL; {alloc_func(0);} - c_stream.zfree := NIL; {free_func(0);} - c_stream.opaque := NIL; {voidpf(0);} - err := deflateInit(c_stream, Z_BEST_SPEED); CHECK_ERR(err, 'deflateInit'); @@ -349,10 +338,6 @@ var begin strcopy(PChar(uncompr), 'garbage'); - d_stream.zalloc := NIL; {alloc_func(0);} - d_stream.zfree := NIL; {free_func(0);} - d_stream.opaque := NIL; {voidpf(0);} - d_stream.next_in := compr; d_stream.avail_in := cardinal(comprLen); @@ -394,10 +379,6 @@ var begin len := strlen(hello)+1; - c_stream.zalloc := NIL; {alloc_func(0);} - c_stream.zfree := NIL; {free_func(0);} - c_stream.opaque := NIL; {voidpf(0);} - err := deflateInit(c_stream, Z_DEFAULT_COMPRESSION); CHECK_ERR(err, 'deflateInit'); @@ -435,10 +416,6 @@ var begin strcopy(PChar(uncompr), 'garbage'); - d_stream.zalloc := NIL; {alloc_func(0);} - d_stream.zfree := NIL; {free_func(0);} - d_stream.opaque := NIL; {voidpf(0);} - d_stream.next_in := compr; d_stream.avail_in := 2; { just read the zlib header } @@ -478,10 +455,6 @@ var c_stream : z_stream; { compression stream } err : integer; begin - c_stream.zalloc := NIL; {(alloc_func)0;} - c_stream.zfree := NIL; {(free_func)0;} - c_stream.opaque := NIL; {(voidpf)0;} - err := deflateInit(c_stream, Z_BEST_COMPRESSION); CHECK_ERR(err, 'deflateInit'); @@ -517,10 +490,6 @@ var begin strcopy(PChar(uncompr), 'garbage'); - d_stream.zalloc := NIL; { alloc_func(0); } - d_stream.zfree := NIL; { free_func(0); } - d_stream.opaque := NIL; { voidpf(0); } - d_stream.next_in := compr; d_stream.avail_in := cardinal(comprLen); diff --git a/packages/base/paszlib/gzio.pas b/packages/base/paszlib/gzio.pas index 262bd1e62a..b0b84d7441 100644 --- a/packages/base/paszlib/gzio.pas +++ b/packages/base/paszlib/gzio.pas @@ -150,9 +150,6 @@ begin level := Z_DEFAULT_COMPRESSION; strategy := Z_DEFAULT_STRATEGY; - s^.stream.zalloc := nil; { (alloc_func)0 } - s^.stream.zfree := nil; { (free_func)0 } - s^.stream.opaque := nil; { (voidpf)0 } s^.stream.next_in := nil; s^.stream.next_out := nil; s^.stream.avail_in := 0; diff --git a/packages/base/paszlib/zbase.pas b/packages/base/paszlib/zbase.pas index 129bf233d7..b26cf62e06 100644 --- a/packages/base/paszlib/zbase.pas +++ b/packages/base/paszlib/zbase.pas @@ -291,10 +291,6 @@ type msg : string[255]; { last error message, '' if no error } state : pInternal_state; { not visible by applications } - zalloc : alloc_func; { used to allocate the internal state } - zfree : free_func; { used to free the internal state } - opaque : pointer; { private data object passed to zalloc and zfree } - data_type : integer; { best guess about the data type: ascii or binary } adler : cardinal; { adler32 value of the uncompressed data } reserved : cardinal; { reserved for future use } @@ -506,18 +502,17 @@ end; function ZALLOC (var strm : z_stream; items : cardinal; size : cardinal) : pointer; begin - ZALLOC := strm.zalloc(strm.opaque, items, size); + getmem(ZALLOC,items*size); end; procedure ZFREE (var strm : z_stream; ptr : pointer); begin - strm.zfree(strm.opaque, ptr); + freemem(ptr); end; procedure TRY_FREE (var strm : z_stream; ptr : pointer); begin - {if @strm <> Z_NULL then} - strm.zfree(strm.opaque, ptr); + freemem(ptr); end; end. \ No newline at end of file diff --git a/packages/base/paszlib/zcompres.pas b/packages/base/paszlib/zcompres.pas index 85bfbefcfb..4535f04247 100644 --- a/packages/base/paszlib/zcompres.pas +++ b/packages/base/paszlib/zcompres.pas @@ -81,10 +81,6 @@ begin exit; end; - stream.zalloc := NIL; { alloc_func(0); } - stream.zfree := NIL; { free_func(0); } - stream.opaque := NIL; { voidpf(0); } - err := deflateInit(stream, level); if (err <> Z_OK) then begin diff --git a/packages/base/paszlib/zdeflate.pas b/packages/base/paszlib/zdeflate.pas index aeaa8c0b09..60fd7c99d6 100644 --- a/packages/base/paszlib/zdeflate.pas +++ b/packages/base/paszlib/zdeflate.pas @@ -527,13 +527,6 @@ begin } { SetLength(strm.msg, 255); } strm.msg := ''; - if strm.zalloc=nil then - begin - strm.zalloc := @zcalloc; - strm.opaque := nil; - end; - if strm.zfree=nil then - strm.zfree := @zcfree; if (level = Z_DEFAULT_COMPRESSION) then level := 6; @@ -555,7 +548,7 @@ begin end; s := deflate_state_ptr (ZALLOC(strm, 1, sizeof(deflate_state))); - if (s = Z_NULL) then + if (s = nil) then begin deflateInit2_ := Z_MEM_ERROR; exit; @@ -709,8 +702,7 @@ var s : deflate_state_ptr; begin if {(@strm = Z_NULL) or} - (strm.state = Z_NULL) - or (not Assigned(strm.zalloc)) or (not Assigned(strm.zfree)) then + (strm.state = nil) then begin deflateReset := Z_STREAM_ERROR; exit; diff --git a/packages/base/paszlib/zinflate.pas b/packages/base/paszlib/zinflate.pas index 30ce25dcab..575690683b 100644 --- a/packages/base/paszlib/zinflate.pas +++ b/packages/base/paszlib/zinflate.pas @@ -228,7 +228,7 @@ end; function inflateEnd(var z : z_stream) : integer; begin - if (z.state = Z_NULL) or not Assigned(z.zfree) then + if z.state=nil then begin inflateEnd := Z_STREAM_ERROR; exit; @@ -258,22 +258,15 @@ begin { initialize state } { SetLength(strm.msg, 255); } z.msg := ''; - if z.zalloc=nil then - begin - z.zalloc := @zcalloc; - z.opaque := nil; - end; - if z.zfree=nil then - z.zfree := @zcfree; z.state := pInternal_state( ZALLOC(z,1,sizeof(internal_state)) ); - if (z.state = Z_NULL) then + if z.state=nil then begin inflateInit2_ := Z_MEM_ERROR; exit; end; - z.state^.blocks := Z_NULL; + z.state^.blocks := nil; { handle undocumented nowrap option (no zlib header or check) } z.state^.nowrap := FALSE; diff --git a/packages/base/paszlib/zuncompr.pas b/packages/base/paszlib/zuncompr.pas index c93ebcbedd..18a608ff86 100644 --- a/packages/base/paszlib/zuncompr.pas +++ b/packages/base/paszlib/zuncompr.pas @@ -63,9 +63,6 @@ begin exit; end; - stream.zalloc := nil; { alloc_func(0); } - stream.zfree := nil; { free_func(0); } - err := inflateInit(stream); if (err <> Z_OK) then begin