Re: /bzr/squid3/trunk/ r9584: Various errors detected by Coverity scan

From: Amos Jeffries <squid3_at_treenet.co.nz>
Date: Fri, 20 Mar 2009 13:37:47 +1300

Alex Rousskov wrote:
> On 03/19/2009 08:44 AM, Amos Jeffries wrote:
>> ------------------------------------------------------------
>> revno: 9584
>> committer: Amos Jeffries <squid3_at_treenet.co.nz>
>> branch nick: trunk
>> timestamp: Fri 2009-03-20 03:44:22 +1300
>> message:
>> Various errors detected by Coverity scan
>
>
> === modified file 'src/ip/IpAddress.cc'
> --- a/src/ip/IpAddress.cc 2009-03-10 14:29:30 +0000
> +++ b/src/ip/IpAddress.cc 2009-03-19 14:44:22 +0000
> @@ -651,10 +651,8 @@
>
> IpAddress& IpAddress::operator =(IpAddress *s)
> {
> - IpAddress *tmp = NULL;
> if (!s) return *this;
> - tmp = dynamic_cast<IpAddress*>(s);
> - if (!tmp) return *this;
> + IpAddress *tmp = static_cast<IpAddress*>(s);
> return operator=(*tmp);
> }
>
> Is there a reason to cast "s" to its own type?
>
> Thanks,
>
> Alex.
> P.S. The assignment operator above essentially converts a "pointer to an
> IP address" to an "IP address", which is, to put it mildly, strange. Do
> we really need this operator?

True. I can only think it was a legacy of the migration process.
Killing...

Amos

-- 
Please be using
   Current Stable Squid 2.7.STABLE6 or 3.0.STABLE13
   Current Beta Squid 3.1.0.6
Received on Fri Mar 20 2009 - 00:37:02 MDT

This archive was generated by hypermail 2.2.0 : Fri Mar 20 2009 - 12:00:04 MDT