mirror of
				https://github.com/eledio-devices/thirdparty-ArduinoJson.git
				synced 2025-10-31 16:14:11 +01:00 
			
		
		
		
	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 `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) | ||||
| ------- | ||||
|   | ||||
| @@ -88,28 +88,38 @@ | ||||
|  | ||||
| #ifdef ARDUINO | ||||
|  | ||||
| // Enable support for Arduino String | ||||
| // Enable support for Arduino's String class | ||||
| #ifndef ARDUINOJSON_ENABLE_ARDUINO_STRING | ||||
| #define ARDUINOJSON_ENABLE_ARDUINO_STRING 1 | ||||
| #endif | ||||
|  | ||||
| // Enable support for Arduino Stream | ||||
| // Enable support for Arduino's Stream class | ||||
| #ifndef ARDUINOJSON_ENABLE_ARDUINO_STREAM | ||||
| #define ARDUINOJSON_ENABLE_ARDUINO_STREAM 1 | ||||
| #endif | ||||
|  | ||||
| // Enable support for Arduino's Print class | ||||
| #ifndef ARDUINOJSON_ENABLE_ARDUINO_PRINT | ||||
| #define ARDUINOJSON_ENABLE_ARDUINO_PRINT 1 | ||||
| #endif | ||||
|  | ||||
| #else  // ARDUINO | ||||
|  | ||||
| // Disable support for Arduino String | ||||
| // Enable support for Arduino's String class | ||||
| #ifndef ARDUINOJSON_ENABLE_ARDUINO_STRING | ||||
| #define ARDUINOJSON_ENABLE_ARDUINO_STRING 0 | ||||
| #endif | ||||
|  | ||||
| // Disable support for Arduino Stream | ||||
| // Enable support for Arduino's Stream class | ||||
| #ifndef ARDUINOJSON_ENABLE_ARDUINO_STREAM | ||||
| #define ARDUINOJSON_ENABLE_ARDUINO_STREAM 0 | ||||
| #endif | ||||
|  | ||||
| // Enable support for Arduino's Print class | ||||
| #ifndef ARDUINOJSON_ENABLE_ARDUINO_PRINT | ||||
| #define ARDUINOJSON_ENABLE_ARDUINO_PRINT 0 | ||||
| #endif | ||||
|  | ||||
| #endif  // ARDUINO | ||||
|  | ||||
| #ifndef ARDUINOJSON_ENABLE_PROGMEM | ||||
|   | ||||
| @@ -14,32 +14,38 @@ | ||||
| namespace ARDUINOJSON_NAMESPACE { | ||||
|  | ||||
| template <template <typename> class TSerializer, typename TSource, | ||||
|           typename TPrint> | ||||
| typename enable_if<!IsWriteableString<TPrint>::value, size_t>::type serialize( | ||||
|     const TSource &source, TPrint &destination) { | ||||
|   TSerializer<TPrint> serializer(destination); | ||||
|           typename TDestination> | ||||
| size_t doSerialize(const TSource &source, TDestination &destination) { | ||||
|   TSerializer<TDestination> serializer(destination); | ||||
|   source.accept(serializer); | ||||
|   return serializer.bytesWritten(); | ||||
| } | ||||
|  | ||||
| #if ARDUINOJSON_ENABLE_STD_STREAM | ||||
| template <template <typename> class TSerializer, typename TSource> | ||||
| size_t serialize(const TSource &source, std::ostream &os) { | ||||
|   StreamWriter writer(os); | ||||
|   return serialize<TSerializer>(source, writer); | ||||
| size_t serialize(const TSource &source, std::ostream &destination) { | ||||
|   StreamWriter writer(destination); | ||||
|   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 | ||||
|  | ||||
| template <template <typename> class TSerializer, typename TSource> | ||||
| size_t serialize(const TSource &source, char *buffer, size_t 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> | ||||
| size_t serialize(const TSource &source, char (&buffer)[N]) { | ||||
|   StaticStringWriter writer(buffer, N); | ||||
|   return serialize<TSerializer>(source, writer); | ||||
|   return doSerialize<TSerializer>(source, writer); | ||||
| } | ||||
|  | ||||
| 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( | ||||
|     const TSource &source, TString &str) { | ||||
|   DynamicStringWriter<TString> writer(str); | ||||
|   return serialize<TSerializer>(source, writer); | ||||
|   return doSerialize<TSerializer>(source, writer); | ||||
| } | ||||
|  | ||||
| }  // namespace ARDUINOJSON_NAMESPACE | ||||
|   | ||||
		Reference in New Issue
	
	Block a user