From 2feb15eb19be36267b593530b8f98cca9d1602c3 Mon Sep 17 00:00:00 2001 From: Alex Fabijanic Date: Sun, 29 Mar 2015 10:20:12 -0500 Subject: [PATCH 1/4] Unable to build static with NetSSL_OpenSSL for OS X #763 --- NetSSL_OpenSSL/samples/Mail/Makefile | 2 +- NetSSL_OpenSSL/samples/TwitterClient/Makefile | 9 ++++++++- NetSSL_OpenSSL/samples/download/Makefile | 2 +- NetSSL_OpenSSL/testsuite/Makefile | 2 +- 4 files changed, 11 insertions(+), 4 deletions(-) diff --git a/NetSSL_OpenSSL/samples/Mail/Makefile b/NetSSL_OpenSSL/samples/Mail/Makefile index 1ded0e760..8ca4344ed 100644 --- a/NetSSL_OpenSSL/samples/Mail/Makefile +++ b/NetSSL_OpenSSL/samples/Mail/Makefile @@ -19,6 +19,6 @@ objects = Mail target = Mail target_version = 1 -target_libs = PocoNetSSL PocoNet PocoCrypto PocoUtil PocoXML PocoFoundation +target_libs = PocoNetSSL PocoNet PocoCrypto PocoUtil PocoJSON PocoXML PocoFoundation include $(POCO_BASE)/build/rules/exec diff --git a/NetSSL_OpenSSL/samples/TwitterClient/Makefile b/NetSSL_OpenSSL/samples/TwitterClient/Makefile index 7983a95b3..3b49cbd13 100644 --- a/NetSSL_OpenSSL/samples/TwitterClient/Makefile +++ b/NetSSL_OpenSSL/samples/TwitterClient/Makefile @@ -8,11 +8,18 @@ include $(POCO_BASE)/build/rules/global +# Note: linking order is important, do not change it. +ifeq ($(POCO_CONFIG),FreeBSD) +SYSLIBS += -lssl -lcrypto -lz +else +SYSLIBS += -lssl -lcrypto -lz -ldl +endif + objects = Twitter TweetApp target = tweet target_version = 1 -target_libs = PocoUtil PocoJSON PocoNetSSL PocoCrypto PocoNet PocoXML PocoFoundation +target_libs = PocoNetSSL PocoCrypto PocoNet PocoUtil PocoJSON PocoXML PocoFoundation include $(POCO_BASE)/build/rules/exec diff --git a/NetSSL_OpenSSL/samples/download/Makefile b/NetSSL_OpenSSL/samples/download/Makefile index 49b0ec507..8f18aef9a 100644 --- a/NetSSL_OpenSSL/samples/download/Makefile +++ b/NetSSL_OpenSSL/samples/download/Makefile @@ -19,6 +19,6 @@ objects = download target = download target_version = 1 -target_libs = PocoNetSSL PocoCrypto PocoNet PocoUtil PocoXML PocoFoundation +target_libs = PocoNetSSL PocoCrypto PocoNet PocoUtil PocoJSON PocoXML PocoFoundation include $(POCO_BASE)/build/rules/exec diff --git a/NetSSL_OpenSSL/testsuite/Makefile b/NetSSL_OpenSSL/testsuite/Makefile index 496d15aae..7c425aec0 100644 --- a/NetSSL_OpenSSL/testsuite/Makefile +++ b/NetSSL_OpenSSL/testsuite/Makefile @@ -21,6 +21,6 @@ objects = NetSSLTestSuite Driver \ target = testrunner target_version = 1 -target_libs = PocoNetSSL PocoNet PocoCrypto PocoUtil PocoXML PocoFoundation CppUnit +target_libs = PocoNetSSL PocoNet PocoCrypto PocoUtil PocoJSON PocoXML PocoFoundation CppUnit include $(POCO_BASE)/build/rules/exec From fea66f4dbc86b881b4b7c567317b54ac461c4acc Mon Sep 17 00:00:00 2001 From: Alex Fabijanic Date: Tue, 31 Mar 2015 21:35:34 -0500 Subject: [PATCH 2/4] Poco::JSON::PrintHandler not working for objects in array #766 --- JSON/include/Poco/JSON/PrintHandler.h | 11 +++++++- JSON/src/PrintHandler.cpp | 25 ++++++++++------- JSON/testsuite/src/JSONTest.cpp | 39 +++++++++++++++++++++++++++ 3 files changed, 65 insertions(+), 10 deletions(-) diff --git a/JSON/include/Poco/JSON/PrintHandler.h b/JSON/include/Poco/JSON/PrintHandler.h index 6fb223720..a9661694f 100644 --- a/JSON/include/Poco/JSON/PrintHandler.h +++ b/JSON/include/Poco/JSON/PrintHandler.h @@ -109,12 +109,14 @@ private: unsigned indent(); bool printFlat() const; void arrayValue(); + bool array() const; std::ostream& _out; unsigned _indent; std::string _tab; - bool _array; + int _array; bool _value; + bool _objStart; }; @@ -124,6 +126,13 @@ inline void PrintHandler::setIndent(unsigned indent) } +inline bool PrintHandler::array() const +{ + return _array > 0; +} + + + }} // namespace Poco::JSON diff --git a/JSON/src/PrintHandler.cpp b/JSON/src/PrintHandler.cpp index 3498bdda1..fabbf6246 100644 --- a/JSON/src/PrintHandler.cpp +++ b/JSON/src/PrintHandler.cpp @@ -26,8 +26,9 @@ namespace JSON { PrintHandler::PrintHandler(unsigned indent): _out(std::cout), _indent(indent), - _array(false), - _value(false) + _array(0), + _value(false), + _objStart(false) { } @@ -35,8 +36,9 @@ PrintHandler::PrintHandler(unsigned indent): PrintHandler::PrintHandler(std::ostream& out, unsigned indent): _out(out), _indent(indent), - _array(false), - _value(false) + _array(0), + _value(false), + _objStart(false) { } @@ -50,7 +52,7 @@ void PrintHandler::reset() { _out.flush(); _tab = ""; - _array = false; + _array = 0; _value = false; } @@ -78,9 +80,11 @@ unsigned PrintHandler::indent() void PrintHandler::startObject() { + arrayValue(); _out << '{'; _out << endLine(); _tab.append(indent(), ' '); + _objStart = true; } @@ -90,6 +94,7 @@ void PrintHandler::endObject() _tab.erase(_tab.length() - indent()); _out << endLine() << _tab << '}'; + if (array()) _value = true; } @@ -97,7 +102,7 @@ void PrintHandler::startArray() { _out << '[' << endLine(); _tab.append(indent(), ' '); - _array = true; + ++_array; _value = false; } @@ -106,7 +111,8 @@ void PrintHandler::endArray() { _tab.erase(_tab.length() - indent()); _out << endLine() << _tab << ']'; - _array = false; + --_array; + poco_assert (_array >= 0); _value = false; } @@ -115,9 +121,10 @@ void PrintHandler::key(const std::string& k) { if (_value) { - comma(); + if (!_objStart) comma(); _value = false; } + _objStart = false; _out << _tab; Stringifier::formatString(k, _out); if (!printFlat()) _out << ' '; @@ -201,7 +208,7 @@ void PrintHandler::comma() void PrintHandler::arrayValue() { - if (_array) + if (array()) { if (_value) comma(); _out << _tab; diff --git a/JSON/testsuite/src/JSONTest.cpp b/JSON/testsuite/src/JSONTest.cpp index 3b9b821e5..baebf2a89 100644 --- a/JSON/testsuite/src/JSONTest.cpp +++ b/JSON/testsuite/src/JSONTest.cpp @@ -1181,6 +1181,45 @@ void JSONTest::testPrintHandler() " ]\n" "}" ); + + json = + "{" + "\"array\":" + "[" + "{" + "\"key1\":" + "[" + "1,2,3," + "{" + "\"subkey\":" + "\"test\"" + "}" + "]" + "}," + "{" + "\"key2\":" + "{" + "\"anotherSubKey\":" + "[" + "1," + "{" + "\"subSubKey\":" + "[" + "4,5,6" + "]" + "}" + "]" + "}" + "}" + "]" + "}"; + + + ostr.str(""); + pHandler->setIndent(0); + parser.reset(); + parser.parse(json); + assert (json == ostr.str()); } From f695b775e431a5ae96122e25beb2ebd1c88e6eb5 Mon Sep 17 00:00:00 2001 From: Aleksandar Fabijanic Date: Fri, 3 Apr 2015 10:11:00 -0500 Subject: [PATCH 3/4] Update 99100-ReleaseNotes.page DefaultHandler => ParseHandler breaking change note for 1.5.2 --- doc/99100-ReleaseNotes.page | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/doc/99100-ReleaseNotes.page b/doc/99100-ReleaseNotes.page index 7277cda08..303eead04 100644 --- a/doc/99100-ReleaseNotes.page +++ b/doc/99100-ReleaseNotes.page @@ -331,6 +331,10 @@ AAAIntroduction - Dynamic::Var: comparison of two empty objects now returns true - WinCE does not build in this release; this will be fixed in a later release + - JSON::DefaultHandler was renamed to a more appropriate name - ParseHandler; + ParseHandler does not have to be passed to the Parser, it will be used by default; + handlers are now passed into Parser as smart pointers, so passing in addresses of + stack objects will cause undefined behavior - Please note that 1.5.x releases are development releases and not considered stable. Interfaces may change, and backwards compatibility with the stable 1.4 release series is not guaranteed. There may also be some rough edges. From 25cd53d953ee7954b4f9050408fc72750e0dc083 Mon Sep 17 00:00:00 2001 From: Alex Fabijanic Date: Fri, 3 Apr 2015 10:46:07 -0500 Subject: [PATCH 4/4] Poco::Var operator== throws exception #769 --- Foundation/src/Var.cpp | 2 +- Foundation/testsuite/src/VarTest.cpp | 5 +++++ 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/Foundation/src/Var.cpp b/Foundation/src/Var.cpp index 714560477..5daa2f8b2 100644 --- a/Foundation/src/Var.cpp +++ b/Foundation/src/Var.cpp @@ -255,7 +255,7 @@ const Var Var::operator -- (int) bool Var::operator == (const Var& other) const { - if (isEmpty() && !other.isEmpty()) return false; + if (isEmpty() != other.isEmpty()) return false; if (isEmpty() && other.isEmpty()) return true; return convert() == other.convert(); } diff --git a/Foundation/testsuite/src/VarTest.cpp b/Foundation/testsuite/src/VarTest.cpp index 871792b57..984ff22b4 100644 --- a/Foundation/testsuite/src/VarTest.cpp +++ b/Foundation/testsuite/src/VarTest.cpp @@ -2473,6 +2473,11 @@ void VarTest::testEmpty() assert (da == da); assert (!(da != da)); + assert (da != Var(1)); + assert (!(da == Var(1))); + assert (Var(1) != da); + assert (!(Var(1) == da)); + assert (da != ""); assert ("" != da); assert (!(da == ""));