~yadi/squid/warnings

« back to all changes in this revision

Viewing changes to src/SBuf.cc

  • Committer: Amos Jeffries
  • Date: 2015-02-06 21:23:19 UTC
  • Revision ID: squid3@treenet.co.nz-20150206212319-yvb5ujosl4l04m92
Fix for Coverity Scan false positives in SBuf

Coverity scanner gets badly confused with SBuf::npos being used as
default parameter value, even though its used to indicate that
strlen() needs to be used on the string.

This is an experiment to see if it gets less confused by having
explicit overloads for the two cases and not using SBuf::npos value
in relation to the unknown length c-strings.

Show diffs side-by-side

added added

removed removed

Lines of Context:
208
208
SBuf &
209
209
SBuf::append(const char * S, size_type Ssize)
210
210
{
211
 
    if (S == NULL)
 
211
    if (!S)
212
212
        return *this;
213
 
    if (Ssize == SBuf::npos)
214
 
        Ssize = strlen(S);
215
213
    debugs(24, 7, "from c-string to id " << id);
216
214
    // coverity[access_dbuff_in_call]
217
215
    return lowAppend(S, Ssize);