[haiku-bugs] [Haiku] #6282: Misnamed BNetBuffer / DynamicBuffer methods

  • From: "Shisui" <trac@xxxxxxxxxxxx>
  • Date: Wed, 07 Jul 2010 20:03:08 -0000

#6282: Misnamed BNetBuffer / DynamicBuffer methods
--------------------------------------+-------------------------------------
   Reporter:  Shisui                  |        Owner:  nobody   
       Type:  bug                     |       Status:  new      
   Priority:  normal                  |    Milestone:  R1       
  Component:  Network & Internet      |      Version:  R1/alpha2
   Keywords:  bnetbuffer network_kit  |   Blocked By:           
Has a Patch:  0                       |     Platform:  All      
   Blocking:                          |  
--------------------------------------+-------------------------------------
 * BNetBuffer::Size() should (according to the BeBook), ''return the number
 of bytes currently in the buffer.''. Actually, if we look at the source
 code (in src/kits/network/libnetapi/DynamicBuffer.cpp :: Size() ) it
 returns the allocated buffer size (i.e including unused bytes at the end
 and wasted bytes at the beginning of the buffer).

 * BNetBuffer::BytesRemaining() should ''return the number of unused bytes
 in the buffer.'' while it returns the number of used bytes in the buffer
 (this is what Size() should do).

 It seems that the members bodies doesn't correspond to the right member
 names (e.g: DynamicBuffer::Size() should return fDataEnd - fDataStart and
 DynamicBuffer::BytesRemaining() should return fBufferSize - fDataEnd,
 since "remaining" bytes are located in the end of the buffer)

-- 
Ticket URL: <http://dev.haiku-os.org/ticket/6282>
Haiku <http://dev.haiku-os.org>
Haiku - the operating system.

Other related posts: