From 635a4fc3441be4f7040b0654a3ac8f9e305a70d4 Mon Sep 17 00:00:00 2001 From: Jonathan Dumaresq Date: Wed, 12 Dec 2018 16:33:25 -0500 Subject: [PATCH] use namespace std when possible. Change the name of private variable. --- include/nlohmann/detail/input/input_adapters.hpp | 8 ++++---- single_include/nlohmann/json.hpp | 8 ++++---- test/src/unit-testsuites.cpp | 10 +++++----- 3 files changed, 13 insertions(+), 13 deletions(-) diff --git a/include/nlohmann/detail/input/input_adapters.hpp b/include/nlohmann/detail/input/input_adapters.hpp index 98249774..3c097a6a 100644 --- a/include/nlohmann/detail/input/input_adapters.hpp +++ b/include/nlohmann/detail/input/input_adapters.hpp @@ -53,17 +53,17 @@ Input adapter for stdio file access. This adapter read only 1 byte and do not us class file_input_adapter : public input_adapter_protocol { public: - explicit file_input_adapter(FILE* file) noexcept - : file(file) + explicit file_input_adapter(std::FILE* f) noexcept + : m_file(f) {} std::char_traits::int_type get_character() noexcept override { - return fgetc(file); + return std::fgetc(m_file); } private: /// the file pointer to read from - FILE* file; + std::FILE* m_file; }; diff --git a/single_include/nlohmann/json.hpp b/single_include/nlohmann/json.hpp index 93ed2b24..781d6f14 100644 --- a/single_include/nlohmann/json.hpp +++ b/single_include/nlohmann/json.hpp @@ -2102,17 +2102,17 @@ Input adapter for stdio file access. This adapter read only 1 byte and do not us class file_input_adapter : public input_adapter_protocol { public: - explicit file_input_adapter(FILE* file) noexcept - : file(file) + explicit file_input_adapter(std::FILE* f) noexcept + : m_file(f) {} std::char_traits::int_type get_character() noexcept override { - return fgetc(file); + return std::fgetc(m_file); } private: /// the file pointer to read from - FILE* file; + std::FILE* m_file; }; diff --git a/test/src/unit-testsuites.cpp b/test/src/unit-testsuites.cpp index fe3e0175..9563b498 100644 --- a/test/src/unit-testsuites.cpp +++ b/test/src/unit-testsuites.cpp @@ -386,35 +386,35 @@ TEST_CASE("json.org examples") } SECTION("FILE 1.json") { - std::unique_ptr f(fopen("test/data/json.org/1.json", "r"), &fclose); + std::unique_ptr f(std::fopen("test/data/json.org/1.json", "r"), &std::fclose); json j; CHECK_NOTHROW(j.parse(f.get())); } SECTION("FILE 2.json") { - std::unique_ptr f(fopen("test/data/json.org/2.json", "r"), &fclose); + std::unique_ptr f(std::fopen("test/data/json.org/2.json", "r"), &std::fclose); json j; CHECK_NOTHROW(j.parse(f.get())); } SECTION("FILE 3.json") { - std::unique_ptr f(fopen("test/data/json.org/3.json", "r"), &fclose); + std::unique_ptr f(std::fopen("test/data/json.org/3.json", "r"), &std::fclose); json j; CHECK_NOTHROW(j.parse(f.get())); } SECTION("FILE 4.json") { - std::unique_ptr f(fopen("test/data/json.org/4.json", "r"), &fclose); + std::unique_ptr f(std::fopen("test/data/json.org/4.json", "r"), &std::fclose); json j; CHECK_NOTHROW(j.parse(f.get())); } SECTION("FILE 5.json") { - std::unique_ptr f(fopen("test/data/json.org/5.json", "r"), &fclose); + std::unique_ptr f(std::fopen("test/data/json.org/5.json", "r"), &std::fclose); json j; CHECK_NOTHROW(j.parse(f.get())); }