From 0200f2dc6280c474d4298b490ce54cc254e2eb3b Mon Sep 17 00:00:00 2001 From: Niels Lohmann Date: Fri, 17 Feb 2017 19:14:21 +0100 Subject: [PATCH 1/2] :construction: fixing warning C4267 (#453) --- src/json.hpp | 6 +++--- src/json.hpp.re2c | 6 +++--- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/src/json.hpp b/src/json.hpp index 6e49b4d9..5ad77f9d 100644 --- a/src/json.hpp +++ b/src/json.hpp @@ -7046,7 +7046,7 @@ class basic_json const auto N = j.m_value.string->size(); if (N <= 0x17) { - v.push_back(0x60 + N); // 1 byte for string + size + v.push_back(0x60 + static_cast(N)); // 1 byte for string + size } else if (N <= 0xff) { @@ -7082,7 +7082,7 @@ class basic_json const auto N = j.m_value.array->size(); if (N <= 0x17) { - v.push_back(0x80 + N); // 1 byte for array + size + v.push_back(0x80 + static_cast(N)); // 1 byte for array + size } else if (N <= 0xff) { @@ -7120,7 +7120,7 @@ class basic_json const auto N = j.m_value.object->size(); if (N <= 0x17) { - v.push_back(0xa0 + N); // 1 byte for object + size + v.push_back(0xa0 + static_cast(N)); // 1 byte for object + size } else if (N <= 0xff) { diff --git a/src/json.hpp.re2c b/src/json.hpp.re2c index dae2e958..84c0e893 100644 --- a/src/json.hpp.re2c +++ b/src/json.hpp.re2c @@ -7046,7 +7046,7 @@ class basic_json const auto N = j.m_value.string->size(); if (N <= 0x17) { - v.push_back(0x60 + N); // 1 byte for string + size + v.push_back(0x60 + static_cast(N)); // 1 byte for string + size } else if (N <= 0xff) { @@ -7082,7 +7082,7 @@ class basic_json const auto N = j.m_value.array->size(); if (N <= 0x17) { - v.push_back(0x80 + N); // 1 byte for array + size + v.push_back(0x80 + static_cast(N)); // 1 byte for array + size } else if (N <= 0xff) { @@ -7120,7 +7120,7 @@ class basic_json const auto N = j.m_value.object->size(); if (N <= 0x17) { - v.push_back(0xa0 + N); // 1 byte for object + size + v.push_back(0xa0 + static_cast(N)); // 1 byte for object + size } else if (N <= 0xff) { From 9a9d0ba3df4f9b44582e59bff202d1811d47cad6 Mon Sep 17 00:00:00 2001 From: Niels Lohmann Date: Sun, 19 Feb 2017 17:47:20 +0100 Subject: [PATCH 2/2] :construction: fixing warning C4293 (#453) --- src/json.hpp | 8 ++++---- src/json.hpp.re2c | 8 ++++---- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/src/json.hpp b/src/json.hpp index 5ad77f9d..4891ddfb 100644 --- a/src/json.hpp +++ b/src/json.hpp @@ -6570,10 +6570,10 @@ class basic_json { case 8: { - vec.push_back(static_cast((number >> 070) & 0xff)); - vec.push_back(static_cast((number >> 060) & 0xff)); - vec.push_back(static_cast((number >> 050) & 0xff)); - vec.push_back(static_cast((number >> 040) & 0xff)); + vec.push_back(static_cast((static_cast(number) >> 070) & 0xff)); + vec.push_back(static_cast((static_cast(number) >> 060) & 0xff)); + vec.push_back(static_cast((static_cast(number) >> 050) & 0xff)); + vec.push_back(static_cast((static_cast(number) >> 040) & 0xff)); // intentional fall-through } diff --git a/src/json.hpp.re2c b/src/json.hpp.re2c index 84c0e893..518889e0 100644 --- a/src/json.hpp.re2c +++ b/src/json.hpp.re2c @@ -6570,10 +6570,10 @@ class basic_json { case 8: { - vec.push_back(static_cast((number >> 070) & 0xff)); - vec.push_back(static_cast((number >> 060) & 0xff)); - vec.push_back(static_cast((number >> 050) & 0xff)); - vec.push_back(static_cast((number >> 040) & 0xff)); + vec.push_back(static_cast((static_cast(number) >> 070) & 0xff)); + vec.push_back(static_cast((static_cast(number) >> 060) & 0xff)); + vec.push_back(static_cast((static_cast(number) >> 050) & 0xff)); + vec.push_back(static_cast((static_cast(number) >> 040) & 0xff)); // intentional fall-through }