forked from bblanchon/ArduinoJson
Removed dependency on PGM_P
as Particle 0.6.2 doesn't define it (issue #546)
This commit is contained in:
@ -1,6 +1,11 @@
|
|||||||
ArduinoJson: change log
|
ArduinoJson: change log
|
||||||
=======================
|
=======================
|
||||||
|
|
||||||
|
HEAD
|
||||||
|
----
|
||||||
|
|
||||||
|
* Removed dependency on `PGM_P` as Particle 0.6.2 doesn't define it (issue #546)
|
||||||
|
|
||||||
v5.11.0
|
v5.11.0
|
||||||
-------
|
-------
|
||||||
|
|
||||||
|
@ -34,15 +34,15 @@ struct StringTraits<const __FlashStringHelper*, void> {
|
|||||||
};
|
};
|
||||||
|
|
||||||
static bool equals(const __FlashStringHelper* str, const char* expected) {
|
static bool equals(const __FlashStringHelper* str, const char* expected) {
|
||||||
return strcmp_P(expected, (PGM_P)str) == 0;
|
return strcmp_P(expected, (const char*)str) == 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
template <typename Buffer>
|
template <typename Buffer>
|
||||||
static char* duplicate(const __FlashStringHelper* str, Buffer* buffer) {
|
static char* duplicate(const __FlashStringHelper* str, Buffer* buffer) {
|
||||||
if (!str) return NULL;
|
if (!str) return NULL;
|
||||||
size_t size = strlen_P((PGM_P)str) + 1;
|
size_t size = strlen_P((const char*)str) + 1;
|
||||||
void* dup = buffer->alloc(size);
|
void* dup = buffer->alloc(size);
|
||||||
if (dup != NULL) memcpy_P(dup, (PGM_P)str, size);
|
if (dup != NULL) memcpy_P(dup, (const char*)str, size);
|
||||||
return static_cast<char*>(dup);
|
return static_cast<char*>(dup);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user