+ New const MaxzbaseInt, set to maxlongint for FPC

to avoid range check errors within code if compiled
    with range check enabled.

git-svn-id: trunk@17805 -
This commit is contained in:
pierre 2011-06-23 12:30:52 +00:00
parent 239944f8d0
commit 0c210a9df3
2 changed files with 12 additions and 10 deletions

View File

@ -106,7 +106,7 @@ type
dtree_type = array[0..2*D_CODES+1-1] of ct_data; { distance tree }
htree_type = array[0..2*BL_CODES+1-1] of ct_data; { Huffman tree for bit lengths }
{ generic tree type }
tree_type = array[0..(maxint div SizeOf(ct_data))-1] of ct_data;
tree_type = array[0..(maxzbaseint div SizeOf(ct_data))-1] of ct_data;
tree_ptr = ^ct_data;
ltree_ptr = ^ltree_type;
@ -139,7 +139,7 @@ type
pPosf = ^Posf;
zPosfArray = array[0..(maxint div SizeOf(Posf))-1] of Posf;
zPosfArray = array[0..(maxzbaseint div SizeOf(Posf))-1] of Posf;
pzPosfArray = ^zPosfArray;
{ A Pos is an index in the character window. We use short instead of integer to
@ -509,7 +509,7 @@ const
27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 28
);
{ First normalized length for each code (0 = MIN_MATCH) }
base_length : array[0..LENGTH_CODES-1] of integer = (
0, 1, 2, 3, 4, 5, 6, 7, 8, 10, 12, 14, 16, 20, 24, 28, 32, 40, 48, 56,

View File

@ -88,9 +88,11 @@ const
{ Maximum value for windowBits in deflateInit2 and inflateInit2 }
const
{$IFDEF TP}
MAX_WBITS = 14; { 32K LZ77 window }
MAX_WBITS = 14; { 16K LZ77 window }
maxzbaseint = maxint;
{$ELSE}
MAX_WBITS = 15; { 32K LZ77 window }
maxzbaseint = maxlongint;
{$ENDIF}
{ default windowBits for decompression. MAX_WBITS is for compression only }
@ -102,10 +104,10 @@ type Pbytearray=^Tbytearray;
Pwordarray=^Twordarray;
Pcardinalarray=^Tcardinalarray;
Tbytearray = array [0..maxint div sizeof(byte)-1] of byte;
Twordarray = array [0..maxint div sizeof(word)-1] of word;
Tintegerarray = array [0..maxint div sizeof(integer)-1] of integer;
Tcardinalarray = array [0..maxint div sizeof(cardinal)-1] of cardinal;
Tbytearray = array [0..maxzbaseint div sizeof(byte)-1] of byte;
Twordarray = array [0..maxzbaseint div sizeof(word)-1] of word;
Tintegerarray = array [0..maxzbaseint div sizeof(integer)-1] of integer;
Tcardinalarray = array [0..maxzbaseint div sizeof(cardinal)-1] of cardinal;
{ The memory requirements for deflate are (in bytes):
@ -136,7 +138,7 @@ type
End;
type
huft_field = Array[0..(maxint div SizeOf(inflate_huft))-1] of inflate_huft;
huft_field = Array[0..(maxzbaseint div SizeOf(inflate_huft))-1] of inflate_huft;
huft_ptr = ^huft_field;
type
ppInflate_huft = ^pInflate_huft;
@ -500,4 +502,4 @@ begin
WriteLn(x);
end;
end.
end.