[interfacekit] Re: BMallocIO broken

In a strange way, it's handy this happened, because now I can say this: 
  whenever we run into something like this (that is, a bug), please make 
sure to create a unit test that specifically test for the bug -- this 
way we will always be notified by the failure of that test should the 
bug ever creep back into our code.

Thanks!

e

Jack Burton wrote:
> On 2002-10-06 at 20:24:29 [+0200], you wrote:
> 
> 
>>   Looking at the code for BMallocIO, it looks like it's resizing on a
>>Write() even if the new calculated size (ie position + bytes written)
>>is *less* blocks than are currently allocated.  
> 
> 
> Hm... it should not...
> 
> =09size_t newSize =3D max(pos + size, static_cast<off_t>(fLength));
> =09status_t error =3D B_OK;
> 
> =09if (newSize > fMallocSize)
> =09=09error =3D SetSize(newSize);
> 
> See? It resizes JUST if the newSize is more than the current allocated 
> memory.
> Anyway, the behaviour of my MallocIO implementation is very strange when 
> used with the storage kit tests. I am looking into it.
> 
> 


Other related posts: