Browse Source

+ support writing more than 1024 zeros in TObjSection.WriteZeros

git-svn-id: trunk@31505 -
nickysn 10 years ago
parent
commit
cbaa02e7b5
1 changed files with 14 additions and 6 deletions
  1. 14 6
      compiler/ogbase.pas

+ 14 - 6
compiler/ogbase.pas

@@ -921,15 +921,23 @@ implementation
       var
       var
         empty : array[0..1023] of byte;
         empty : array[0..1023] of byte;
       begin
       begin
+        result:=Size;
         if l>sizeof(empty) then
         if l>sizeof(empty) then
-          internalerror(200404082);
-        if l>0 then
           begin
           begin
-            fillchar(empty,l,0);
-            result:=Write(empty,l);
+            fillchar(empty,sizeof(empty),0);
+            while l>sizeof(empty) do
+              begin
+                Write(empty,sizeof(empty));
+                Dec(l,sizeof(empty));
+              end;
+            if l>0 then
+              Write(empty,l);
           end
           end
-        else
-          result:=Size;
+        else if l>0 then
+          begin
+            fillchar(empty,l,0);
+            Write(empty,l);
+          end;
       end;
       end;