Просмотр исходного кода

* Fix bug ID #37118

git-svn-id: trunk@45444 -
michael 5 лет назад
Родитель
Сommit
74e65f77bc
1 измененных файлов с 4 добавлено и 1 удалено
  1. 4 1
      rtl/objpas/classes/streams.inc

+ 4 - 1
rtl/objpas/classes/streams.inc

@@ -1243,7 +1243,10 @@ end;
 Procedure THandleStream.SetSize(const NewSize: Int64);
 
 begin
-  FileTruncate(FHandle,NewSize);
+  // We set the position afterwards, because the size can also be larger.
+  if not FileTruncate(FHandle,NewSize) then
+    Raise EInOutError.Create(SStreamSetSize);
+  Position:=NewSize;
 end;