Remove unsafe JsonScope::operator<<(bool) to which pointers can be converted.

GitOrigin-RevId: 0350036ba8dd4b24df8974e1fe95593afe78a309
This commit is contained in:
levlam 2019-12-23 03:21:51 +03:00
parent 5fdb88a8ac
commit 674e6b79d8
4 changed files with 5 additions and 4 deletions

View File

@ -43,6 +43,8 @@ void gen_to_json_constructor(StringBuilder &sb, const T *constructor, bool is_he
auto object = PSTRING() << "object." << tl::simple::gen_cpp_field_name(arg.name);
if (arg.type->type == tl::simple::Type::Bytes) {
object = PSTRING() << "base64_encode(" << object << ")";
} else if (arg.type->type == tl::simple::Type::Bool) {
object = PSTRING() << "JsonBool{" << object << "}";
} else if (arg.type->type == tl::simple::Type::Int64) {
object = PSTRING() << "JsonInt64{" << object << "}";
} else if (arg.type->type == tl::simple::Type::Vector &&

View File

@ -148,7 +148,7 @@ class JsonableJsonValue : public Jsonable {
*scope << JsonNull();
break;
case td_api::jsonValueBoolean::ID:
*scope << static_cast<const td_api::jsonValueBoolean *>(json_value_)->value_;
*scope << JsonBool(static_cast<const td_api::jsonValueBoolean *>(json_value_)->value_);
break;
case td_api::jsonValueNumber::ID:
*scope << static_cast<const td_api::jsonValueNumber *>(json_value_)->value_;

View File

@ -30,6 +30,7 @@ struct JsonInt64 {
inline void to_json(JsonValueScope &jv, const JsonInt64 json_int64) {
jv << JsonString(PSLICE() << json_int64.value);
}
struct JsonVectorInt64 {
const std::vector<int64> &value;
};

View File

@ -289,9 +289,7 @@ class JsonScope {
*sb_ << x;
return *this;
}
JsonScope &operator<<(bool x) {
return *this << JsonBool(x);
}
JsonScope &operator<<(bool x) = delete;
JsonScope &operator<<(int32 x) {
return *this << JsonInt(x);
}