Improve calculation of new buffer size

svn path=/trunk/; revision=28121
This commit is contained in:
Thomas Bluemel 2007-08-03 10:21:59 +00:00
parent 401e48338f
commit ff44e1ea45

View file

@ -43,8 +43,8 @@ Output(POUTPUTBUFFER OutBuf, PCTSTR Text)
DPRINT("Out of free space. TotalSize %lu FreeSize %lu Length %u\n",
OutBuf->TotalSize, OutBuf->FreeSize, Length);
/* Round up to next SIZE_INC */
NewSize = OutBuf->TotalSize +
(((Length + 1) - OutBuf->FreeSize + (SIZE_INC - 1)) /
NewSize = OutBuf->TotalSize - OutBuf->FreeSize +
(((Length + 1) + (SIZE_INC - 1)) /
SIZE_INC) * SIZE_INC;
DPRINT("NewSize %lu\n", NewSize);
NewBuf = MALLOC(NewSize);