[haiku-bugs] Re: [Haiku] #13522: BNetworkAddress::SetTo() doesn't store some error cases.

  • From: "pulkomandy" <trac@xxxxxxxxxxxx>
  • Date: Sat, 20 May 2017 06:55:01 -0000

#13522: BNetworkAddress::SetTo() doesn't store some error cases.
--------------------------------+----------------------------
   Reporter:  anevilyak         |      Owner:  pulkomandy
       Type:  bug               |     Status:  assigned
   Priority:  normal            |  Milestone:  Unscheduled
  Component:  Kits/Network Kit  |    Version:  R1/Development
 Resolution:                    |   Keywords:
 Blocked By:                    |   Blocking:
Has a Patch:  0                 |   Platform:  All
--------------------------------+----------------------------

Comment (by pulkomandy):

 The reasoning for this code is that when SetTo fails in these cases, the
 object preserves its previous state. So, SetTo failed, but the object is
 still valid (or invalid) with the data that was in it before.

 The constructors using this SetTo method do set fStatus with the SetTo
 return value, so InitCheck can be used safely in that case.

 There isn't really a need to preserve this behavior, in case of errors in
 SetTo, we could then call Unset() and set fStatus to the error code,
 allowing use of SetTo + InitCheck.

--
Ticket URL: <https://dev.haiku-os.org/ticket/13522#comment:2>
Haiku <https://dev.haiku-os.org>
The Haiku operating system.

Other related posts: