summaryrefslogtreecommitdiff
path: root/packages/paszlib
diff options
context:
space:
mode:
authorpierre <pierre@3ad0048d-3df7-0310-abae-a5850022a9f2>2011-06-23 12:30:52 +0000
committerpierre <pierre@3ad0048d-3df7-0310-abae-a5850022a9f2>2011-06-23 12:30:52 +0000
commit76723b829f5e8cba6cd0b917eeeb4e794ffed173 (patch)
treec8530cdf8922047dd37d4270f243585221600cf4 /packages/paszlib
parent1f5082fcdc4221a973c89fbac3fc9977a7dab2e3 (diff)
downloadfpc-76723b829f5e8cba6cd0b917eeeb4e794ffed173.tar.gz
+ New const MaxzbaseInt, set to maxlongint for FPC
to avoid range check errors within code if compiled with range check enabled. git-svn-id: http://svn.freepascal.org/svn/fpc/trunk@17805 3ad0048d-3df7-0310-abae-a5850022a9f2
Diffstat (limited to 'packages/paszlib')
-rw-r--r--packages/paszlib/src/trees.pas6
-rw-r--r--packages/paszlib/src/zbase.pas16
2 files changed, 12 insertions, 10 deletions
diff --git a/packages/paszlib/src/trees.pas b/packages/paszlib/src/trees.pas
index 4d3d455e6b..e0975c497a 100644
--- a/packages/paszlib/src/trees.pas
+++ b/packages/paszlib/src/trees.pas
@@ -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,
diff --git a/packages/paszlib/src/zbase.pas b/packages/paszlib/src/zbase.pas
index 5b20f814d9..0d2b34bd03 100644
--- a/packages/paszlib/src/zbase.pas
+++ b/packages/paszlib/src/zbase.pas
@@ -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. \ No newline at end of file
+end.