summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorAndrei Karas <akaras@inbox.ru>2017-03-28 21:03:23 +0300
committerAndrei Karas <akaras@inbox.ru>2017-03-28 23:25:13 +0300
commit30df2c7248c2b58469aeb635a87a0ed978829c47 (patch)
tree0674f11b8f5450426cb5d7940aa203705e353702 /src
parent75a5173176adfc4bc417c10df137d9ea8d90d403 (diff)
downloadmanaplus-30df2c7248c2b58469aeb635a87a0ed978829c47.tar.gz
manaplus-30df2c7248c2b58469aeb635a87a0ed978829c47.tar.bz2
manaplus-30df2c7248c2b58469aeb635a87a0ed978829c47.tar.xz
manaplus-30df2c7248c2b58469aeb635a87a0ed978829c47.zip
Move Virtfs::loadFile into virtfs.cpp
Diffstat (limited to 'src')
-rw-r--r--src/fs/virtfs/virtfs.cpp29
-rw-r--r--src/fs/virtfs/virtfs.h2
-rw-r--r--src/fs/virtfs/virtfstools.cpp28
-rw-r--r--src/fs/virtfs/virtfstools.h2
-rw-r--r--src/utils/translation/translationmanager.cpp2
-rw-r--r--src/utils/xml/libxml.cpp2
-rw-r--r--src/utils/xml/pugixml.cpp2
-rw-r--r--src/utils/xml/tinyxml2.cpp2
8 files changed, 35 insertions, 34 deletions
diff --git a/src/fs/virtfs/virtfs.cpp b/src/fs/virtfs/virtfs.cpp
index bab10197d..b36ee5ddd 100644
--- a/src/fs/virtfs/virtfs.cpp
+++ b/src/fs/virtfs/virtfs.cpp
@@ -561,4 +561,33 @@ namespace VirtFs
{
return file->funcs->eof(file);
}
+
+ char *loadFile(const std::string &restrict fileName,
+ int &restrict fileSize)
+ {
+ // Attempt to open the specified file using PhysicsFS
+ VirtFile *restrict const file = VirtFs::openRead(fileName);
+
+ if (!file)
+ {
+ logger->log("Warning: Failed to load %s.",
+ fileName.c_str());
+ return nullptr;
+ }
+
+ logger->log("Loaded %s/%s",
+ VirtFs::getRealDir(fileName).c_str(),
+ fileName.c_str());
+
+ fileSize = CAST_S32(VirtFs::fileLength(file));
+ // Allocate memory and load the file
+ char *restrict const buffer = new char[fileSize];
+ if (fileSize > 0)
+ buffer[fileSize - 1] = 0;
+ VirtFs::read(file, buffer, 1, fileSize);
+ VirtFs::close(file);
+
+ return buffer;
+ }
+
} // namespace VirtFs
diff --git a/src/fs/virtfs/virtfs.h b/src/fs/virtfs/virtfs.h
index ed6b27a3d..a70e0347c 100644
--- a/src/fs/virtfs/virtfs.h
+++ b/src/fs/virtfs/virtfs.h
@@ -93,6 +93,8 @@ namespace VirtFs
bool mountDirSilent2(std::string newDir,
const Append append);
#endif // UNITTESTS
+ char *loadFile(const std::string &restrict fileName,
+ int &restrict fileSize);
} // namespace VirtFs
extern const char *dirSeparator;
diff --git a/src/fs/virtfs/virtfstools.cpp b/src/fs/virtfs/virtfstools.cpp
index c58f41b43..cc11f5022 100644
--- a/src/fs/virtfs/virtfstools.cpp
+++ b/src/fs/virtfs/virtfstools.cpp
@@ -36,34 +36,6 @@
namespace VirtFs
{
- char *loadFile(const std::string &restrict fileName,
- int &restrict fileSize)
- {
- // Attempt to open the specified file using PhysicsFS
- VirtFile *restrict const file = VirtFs::openRead(fileName);
-
- if (!file)
- {
- logger->log("Warning: Failed to load %s.",
- fileName.c_str());
- return nullptr;
- }
-
- logger->log("Loaded %s/%s",
- VirtFs::getRealDir(fileName).c_str(),
- fileName.c_str());
-
- fileSize = CAST_S32(VirtFs::fileLength(file));
- // Allocate memory and load the file
- char *restrict const buffer = new char[fileSize];
- if (fileSize > 0)
- buffer[fileSize - 1] = 0;
- VirtFs::read(file, buffer, 1, fileSize);
- VirtFs::close(file);
-
- return buffer;
- }
-
void searchAndAddArchives(const std::string &restrict path,
const std::string &restrict ext,
const Append append)
diff --git a/src/fs/virtfs/virtfstools.h b/src/fs/virtfs/virtfstools.h
index c9ff1d290..7ed9b7c66 100644
--- a/src/fs/virtfs/virtfstools.h
+++ b/src/fs/virtfs/virtfstools.h
@@ -29,8 +29,6 @@
namespace VirtFs
{
- char *loadFile(const std::string &restrict fileName,
- int &restrict fileSize);
void searchAndAddArchives(const std::string &restrict path,
const std::string &restrict ext,
const Append append);
diff --git a/src/utils/translation/translationmanager.cpp b/src/utils/translation/translationmanager.cpp
index 5f9b5d587..12c5519c4 100644
--- a/src/utils/translation/translationmanager.cpp
+++ b/src/utils/translation/translationmanager.cpp
@@ -20,7 +20,7 @@
#include "utils/translation/translationmanager.h"
-#include "fs/virtfs/virtfstools.h"
+#include "fs/virtfs/virtfs.h"
#include "utils/delete2.h"
#include "utils/stringutils.h"
diff --git a/src/utils/xml/libxml.cpp b/src/utils/xml/libxml.cpp
index 7abed4a09..ccb3aca39 100644
--- a/src/utils/xml/libxml.cpp
+++ b/src/utils/xml/libxml.cpp
@@ -24,7 +24,7 @@
#include "utils/xml/libxml.h"
-#include "fs/virtfs/virtfstools.h"
+#include "fs/virtfs/virtfs.h"
#include "utils/checkutils.h"
#include "utils/fuzzer.h"
diff --git a/src/utils/xml/pugixml.cpp b/src/utils/xml/pugixml.cpp
index a1ca7be70..1b5a3278e 100644
--- a/src/utils/xml/pugixml.cpp
+++ b/src/utils/xml/pugixml.cpp
@@ -24,7 +24,7 @@
#include "utils/xml/pugixml.h"
-#include "fs/virtfs/virtfstools.h"
+#include "fs/virtfs/virtfs.h"
#include "utils/checkutils.h"
#include "utils/delete2.h"
diff --git a/src/utils/xml/tinyxml2.cpp b/src/utils/xml/tinyxml2.cpp
index 7e2ef5ebb..c88930828 100644
--- a/src/utils/xml/tinyxml2.cpp
+++ b/src/utils/xml/tinyxml2.cpp
@@ -24,7 +24,7 @@
#include "utils/xml/tinyxml2.h"
-#include "fs/virtfs/virtfstools.h"
+#include "fs/virtfs/virtfs.h"
#include "utils/checkutils.h"
#include "utils/fuzzer.h"