From 4cc4b26dd2c4426bcd58bac9b106fc8a53ee74a5 Mon Sep 17 00:00:00 2001 From: Niels Date: Wed, 10 Feb 2016 21:09:52 +0100 Subject: [PATCH 1/2] try to replace ssize_t occurrences with std::ptrdiff_t (for #204) --- src/json.hpp | 19 +++---------------- src/json.hpp.re2c | 19 +++---------------- 2 files changed, 6 insertions(+), 32 deletions(-) diff --git a/src/json.hpp b/src/json.hpp index df14283c..2abaa93d 100644 --- a/src/json.hpp +++ b/src/json.hpp @@ -34,25 +34,12 @@ Licensed under the MIT License . #include #include -// enable ssize_t on MinGW -#ifdef __GNUC__ - #ifdef __MINGW32__ - #include - #endif -#endif - // disable float-equal warnings on GCC/clang #if defined(__clang__) || defined(__GNUC__) || defined(__GNUG__) #pragma GCC diagnostic push #pragma GCC diagnostic ignored "-Wfloat-equal" #endif -// enable ssize_t for MSVC -#ifdef _MSC_VER - #include - using ssize_t = SSIZE_T; -#endif - /*! @brief namespace for Niels Lohmann @see https://github.com/nlohmann @@ -7983,9 +7970,9 @@ basic_json_parser_63: return; } - const ssize_t offset_start = m_start - m_content; - const ssize_t offset_marker = m_marker - m_start; - const ssize_t offset_cursor = m_cursor - m_start; + const std::ptrdiff_t offset_start = m_start - m_content; + const std::ptrdiff_t offset_marker = m_marker - m_start; + const std::ptrdiff_t offset_cursor = m_cursor - m_start; m_buffer.erase(0, static_cast(offset_start)); std::string line; diff --git a/src/json.hpp.re2c b/src/json.hpp.re2c index 292e4587..2e25bdcf 100644 --- a/src/json.hpp.re2c +++ b/src/json.hpp.re2c @@ -34,25 +34,12 @@ Licensed under the MIT License . #include #include -// enable ssize_t on MinGW -#ifdef __GNUC__ - #ifdef __MINGW32__ - #include - #endif -#endif - // disable float-equal warnings on GCC/clang #if defined(__clang__) || defined(__GNUC__) || defined(__GNUG__) #pragma GCC diagnostic push #pragma GCC diagnostic ignored "-Wfloat-equal" #endif -// enable ssize_t for MSVC -#ifdef _MSC_VER - #include - using ssize_t = SSIZE_T; -#endif - /*! @brief namespace for Niels Lohmann @see https://github.com/nlohmann @@ -7293,9 +7280,9 @@ class basic_json return; } - const ssize_t offset_start = m_start - m_content; - const ssize_t offset_marker = m_marker - m_start; - const ssize_t offset_cursor = m_cursor - m_start; + const std::ptrdiff_t offset_start = m_start - m_content; + const std::ptrdiff_t offset_marker = m_marker - m_start; + const std::ptrdiff_t offset_cursor = m_cursor - m_start; m_buffer.erase(0, static_cast(offset_start)); std::string line; From a831c787df2215eb3d062b7b9179966662829206 Mon Sep 17 00:00:00 2001 From: Niels Date: Wed, 10 Feb 2016 21:19:31 +0100 Subject: [PATCH 2/2] try to replace std::ptrdiff_t with auto (for #204) --- 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 2abaa93d..5a51ef31 100644 --- a/src/json.hpp +++ b/src/json.hpp @@ -7970,9 +7970,9 @@ basic_json_parser_63: return; } - const std::ptrdiff_t offset_start = m_start - m_content; - const std::ptrdiff_t offset_marker = m_marker - m_start; - const std::ptrdiff_t offset_cursor = m_cursor - m_start; + const auto offset_start = m_start - m_content; + const auto offset_marker = m_marker - m_start; + const auto offset_cursor = m_cursor - m_start; m_buffer.erase(0, static_cast(offset_start)); std::string line; diff --git a/src/json.hpp.re2c b/src/json.hpp.re2c index 2e25bdcf..dcd7b7ec 100644 --- a/src/json.hpp.re2c +++ b/src/json.hpp.re2c @@ -7280,9 +7280,9 @@ class basic_json return; } - const std::ptrdiff_t offset_start = m_start - m_content; - const std::ptrdiff_t offset_marker = m_marker - m_start; - const std::ptrdiff_t offset_cursor = m_cursor - m_start; + const auto offset_start = m_start - m_content; + const auto offset_marker = m_marker - m_start; + const auto offset_cursor = m_cursor - m_start; m_buffer.erase(0, static_cast(offset_start)); std::string line;