FIX: Correct some pointer types and compiler warnings for 64-bit.

This commit is contained in:
cobines 2010-03-07 16:27:25 +00:00
commit 48e3cb38d1
3 changed files with 18 additions and 21 deletions

View file

@ -2072,10 +2072,10 @@ end;
procedure TAbExtraField.DeleteField(aSubField : PAbExtraSubField);
var
Len: Integer;
Offset : PtrInt;
Offset : PtrUInt;
begin
Len := SizeOf(TAbExtraSubField) + aSubField.Len;
Offset := PtrInt(aSubField) - PtrInt(FBuffer);
Offset := PtrUInt(aSubField) - PtrUInt(FBuffer);
if Offset + Len < Length(FBuffer) then
Move(FBuffer[Offset + Len], aSubField^, Length(FBuffer) - Offset - Len);
SetLength(FBuffer, Length(FBuffer) - Len);
@ -2103,7 +2103,7 @@ begin
end
else begin
BytesLeft := Length(FBuffer) -
Integer(PtrInt(aCurField) - PtrInt(FBuffer)) -
Integer(PtrUInt(aCurField) - PtrUInt(FBuffer)) -
SizeOf(TAbExtraSubField) - aCurField.Len;
aCurField := aCurField + aCurField.Len + SizeOf(TAbExtraSubField);
end;

View file

@ -451,8 +451,7 @@ begin
P := OutBuf;
Inc(OutBytes, 256);
ReallocMem(OutBuf, OutBytes);
strm.next_out := PByte(Integer(OutBuf)
+ (Integer(strm.next_out) - Integer(P)));
strm.next_out := OutBuf + strm.next_out - P;
strm.avail_out := 256;
end;
finally
@ -494,7 +493,7 @@ begin
P := OutBuf;
Inc(OutBytes, BufInc);
ReallocMem(OutBuf, OutBytes);
strm.next_out := PByte(Integer(OutBuf) + (Integer(strm.next_out) - Integer(P)));
strm.next_out := OutBuf + strm.next_out - P;
strm.avail_out := BufInc;
end;
finally

View file

@ -256,8 +256,7 @@ begin
HashInx :=
((HashInx shl c_HashShift) xor longint(CurPos[2])) and
c_HashMask;
HashChains^[longint(CurPos) and FWinMask] :=
HashHeads^[HashInx]; //TODO 64bit pointer
HashChains^[PtrUInt(CurPos) and FWinMask] := HashHeads^[HashInx];
HashHeads^[HashInx] := CurPos;
inc(CurPos);
end;
@ -364,7 +363,6 @@ function TAbDfInputWindow.FindLongestMatch(aAmpleLength : integer;
{$ENDIF}
{$ENDIF}
type
PLongint = ^longint;
PWord = ^word;
var
MaxLen : longint;
@ -403,7 +401,7 @@ begin
{update the chain itself: set the entry for this position equal to
the previous string position}
FHashChains^[longint(CurPos) and FWinMask] := PrevStrPos;//TODO 64bit pointer
FHashChains^[PtrUInt(CurPos) and FWinMask] := PrevStrPos;
{calculate the maximum match we could do at this position}
MaxMatch := (FLookAheadEnd - CurPos);
@ -599,7 +597,7 @@ begin
Break;
{otherwise move onto the next position}
PrevStrPos := FHashChains^[longint(PrevStrPos) and FWinMask];
PrevStrPos := FHashChains^[PtrUInt(PrevStrPos) and FWinMask];
end;
{$ENDIF}
@ -699,9 +697,9 @@ end;
procedure TAbDfInputWindow.iwSlide;
var
i : integer;
ByteCount : integer;
Buffer : longint;
ListItem : PLongint;
ByteCount : PtrInt;
Buffer : PAnsiChar;
ListItem : PPointer;
begin
{move current valid data back to the start of the buffer}
ByteCount := FLookAheadEnd - FStart;
@ -714,22 +712,22 @@ begin
dec(FLookAheadEnd, ByteCount);
{patch up the hash table: the head pointers}
Buffer := longint(FBuffer);//64bit pointer
ListItem := PLongint(@FHashHeads^[0]);
Buffer := FBuffer;
ListItem := @FHashHeads^[0];
for i := 0 to pred(c_HashCount) do begin
dec(ListItem^, ByteCount);
if (ListItem^ < Buffer) then
ListItem^ := 0;
inc(PAnsiChar(ListItem), sizeof(pointer));
ListItem^ := nil;
inc(ListItem);
end;
{..the chain pointers}
ListItem := PLongint(@FHashChains^[0]);
ListItem := @FHashChains^[0];
for i := 0 to pred(FWinSize) do begin
dec(ListItem^, ByteCount);
if (ListItem^ < Buffer) then
ListItem^ := 0;
inc(PAnsiChar(ListItem), sizeof(pointer));
ListItem^ := nil;
inc(ListItem);
end;
{now read some more data from the stream}