summaryrefslogtreecommitdiff
path: root/src/fs/virtfs/virtfs1_unittest.cc
diff options
context:
space:
mode:
authorAndrei Karas <akaras@inbox.ru>2017-03-29 18:31:00 +0300
committerAndrei Karas <akaras@inbox.ru>2017-03-29 18:31:00 +0300
commit7132f71cf010e4f13eb27c1a24d8878aa984b43f (patch)
tree330ad08a5ae15d0f4dc2d13461de1d5a47a69fe6 /src/fs/virtfs/virtfs1_unittest.cc
parentd9c0d1c3b2800b0c995393426b65a031203ca2f0 (diff)
downloadmanaplus-7132f71cf010e4f13eb27c1a24d8878aa984b43f.tar.gz
manaplus-7132f71cf010e4f13eb27c1a24d8878aa984b43f.tar.bz2
manaplus-7132f71cf010e4f13eb27c1a24d8878aa984b43f.tar.xz
manaplus-7132f71cf010e4f13eb27c1a24d8878aa984b43f.zip
Remove extra memory copy in VirtFs::loadFile.
Also add const into VirtFs::loadFile.
Diffstat (limited to 'src/fs/virtfs/virtfs1_unittest.cc')
-rw-r--r--src/fs/virtfs/virtfs1_unittest.cc14
1 files changed, 8 insertions, 6 deletions
diff --git a/src/fs/virtfs/virtfs1_unittest.cc b/src/fs/virtfs/virtfs1_unittest.cc
index ee8e97e3e..a48f9829c 100644
--- a/src/fs/virtfs/virtfs1_unittest.cc
+++ b/src/fs/virtfs/virtfs1_unittest.cc
@@ -1433,8 +1433,8 @@ TEST_CASE("VirtFs1 loadFile1")
VirtFs::mountDir(prefix + "data",
Append_false);
- char *const buffer = VirtFs::loadFile("test/test.txt", fileSize);
- REQUIRE(static_cast<void*>(buffer) != nullptr);
+ const char *const buffer = VirtFs::loadFile("test/test.txt", fileSize);
+ REQUIRE(static_cast<const void*>(buffer) != nullptr);
REQUIRE(fileSize == 23);
REQUIRE(strncmp(buffer, "test line 1\ntest line 2", 23) == 0);
delete [] buffer;
@@ -1459,8 +1459,9 @@ TEST_CASE("VirtFs1 loadFile2")
SECTION("test 1")
{
- char *restrict buffer = VirtFs::loadFile("dir2//test.txt", fileSize);
- REQUIRE(static_cast<void*>(buffer) != nullptr);
+ const char *restrict buffer = VirtFs::loadFile("dir2//test.txt",
+ fileSize);
+ REQUIRE(static_cast<const void*>(buffer) != nullptr);
REQUIRE(fileSize == 23);
REQUIRE(strncmp(buffer, "test line 1\ntest line 2", 23) == 0);
delete [] buffer;
@@ -1468,8 +1469,9 @@ TEST_CASE("VirtFs1 loadFile2")
SECTION("test 2")
{
- char *restrict buffer = VirtFs::loadFile("dir2\\/test.txt", fileSize);
- REQUIRE(static_cast<void*>(buffer) != nullptr);
+ const char *restrict buffer = VirtFs::loadFile("dir2\\/test.txt",
+ fileSize);
+ REQUIRE(static_cast<const void*>(buffer) != nullptr);
REQUIRE(fileSize == 23);
REQUIRE(strncmp(buffer, "test line 1\ntest line 2", 23) == 0);
delete [] buffer;