From b17634ef24cfd2bf57e875319093afde3704d0ac Mon Sep 17 00:00:00 2001 From: Felix Wolfsteller Date: Mon, 29 Jan 2018 12:24:17 +0100 Subject: [PATCH 1/6] Update URLs to MIT license. This closes #47 . Command(s) used to create this changeset was: ''' find . -type f -print0 | xargs -0 sed -i -e 's,http://www.opensource.org/licenses/mit-license.php,https://opensource.org/licenses/mit-license.php,g' ''' --- gen/gen.cpp | 2 +- include/univalue.h | 2 +- lib/univalue.cpp | 2 +- lib/univalue_get.cpp | 2 +- lib/univalue_read.cpp | 2 +- lib/univalue_utffilter.h | 2 +- lib/univalue_write.cpp | 2 +- test/object.cpp | 2 +- test/unitester.cpp | 2 +- 9 files changed, 9 insertions(+), 9 deletions(-) diff --git a/gen/gen.cpp b/gen/gen.cpp index 85fe20924ac..be3d4ccf72b 100644 --- a/gen/gen.cpp +++ b/gen/gen.cpp @@ -1,6 +1,6 @@ // Copyright 2014 BitPay Inc. // Distributed under the MIT software license, see the accompanying -// file COPYING or http://www.opensource.org/licenses/mit-license.php. +// file COPYING or https://opensource.org/licenses/mit-license.php. // // To re-create univalue_escapes.h: diff --git a/include/univalue.h b/include/univalue.h index 4fd2223b302..3f8f3441460 100644 --- a/include/univalue.h +++ b/include/univalue.h @@ -1,7 +1,7 @@ // Copyright 2014 BitPay Inc. // Copyright 2015 Bitcoin Core Developers // Distributed under the MIT software license, see the accompanying -// file COPYING or http://www.opensource.org/licenses/mit-license.php. +// file COPYING or https://opensource.org/licenses/mit-license.php. #ifndef __UNIVALUE_H__ #define __UNIVALUE_H__ diff --git a/lib/univalue.cpp b/lib/univalue.cpp index 4c9c15d63e3..2b966ad859b 100644 --- a/lib/univalue.cpp +++ b/lib/univalue.cpp @@ -1,7 +1,7 @@ // Copyright 2014 BitPay Inc. // Copyright 2015 Bitcoin Core Developers // Distributed under the MIT software license, see the accompanying -// file COPYING or http://www.opensource.org/licenses/mit-license.php. +// file COPYING or https://opensource.org/licenses/mit-license.php. #include #include diff --git a/lib/univalue_get.cpp b/lib/univalue_get.cpp index eabcf2dad1a..19ba5bbc3ec 100644 --- a/lib/univalue_get.cpp +++ b/lib/univalue_get.cpp @@ -1,7 +1,7 @@ // Copyright 2014 BitPay Inc. // Copyright 2015 Bitcoin Core Developers // Distributed under the MIT software license, see the accompanying -// file COPYING or http://www.opensource.org/licenses/mit-license.php. +// file COPYING or https://opensource.org/licenses/mit-license.php. #include #include diff --git a/lib/univalue_read.cpp b/lib/univalue_read.cpp index 14834db24dc..c29821e5972 100644 --- a/lib/univalue_read.cpp +++ b/lib/univalue_read.cpp @@ -1,6 +1,6 @@ // Copyright 2014 BitPay Inc. // Distributed under the MIT software license, see the accompanying -// file COPYING or http://www.opensource.org/licenses/mit-license.php. +// file COPYING or https://opensource.org/licenses/mit-license.php. #include #include diff --git a/lib/univalue_utffilter.h b/lib/univalue_utffilter.h index 20d40430095..c24ac58eaf2 100644 --- a/lib/univalue_utffilter.h +++ b/lib/univalue_utffilter.h @@ -1,6 +1,6 @@ // Copyright 2016 Wladimir J. van der Laan // Distributed under the MIT software license, see the accompanying -// file COPYING or http://www.opensource.org/licenses/mit-license.php. +// file COPYING or https://opensource.org/licenses/mit-license.php. #ifndef UNIVALUE_UTFFILTER_H #define UNIVALUE_UTFFILTER_H diff --git a/lib/univalue_write.cpp b/lib/univalue_write.cpp index 827eb9b2715..d31414eddea 100644 --- a/lib/univalue_write.cpp +++ b/lib/univalue_write.cpp @@ -1,6 +1,6 @@ // Copyright 2014 BitPay Inc. // Distributed under the MIT software license, see the accompanying -// file COPYING or http://www.opensource.org/licenses/mit-license.php. +// file COPYING or https://opensource.org/licenses/mit-license.php. #include #include diff --git a/test/object.cpp b/test/object.cpp index 02446292a1a..6641a764a59 100644 --- a/test/object.cpp +++ b/test/object.cpp @@ -1,7 +1,7 @@ // Copyright (c) 2014 BitPay Inc. // Copyright (c) 2014-2016 The Bitcoin Core developers // Distributed under the MIT software license, see the accompanying -// file COPYING or http://www.opensource.org/licenses/mit-license.php. +// file COPYING or https://opensource.org/licenses/mit-license.php. #include #include diff --git a/test/unitester.cpp b/test/unitester.cpp index 75c0dc225a7..89157142008 100644 --- a/test/unitester.cpp +++ b/test/unitester.cpp @@ -1,6 +1,6 @@ // Copyright 2014 BitPay Inc. // Distributed under the MIT/X11 software license, see the accompanying -// file COPYING or http://www.opensource.org/licenses/mit-license.php. +// file COPYING or https://opensource.org/licenses/mit-license.php. #include #include From c23132bcf4da3db8fe514bf56b8b0830215bd882 Mon Sep 17 00:00:00 2001 From: Karel Bilek Date: Sun, 24 Sep 2017 23:35:24 +0200 Subject: [PATCH 2/6] Pushing boolean value to univalue correctly --- include/univalue.h | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/include/univalue.h b/include/univalue.h index 3f8f3441460..10ce39aec8b 100644 --- a/include/univalue.h +++ b/include/univalue.h @@ -130,6 +130,10 @@ class UniValue { UniValue tmpVal(val_); return pushKV(key, tmpVal); } + bool pushKV(const std::string& key, bool val_) { + UniValue tmpVal((bool)val_); + return pushKV(key, tmpVal); + } bool pushKV(const std::string& key, int val_) { UniValue tmpVal((int64_t)val_); return pushKV(key, tmpVal); From 72392fb227155f07ffc57c806cf7a177474b224c Mon Sep 17 00:00:00 2001 From: John Newbery Date: Tue, 12 Dec 2017 13:07:19 -0500 Subject: [PATCH 3/6] [tests] test pushKV for boolean values --- test/object.cpp | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/test/object.cpp b/test/object.cpp index 6641a764a59..15b043d0ebd 100644 --- a/test/object.cpp +++ b/test/object.cpp @@ -260,6 +260,12 @@ BOOST_AUTO_TEST_CASE(univalue_object) strKey = "temperature"; BOOST_CHECK(obj.pushKV(strKey, (double) 90.012)); + strKey = "moon"; + BOOST_CHECK(obj.pushKV(strKey, true)); + + strKey = "spoon"; + BOOST_CHECK(obj.pushKV(strKey, false)); + UniValue obj2(UniValue::VOBJ); BOOST_CHECK(obj2.pushKV("cat1", 9000)); BOOST_CHECK(obj2.pushKV("cat2", 12345)); @@ -267,7 +273,7 @@ BOOST_AUTO_TEST_CASE(univalue_object) BOOST_CHECK(obj.pushKVs(obj2)); BOOST_CHECK_EQUAL(obj.empty(), false); - BOOST_CHECK_EQUAL(obj.size(), 9); + BOOST_CHECK_EQUAL(obj.size(), 11); BOOST_CHECK_EQUAL(obj["age"].getValStr(), "100"); BOOST_CHECK_EQUAL(obj["first"].getValStr(), "John"); @@ -276,6 +282,8 @@ BOOST_AUTO_TEST_CASE(univalue_object) BOOST_CHECK_EQUAL(obj["time"].getValStr(), "3600"); BOOST_CHECK_EQUAL(obj["calories"].getValStr(), "12"); BOOST_CHECK_EQUAL(obj["temperature"].getValStr(), "90.012"); + BOOST_CHECK_EQUAL(obj["moon"].getValStr(), "1"); + BOOST_CHECK_EQUAL(obj["spoon"].getValStr(), ""); BOOST_CHECK_EQUAL(obj["cat1"].getValStr(), "9000"); BOOST_CHECK_EQUAL(obj["cat2"].getValStr(), "12345"); @@ -288,6 +296,8 @@ BOOST_AUTO_TEST_CASE(univalue_object) BOOST_CHECK(obj.exists("time")); BOOST_CHECK(obj.exists("calories")); BOOST_CHECK(obj.exists("temperature")); + BOOST_CHECK(obj.exists("moon")); + BOOST_CHECK(obj.exists("spoon")); BOOST_CHECK(obj.exists("cat1")); BOOST_CHECK(obj.exists("cat2")); @@ -301,6 +311,8 @@ BOOST_AUTO_TEST_CASE(univalue_object) objTypes["time"] = UniValue::VNUM; objTypes["calories"] = UniValue::VNUM; objTypes["temperature"] = UniValue::VNUM; + objTypes["moon"] = UniValue::VBOOL; + objTypes["spoon"] = UniValue::VBOOL; objTypes["cat1"] = UniValue::VNUM; objTypes["cat2"] = UniValue::VNUM; BOOST_CHECK(obj.checkObject(objTypes)); From 88967f658663654a67f1cda93ca6f99de1f7c91f Mon Sep 17 00:00:00 2001 From: Jeff Garzik Date: Fri, 31 Aug 2018 21:32:32 -0400 Subject: [PATCH 4/6] Version 1.0.4 --- configure.ac | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/configure.ac b/configure.ac index 8298332ac13..f3131283994 100644 --- a/configure.ac +++ b/configure.ac @@ -1,7 +1,7 @@ m4_define([libunivalue_major_version], [1]) m4_define([libunivalue_minor_version], [1]) -m4_define([libunivalue_micro_version], [3]) -m4_define([libunivalue_interface_age], [3]) +m4_define([libunivalue_micro_version], [4]) +m4_define([libunivalue_interface_age], [4]) # If you need a modifier for the version number. # Normally empty, but can be used to make "fixup" releases. m4_define([libunivalue_extraversion], []) @@ -14,7 +14,7 @@ m4_define([libunivalue_age], [m4_eval(libunivalue_binary_age - libunivalue_inter m4_define([libunivalue_version], [libunivalue_major_version().libunivalue_minor_version().libunivalue_micro_version()libunivalue_extraversion()]) -AC_INIT([univalue], [1.0.3], +AC_INIT([univalue], [1.0.4], [http://github.com/jgarzik/univalue/]) dnl make the compilation flags quiet unless V=1 is used From 66e0adec4dcd53bdfc0693c4b5f3d1aa42841f59 Mon Sep 17 00:00:00 2001 From: Heikki Hellgren Date: Tue, 2 Oct 2018 08:16:13 +0300 Subject: [PATCH 5/6] Remove unnecessary sstream header from univalue.h sstream is not needed in the header. If there needs to be stream objects as member variables of classes, header iosfwd should be included to make the compilation time of the dependant headers faster by removing unnecessary preprocessing. --- include/univalue.h | 1 - lib/univalue_get.cpp | 1 + 2 files changed, 1 insertion(+), 1 deletion(-) diff --git a/include/univalue.h b/include/univalue.h index 10ce39aec8b..225533ce30b 100644 --- a/include/univalue.h +++ b/include/univalue.h @@ -14,7 +14,6 @@ #include #include -#include // .get_int64() #include // std::pair class UniValue { diff --git a/lib/univalue_get.cpp b/lib/univalue_get.cpp index 19ba5bbc3ec..8b2da7555a0 100644 --- a/lib/univalue_get.cpp +++ b/lib/univalue_get.cpp @@ -11,6 +11,7 @@ #include #include #include +#include #include "univalue.h" From 92bdd11f0bfcc749b5cb3fb078b06bb85a09389a Mon Sep 17 00:00:00 2001 From: Jeff Garzik Date: Thu, 27 Dec 2018 22:42:36 -0500 Subject: [PATCH 6/6] univalue_write: remove unneeded sstream.h include --- lib/univalue_write.cpp | 1 - 1 file changed, 1 deletion(-) diff --git a/lib/univalue_write.cpp b/lib/univalue_write.cpp index d31414eddea..db039fcb00d 100644 --- a/lib/univalue_write.cpp +++ b/lib/univalue_write.cpp @@ -3,7 +3,6 @@ // file COPYING or https://opensource.org/licenses/mit-license.php. #include -#include #include #include "univalue.h" #include "univalue_escapes.h"