Commit 0e4a41d0 authored by Christopher Dykes's avatar Christopher Dykes Committed by Facebook Github Bot

Make a few coersions to bool explicit

Summary: MSVC has warning 4800 which is triggered on implicit coercions to `bool` when not in use as the condition to a control-flow statement.

Reviewed By: yfeldblum

Differential Revision: D4518465

fbshipit-source-id: 858ab9e68215a2a667cb3ea55daf51b74368174d
parent 11505903
......@@ -99,7 +99,7 @@ class CpuId {
#define X(name, r, bit) \
FOLLY_ALWAYS_INLINE bool name() const { \
return (r) & (1U << bit); \
return ((r) & (1U << bit)) != 0; \
}
// cpuid(1): Processor Info and Feature Bits.
......
......@@ -244,7 +244,7 @@ inline StringPiece FormatArg::doSplitKey() {
if (e[-1] == ']') {
--e;
p = static_cast<const char*>(memchr(b, '[', size_t(e - b)));
enforce(p, "unmatched ']'");
enforce(p != nullptr, "unmatched ']'");
} else {
p = static_cast<const char*>(memchr(b, '.', size_t(e - b)));
}
......
......@@ -342,15 +342,29 @@ inline dynamic::IterableProxy<dynamic::const_item_iterator> dynamic::items()
}
inline bool dynamic::isString() const {
return get_nothrow<std::string>();
}
inline bool dynamic::isObject() const { return get_nothrow<ObjectImpl>(); }
inline bool dynamic::isBool() const { return get_nothrow<bool>(); }
inline bool dynamic::isArray() const { return get_nothrow<Array>(); }
inline bool dynamic::isDouble() const { return get_nothrow<double>(); }
inline bool dynamic::isInt() const { return get_nothrow<int64_t>(); }
inline bool dynamic::isNull() const { return get_nothrow<void*>(); }
inline bool dynamic::isNumber() const { return isInt() || isDouble(); }
return get_nothrow<std::string>() != nullptr;
}
inline bool dynamic::isObject() const {
return get_nothrow<ObjectImpl>() != nullptr;
}
inline bool dynamic::isBool() const {
return get_nothrow<bool>() != nullptr;
}
inline bool dynamic::isArray() const {
return get_nothrow<Array>() != nullptr;
}
inline bool dynamic::isDouble() const {
return get_nothrow<double>() != nullptr;
}
inline bool dynamic::isInt() const {
return get_nothrow<int64_t>() != nullptr;
}
inline bool dynamic::isNull() const {
return get_nothrow<void*>() != nullptr;
}
inline bool dynamic::isNumber() const {
return isInt() || isDouble();
}
inline dynamic::Type dynamic::type() const {
return type_;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment