diff --git a/Data/src/RecordSet.cpp b/Data/src/RecordSet.cpp index b630a3153..555fe2a03 100644 --- a/Data/src/RecordSet.cpp +++ b/Data/src/RecordSet.cpp @@ -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; diff --git a/Foundation/src/StreamCopier.cpp b/Foundation/src/StreamCopier.cpp index f0c4445b1..92f923ec6 100644 --- a/Foundation/src/StreamCopier.cpp +++ b/Foundation/src/StreamCopier.cpp @@ -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) diff --git a/Net/src/HTTPResponse.cpp b/Net/src/HTTPResponse.cpp index cf6a47b4f..8782d3cc8 100644 --- a/Net/src/HTTPResponse.cpp +++ b/Net/src/HTTPResponse.cpp @@ -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(); diff --git a/Net/src/MailMessage.cpp b/Net/src/MailMessage.cpp index 69a6d88c1..54ee3c104 100644 --- a/Net/src/MailMessage.cpp +++ b/Net/src/MailMessage.cpp @@ -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; } } diff --git a/Net/src/MultipartReader.cpp b/Net/src/MultipartReader.cpp index 1ee9a98e5..d167906d3 100644 --- a/Net/src/MultipartReader.cpp +++ b/Net/src/MultipartReader.cpp @@ -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(); } diff --git a/Net/src/QuotedPrintableDecoder.cpp b/Net/src/QuotedPrintableDecoder.cpp index 331d8b148..d664f63ae 100644 --- a/Net/src/QuotedPrintableDecoder.cpp +++ b/Net/src/QuotedPrintableDecoder.cpp @@ -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)) { diff --git a/NetSSL_OpenSSL/src/ConsoleCertificateHandler.cpp b/NetSSL_OpenSSL/src/ConsoleCertificateHandler.cpp index 40cf8ce8b..839ea13a9 100644 --- a/NetSSL_OpenSSL/src/ConsoleCertificateHandler.cpp +++ b/NetSSL_OpenSSL/src/ConsoleCertificateHandler.cpp @@ -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); diff --git a/PageCompiler/src/PageReader.cpp b/PageCompiler/src/PageReader.cpp index d435ca07f..02a08a110 100644 --- a/PageCompiler/src/PageReader.cpp +++ b/PageCompiler/src/PageReader.cpp @@ -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; }