Removed dependency on PGM_P as Particle 0.6.2 doesn't define it (issue #546)

This commit is contained in:
Benoit Blanchon
2017-07-07 23:04:42 +02:00
parent c3d7a79a83
commit 788c9be016
2 changed files with 8 additions and 3 deletions

View File

@ -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
------- -------

View File

@ -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);
} }