From 588822b14d9e63df7e35f7d3655f3d10fab591bb Mon Sep 17 00:00:00 2001 From: Jonas Maebe Date: Wed, 9 Jan 2008 18:32:37 +0000 Subject: [PATCH] * more ptruint type casts to avoid 64 bit comparisons on 32 bit platforms git-svn-id: trunk@9693 - --- rtl/inc/heap.inc | 6 +++--- rtl/inc/wustrings.inc | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/rtl/inc/heap.inc b/rtl/inc/heap.inc index 213a72e955..638b35e781 100644 --- a/rtl/inc/heap.inc +++ b/rtl/inc/heap.inc @@ -828,7 +828,7 @@ begin maximum of $ffff elements are allowed, otherwise there will be an overflow } chunksize := chunkindex shl blockshift; - if size-chunksize>maxsize then + if ptruint(size-chunksize)>maxsize then HandleError(204); { we need to align the user pointers to 8 byte at least for mmx/sse and doubles on sparc, align to 16 bytes } @@ -839,7 +839,7 @@ begin repeat pmc^.size := fixedsizeflag or chunksize or (i shl fixedoffsetshift); inc(i, chunksize); - if i > size - chunksize then break; + if i > ptruint(size - chunksize) then break; pmc_next := pmemchunk_fixed(pointer(pmc)+chunksize); pmc^.next_fixed := pmc_next; pmc_next^.prev_fixed := pmc; @@ -858,7 +858,7 @@ begin mmx/sse and doubles on sparc, align to 16 bytes } result := pointer(poc)+varfirstoffset; pmcv := pmemchunk_var(result); - pmcv^.size := ((size-varfirstoffset) and sizemask) or (firstblockflag or lastblockflag); + pmcv^.size := (ptruint(size-varfirstoffset) and sizemask) or (firstblockflag or lastblockflag); pmcv^.prevsize := 0; pmcv^.freelists := loc_freelists; append_to_list_var(pmcv); diff --git a/rtl/inc/wustrings.inc b/rtl/inc/wustrings.inc index e4ba5e6280..ae5a49b5df 100644 --- a/rtl/inc/wustrings.inc +++ b/rtl/inc/wustrings.inc @@ -1652,7 +1652,7 @@ function UnicodeToUtf8(Dest: PChar; MaxDestBytes: SizeUInt; Source: PWideChar; S inc(i); end; - if j>MaxDestBytes-1 then + if j>SizeUInt(MaxDestBytes-1) then j:=MaxDestBytes-1; Dest[j]:=#0;