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

@ -256,8 +256,7 @@ bool RecordSet::moveFirst()
return true;
}
std::size_t currentRow = _currentRow;
currentRow = 0;
std::size_t currentRow = 0;
while (!isAllowed(currentRow))
{
if (currentRow >= rc - 1) return false;
@ -303,8 +302,7 @@ bool RecordSet::moveLast()
{
if (storageRowCount() > 0)
{
std::size_t currentRow = _currentRow;
currentRow = storageRowCount() - 1;
std::size_t currentRow = subTotalRowCount() - 1;
if (!isFiltered())
{
_currentRow = currentRow;

View File

@ -119,7 +119,7 @@ Poco::UInt64 StreamCopier::copyToString64(std::istream& istr, std::string& str,
std::streamsize StreamCopier::copyStreamUnbuffered(std::istream& istr, std::ostream& ostr)
{
char c;
char c = 0;
std::streamsize len = 0;
istr.get(c);
while (istr && ostr)
@ -135,7 +135,7 @@ std::streamsize StreamCopier::copyStreamUnbuffered(std::istream& istr, std::ostr
#if defined(POCO_HAVE_INT64)
Poco::UInt64 StreamCopier::copyStreamUnbuffered64(std::istream& istr, std::ostream& ostr)
{
char c;
char c = 0;
Poco::UInt64 len = 0;
istr.get(c);
while (istr && ostr)

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))
{

View File

@ -43,7 +43,7 @@ void ConsoleCertificateHandler::onInvalidCertificate(const void*, VerificationEr
std::cout << "The certificate yielded the error: " << errorCert.errorMessage() << "\n\n";
std::cout << "The error occurred in the certificate chain at position " << errorCert.errorDepth() << "\n";
std::cout << "Accept the certificate (y,n)? ";
char c;
char c = 0;
std::cin >> c;
if (c == 'y' || c == 'Y')
errorCert.setIgnoreError(true);

View File

@ -267,7 +267,7 @@ void PageReader::nextToken(std::istream& istr, std::string& token)
if (ch == '<' && istr.peek() == '%')
{
token += "<%";
ch = istr.get();
istr.get();
ch = istr.peek();
switch (ch)
{
@ -300,7 +300,7 @@ void PageReader::nextToken(std::istream& istr, std::string& token)
else if (ch == '%' && istr.peek() == '>')
{
token += "%>";
ch = istr.get();
istr.get();
}
else token += (char) ch;
}