[haiku-commits] Re: haiku: hrev46860 - in src/kits: shared package/hpkg package/hpkg/v1

  • From: Ingo Weinhold <ingo_weinhold@xxxxxx>
  • To: haiku-commits@xxxxxxxxxxxxx
  • Date: Wed, 12 Feb 2014 15:06:15 +0100

On 02/12/2014 02:34 PM, Adrien Destugues wrote:
Thanks for following up on the suggestions. Personally, I think "result"
is still not a good name, I prefer "written" (or "read", depending on
context), but this is entering the area of nitpicking.

I went with result, because in this case the variable isn't actually used as a 
count/size: we only check the "negative error code" case.

The more I think about this whole change, the more I think it sucks (at least as it is now). You switched from an interface with a Write() method that either writes everything or fails (BDataOutput) to an interface with a Write() method that explicitly supports partial writes (BDataIO). I was wondering why the incorrect implementation of PackageFile::IORequestOutput::Write() in packagefs (for which Jérôme added a TODO) doesn't break things completely. But obviously that's because the code using the interface hasn't been adjusted to handle the return value correctly either.

I think it would be better to revert the interface switch and rather introduce a BDataOutput -> BDataIO adapter. This would allow using BDataIOs with ZlibDecompressor while keeping the more concise interface.

CU, Ingo


Other related posts: