瀏覽代碼

* fixed bug in TryBlockGetMem, caused by ambigous variable named 'Size' in with statement

git-svn-id: trunk@37641 -
nickysn 7 年之前
父節點
當前提交
ca7da11bb6
共有 1 個文件被更改,包括 10 次插入10 次删除
  1. 10 10
      rtl/win16/glbheap.inc

+ 10 - 10
rtl/win16/glbheap.inc

@@ -78,8 +78,8 @@ circular linked list.
       end;
 
     { tries to suballocate from the existing blocks. Returns nil if not enough
-      free space is available. Size must be aligned by 4. }
-    function TryBlockGetMem(Size: Word): FarPointer;
+      free space is available. ASize must be aligned by 4. }
+    function TryBlockGetMem(ASize: Word): FarPointer;
       var
         CurBlock: Word;
         CurBlockP: PGlobalHeapBlockHeader;
@@ -91,16 +91,16 @@ circular linked list.
           exit;
         repeat
           CurBlockP:=Ptr(CurBlock,0);
-          if CurBlockP^.TotalFreeSpaceInBlock>=Size then
+          if CurBlockP^.TotalFreeSpaceInBlock>=ASize then
             begin
               PrevSubBlock:=nil;
               CurSubBlock:=Ptr(CurBlock,CurBlockP^.FirstFreeOfs);
               while Ofs(CurSubBlock^)<>0 do
                 begin
-                  if CurSubBlock^.Size>=Size then
+                  if CurSubBlock^.Size>=ASize then
                     begin
                       result:=CurSubBlock;
-                      if CurSubBlock^.Size=Size then
+                      if CurSubBlock^.Size=ASize then
                         begin
                           if PrevSubBlock<>nil then
                             PrevSubBlock^.Next:=CurSubBlock^.Next
@@ -109,17 +109,17 @@ circular linked list.
                         end
                       else
                         begin
-                          with PFreeSubBlock(Ptr(CurBlock,Ofs(CurSubBlock^)+Size))^ do
+                          with PFreeSubBlock(Ptr(CurBlock,Ofs(CurSubBlock^)+ASize))^ do
                             begin
                               Next:=CurSubBlock^.Next;
-                              Size:=CurSubBlock^.Size-Size;
+                              Size:=CurSubBlock^.Size-ASize;
                             end;
                           if PrevSubBlock<>nil then
-                            PrevSubBlock^.Next:=Ofs(CurSubBlock^)+Size
+                            PrevSubBlock^.Next:=Ofs(CurSubBlock^)+ASize
                           else
-                            CurBlockP^.FirstFreeOfs:=Ofs(CurSubBlock^)+Size;
+                            CurBlockP^.FirstFreeOfs:=Ofs(CurSubBlock^)+ASize;
                         end;
-                      Dec(CurBlockP^.TotalFreeSpaceInBlock,Size);
+                      Dec(CurBlockP^.TotalFreeSpaceInBlock,ASize);
                       { TODO: what is FirstFreeOfs if the entire block is allocated??? }
                       exit;
                     end;