mirror of
				https://github.com/eledio-devices/thirdparty-ArduinoJson.git
				synced 2025-10-31 16:14:11 +01:00 
			
		
		
		
	Fix cannot convert 'pgm_p' to 'const void*' (fixes #1707)
				
					
				
			This commit is contained in:
		| @@ -1,6 +1,11 @@ | ||||
| ArduinoJson: change log | ||||
| ======================= | ||||
|  | ||||
| HEAD | ||||
| ---- | ||||
|  | ||||
| * Fix `cannot convert 'pgm_p' to 'const void*'` (issue #1707) | ||||
|  | ||||
| v6.19.1 (2022-01-14) | ||||
| ------- | ||||
|  | ||||
|   | ||||
| @@ -16,6 +16,7 @@ add_executable(MixedConfigurationTests | ||||
| 	enable_progmem_1.cpp | ||||
| 	enable_string_deduplication_0.cpp | ||||
| 	enable_string_deduplication_1.cpp | ||||
| 	issue1707.cpp | ||||
| 	use_double_0.cpp | ||||
| 	use_double_1.cpp | ||||
| ) | ||||
|   | ||||
							
								
								
									
										17
									
								
								extras/tests/MixedConfiguration/issue1707.cpp
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										17
									
								
								extras/tests/MixedConfiguration/issue1707.cpp
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,17 @@ | ||||
| // ArduinoJson - https://arduinojson.org | ||||
| // Copyright © 2014-2022, Benoit BLANCHON | ||||
| // MIT License | ||||
|  | ||||
| #define ARDUINO | ||||
| #define memcpy_P(dest, src, n) memcpy((dest), (src), (n)) | ||||
|  | ||||
| #include <ArduinoJson.h> | ||||
|  | ||||
| #include <catch.hpp> | ||||
|  | ||||
| TEST_CASE("Issue1707") { | ||||
|   StaticJsonDocument<128> doc; | ||||
|  | ||||
|   DeserializationError err = deserializeJson(doc, F("{\"hello\":12}")); | ||||
|   REQUIRE(err == DeserializationError::Ok); | ||||
| } | ||||
| @@ -99,7 +99,7 @@ inline void* memcpy_P(void* dst, ARDUINOJSON_NAMESPACE::pgm_p src, size_t n) { | ||||
| #ifndef pgm_read_dword | ||||
| inline uint32_t pgm_read_dword(ARDUINOJSON_NAMESPACE::pgm_p p) { | ||||
|   uint32_t result; | ||||
|   memcpy_P(&result, p, 4); | ||||
|   memcpy_P(&result, p.address, 4); | ||||
|   return result; | ||||
| } | ||||
| #endif | ||||
| @@ -107,7 +107,7 @@ inline uint32_t pgm_read_dword(ARDUINOJSON_NAMESPACE::pgm_p p) { | ||||
| #ifndef pgm_read_ptr | ||||
| inline void* pgm_read_ptr(ARDUINOJSON_NAMESPACE::pgm_p p) { | ||||
|   void* result; | ||||
|   memcpy_P(&result, p, sizeof(result)); | ||||
|   memcpy_P(&result, p.address, sizeof(result)); | ||||
|   return result; | ||||
| } | ||||
| #endif | ||||
|   | ||||
		Reference in New Issue
	
	Block a user