else
Bin[i / 2] |= n;
}
+/* FIXME: Coverity detects the below as dead code.
+ Why? :: right here i == 32
+ which means the first step of the for loop makes i==16
+ and cannot be < HASHLEN (which is also 16)
+*/
for (i = i / 2; i < HASHLEN; i++) {
Bin[i] = '\0';
}
AuthBasicUserRequest::authenticated() const
{
BasicUser const *basic_auth = dynamic_cast<BasicUser const *>(user());
- assert (basic_auth != NULL);
- if (basic_auth->authenticated())
+ if (basic_auth && basic_auth->authenticated())
return 1;
return 0;
stuff.S.uri = spec->uri;
stuff.S.version = spec->version;
stuff.S.req_hdrs = spec->req_hdrs;
- hdr.putInt(HDR_AGE,
- e->timestamp <= squid_curtime ?
- squid_curtime - e->timestamp : 0);
+ if(e)
+ hdr.putInt(HDR_AGE, (e->timestamp <= squid_curtime ? (squid_curtime - e->timestamp) : 0) );
+ else
+ hdr.putInt(HDR_AGE, 0);
hdr.packInto(&p);
stuff.D.resp_hdrs = xstrdup(mb.buf);
debugs(31, 3, "htcpTstReply: resp_hdrs = {" << stuff.D.resp_hdrs << "}");
mb.reset();
hdr.reset();
- if (e->expires > -1)
+ if (e && e->expires > -1)
hdr.putTime(HDR_EXPIRES, e->expires);
- if (e->lastmod > -1)
+ if (e && e->lastmod > -1)
hdr.putTime(HDR_LAST_MODIFIED, e->lastmod);
hdr.packInto(&p);
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);
}