summaryrefslogtreecommitdiff
path: root/src/fs/virtfs
diff options
context:
space:
mode:
authorAndrei Karas <akaras@inbox.ru>2017-06-06 23:34:34 +0300
committerAndrei Karas <akaras@inbox.ru>2017-06-07 19:23:40 +0300
commit36ba43d6ea38062b17f7e63ef659962bfc51c64d (patch)
tree190156cb88b13a38a6d13c69ee0742cc078065a1 /src/fs/virtfs
parentf1518dd8476c968a43fa57cfb06198e290a4f77a (diff)
downloadmanaverse-36ba43d6ea38062b17f7e63ef659962bfc51c64d.tar.gz
manaverse-36ba43d6ea38062b17f7e63ef659962bfc51c64d.tar.bz2
manaverse-36ba43d6ea38062b17f7e63ef659962bfc51c64d.tar.xz
manaverse-36ba43d6ea38062b17f7e63ef659962bfc51c64d.zip
Fix clang-tidy check readability-implicit-bool-cast.
Diffstat (limited to 'src/fs/virtfs')
-rw-r--r--src/fs/virtfs/fsdir.cpp18
-rw-r--r--src/fs/virtfs/fsdirrwops.cpp8
-rw-r--r--src/fs/virtfs/fszip.cpp2
-rw-r--r--src/fs/virtfs/fsziprwops.cpp6
-rw-r--r--src/fs/virtfs/rwops.cpp4
-rw-r--r--src/fs/virtfs/tools.cpp8
6 files changed, 23 insertions, 23 deletions
diff --git a/src/fs/virtfs/fsdir.cpp b/src/fs/virtfs/fsdir.cpp
index c3b0d3c66..bc73771e7 100644
--- a/src/fs/virtfs/fsdir.cpp
+++ b/src/fs/virtfs/fsdir.cpp
@@ -198,9 +198,9 @@ namespace FsDir
dirName;
const struct dirent *next_file = nullptr;
DIR *const dir = opendir(path.c_str());
- if (dir)
+ if (dir != nullptr)
{
- while ((next_file = readdir(dir)))
+ while ((next_file = readdir(dir)) != nullptr)
{
const std::string file = next_file->d_name;
if (file == "." || file == "..")
@@ -457,7 +457,7 @@ namespace FsDir
}
const int64_t len = static_cast<int64_t>(statbuf.st_size);
#endif // USE_FILE_FOPEN
- return pos < 0 || len < 0 || pos >= len;
+ return static_cast<int>(pos < 0 || len < 0 || pos >= len);
}
const char *loadFile(FsEntry *restrict const entry,
@@ -531,9 +531,9 @@ namespace FsDir
dirName;
const struct dirent *next_file = nullptr;
DIR *const dir = opendir(path.c_str());
- if (dir)
+ if (dir != nullptr)
{
- while ((next_file = readdir(dir)))
+ while ((next_file = readdir(dir)) != nullptr)
{
struct stat statbuf;
const std::string file = next_file->d_name;
@@ -581,9 +581,9 @@ namespace FsDir
dirName;
const struct dirent *next_file = nullptr;
DIR *const dir = opendir(path.c_str());
- if (dir)
+ if (dir != nullptr)
{
- while ((next_file = readdir(dir)))
+ while ((next_file = readdir(dir)) != nullptr)
{
struct stat statbuf;
const std::string file = next_file->d_name;
@@ -631,9 +631,9 @@ namespace FsDir
dirName;
const struct dirent *next_file = nullptr;
DIR *const dir = opendir(path.c_str());
- if (dir)
+ if (dir != nullptr)
{
- while ((next_file = readdir(dir)))
+ while ((next_file = readdir(dir)) != nullptr)
{
struct stat statbuf;
const std::string file = next_file->d_name;
diff --git a/src/fs/virtfs/fsdirrwops.cpp b/src/fs/virtfs/fsdirrwops.cpp
index d0f9a3e6d..e77a4fc5f 100644
--- a/src/fs/virtfs/fsdirrwops.cpp
+++ b/src/fs/virtfs/fsdirrwops.cpp
@@ -37,7 +37,7 @@ namespace FsDir
const RWOPSINT offset,
const int whence)
{
- if (!rw)
+ if (rw == nullptr)
return -1;
File *const handle = static_cast<File *>(
rw->hidden.unknown.data1);
@@ -149,7 +149,7 @@ namespace FsDir
const RWOPSSIZE size,
const RWOPSSIZE maxnum)
{
- if (!rw)
+ if (rw == nullptr)
return 0;
File *const handle = static_cast<File *>(
rw->hidden.unknown.data1);
@@ -185,7 +185,7 @@ namespace FsDir
const RWOPSSIZE size,
const RWOPSSIZE maxnum)
{
- if (!rw)
+ if (rw == nullptr)
return 0;
File *const handle = static_cast<File *>(
rw->hidden.unknown.data1);
@@ -218,7 +218,7 @@ namespace FsDir
int rwops_close(SDL_RWops *const rw)
{
- if (!rw)
+ if (rw == nullptr)
return 0;
File *const handle = static_cast<File*>(
rw->hidden.unknown.data1);
diff --git a/src/fs/virtfs/fszip.cpp b/src/fs/virtfs/fszip.cpp
index d70df7749..43891c783 100644
--- a/src/fs/virtfs/fszip.cpp
+++ b/src/fs/virtfs/fszip.cpp
@@ -666,7 +666,7 @@ namespace FsZip
if (file == nullptr)
return -1;
- return file->mPos >= file->mSize;
+ return static_cast<int>(file->mPos >= file->mSize);
}
const char *loadFile(FsEntry *restrict const entry,
diff --git a/src/fs/virtfs/fsziprwops.cpp b/src/fs/virtfs/fsziprwops.cpp
index efe1c3670..739ad4d3a 100644
--- a/src/fs/virtfs/fsziprwops.cpp
+++ b/src/fs/virtfs/fsziprwops.cpp
@@ -38,7 +38,7 @@ namespace FsZip
const RWOPSINT offset,
const int whence)
{
- if (!rw)
+ if (rw == nullptr)
return -1;
File *const handle = static_cast<File *>(
rw->hidden.unknown.data1);
@@ -108,7 +108,7 @@ namespace FsZip
const RWOPSSIZE size,
const RWOPSSIZE maxnum)
{
- if (!rw)
+ if (rw == nullptr)
return 0;
File *const handle = static_cast<File *>(
rw->hidden.unknown.data1);
@@ -130,7 +130,7 @@ namespace FsZip
int rwops_close(SDL_RWops *const rw)
{
- if (!rw)
+ if (rw == nullptr)
return 0;
File *const handle = static_cast<File*>(
rw->hidden.unknown.data1);
diff --git a/src/fs/virtfs/rwops.cpp b/src/fs/virtfs/rwops.cpp
index 3a18d53c2..e6ff601b3 100644
--- a/src/fs/virtfs/rwops.cpp
+++ b/src/fs/virtfs/rwops.cpp
@@ -63,14 +63,14 @@ SDL_RWops *create_rwops(File *const file)
{
SDL_RWops *retval = nullptr;
- if (!file)
+ if (file == nullptr)
{
logger->assertLog("VirtFs::rwops_seek: create rwops error.");
}
else
{
retval = SDL_AllocRW();
- if (retval)
+ if (retval != nullptr)
{
#ifdef USE_SDL2
retval->size = file->funcs->rwops_size;
diff --git a/src/fs/virtfs/tools.cpp b/src/fs/virtfs/tools.cpp
index a5bf06097..7850d056b 100644
--- a/src/fs/virtfs/tools.cpp
+++ b/src/fs/virtfs/tools.cpp
@@ -47,7 +47,7 @@ namespace VirtFs
const size_t len = str.size();
if (len > ext.length() &&
- !ext.compare(str.substr(len - ext.length())))
+ (ext.compare(str.substr(len - ext.length())) == 0))
{
const std::string file = path + str;
const std::string realPath = VirtFs::getRealDir(file);
@@ -66,7 +66,7 @@ namespace VirtFs
const std::string str = *i;
const size_t len = str.size();
if (len > ext.length() &&
- !ext.compare(str.substr(len - ext.length())))
+ (ext.compare(str.substr(len - ext.length())) == 0))
{
const std::string file = path + str;
const std::string realPath = VirtFs::getRealDir(file);
@@ -122,7 +122,7 @@ namespace VirtFs
int contentsLength;
const char *fileContents = VirtFs::loadFile(fileName, contentsLength);
- if (!fileContents)
+ if (fileContents == nullptr)
{
logger->log("Couldn't load text file: %s", fileName.c_str());
return std::string();
@@ -138,7 +138,7 @@ namespace VirtFs
int contentsLength;
const char *fileContents = VirtFs::loadFile(fileName, contentsLength);
- if (!fileContents)
+ if (fileContents == nullptr)
{
logger->log("Couldn't load text file: %s", fileName.c_str());
return false;