summaryrefslogtreecommitdiff
path: root/src/fs/virtfs/virtfsdir.cpp
diff options
context:
space:
mode:
authorAndrei Karas <akaras@inbox.ru>2017-04-28 20:06:43 +0300
committerAndrei Karas <akaras@inbox.ru>2017-04-28 23:02:16 +0300
commit15919532c723ca0186b0c0c932cd1b90c7d2e570 (patch)
tree249673c7f5f06b2741826e12d7f69a9de379a52d /src/fs/virtfs/virtfsdir.cpp
parent515323530ba1b93c8d5ba00b015bf55aa0ecb01c (diff)
downloadmanaverse-15919532c723ca0186b0c0c932cd1b90c7d2e570.tar.gz
manaverse-15919532c723ca0186b0c0c932cd1b90c7d2e570.tar.bz2
manaverse-15919532c723ca0186b0c0c932cd1b90c7d2e570.tar.xz
manaverse-15919532c723ca0186b0c0c932cd1b90c7d2e570.zip
Fix code style.
Diffstat (limited to 'src/fs/virtfs/virtfsdir.cpp')
-rw-r--r--src/fs/virtfs/virtfsdir.cpp6
1 files changed, 4 insertions, 2 deletions
diff --git a/src/fs/virtfs/virtfsdir.cpp b/src/fs/virtfs/virtfsdir.cpp
index 223b45e1d..902e686c0 100644
--- a/src/fs/virtfs/virtfsdir.cpp
+++ b/src/fs/virtfs/virtfsdir.cpp
@@ -485,13 +485,15 @@ namespace VirtFsDir
if (fstat(fd, &statbuf) == -1)
{
reportAlways("VirtFsDir::fileLength error.");
- return -1;
+ if (fd != FILEHDEFAULT)
+ FILECLOSE(fd);
+ return nullptr;
}
fileSize = static_cast<int>(statbuf.st_size);
#endif // USE_FILE_FOPEN
// Allocate memory and load the file
- char *restrict const buffer = new char[fileSize];
+ char *restrict const buffer = new char[CAST_SIZE(fileSize)];
if (fileSize > 0)
buffer[fileSize - 1] = 0;