From 9e010930cfcc6d05f9dc4c1ed45d3ada87f411d6 Mon Sep 17 00:00:00 2001 From: kmribti Date: Sat, 16 Jan 2016 10:00:36 +0100 Subject: [PATCH 01/71] Add mime RFC2047 decoder to MessageHeader Add RFC2047 word decode to MessageHeader class --- Net/src/MessageHeader.cpp | 129 +++++++++++++++++++++++++++++++++++++- 1 file changed, 128 insertions(+), 1 deletion(-) diff --git a/Net/src/MessageHeader.cpp b/Net/src/MessageHeader.cpp index 2a41d8e94..c3ad4877a 100644 --- a/Net/src/MessageHeader.cpp +++ b/Net/src/MessageHeader.cpp @@ -18,7 +18,12 @@ #include "Poco/Net/NetException.h" #include "Poco/String.h" #include "Poco/Ascii.h" +#include "Poco/TextConverter.h" +#include "Poco/StringTokenizer.h" +#include "Poco/Base64Decoder.h" +#include "Poco/UTF8Encoding.h" +#include namespace Poco { namespace Net { @@ -98,7 +103,7 @@ void MessageHeader::read(std::istream& istr) throw MessageException("Folded field value too long/no CRLF found"); } Poco::trimRightInPlace(value); - add(name, value); + add(name, decodeWord(value)); ++fields; } istr.putback(ch); @@ -253,5 +258,127 @@ void MessageHeader::quote(const std::string& value, std::string& result, bool al if (mustQuote) result += '"'; } +void MessageHeader::decodeRFC2047(const std::string& ins, std::string& outs, const std::string& charset_to) { + std::string tempout; + StringTokenizer tokens(ins, "?"); + + + std::string charset = toUpper(tokens[0]); + std::string encoding = toUpper(tokens[1]); + std::string text = tokens[2]; + + std::istringstream istr(text); + + if (encoding == "B") { + // Base64 encoding. + Base64Decoder decoder(istr); + for (char c; decoder.get(c); tempout += c) {} + } + else if (encoding == "Q") { + // Quoted encoding. + for (char c; istr.get(c);) { + if (c == '_') { + //RFC 2047 _ is a space. + tempout += " "; + continue; + } + + // FIXME: check that we have enought chars- + if (c == '=') { + // The next two chars are hex representation of the complete byte. + std::string hex; + for (int i = 0; i < 2; i++) { + istr.get(c); + hex += c; + } + hex = toUpper(hex); + tempout += (char)(int)strtol(hex.c_str(), 0, 16); + continue; + } + tempout += c; + } + } + else { + // Wrong encoding + outs = ins; + return; + } + + // convert to the right charset. + if (charset != charset_to) { + try { + TextEncoding& enc = TextEncoding::byName(charset); + TextEncoding& dec = TextEncoding::byName(charset_to); + TextConverter converter(enc, dec); + converter.convert(tempout, outs); + } + catch (...) { + // FIXME: Unsuported encoding... + outs = tempout; + } + } + else { + // Not conversion necesary. + outs = tempout; + } +} + + +std::string MessageHeader::decodeWord(const std::string& text, const std::string& charset) +{ + std::string outs, tmp = text; + do { + std::string tmp2; + // find the begining of the next rfc2047 chunk + auto pos = tmp.find("=?"); + if (pos == std::string::npos) { + // No more found, return + outs += tmp; + break; + } + + // check if there are standar text before the rfc2047 chunk, and if so, copy it. + if (pos > 0) { + outs += tmp.substr(0, pos - 1); + } + + // remove text already copied. + tmp = tmp.substr(pos + 2); + + // find the first separator + auto pos1 = tmp.find("?"); + if (pos1 == std::string::npos) { + // not found. + outs += tmp; + break; + } + + // find the second separator + auto pos2 = tmp.find("?", pos1 + 1); + if (pos2 == std::string::npos) { + // not found + outs += tmp; + break; + } + + // find the end of the actual rfc2047 chunk + auto pos3 = tmp.find("?=", pos2 + 1); + if (pos3 == std::string::npos) { + // not found. + outs += tmp; + break; + + } + // At this place, there are a valid rfc2047 chunk, so decode and copy the result. + decodeRFC2047(tmp.substr(0, pos3), tmp2, charset); + outs += tmp2; + + // Jump at the rest of the string and repeat the whole process. + tmp = tmp.substr(pos3 + 2); + } while (true); + + return outs; +} + } } // namespace Poco::Net From 37d5cf9d4660719b2e25bc6f304bc9a2e1b4fb19 Mon Sep 17 00:00:00 2001 From: kmribti Date: Sat, 16 Jan 2016 10:04:41 +0100 Subject: [PATCH 02/71] Update MessageHeader.h --- Net/include/Poco/Net/MessageHeader.h | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/Net/include/Poco/Net/MessageHeader.h b/Net/include/Poco/Net/MessageHeader.h index 964d0216d..3c402f19f 100644 --- a/Net/include/Poco/Net/MessageHeader.h +++ b/Net/include/Poco/Net/MessageHeader.h @@ -147,6 +147,11 @@ public: /// appended to result, enclosed in double-quotes. /// Otherwise, the value is appended to result as-is. + static void decodeRFC2047(const std::string& ins, std::string& outs, const std::string& charset = "UTF-8"); + static std::string decodeWord(const std::string& text, const std::string& charset = "UTF-8"); + /// Decode RFC2047 string. + + private: enum Limits /// Limits for basic sanity checks when reading a header From 25f2f9b66bc5cdb8ddc4f6df347a1bcdec0d0281 Mon Sep 17 00:00:00 2001 From: kmribti Date: Sat, 16 Jan 2016 10:46:06 +0100 Subject: [PATCH 03/71] Removed auto type as is not accepted -- --- Net/src/MessageHeader.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/Net/src/MessageHeader.cpp b/Net/src/MessageHeader.cpp index c3ad4877a..8c08654b1 100644 --- a/Net/src/MessageHeader.cpp +++ b/Net/src/MessageHeader.cpp @@ -346,7 +346,7 @@ std::string MessageHeader::decodeWord(const std::string& text, const std::string tmp = tmp.substr(pos + 2); // find the first separator - auto pos1 = tmp.find("?"); + int pos1 = tmp.find("?"); if (pos1 == std::string::npos) { // not found. outs += tmp; @@ -354,7 +354,7 @@ std::string MessageHeader::decodeWord(const std::string& text, const std::string } // find the second separator - auto pos2 = tmp.find("?", pos1 + 1); + int pos2 = tmp.find("?", pos1 + 1); if (pos2 == std::string::npos) { // not found outs += tmp; @@ -362,7 +362,7 @@ std::string MessageHeader::decodeWord(const std::string& text, const std::string } // find the end of the actual rfc2047 chunk - auto pos3 = tmp.find("?=", pos2 + 1); + int pos3 = tmp.find("?=", pos2 + 1); if (pos3 == std::string::npos) { // not found. outs += tmp; From fc2fd470ffa788dcc087eb4029450f128c51e133 Mon Sep 17 00:00:00 2001 From: kmribti Date: Sat, 16 Jan 2016 11:26:50 +0100 Subject: [PATCH 04/71] Removed a one more auto. --- Net/src/MessageHeader.cpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/Net/src/MessageHeader.cpp b/Net/src/MessageHeader.cpp index 8c08654b1..2030a4364 100644 --- a/Net/src/MessageHeader.cpp +++ b/Net/src/MessageHeader.cpp @@ -330,7 +330,7 @@ std::string MessageHeader::decodeWord(const std::string& text, const std::string do { std::string tmp2; // find the begining of the next rfc2047 chunk - auto pos = tmp.find("=?"); + size_t pos = tmp.find("=?"); if (pos == std::string::npos) { // No more found, return outs += tmp; @@ -346,7 +346,7 @@ std::string MessageHeader::decodeWord(const std::string& text, const std::string tmp = tmp.substr(pos + 2); // find the first separator - int pos1 = tmp.find("?"); + size_t pos1 = tmp.find("?"); if (pos1 == std::string::npos) { // not found. outs += tmp; @@ -354,7 +354,7 @@ std::string MessageHeader::decodeWord(const std::string& text, const std::string } // find the second separator - int pos2 = tmp.find("?", pos1 + 1); + size_t pos2 = tmp.find("?", pos1 + 1); if (pos2 == std::string::npos) { // not found outs += tmp; @@ -362,7 +362,7 @@ std::string MessageHeader::decodeWord(const std::string& text, const std::string } // find the end of the actual rfc2047 chunk - int pos3 = tmp.find("?=", pos2 + 1); + size_t pos3 = tmp.find("?=", pos2 + 1); if (pos3 == std::string::npos) { // not found. outs += tmp; From f94d20492af43e1f9e19b5982e4edba2a0db1d49 Mon Sep 17 00:00:00 2001 From: kmribti Date: Sat, 16 Jan 2016 22:54:30 +0100 Subject: [PATCH 05/71] Small fix on MessageHeader decodeWord. --- Net/src/MessageHeader.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Net/src/MessageHeader.cpp b/Net/src/MessageHeader.cpp index 2030a4364..6745192eb 100644 --- a/Net/src/MessageHeader.cpp +++ b/Net/src/MessageHeader.cpp @@ -339,7 +339,7 @@ std::string MessageHeader::decodeWord(const std::string& text, const std::string // check if there are standar text before the rfc2047 chunk, and if so, copy it. if (pos > 0) { - outs += tmp.substr(0, pos - 1); + outs += tmp.substr(0, pos); } // remove text already copied. From 8c98e4303c13d0936d83387f402bf8d35340dd26 Mon Sep 17 00:00:00 2001 From: kmribti Date: Sun, 17 Jan 2016 09:27:28 +0100 Subject: [PATCH 06/71] Add test case for MessageHeader decodeWord --- Net/testsuite/src/MessageHeaderTest.cpp | 20 +++++++++++++++++++- 1 file changed, 19 insertions(+), 1 deletion(-) diff --git a/Net/testsuite/src/MessageHeaderTest.cpp b/Net/testsuite/src/MessageHeaderTest.cpp index 793119f02..e94e7e8f4 100644 --- a/Net/testsuite/src/MessageHeaderTest.cpp +++ b/Net/testsuite/src/MessageHeaderTest.cpp @@ -362,6 +362,23 @@ void MessageHeaderTest::testFieldLimit() } +void MessageHeaderTest::testDecodeWord() +{ + std::string coded("this is pure ASCII"); + std::string decoded = MessageHeader::decodeWord(coded, "ISO-8859-1"); + assert(decoded == coded); + + coded = "(=?ISO-8859-1?Q?a?= =?ISO-8859-1?Q?b?=)"; + decoded = MessageHeader::decodeWord(coded, "ISO-8859-1"); + assert(decoded == "(a b)"); + + coded = "Hello =?UTF-8?B?RnJhbmNpcw==?=, good bye"; + decoded = MessageHeader::decodeWord(coded, "ISO-8859-1"); + assert(decoded == "Hello Francis, good bye"); +} + + + void MessageHeaderTest::setUp() { } @@ -392,6 +409,7 @@ CppUnit::Test* MessageHeaderTest::suite() CppUnit_addTest(pSuite, MessageHeaderTest, testSplitElements); CppUnit_addTest(pSuite, MessageHeaderTest, testSplitParameters); CppUnit_addTest(pSuite, MessageHeaderTest, testFieldLimit); - + CppUnit_addTest(pSuite, MessageHeaderTest, testDecodeWord); + return pSuite; } From cdb30f39f35b8516e01920179992231c88dbbb58 Mon Sep 17 00:00:00 2001 From: kmribti Date: Sun, 17 Jan 2016 09:28:15 +0100 Subject: [PATCH 07/71] Add test case for MessageHeader decodeWord --- Net/testsuite/src/MessageHeaderTest.h | 1 + 1 file changed, 1 insertion(+) diff --git a/Net/testsuite/src/MessageHeaderTest.h b/Net/testsuite/src/MessageHeaderTest.h index 156db25ed..759d55643 100644 --- a/Net/testsuite/src/MessageHeaderTest.h +++ b/Net/testsuite/src/MessageHeaderTest.h @@ -42,6 +42,7 @@ public: void testSplitElements(); void testSplitParameters(); void testFieldLimit(); + void testDecodeWord(); void setUp(); void tearDown(); From 6d1a4f20bae037467c0edf369154916a4043aab9 Mon Sep 17 00:00:00 2001 From: Miklos Vajna Date: Mon, 18 Jan 2016 22:52:27 +0100 Subject: [PATCH 08/71] GH #1050 Data: fix gcc -Wshadow warnings --- Data/include/Poco/Data/Binding.h | 80 ++++++++-------- Data/include/Poco/Data/BulkExtraction.h | 20 ++-- Data/include/Poco/Data/Column.h | 8 +- Data/include/Poco/Data/Extraction.h | 76 ++++++++-------- Data/include/Poco/Data/LOB.h | 12 +-- Data/include/Poco/Data/MetaColumn.h | 16 ++-- Data/include/Poco/Data/RecordSet.h | 28 +++--- Data/include/Poco/Data/RowFormatter.h | 8 +- Data/include/Poco/Data/SessionPool.h | 6 +- Data/include/Poco/Data/Statement.h | 12 +-- Data/src/AbstractBinding.cpp | 8 +- Data/src/AbstractExtraction.cpp | 4 +- Data/src/Bulk.cpp | 2 +- Data/src/Date.cpp | 32 +++---- Data/src/Limit.cpp | 6 +- Data/src/MetaColumn.cpp | 20 ++-- Data/src/PooledSessionHolder.cpp | 4 +- Data/src/Position.cpp | 2 +- Data/src/RecordSet.cpp | 106 +++++++++++----------- Data/src/RowFormatter.cpp | 8 +- Data/src/Session.cpp | 4 +- Data/src/SessionImpl.cpp | 8 +- Data/src/SessionPool.cpp | 26 +++--- Data/src/Statement.cpp | 20 ++-- Data/src/StatementImpl.cpp | 10 +- Data/src/Time.cpp | 30 +++--- Foundation/include/Poco/LinearHashTable.h | 24 ++--- 27 files changed, 290 insertions(+), 290 deletions(-) diff --git a/Data/include/Poco/Data/Binding.h b/Data/include/Poco/Data/Binding.h index 0b55b529b..c22396aff 100644 --- a/Data/include/Poco/Data/Binding.h +++ b/Data/include/Poco/Data/Binding.h @@ -59,9 +59,9 @@ public: typedef SharedPtr Ptr; explicit Binding(T& val, - const std::string& name = "", + const std::string& rName = "", Direction direction = PD_IN): - AbstractBinding(name, direction), + AbstractBinding(rName, direction), _val(val), _bound(false) /// Creates the Binding using the passed reference as bound value. @@ -129,9 +129,9 @@ public: typedef SharedPtr Ptr; explicit CopyBinding(T& val, - const std::string& name = "", + const std::string& rName = "", Direction direction = PD_IN): - AbstractBinding(name, direction), + AbstractBinding(rName, direction), _pVal(new T(val)), _bound(false) /// Creates the Binding using the passed reference as bound value. @@ -192,9 +192,9 @@ public: typedef SharedPtr Ptr; explicit Binding(const char* pVal, - const std::string& name = "", + const std::string& rName = "", Direction direction = PD_IN): - AbstractBinding(name, direction), + AbstractBinding(rName, direction), _val(pVal ? pVal : throw NullPointerException() ), _bound(false) /// Creates the Binding by copying the passed string. @@ -254,9 +254,9 @@ public: typedef SharedPtr Ptr; explicit CopyBinding(const char* pVal, - const std::string& name = "", + const std::string& rName = "", Direction direction = PD_IN): - AbstractBinding(name, direction), + AbstractBinding(rName, direction), _val(pVal ? pVal : throw NullPointerException() ), _bound(false) /// Creates the Binding by copying the passed string. @@ -315,9 +315,9 @@ public: typedef typename ValType::const_iterator Iterator; explicit Binding(std::vector& val, - const std::string& name = "", + const std::string& rName = "", Direction direction = PD_IN): - AbstractBinding(name, direction), + AbstractBinding(rName, direction), _val(val), _begin(), _end() @@ -382,9 +382,9 @@ public: typedef typename ValType::const_iterator Iterator; explicit CopyBinding(std::vector& val, - const std::string& name = "", + const std::string& rName = "", Direction direction = PD_IN): - AbstractBinding(name, direction), + AbstractBinding(rName, direction), _pVal(new std::vector(val)), _begin(), _end() @@ -459,9 +459,9 @@ public: typedef ValType::const_iterator Iterator; explicit Binding(const std::vector& val, - const std::string& name = "", + const std::string& rName = "", Direction direction = PD_IN): - AbstractBinding(name, direction), + AbstractBinding(rName, direction), _val(val), _deq(_val.begin(), _val.end()), _begin(), @@ -541,9 +541,9 @@ public: typedef ValType::const_iterator Iterator; explicit CopyBinding(const std::vector& val, - const std::string& name = "", + const std::string& rName = "", Direction direction = PD_IN): - AbstractBinding(name, direction), + AbstractBinding(rName, direction), _deq(val.begin(), val.end()), _begin(), _end() @@ -610,9 +610,9 @@ public: typedef typename ValType::const_iterator Iterator; explicit Binding(std::list& val, - const std::string& name = "", + const std::string& rName = "", Direction direction = PD_IN): - AbstractBinding(name, direction), + AbstractBinding(rName, direction), _val(val), _begin(), _end() @@ -675,9 +675,9 @@ public: typedef typename ValType::const_iterator Iterator; explicit CopyBinding(ValType& val, - const std::string& name = "", + const std::string& rName = "", Direction direction = PD_IN): - AbstractBinding(name, direction), + AbstractBinding(rName, direction), _pVal(new std::list(val)), _begin(), _end() @@ -740,9 +740,9 @@ public: typedef typename ValType::const_iterator Iterator; explicit Binding(std::deque& val, - const std::string& name = "", + const std::string& rName = "", Direction direction = PD_IN): - AbstractBinding(name, direction), + AbstractBinding(rName, direction), _val(val), _begin(), _end() @@ -805,9 +805,9 @@ public: typedef typename ValType::const_iterator Iterator; explicit CopyBinding(std::deque& val, - const std::string& name = "", + const std::string& rName = "", Direction direction = PD_IN): - AbstractBinding(name, direction), + AbstractBinding(rName, direction), _pVal(new std::deque(val)), _begin(), _end() @@ -870,9 +870,9 @@ public: typedef typename ValType::const_iterator Iterator; explicit Binding(std::set& val, - const std::string& name = "", + const std::string& rName = "", Direction direction = PD_IN): - AbstractBinding(name, direction), + AbstractBinding(rName, direction), _val(val), _begin(), _end() @@ -935,9 +935,9 @@ public: typedef typename ValType::const_iterator Iterator; explicit CopyBinding(std::set& val, - const std::string& name = "", + const std::string& rName = "", Direction direction = PD_IN): - AbstractBinding(name, direction), + AbstractBinding(rName, direction), _pVal(new std::set(val)), _begin(), _end() @@ -1000,9 +1000,9 @@ public: typedef typename ValType::const_iterator Iterator; explicit Binding(std::multiset& val, - const std::string& name = "", + const std::string& rName = "", Direction direction = PD_IN): - AbstractBinding(name, direction), + AbstractBinding(rName, direction), _val(val), _begin(), _end() @@ -1065,9 +1065,9 @@ public: typedef typename ValType::const_iterator Iterator; explicit CopyBinding(std::multiset& val, - const std::string& name = "", + const std::string& rName = "", Direction direction = PD_IN): - AbstractBinding(name, direction), + AbstractBinding(rName, direction), _pVal(new std::multiset(val)), _begin(), _end() @@ -1130,9 +1130,9 @@ public: typedef typename ValType::const_iterator Iterator; explicit Binding(std::map& val, - const std::string& name = "", + const std::string& rName = "", Direction direction = PD_IN): - AbstractBinding(name, direction), + AbstractBinding(rName, direction), _val(val), _begin(), _end() @@ -1195,9 +1195,9 @@ public: typedef typename ValType::const_iterator Iterator; explicit CopyBinding(std::map& val, - const std::string& name = "", + const std::string& rName = "", Direction direction = PD_IN): - AbstractBinding(name, direction), + AbstractBinding(rName, direction), _pVal(new std::map(val)), _begin(), _end() @@ -1260,9 +1260,9 @@ public: typedef typename ValType::const_iterator Iterator; explicit Binding(std::multimap& val, - const std::string& name = "", + const std::string& rName = "", Direction direction = PD_IN): - AbstractBinding(name, direction), + AbstractBinding(rName, direction), _val(val), _begin(), _end() @@ -1325,9 +1325,9 @@ public: typedef typename ValType::const_iterator Iterator; explicit CopyBinding(std::multimap& val, - const std::string& name = "", + const std::string& rName = "", Direction direction = PD_IN): - AbstractBinding(name, direction), + AbstractBinding(rName, direction), _pVal(new std::multimap(val)), _begin(), _end() diff --git a/Data/include/Poco/Data/BulkExtraction.h b/Data/include/Poco/Data/BulkExtraction.h index 683a9f733..2a76110ef 100644 --- a/Data/include/Poco/Data/BulkExtraction.h +++ b/Data/include/Poco/Data/BulkExtraction.h @@ -46,22 +46,22 @@ public: typedef BulkExtraction Type; typedef SharedPtr Ptr; - BulkExtraction(C& result, Poco::UInt32 limit, const Position& pos = Position(0)): + BulkExtraction(C& rResult, Poco::UInt32 limit, const Position& pos = Position(0)): AbstractExtraction(limit, pos.value(), true), - _rResult(result), + _rResult(rResult), _default() { - if (static_cast(result.size()) != limit) - result.resize(limit); + if (static_cast(rResult.size()) != limit) + rResult.resize(limit); } - BulkExtraction(C& result, const CValType& def, Poco::UInt32 limit, const Position& pos = Position(0)): + BulkExtraction(C& rResult, const CValType& def, Poco::UInt32 limit, const Position& pos = Position(0)): AbstractExtraction(limit, pos.value(), true), - _rResult(result), + _rResult(rResult), _default(def) { - if (static_cast(result.size()) != limit) - result.resize(limit); + if (static_cast(rResult.size()) != limit) + rResult.resize(limit); } virtual ~BulkExtraction() @@ -153,11 +153,11 @@ public: typedef InternalBulkExtraction Type; typedef SharedPtr Ptr; - InternalBulkExtraction(C& result, + InternalBulkExtraction(C& rResult, Column* pColumn, Poco::UInt32 limit, const Position& pos = Position(0)): - BulkExtraction(result, CValType(), limit, pos), + BulkExtraction(rResult, CValType(), limit, pos), _pColumn(pColumn) /// Creates InternalBulkExtraction. { diff --git a/Data/include/Poco/Data/Column.h b/Data/include/Poco/Data/Column.h index fb2a9d80b..3c100a14d 100644 --- a/Data/include/Poco/Data/Column.h +++ b/Data/include/Poco/Data/Column.h @@ -393,16 +393,16 @@ public: if (row <= (std::size_t) (_pData->size() / 2)) { Iterator it = _pData->begin(); - Iterator end = _pData->end(); - for (int i = 0; it != end; ++it, ++i) + Iterator itEnd = _pData->end(); + for (int i = 0; it != itEnd; ++it, ++i) if (i == row) return *it; } else { row = _pData->size() - row; RIterator it = _pData->rbegin(); - RIterator end = _pData->rend(); - for (int i = 1; it != end; ++it, ++i) + RIterator itEnd = _pData->rend(); + for (int i = 1; it != itEnd; ++it, ++i) if (i == row) return *it; } diff --git a/Data/include/Poco/Data/Extraction.h b/Data/include/Poco/Data/Extraction.h index 577546a93..42dbd6c16 100644 --- a/Data/include/Poco/Data/Extraction.h +++ b/Data/include/Poco/Data/Extraction.h @@ -49,9 +49,9 @@ public: typedef Extraction Type; typedef SharedPtr Ptr; - Extraction(T& result, const Position& pos = Position(0)): + Extraction(T& rResult, const Position& pos = Position(0)): AbstractExtraction(Limit::LIMIT_UNLIMITED, pos.value()), - _rResult(result), + _rResult(rResult), _default(), _extracted(false) /// Creates an Extraction object at specified position. @@ -59,9 +59,9 @@ public: { } - Extraction(T& result, const T& def, const Position& pos = Position(0)): + Extraction(T& rResult, const T& def, const Position& pos = Position(0)): AbstractExtraction(Limit::LIMIT_UNLIMITED, pos.value()), - _rResult(result), + _rResult(rResult), _default(def), _extracted(false) /// Creates an Extraction object at specified position. @@ -139,18 +139,18 @@ public: typedef Extraction Type; typedef SharedPtr Ptr; - Extraction(std::vector& result, const Position& pos = Position(0)): + Extraction(std::vector& rResult, const Position& pos = Position(0)): AbstractExtraction(Limit::LIMIT_UNLIMITED, pos.value()), - _rResult(result), + _rResult(rResult), _default() { _rResult.clear(); } - Extraction(std::vector& result, const T& def, const Position& pos = Position(0)): + Extraction(std::vector& rResult, const T& def, const Position& pos = Position(0)): AbstractExtraction(Limit::LIMIT_UNLIMITED, pos.value()), - _rResult(result), + _rResult(rResult), _default(def) { _rResult.clear(); @@ -230,17 +230,17 @@ public: typedef Extraction Type; typedef SharedPtr Ptr; - Extraction(std::vector& result, const Position& pos = Position(0)): + Extraction(std::vector& rResult, const Position& pos = Position(0)): AbstractExtraction(Limit::LIMIT_UNLIMITED, pos.value()), - _rResult(result), + _rResult(rResult), _default() { _rResult.clear(); } - Extraction(std::vector& result, const bool& def, const Position& pos = Position(0)): + Extraction(std::vector& rResult, const bool& def, const Position& pos = Position(0)): AbstractExtraction(Limit::LIMIT_UNLIMITED, pos.value()), - _rResult(result), + _rResult(rResult), _default(def) { _rResult.clear(); @@ -322,17 +322,17 @@ public: typedef Extraction Type; typedef SharedPtr Ptr; - Extraction(std::list& result, const Position& pos = Position(0)): + Extraction(std::list& rResult, const Position& pos = Position(0)): AbstractExtraction(Limit::LIMIT_UNLIMITED, pos.value()), - _rResult(result), + _rResult(rResult), _default() { _rResult.clear(); } - Extraction(std::list& result, const T& def, const Position& pos = Position(0)): + Extraction(std::list& rResult, const T& def, const Position& pos = Position(0)): AbstractExtraction(Limit::LIMIT_UNLIMITED, pos.value()), - _rResult(result), + _rResult(rResult), _default(def) { _rResult.clear(); @@ -412,17 +412,17 @@ public: typedef Extraction Type; typedef SharedPtr Ptr; - Extraction(std::deque& result, const Position& pos = Position(0)): + Extraction(std::deque& rResult, const Position& pos = Position(0)): AbstractExtraction(Limit::LIMIT_UNLIMITED, pos.value()), - _rResult(result), + _rResult(rResult), _default() { _rResult.clear(); } - Extraction(std::deque& result, const T& def, const Position& pos = Position(0)): + Extraction(std::deque& rResult, const T& def, const Position& pos = Position(0)): AbstractExtraction(Limit::LIMIT_UNLIMITED, pos.value()), - _rResult(result), + _rResult(rResult), _default(def) { _rResult.clear(); @@ -511,8 +511,8 @@ public: typedef SharedPtr Ptr; - InternalExtraction(C& result, Column* pColumn, const Position& pos = Position(0)): - Extraction(result, ValType(), pos), + InternalExtraction(C& rResult, Column* pColumn, const Position& pos = Position(0)): + Extraction(rResult, ValType(), pos), _pColumn(pColumn) /// Creates InternalExtraction. { @@ -572,17 +572,17 @@ public: typedef SharedPtr Ptr; typedef typename ValType::iterator Iterator; - Extraction(std::set& result, const Position& pos = Position(0)): + Extraction(std::set& rResult, const Position& pos = Position(0)): AbstractExtraction(Limit::LIMIT_UNLIMITED, pos.value()), - _rResult(result), + _rResult(rResult), _default() { _rResult.clear(); } - Extraction(std::set& result, const T& def, const Position& pos = Position(0)): + Extraction(std::set& rResult, const T& def, const Position& pos = Position(0)): AbstractExtraction(Limit::LIMIT_UNLIMITED, pos.value()), - _rResult(result), + _rResult(rResult), _default(def) { _rResult.clear(); @@ -636,17 +636,17 @@ public: typedef Extraction Type; typedef SharedPtr Ptr; - Extraction(std::multiset& result, const Position& pos = Position(0)): + Extraction(std::multiset& rResult, const Position& pos = Position(0)): AbstractExtraction(Limit::LIMIT_UNLIMITED, pos.value()), - _rResult(result), + _rResult(rResult), _default() { _rResult.clear(); } - Extraction(std::multiset& result, const T& def, const Position& pos = Position(0)): + Extraction(std::multiset& rResult, const T& def, const Position& pos = Position(0)): AbstractExtraction(Limit::LIMIT_UNLIMITED, pos.value()), - _rResult(result), + _rResult(rResult), _default(def) { _rResult.clear(); @@ -700,17 +700,17 @@ public: typedef Extraction Type; typedef SharedPtr Ptr; - Extraction(std::map& result, const Position& pos = Position(0)): + Extraction(std::map& rResult, const Position& pos = Position(0)): AbstractExtraction(Limit::LIMIT_UNLIMITED, pos.value()), - _rResult(result), + _rResult(rResult), _default() { _rResult.clear(); } - Extraction(std::map& result, const V& def, const Position& pos = Position(0)): + Extraction(std::map& rResult, const V& def, const Position& pos = Position(0)): AbstractExtraction(Limit::LIMIT_UNLIMITED, pos.value()), - _rResult(result), + _rResult(rResult), _default(def) { _rResult.clear(); @@ -764,17 +764,17 @@ public: typedef Extraction Type; typedef SharedPtr Ptr; - Extraction(std::multimap& result, const Position& pos = Position(0)): + Extraction(std::multimap& rResult, const Position& pos = Position(0)): AbstractExtraction(Limit::LIMIT_UNLIMITED, pos.value()), - _rResult(result), + _rResult(rResult), _default() { _rResult.clear(); } - Extraction(std::multimap& result, const V& def, const Position& pos = Position(0)): + Extraction(std::multimap& rResult, const V& def, const Position& pos = Position(0)): AbstractExtraction(Limit::LIMIT_UNLIMITED, pos.value()), - _rResult(result), + _rResult(rResult), _default(def) { _rResult.clear(); diff --git a/Data/include/Poco/Data/LOB.h b/Data/include/Poco/Data/LOB.h index 94f1bfcbb..7b1490d10 100644 --- a/Data/include/Poco/Data/LOB.h +++ b/Data/include/Poco/Data/LOB.h @@ -53,20 +53,20 @@ public: { } - LOB(const std::vector& content): - _pContent(new std::vector(content)) + LOB(const std::vector& rContent): + _pContent(new std::vector(rContent)) /// Creates the LOB, content is deep-copied. { } - LOB(const T* const pContent, std::size_t size): - _pContent(new std::vector(pContent, pContent + size)) + LOB(const T* const pContent, std::size_t objectSize): + _pContent(new std::vector(pContent, pContent + objectSize)) /// Creates the LOB by deep-copying pContent. { } - LOB(const std::basic_string& content): - _pContent(new std::vector(content.begin(), content.end())) + LOB(const std::basic_string& rContent): + _pContent(new std::vector(rContent.begin(), rContent.end())) /// Creates a LOB from a string. { } diff --git a/Data/include/Poco/Data/MetaColumn.h b/Data/include/Poco/Data/MetaColumn.h index 40e957615..40285d337 100644 --- a/Data/include/Poco/Data/MetaColumn.h +++ b/Data/include/Poco/Data/MetaColumn.h @@ -154,27 +154,27 @@ inline bool MetaColumn::isNullable() const } -inline void MetaColumn::setName(const std::string& name) +inline void MetaColumn::setName(const std::string& rName) { - _name = name; + _name = rName; } -inline void MetaColumn::setLength(std::size_t length) +inline void MetaColumn::setLength(std::size_t columnLength) { - _length = length; + _length = columnLength; } -inline void MetaColumn::setPrecision(std::size_t precision) +inline void MetaColumn::setPrecision(std::size_t columnPrecision) { - _precision = precision; + _precision = columnPrecision; } -inline void MetaColumn::setType(ColumnDataType type) +inline void MetaColumn::setType(ColumnDataType columnType) { - _type = type; + _type = columnType; } diff --git a/Data/include/Poco/Data/RecordSet.h b/Data/include/Poco/Data/RecordSet.h index 0647d4f1b..9bc9f3c33 100644 --- a/Data/include/Poco/Data/RecordSet.h +++ b/Data/include/Poco/Data/RecordSet.h @@ -191,10 +191,10 @@ public: /// Rows are lazy-created and cached. template - const T& value(std::size_t col, std::size_t row, bool useFilter = true) const + const T& value(std::size_t col, std::size_t dataRow, bool useFilter = true) const /// Returns the reference to data value at [col, row] location. { - if (useFilter && isFiltered() && !isAllowed(row)) + if (useFilter && isFiltered() && !isAllowed(dataRow)) throw InvalidAccessException("Row not allowed"); switch (storage()) @@ -202,18 +202,18 @@ public: case STORAGE_VECTOR: { typedef typename std::vector C; - return column(col).value(row); + return column(col).value(dataRow); } case STORAGE_LIST: { typedef typename std::list C; - return column(col).value(row); + return column(col).value(dataRow); } case STORAGE_DEQUE: case STORAGE_UNKNOWN: { typedef typename std::deque C; - return column(col).value(row); + return column(col).value(dataRow); } default: throw IllegalStateException("Invalid storage setting."); @@ -221,10 +221,10 @@ public: } template - const T& value(const std::string& name, std::size_t row, bool useFilter = true) const + const T& value(const std::string& name, std::size_t dataRow, bool useFilter = true) const /// Returns the reference to data value at named column, row location. { - if (useFilter && isFiltered() && !isAllowed(row)) + if (useFilter && isFiltered() && !isAllowed(dataRow)) throw InvalidAccessException("Row not allowed"); switch (storage()) @@ -232,18 +232,18 @@ public: case STORAGE_VECTOR: { typedef typename std::vector C; - return column(name).value(row); + return column(name).value(dataRow); } case STORAGE_LIST: { typedef typename std::list C; - return column(name).value(row); + return column(name).value(dataRow); } case STORAGE_DEQUE: case STORAGE_UNKNOWN: { typedef typename std::deque C; - return column(name).value(row); + return column(name).value(dataRow); } default: throw IllegalStateException("Invalid storage setting."); @@ -402,9 +402,9 @@ private: const AbstractExtractionVec& rExtractions = extractions(); AbstractExtractionVec::const_iterator it = rExtractions.begin(); - AbstractExtractionVec::const_iterator end = rExtractions.end(); + AbstractExtractionVec::const_iterator itEnd = rExtractions.end(); - for (; it != end; ++it) + for (; it != itEnd; ++it) { ExtractionVecPtr pExtraction = dynamic_cast(it->get()); @@ -505,9 +505,9 @@ inline std::size_t RecordSet::totalRowCount() const } -inline void RecordSet::setTotalRowCount(std::size_t totalRowCount) +inline void RecordSet::setTotalRowCount(std::size_t count) { - _totalRowCount = totalRowCount; + _totalRowCount = count; } diff --git a/Data/include/Poco/Data/RowFormatter.h b/Data/include/Poco/Data/RowFormatter.h index e283a6ec2..5bafbf84d 100644 --- a/Data/include/Poco/Data/RowFormatter.h +++ b/Data/include/Poco/Data/RowFormatter.h @@ -184,15 +184,15 @@ inline void RowFormatter::setTotalRowCount(int count) } -inline void RowFormatter::setPrefix(const std::string& prefix) +inline void RowFormatter::setPrefix(const std::string& rPrefix) { - _prefix = prefix; + _prefix = rPrefix; } -inline void RowFormatter::setPostfix(const std::string& postfix) +inline void RowFormatter::setPostfix(const std::string& rPostfix) { - _postfix = postfix; + _postfix = rPostfix; } diff --git a/Data/include/Poco/Data/SessionPool.h b/Data/include/Poco/Data/SessionPool.h index 66e402e02..6ffce7ee6 100644 --- a/Data/include/Poco/Data/SessionPool.h +++ b/Data/include/Poco/Data/SessionPool.h @@ -96,7 +96,7 @@ public: /// is thrown. template - Session get(const std::string& name, const T& value) + Session get(const std::string& rName, const T& value) /// Returns a Session with requested property set. /// The property can be different from the default pool /// value, in which case it is reset back to the pool @@ -104,8 +104,8 @@ public: { Session s = get(); _addPropertyMap.insert(AddPropertyMap::value_type(s.impl(), - std::make_pair(name, s.getProperty(name)))); - s.setProperty(name, value); + std::make_pair(rName, s.getProperty(rName)))); + s.setProperty(rName, value); return s; } diff --git a/Data/include/Poco/Data/Statement.h b/Data/include/Poco/Data/Statement.h index 7e8c182b7..17cb974e2 100644 --- a/Data/include/Poco/Data/Statement.h +++ b/Data/include/Poco/Data/Statement.h @@ -147,10 +147,10 @@ public: /// Registers the Binding vector with the Statement. template - Statement& addBinding(C& bindingCont, bool reset) + Statement& addBinding(C& bindingCont, bool doReset) /// Registers binding container with the Statement. { - if (reset) _pImpl->resetBinding(); + if (doReset) _pImpl->resetBinding(); typename C::iterator itAB = bindingCont.begin(); typename C::iterator itABEnd = bindingCont.end(); for (; itAB != itABEnd; ++itAB) addBind(*itAB); @@ -169,10 +169,10 @@ public: /// Registers the vector of extraction vectors with the Statement. template - Statement& addExtraction(C& val, bool reset) + Statement& addExtraction(C& val, bool doReset) /// Registers extraction container with the Statement. { - if (reset) _pImpl->resetExtraction(); + if (doReset) _pImpl->resetExtraction(); typename C::iterator itAE = val.begin(); typename C::iterator itAEEnd = val.end(); for (; itAE != itAEEnd; ++itAE) addExtract(*itAE); @@ -680,9 +680,9 @@ inline const MetaColumn& Statement::metaColumn(const std::string& name) const } -inline void Statement::setStorage(const std::string& storage) +inline void Statement::setStorage(const std::string& rStorage) { - _pImpl->setStorage(storage); + _pImpl->setStorage(rStorage); } diff --git a/Data/src/AbstractBinding.cpp b/Data/src/AbstractBinding.cpp index fae8ed3a5..a05cbf6be 100644 --- a/Data/src/AbstractBinding.cpp +++ b/Data/src/AbstractBinding.cpp @@ -21,13 +21,13 @@ namespace Poco { namespace Data { -AbstractBinding::AbstractBinding(const std::string& name, +AbstractBinding::AbstractBinding(const std::string& rName, Direction direction, - Poco::UInt32 bulkSize): + Poco::UInt32 bindingBulkSize): _pBinder(0), - _name(name), + _name(rName), _direction(direction), - _bulkSize(bulkSize) + _bulkSize(bindingBulkSize) { } diff --git a/Data/src/AbstractExtraction.cpp b/Data/src/AbstractExtraction.cpp index 51bb687a7..a9bf42aff 100644 --- a/Data/src/AbstractExtraction.cpp +++ b/Data/src/AbstractExtraction.cpp @@ -22,11 +22,11 @@ namespace Data { AbstractExtraction::AbstractExtraction(Poco::UInt32 limit, - Poco::UInt32 position, + Poco::UInt32 extractionPosition, bool bulk): _pExtractor(0), _limit(limit), - _position(position), + _position(extractionPosition), _bulk(bulk), _emptyStringIsNull(false), _forceEmptyString(false) diff --git a/Data/src/Bulk.cpp b/Data/src/Bulk.cpp index e4a0b7be7..29cd95a21 100644 --- a/Data/src/Bulk.cpp +++ b/Data/src/Bulk.cpp @@ -21,7 +21,7 @@ namespace Poco { namespace Data { -Bulk::Bulk(const Limit& limit): _limit(limit.value(), false, false) +Bulk::Bulk(const Limit& rLimit): _limit(rLimit.value(), false, false) { } diff --git a/Data/src/Date.cpp b/Data/src/Date.cpp index c1d52b55f..40aac934b 100644 --- a/Data/src/Date.cpp +++ b/Data/src/Date.cpp @@ -37,9 +37,9 @@ Date::Date() } -Date::Date(int year, int month, int day) +Date::Date(int dateYear, int dateMonth, int dateDay) { - assign(year, month, day); + assign(dateYear, dateMonth, dateDay); } @@ -54,36 +54,36 @@ Date::~Date() } -void Date::assign(int year, int month, int day) +void Date::assign(int dateYear, int dateMonth, int dateDay) { - if (year < 0 || year > 9999) + if (dateYear < 0 || dateYear > 9999) throw InvalidArgumentException("Year must be between 0 and 9999"); - if (month < 1 || month > 12) + if (dateMonth < 1 || dateMonth > 12) throw InvalidArgumentException("Month must be between 1 and 12"); - if (day < 1 || day > DateTime::daysOfMonth(year, month)) + if (dateDay < 1 || dateDay > DateTime::daysOfMonth(dateYear, dateMonth)) throw InvalidArgumentException("Month must be between 1 and " + - NumberFormatter::format(DateTime::daysOfMonth(year, month))); + NumberFormatter::format(DateTime::daysOfMonth(dateYear, dateMonth))); - _year = year; - _month = month; - _day = day; + _year = dateYear; + _month = dateMonth; + _day = dateDay; } bool Date::operator < (const Date& date) const { - int year = date.year(); + int dateYear = date.year(); - if (_year < year) return true; - else if (_year > year) return false; + if (_year < dateYear) return true; + else if (_year > dateYear) return false; else // years equal { - int month = date.month(); - if (_month < month) return true; + int dateMonth = date.month(); + if (_month < dateMonth) return true; else - if (_month > month) return false; + if (_month > dateMonth) return false; else // months equal if (_day < date.day()) return true; } diff --git a/Data/src/Limit.cpp b/Data/src/Limit.cpp index 28961c22a..0f4785d30 100644 --- a/Data/src/Limit.cpp +++ b/Data/src/Limit.cpp @@ -21,10 +21,10 @@ namespace Poco { namespace Data { -Limit::Limit(SizeT value, bool hardLimit, bool isLowerLimit) : - _value(value), +Limit::Limit(SizeT limitValue, bool hardLimit, bool lowerLimit) : + _value(limitValue), _hardLimit(hardLimit), - _isLowerLimit(isLowerLimit) + _isLowerLimit(lowerLimit) { } diff --git a/Data/src/MetaColumn.cpp b/Data/src/MetaColumn.cpp index d1d9cd4ac..c743665a7 100644 --- a/Data/src/MetaColumn.cpp +++ b/Data/src/MetaColumn.cpp @@ -26,17 +26,17 @@ MetaColumn::MetaColumn() } -MetaColumn::MetaColumn(std::size_t position, - const std::string& name, - ColumnDataType type, - std::size_t length, - std::size_t precision, +MetaColumn::MetaColumn(std::size_t columnPosition, + const std::string& rName, + ColumnDataType columnType, + std::size_t columnLength, + std::size_t columnPrecision, bool nullable): - _name(name), - _length(length), - _precision(precision), - _position(position), - _type(type), + _name(rName), + _length(columnLength), + _precision(columnPrecision), + _position(columnPosition), + _type(columnType), _nullable(nullable) { } diff --git a/Data/src/PooledSessionHolder.cpp b/Data/src/PooledSessionHolder.cpp index 4fdc1d1c4..998374aca 100644 --- a/Data/src/PooledSessionHolder.cpp +++ b/Data/src/PooledSessionHolder.cpp @@ -21,8 +21,8 @@ namespace Poco { namespace Data { -PooledSessionHolder::PooledSessionHolder(SessionPool& owner, SessionImpl* pSessionImpl): - _owner(owner), +PooledSessionHolder::PooledSessionHolder(SessionPool& rOwner, SessionImpl* pSessionImpl): + _owner(rOwner), _pImpl(pSessionImpl, true) { } diff --git a/Data/src/Position.cpp b/Data/src/Position.cpp index 53ea1b0a6..afd3495b3 100644 --- a/Data/src/Position.cpp +++ b/Data/src/Position.cpp @@ -21,7 +21,7 @@ namespace Poco { namespace Data { -Position::Position(Poco::UInt32 value): _value(value) +Position::Position(Poco::UInt32 positionValue): _value(positionValue) { } diff --git a/Data/src/RecordSet.cpp b/Data/src/RecordSet.cpp index 503595698..654cbd621 100644 --- a/Data/src/RecordSet.cpp +++ b/Data/src/RecordSet.cpp @@ -82,8 +82,8 @@ RecordSet::~RecordSet() if(_pFilter) _pFilter->release(); RowMap::iterator it = _rowMap.begin(); - RowMap::iterator end = _rowMap.end(); - for (; it != end; ++it) delete it->second; + RowMap::iterator itEnd = _rowMap.end(); + for (; it != itEnd; ++it) delete it->second; } catch (...) { @@ -92,65 +92,65 @@ RecordSet::~RecordSet() } -Poco::Dynamic::Var RecordSet::value(std::size_t col, std::size_t row, bool useFilter) const +Poco::Dynamic::Var RecordSet::value(std::size_t col, std::size_t dataRow, bool useFilter) const { - if (useFilter && isFiltered() && !isAllowed(row)) + if (useFilter && isFiltered() && !isAllowed(dataRow)) throw InvalidAccessException("Row not allowed"); - if (isNull(col, row)) return Poco::Dynamic::Var(); + if (isNull(col, dataRow)) return Poco::Dynamic::Var(); switch (columnType(col)) { - case MetaColumn::FDT_BOOL: return value(col, row, useFilter); - case MetaColumn::FDT_INT8: return value(col, row, useFilter); - case MetaColumn::FDT_UINT8: return value(col, row, useFilter); - case MetaColumn::FDT_INT16: return value(col, row, useFilter); - case MetaColumn::FDT_UINT16: return value(col, row, useFilter); - case MetaColumn::FDT_INT32: return value(col, row, useFilter); - case MetaColumn::FDT_UINT32: return value(col, row, useFilter); - case MetaColumn::FDT_INT64: return value(col, row, useFilter); - case MetaColumn::FDT_UINT64: return value(col, row, useFilter); - case MetaColumn::FDT_FLOAT: return value(col, row, useFilter); - case MetaColumn::FDT_DOUBLE: return value(col, row, useFilter); - case MetaColumn::FDT_STRING: return value(col, row, useFilter); - case MetaColumn::FDT_WSTRING: return value(col, row, useFilter); - case MetaColumn::FDT_BLOB: return value(col, row, useFilter); - case MetaColumn::FDT_CLOB: return value(col, row, useFilter); - case MetaColumn::FDT_DATE: return value(col, row, useFilter); - case MetaColumn::FDT_TIME: return value