fixed some warnings and minor issues detected by clang-analyzer

Conflicts:
	Data/src/RecordSet.cpp
This commit is contained in:
Guenter Obiltschnig
2016-09-13 11:37:12 +02:00
parent fbbf197fd2
commit ae3c4a4ba3
8 changed files with 17 additions and 15 deletions

View File

@@ -242,6 +242,7 @@ void HTTPResponse::read(std::istream& istr)
while (ch != '\r' && ch != '\n' && ch != eof && reason.length() < MAX_REASON_LENGTH) { reason += (char) ch; ch = istr.get(); }
if (!Poco::Ascii::isSpace(ch)) throw MessageException("HTTP reason string too long");
if (ch == '\r') ch = istr.get();
if (ch != '\n') throw MessageException("Unterminated HTTP response line");
HTTPMessage::read(istr);
ch = istr.get();

View File

@@ -105,18 +105,21 @@ namespace
poco_check_ptr (pPS);
NameValueCollection::ConstIterator it = header.begin();
NameValueCollection::ConstIterator end = header.end();
bool added = false;
for (; it != end; ++it)
{
if (MailMessage::HEADER_CONTENT_DISPOSITION == it->first)
if (!added && MailMessage::HEADER_CONTENT_DISPOSITION == it->first)
{
if (it->second == "inline")
_pMsg->addContent(pPS, cte);
else
_pMsg->addAttachment("", pPS, cte);
added = true;
}
pPS->headers().set(it->first, it->second);
}
if (!added) delete pPS;
}
}

View File

@@ -88,13 +88,13 @@ int MultipartStreamBuf::readFromDevice(char* buffer, std::streamsize length)
{
if (ch == '\r')
{
ch = buf.sbumpc(); // '\n'
buf.sbumpc(); // '\n'
}
return 0;
}
else if (ch == '-' && buf.sgetc() == '-')
{
ch = buf.sbumpc(); // '-'
buf.sbumpc(); // '-'
_lastPart = true;
return 0;
}
@@ -268,7 +268,7 @@ void MultipartReader::guessBoundary()
ch = _istr.peek();
}
if (ch == '\r' || ch == '\n')
ch = _istr.get();
_istr.get();
if (_istr.peek() == '\n')
_istr.get();
}
@@ -281,7 +281,7 @@ void MultipartReader::parseHeader(MessageHeader& messageHeader)
messageHeader.clear();
messageHeader.read(_istr);
int ch = _istr.get();
if (ch == '\r' && _istr.peek() == '\n') ch = _istr.get();
if (ch == '\r' && _istr.peek() == '\n') _istr.get();
}

View File

@@ -48,7 +48,7 @@ int QuotedPrintableDecoderBuf::readFromDevice()
ch = _buf.sbumpc();
if (ch == '\r')
{
ch = _buf.sbumpc(); // read \n
_buf.sbumpc(); // read \n
}
else if (Poco::Ascii::isHexDigit(ch))
{