Commit 635a4fc3 authored by Jonathan Dumaresq's avatar Jonathan Dumaresq

use namespace std when possible. Change the name of private variable.

parent cf31193d
...@@ -53,17 +53,17 @@ Input adapter for stdio file access. This adapter read only 1 byte and do not us ...@@ -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 class file_input_adapter : public input_adapter_protocol
{ {
public: public:
explicit file_input_adapter(FILE* file) noexcept explicit file_input_adapter(std::FILE* f) noexcept
: file(file) : m_file(f)
{} {}
std::char_traits<char>::int_type get_character() noexcept override std::char_traits<char>::int_type get_character() noexcept override
{ {
return fgetc(file); return std::fgetc(m_file);
} }
private: private:
/// the file pointer to read from /// the file pointer to read from
FILE* file; std::FILE* m_file;
}; };
......
...@@ -2102,17 +2102,17 @@ Input adapter for stdio file access. This adapter read only 1 byte and do not us ...@@ -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 class file_input_adapter : public input_adapter_protocol
{ {
public: public:
explicit file_input_adapter(FILE* file) noexcept explicit file_input_adapter(std::FILE* f) noexcept
: file(file) : m_file(f)
{} {}
std::char_traits<char>::int_type get_character() noexcept override std::char_traits<char>::int_type get_character() noexcept override
{ {
return fgetc(file); return std::fgetc(m_file);
} }
private: private:
/// the file pointer to read from /// the file pointer to read from
FILE* file; std::FILE* m_file;
}; };
......
...@@ -386,35 +386,35 @@ TEST_CASE("json.org examples") ...@@ -386,35 +386,35 @@ TEST_CASE("json.org examples")
} }
SECTION("FILE 1.json") SECTION("FILE 1.json")
{ {
std::unique_ptr<FILE, decltype(&fclose)> f(fopen("test/data/json.org/1.json", "r"), &fclose); std::unique_ptr<std::FILE, decltype(&std::fclose)> f(std::fopen("test/data/json.org/1.json", "r"), &std::fclose);
json j; json j;
CHECK_NOTHROW(j.parse(f.get())); CHECK_NOTHROW(j.parse(f.get()));
} }
SECTION("FILE 2.json") SECTION("FILE 2.json")
{ {
std::unique_ptr<FILE, decltype(&fclose)> f(fopen("test/data/json.org/2.json", "r"), &fclose); std::unique_ptr<std::FILE, decltype(&std::fclose)> f(std::fopen("test/data/json.org/2.json", "r"), &std::fclose);
json j; json j;
CHECK_NOTHROW(j.parse(f.get())); CHECK_NOTHROW(j.parse(f.get()));
} }
SECTION("FILE 3.json") SECTION("FILE 3.json")
{ {
std::unique_ptr<FILE, decltype(&fclose)> f(fopen("test/data/json.org/3.json", "r"), &fclose); std::unique_ptr<std::FILE, decltype(&std::fclose)> f(std::fopen("test/data/json.org/3.json", "r"), &std::fclose);
json j; json j;
CHECK_NOTHROW(j.parse(f.get())); CHECK_NOTHROW(j.parse(f.get()));
} }
SECTION("FILE 4.json") SECTION("FILE 4.json")
{ {
std::unique_ptr<FILE, decltype(&fclose)> f(fopen("test/data/json.org/4.json", "r"), &fclose); std::unique_ptr<std::FILE, decltype(&std::fclose)> f(std::fopen("test/data/json.org/4.json", "r"), &std::fclose);
json j; json j;
CHECK_NOTHROW(j.parse(f.get())); CHECK_NOTHROW(j.parse(f.get()));
} }
SECTION("FILE 5.json") SECTION("FILE 5.json")
{ {
std::unique_ptr<FILE, decltype(&fclose)> f(fopen("test/data/json.org/5.json", "r"), &fclose); std::unique_ptr<std::FILE, decltype(&std::fclose)> f(std::fopen("test/data/json.org/5.json", "r"), &std::fclose);
json j; json j;
CHECK_NOTHROW(j.parse(f.get())); CHECK_NOTHROW(j.parse(f.get()));
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment