DEADSOFTWARE

fix round up
[d2df-sdl.git] / src / engine / e_msg.pas
index bb7347740bd950401a0bfc4d49626b41c6884069..7e976e87d38b00fecd761ba2b1175b39a32833f0 100644 (file)
@@ -150,7 +150,7 @@ begin
   begin
     if OwnMemory then
     begin
-      NewSize := MaxSize + ((N + AllocStep) div AllocStep) * AllocStep; // round up
+      NewSize := MaxSize + ((N + AllocStep - 1) div AllocStep) * AllocStep; // round up
       if ReAllocMem(Data, NewSize) = nil then
         raise Exception.Create('TMsg.WriteData: out of memory on realloc');
       MaxSize := NewSize;