Compare commits

...

4 Commits

Author SHA1 Message Date
1360b6a396 Set version to 6.17.2 2020-11-14 10:38:21 +01:00
16e51b83ab Changed the default value of ARDUINOJSON_ENABLE_PROGMEM (fixes #1433)
It now checks that the pgm_read_XXX macros are defined before enabling PROGMEM.
2020-11-10 14:58:31 +01:00
aa7cc5351c Travis: added smoke test for Particle Argon 2020-11-10 14:46:45 +01:00
30da920135 Fixed invalid conversion in operator|(Variant, char*) (fixes #1432) 2020-11-09 09:21:19 +01:00
15 changed files with 64 additions and 11 deletions

4
.gitignore vendored
View File

@ -10,3 +10,7 @@
/extras/fuzzing/*_fuzzer.options
/extras/fuzzing/*_fuzzer_seed_corpus.zip
.vs/
# Used by CI for Particle
/src/*.ino
/project.properties

View File

@ -128,6 +128,7 @@ matrix:
- env: SCRIPT=arduino VERSION=1.8.2 BOARD=arduino:samd:mkr1000
- env: SCRIPT=platformio BOARD=uno
- env: SCRIPT=platformio BOARD=esp01
- env: SCRIPT=particle BOARD=argon
cache:
directories:
- "~/.platformio"

View File

@ -1,6 +1,13 @@
ArduinoJson: change log
=======================
v6.17.2 (2020-11-14)
-------
* Fixed invalid conversion error in `operator|(JsonVariant, char*)` (issue #1432)
* Changed the default value of `ARDUINOJSON_ENABLE_PROGMEM` (issue #1433).
It now checks that the `pgm_read_XXX` macros are defined before enabling `PROGMEM`.
v6.17.1 (2020-11-07)
-------

View File

@ -4,7 +4,7 @@
cmake_minimum_required(VERSION 3.0)
project(ArduinoJson VERSION 6.17.1)
project(ArduinoJson VERSION 6.17.2)
if(CMAKE_PROJECT_NAME STREQUAL PROJECT_NAME)
include(CTest)

View File

@ -2,7 +2,7 @@
---
[![arduino-library-badge](https://www.ardu-badge.com/badge/ArduinoJson.svg?version=6.17.1)](https://www.ardu-badge.com/ArduinoJson/6.17.1)
[![arduino-library-badge](https://www.ardu-badge.com/badge/ArduinoJson.svg?version=6.17.2)](https://www.ardu-badge.com/ArduinoJson/6.17.2)
[![Build Status](https://ci.appveyor.com/api/projects/status/m7s53wav1l0abssg/branch/6.x?svg=true)](https://ci.appveyor.com/project/bblanchon/arduinojson/branch/6.x)
[![Build Status](https://travis-ci.org/bblanchon/ArduinoJson.svg?branch=6.x)](https://travis-ci.org/bblanchon/ArduinoJson)
[![Fuzzing Status](https://oss-fuzz-build-logs.storage.googleapis.com/badges/arduinojson.svg)](https://bugs.chromium.org/p/oss-fuzz/issues/list?sort=-opened&can=1&q=proj:arduinojson)

View File

@ -1,4 +1,4 @@
version: 6.17.1.{build}
version: 6.17.2.{build}
environment:
matrix:
- APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2019

12
extras/ci/particle.sh Executable file
View File

@ -0,0 +1,12 @@
#!/bin/sh -ex
cd "$(dirname "$0")/../../"
npm install -g particle-cli
particle login -t "${PARTICLE_TOKEN}"
cp extras/particle/src/smocktest.ino src/
cp extras/particle/project.properties ./
particle compile "$BOARD"

View File

@ -0,0 +1 @@
name=ArduinoJsonCI

View File

@ -0,0 +1,5 @@
#include "ArduinoJson.h"
void setup() {}
void loop() {}

View File

@ -137,6 +137,20 @@ TEST_CASE("JsonVariant::operator|()") {
REQUIRE(result == "not default");
}
SECTION("const char* | char*") {
char dflt[] = "default";
variant.set("not default");
std::string result = variant | dflt;
REQUIRE(result == "not default");
}
SECTION("int | char*") {
char dflt[] = "default";
variant.set(42);
std::string result = variant | dflt;
REQUIRE(result == "default");
}
SECTION("const char* | int") {
variant.set("not default");
int result = variant | 42;

View File

@ -7,7 +7,7 @@
"type": "git",
"url": "https://github.com/bblanchon/ArduinoJson.git"
},
"version": "6.17.1",
"version": "6.17.2",
"authors": {
"name": "Benoit Blanchon",
"url": "https://blog.benoitblanchon.fr"

View File

@ -1,5 +1,5 @@
name=ArduinoJson
version=6.17.1
version=6.17.2
author=Benoit Blanchon <blog.benoitblanchon.fr>
maintainer=Benoit Blanchon <blog.benoitblanchon.fr>
sentence=A simple and efficient JSON library for embedded C++.

View File

@ -172,7 +172,8 @@
#endif // ARDUINO
#ifndef ARDUINOJSON_ENABLE_PROGMEM
#ifdef PROGMEM
#if defined(PROGMEM) && defined(pgm_read_byte) && defined(pgm_read_dword) && \
defined(pgm_read_ptr) && defined(pgm_read_float)
#define ARDUINOJSON_ENABLE_PROGMEM 1
#else
#define ARDUINOJSON_ENABLE_PROGMEM 0

View File

@ -19,15 +19,23 @@ CompareResult compare(const T1 &lhs, const T2 &rhs); // VariantCompare.cpp
template <typename TVariant>
struct VariantOperators {
// Returns the default value if the VariantRef is undefined or incompatible
//
// int operator|(JsonVariant, int)
// float operator|(JsonVariant, float)
// bool operator|(JsonVariant, bool)
// const char* operator|(JsonVariant, const char*)
// char* operator|(JsonVariant, const char*)
template <typename T>
friend typename enable_if<!IsVariant<T>::value, T>::type operator|(
const TVariant &variant, T defaultValue) {
friend typename enable_if<!IsVariant<T>::value,
typename VariantAs<T>::type>::type
operator|(const TVariant &variant, T defaultValue) {
if (variant.template is<T>())
return variant.template as<T>();
else
return defaultValue;
}
// Returns the default value if the VariantRef is undefined or incompatible
//
// JsonVariant operator|(JsonVariant, JsonVariant)
template <typename T>
friend typename enable_if<IsVariant<T>::value, typename T::variant_type>::type
operator|(const TVariant &variant, T defaultValue) {

View File

@ -4,7 +4,7 @@
#pragma once
#define ARDUINOJSON_VERSION "6.17.1"
#define ARDUINOJSON_VERSION "6.17.2"
#define ARDUINOJSON_VERSION_MAJOR 6
#define ARDUINOJSON_VERSION_MINOR 17
#define ARDUINOJSON_VERSION_REVISION 1
#define ARDUINOJSON_VERSION_REVISION 2