* Further cleanup.

* Don't typecast 0 and nil to longint/pointer.
    * Don't typecast 0 to char, use #0 instead.
    * Use TP define for TP specific code.

git-svn-id: trunk@4808 -
This commit is contained in:
daniel 2006-10-05 20:58:29 +00:00
parent d107c6649c
commit 30078a56dc
5 changed files with 14 additions and 15 deletions

View File

@ -164,7 +164,7 @@ begin
s^.path := path; { limit to 255 chars }
s^.mode := chr(0);
s^.mode := #0;
for i:=1 to Length(mode) do begin
case mode[i] of
'r' : s^.mode := 'r';
@ -174,9 +174,9 @@ begin
'h' : strategy := Z_HUFFMAN_ONLY;
end;
end;
if (s^.mode=chr(0)) then begin
if s^.mode=#0 then begin
destroy(s);
gzopen := gzFile(nil);
gzopen := nil;
exit;
end;
@ -305,17 +305,16 @@ end;
function get_byte (s:gz_streamp) : integer;
begin
if (s^.z_eof = true) then begin
if s^.z_eof then begin
get_byte := Z_EOF;
exit;
end;
if (s^.stream.avail_in = 0) then begin
if s^.stream.avail_in=0 then begin
{$I-}
blockread (s^.gzfile, s^.inbuf^, Z_BUFSIZE, s^.stream.avail_in);
{$I+}
if (s^.stream.avail_in = 0) then begin
if s^.stream.avail_in=0 then begin
s^.z_eof := true;
if (IOResult <> 0) then s^.z_err := Z_ERRNO;
get_byte := Z_EOF;
@ -327,7 +326,6 @@ begin
Dec(s^.stream.avail_in);
get_byte := s^.stream.next_in^;
Inc(s^.stream.next_in);
end;
@ -377,7 +375,7 @@ begin
{$endif}
if (c = Z_EOF) then
s^.z_err := Z_DATA_ERROR;
GetLong := cardinal(longint(x));
GetLong := cardinal(x);
end;
@ -712,7 +710,7 @@ begin
inc (buf);
until (len = 0) or (bytes <> 1) or (gzchar = Chr(13));
buf^ := Chr(0);
buf^ := #0;
if (b = buf) and (len > 0) then gzgets := nil else gzgets := b;
end;

View File

@ -115,7 +115,7 @@ begin
s.read := s.window;
if Assigned(s.checkfn) then
begin
s.check := s.checkfn(cardinal(0), Pbyte(NIL), 0);
s.check := s.checkfn(cardinal(0), nil, 0);
z.adler := s.check;
end;
{$IFDEF ZLIB_DEBUG}

View File

@ -2050,7 +2050,7 @@ begin
begin
{$endif}
{ Since LIT_BUFSIZE <= 2*WSIZE, the input data must be there: }
if (buf = Pchar(0)) then
if buf=nil then
error ('block vanished');
copy_block(buf, cardinal(stored_len), 0); { without header }
@ -2061,7 +2061,7 @@ begin
{$endif} { STORED_FILE_OK }
{$ifdef FORCE_STORED}
if (buf <> pchar(0)) then
if buf<>nil then
begin { force stored block }
{$else}
if (stored_len+4 <= opt_lenb) and (buf <> nil) then

View File

@ -70,7 +70,7 @@ interface
{ Maximum value for memLevel in deflateInit2 }
{$ifdef MAXSEG_64K}
{$IFDEF VER70}
{$IFDEF TP}
const
MAX_MEM_LEVEL = 7;
DEF_MEM_LEVEL = MAX_MEM_LEVEL; { default memLevel }
@ -87,7 +87,7 @@ const
{ Maximum value for windowBits in deflateInit2 and inflateInit2 }
const
{$IFDEF VER70}
{$IFDEF TP}
MAX_WBITS = 14; { 32K LZ77 window }
{$ELSE}
MAX_WBITS = 15; { 32K LZ77 window }

View File

@ -7,6 +7,7 @@
{- $DEFINE MAXSEG_64K}
{$IFDEF VER70}
{$DEFINE TP}
{$DEFINE MAXSEG_64K}
{$ENDIF}
{$IFNDEF WIN32}