readability-implicit-bool-cast

This commit is contained in:
Daniel Chabrowski
2018-02-25 00:16:18 +01:00
parent fb6df0512f
commit 9ebb9ff318
3 changed files with 8 additions and 8 deletions

View File

@@ -46,7 +46,6 @@ public:
void open(const filename_t& fname, bool truncate = false)
{
close();
auto *mode = truncate ? SPDLOG_FILENAME_T("wb") : SPDLOG_FILENAME_T("ab");
_filename = fname;
@@ -76,7 +75,7 @@ public:
void close()
{
if (_fd)
if (_fd != nullptr)
{
std::fclose(_fd);
_fd = nullptr;
@@ -93,8 +92,9 @@ public:
size_t size() const
{
if (!_fd)
if (_fd == nullptr) {
throw spdlog_ex("Cannot use size() on closed file " + os::filename_to_str(_filename));
}
return os::filesize(_fd);
}

View File

@@ -170,7 +170,7 @@ inline void prevent_child_fd(FILE *f)
//fopen_s on non windows for writing
inline int fopen_s(FILE** fp, const filename_t& filename, const filename_t& mode)
inline bool fopen_s(FILE** fp, const filename_t& filename, const filename_t& mode)
{
#ifdef _WIN32
#ifdef SPDLOG_WCHAR_FILENAMES
@@ -482,9 +482,9 @@ inline bool in_terminal(FILE* file)
{
#ifdef _WIN32
return _isatty(_fileno(file)) ? true : false;
return _isatty(_fileno(file)) != 0;
#else
return isatty(fileno(file)) ? true : false;
return isatty(fileno(file)) != 0;
#endif
}
} //os