Skip to content

Commit

Permalink
Fix -Wsign-conversion -funsigned-char (fixes #1715)
Browse files Browse the repository at this point in the history
  • Loading branch information
bblanchon committed Feb 28, 2022
1 parent c127879 commit ff06292
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion src/ArduinoJson/Variant/VariantImpl.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -168,7 +168,7 @@ inline VariantConstRef operator|(VariantConstRef preferedValue,

// Out of class definition to avoid #1560
inline bool VariantRef::set(char value) const {
return set<signed char>(value);
return set(static_cast<signed char>(value));
}

// TODO: move somewhere else
Expand Down
4 changes: 2 additions & 2 deletions src/ArduinoJson/Variant/VariantRef.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,7 @@ class VariantRef : public VariantRefBase<VariantData>,
ARDUINOJSON_DEPRECATED(
"Support for char is deprecated, use int8_t or uint8_t instead")
as() const {
return as<signed char>();
return static_cast<char>(as<signed char>());
}

template <typename T>
Expand Down Expand Up @@ -265,7 +265,7 @@ class VariantConstRef : public VariantRefBase<const VariantData>,
ARDUINOJSON_DEPRECATED(
"Support for char is deprecated, use int8_t or uint8_t instead")
as() const {
return as<signed char>();
return static_cast<char>(as<signed char>());
}

template <typename T>
Expand Down

0 comments on commit ff06292

Please sign in to comment.