diff options
| author | Joel Klinghed <the_jk@spawned.biz> | 2025-10-20 09:08:07 +0200 |
|---|---|---|
| committer | Joel Klinghed <the_jk@spawned.biz> | 2025-10-20 09:15:50 +0200 |
| commit | 1c69dcbd12c359d5708f4af9d627da97e59d8f0e (patch) | |
| tree | 4f8feac8a658fbcd05dfb3ae979d6eb7ee699333 /src/json.cc | |
| parent | 100ca4f3cd27b98a3ffd9bbc51ff2d3433a0d69c (diff) | |
json: Avoid ambigous calls to value()
int == int32_t on this platform, and a uint32_t fits in both int64_t
and uint64_t so be specific.
Diffstat (limited to 'src/json.cc')
| -rw-r--r-- | src/json.cc | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/src/json.cc b/src/json.cc index cb9f0b8..46ea513 100644 --- a/src/json.cc +++ b/src/json.cc @@ -289,9 +289,10 @@ class StringWriter : public BaseWriter { void Writer::value(char const* value) { this->value(std::string_view(value)); } -void Writer::value(int value) { - static_assert(sizeof(int) <= sizeof(int64_t)); - this->value(static_cast<int64_t>(value)); +void Writer::value(int32_t value) { this->value(static_cast<int64_t>(value)); } + +void Writer::value(uint32_t value) { + this->value(static_cast<uint64_t>(value)); } std::unique_ptr<Writer> writer(std::string& out) { |
