Browse Source

* more ptruint type casts to avoid 64 bit comparisons on 32 bit
platforms

git-svn-id: trunk@9693 -

Jonas Maebe 17 năm trước cách đây
mục cha
commit
588822b14d
2 tập tin đã thay đổi với 4 bổ sung4 xóa
  1. 3 3
      rtl/inc/heap.inc
  2. 1 1
      rtl/inc/wustrings.inc

+ 3 - 3
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);

+ 1 - 1
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;