forked from bblanchon/ArduinoJson
Fixed "no matching function for call to write(uint8_t)" (closes #972)
This commit is contained in:
@ -6,6 +6,7 @@ HEAD
|
|||||||
|
|
||||||
* Fixed error "attributes are not allowed on a function-definition"
|
* Fixed error "attributes are not allowed on a function-definition"
|
||||||
* Fixed `deserializeJson()` not being picky enough (issue #969)
|
* Fixed `deserializeJson()` not being picky enough (issue #969)
|
||||||
|
* Fixed error "no matching function for call to write(uint8_t)" (issue #972)
|
||||||
|
|
||||||
v6.10.0 (2019-03-22)
|
v6.10.0 (2019-03-22)
|
||||||
-------
|
-------
|
||||||
|
@ -88,28 +88,38 @@
|
|||||||
|
|
||||||
#ifdef ARDUINO
|
#ifdef ARDUINO
|
||||||
|
|
||||||
// Enable support for Arduino String
|
// Enable support for Arduino's String class
|
||||||
#ifndef ARDUINOJSON_ENABLE_ARDUINO_STRING
|
#ifndef ARDUINOJSON_ENABLE_ARDUINO_STRING
|
||||||
#define ARDUINOJSON_ENABLE_ARDUINO_STRING 1
|
#define ARDUINOJSON_ENABLE_ARDUINO_STRING 1
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
// Enable support for Arduino Stream
|
// Enable support for Arduino's Stream class
|
||||||
#ifndef ARDUINOJSON_ENABLE_ARDUINO_STREAM
|
#ifndef ARDUINOJSON_ENABLE_ARDUINO_STREAM
|
||||||
#define ARDUINOJSON_ENABLE_ARDUINO_STREAM 1
|
#define ARDUINOJSON_ENABLE_ARDUINO_STREAM 1
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
// Enable support for Arduino's Print class
|
||||||
|
#ifndef ARDUINOJSON_ENABLE_ARDUINO_PRINT
|
||||||
|
#define ARDUINOJSON_ENABLE_ARDUINO_PRINT 1
|
||||||
|
#endif
|
||||||
|
|
||||||
#else // ARDUINO
|
#else // ARDUINO
|
||||||
|
|
||||||
// Disable support for Arduino String
|
// Enable support for Arduino's String class
|
||||||
#ifndef ARDUINOJSON_ENABLE_ARDUINO_STRING
|
#ifndef ARDUINOJSON_ENABLE_ARDUINO_STRING
|
||||||
#define ARDUINOJSON_ENABLE_ARDUINO_STRING 0
|
#define ARDUINOJSON_ENABLE_ARDUINO_STRING 0
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
// Disable support for Arduino Stream
|
// Enable support for Arduino's Stream class
|
||||||
#ifndef ARDUINOJSON_ENABLE_ARDUINO_STREAM
|
#ifndef ARDUINOJSON_ENABLE_ARDUINO_STREAM
|
||||||
#define ARDUINOJSON_ENABLE_ARDUINO_STREAM 0
|
#define ARDUINOJSON_ENABLE_ARDUINO_STREAM 0
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
// Enable support for Arduino's Print class
|
||||||
|
#ifndef ARDUINOJSON_ENABLE_ARDUINO_PRINT
|
||||||
|
#define ARDUINOJSON_ENABLE_ARDUINO_PRINT 0
|
||||||
|
#endif
|
||||||
|
|
||||||
#endif // ARDUINO
|
#endif // ARDUINO
|
||||||
|
|
||||||
#ifndef ARDUINOJSON_ENABLE_PROGMEM
|
#ifndef ARDUINOJSON_ENABLE_PROGMEM
|
||||||
|
@ -14,32 +14,38 @@
|
|||||||
namespace ARDUINOJSON_NAMESPACE {
|
namespace ARDUINOJSON_NAMESPACE {
|
||||||
|
|
||||||
template <template <typename> class TSerializer, typename TSource,
|
template <template <typename> class TSerializer, typename TSource,
|
||||||
typename TPrint>
|
typename TDestination>
|
||||||
typename enable_if<!IsWriteableString<TPrint>::value, size_t>::type serialize(
|
size_t doSerialize(const TSource &source, TDestination &destination) {
|
||||||
const TSource &source, TPrint &destination) {
|
TSerializer<TDestination> serializer(destination);
|
||||||
TSerializer<TPrint> serializer(destination);
|
|
||||||
source.accept(serializer);
|
source.accept(serializer);
|
||||||
return serializer.bytesWritten();
|
return serializer.bytesWritten();
|
||||||
}
|
}
|
||||||
|
|
||||||
#if ARDUINOJSON_ENABLE_STD_STREAM
|
#if ARDUINOJSON_ENABLE_STD_STREAM
|
||||||
template <template <typename> class TSerializer, typename TSource>
|
template <template <typename> class TSerializer, typename TSource>
|
||||||
size_t serialize(const TSource &source, std::ostream &os) {
|
size_t serialize(const TSource &source, std::ostream &destination) {
|
||||||
StreamWriter writer(os);
|
StreamWriter writer(destination);
|
||||||
return serialize<TSerializer>(source, writer);
|
return doSerialize<TSerializer>(source, writer);
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#if ARDUINOJSON_ENABLE_ARDUINO_PRINT
|
||||||
|
template <template <typename> class TSerializer, typename TSource>
|
||||||
|
size_t serialize(const TSource &source, Print &destination) {
|
||||||
|
return doSerialize<TSerializer>(source, destination);
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
template <template <typename> class TSerializer, typename TSource>
|
template <template <typename> class TSerializer, typename TSource>
|
||||||
size_t serialize(const TSource &source, char *buffer, size_t bufferSize) {
|
size_t serialize(const TSource &source, char *buffer, size_t bufferSize) {
|
||||||
StaticStringWriter writer(buffer, bufferSize);
|
StaticStringWriter writer(buffer, bufferSize);
|
||||||
return serialize<TSerializer>(source, writer);
|
return doSerialize<TSerializer>(source, writer);
|
||||||
}
|
}
|
||||||
|
|
||||||
template <template <typename> class TSerializer, typename TSource, size_t N>
|
template <template <typename> class TSerializer, typename TSource, size_t N>
|
||||||
size_t serialize(const TSource &source, char (&buffer)[N]) {
|
size_t serialize(const TSource &source, char (&buffer)[N]) {
|
||||||
StaticStringWriter writer(buffer, N);
|
StaticStringWriter writer(buffer, N);
|
||||||
return serialize<TSerializer>(source, writer);
|
return doSerialize<TSerializer>(source, writer);
|
||||||
}
|
}
|
||||||
|
|
||||||
template <template <typename> class TSerializer, typename TSource,
|
template <template <typename> class TSerializer, typename TSource,
|
||||||
@ -47,7 +53,7 @@ template <template <typename> class TSerializer, typename TSource,
|
|||||||
typename enable_if<IsWriteableString<TString>::value, size_t>::type serialize(
|
typename enable_if<IsWriteableString<TString>::value, size_t>::type serialize(
|
||||||
const TSource &source, TString &str) {
|
const TSource &source, TString &str) {
|
||||||
DynamicStringWriter<TString> writer(str);
|
DynamicStringWriter<TString> writer(str);
|
||||||
return serialize<TSerializer>(source, writer);
|
return doSerialize<TSerializer>(source, writer);
|
||||||
}
|
}
|
||||||
|
|
||||||
} // namespace ARDUINOJSON_NAMESPACE
|
} // namespace ARDUINOJSON_NAMESPACE
|
||||||
|
Reference in New Issue
Block a user