Removed implicit conversion in comparison operators (issue #998)

This commit is contained in:
Benoit Blanchon
2019-05-23 21:54:42 +02:00
parent 4eb8074358
commit 630107ae8a
14 changed files with 398 additions and 148 deletions

View File

@@ -6,6 +6,7 @@
#include <stddef.h> // size_t
#include <string.h> // strcmp
#include "../Polyfills/safe_strcmp.hpp"
namespace ARDUINOJSON_NAMESPACE {
@@ -13,10 +14,12 @@ class ConstRamStringAdapter {
public:
ConstRamStringAdapter(const char* str = 0) : _str(str) {}
int8_t compare(const char* other) const {
return safe_strcmp(_str, other);
}
bool equals(const char* expected) const {
const char* actual = _str;
if (!actual || !expected) return actual == expected;
return strcmp(actual, expected) == 0;
return compare(expected) == 0;
}
bool isNull() const {