0
0
Fork 0
mirror of https://github.com/matrix-construct/construct synced 2024-11-25 16:22:35 +01:00

ircd::json: Enforce string type for member key on constructions.

This commit is contained in:
Jason Volk 2018-09-05 22:03:13 -07:00
parent ee8165dfd4
commit 8593d09c80
2 changed files with 4 additions and 3 deletions

View file

@ -77,7 +77,7 @@ inline
ircd::json::member::member(const object::member &m) ircd::json::member::member(const object::member &m)
:std::pair<value, value> :std::pair<value, value>
{ {
m.first, value { m.second, type(m.second) } { m.first, json::STRING }, value { m.second, type(m.second) }
} }
{} {}
@ -85,7 +85,7 @@ inline
ircd::json::member::member(const string_view &k) ircd::json::member::member(const string_view &k)
:std::pair<value, value> :std::pair<value, value>
{ {
k, string_view{} { k, json::STRING }, string_view{}
} }
{} {}

View file

@ -1398,7 +1398,8 @@ ircd::json::stringify(mutable_buffer &buf,
size_t size_t
ircd::json::serialized(const object::member &member) ircd::json::serialized(const object::member &member)
{ {
return serialized(member.first) + 1 + serialized(member.second); const json::value key{member.first, json::STRING};
return serialized(key) + 1 + serialized(member.second);
} }
std::ostream & std::ostream &