summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorAndrei Karas <akaras@inbox.ru>2017-02-14 20:34:06 +0300
committerAndrei Karas <akaras@inbox.ru>2017-02-14 20:59:26 +0300
commitbdec92381ef60cd027292ed63e254e8de70028d9 (patch)
treeebf2722cdc9fe7383a709ba1584432a491cf10ba /src
parent5283a59db971ec2038149bf26ad9b3cbc4924449 (diff)
downloadplus-bdec92381ef60cd027292ed63e254e8de70028d9.tar.gz
plus-bdec92381ef60cd027292ed63e254e8de70028d9.tar.bz2
plus-bdec92381ef60cd027292ed63e254e8de70028d9.tar.xz
plus-bdec92381ef60cd027292ed63e254e8de70028d9.zip
In virtfs replace parameters type from char* to std::string.
Diffstat (limited to 'src')
-rw-r--r--src/dirs.cpp12
-rw-r--r--src/game.cpp2
-rw-r--r--src/gui/theme.cpp16
-rw-r--r--src/gui/windows/minimap.cpp4
-rw-r--r--src/resources/atlas/atlasmanager.cpp2
-rw-r--r--src/resources/loaders/imageloader.cpp2
-rw-r--r--src/resources/loaders/musicloader.cpp2
-rw-r--r--src/resources/loaders/soundloader.cpp2
-rw-r--r--src/resources/mapreader.cpp2
-rw-r--r--src/resources/wallpaper.cpp10
-rw-r--r--src/soundmanager.cpp2
-rw-r--r--src/utils/files.cpp14
-rw-r--r--src/utils/translation/poparser.cpp2
-rw-r--r--src/utils/virtfs.cpp39
-rw-r--r--src/utils/virtfs.h16
-rw-r--r--src/utils/virtfsrwops.cpp12
-rw-r--r--src/utils/virtfsrwops.h10
-rw-r--r--src/utils/virtfstools.cpp8
18 files changed, 81 insertions, 76 deletions
diff --git a/src/dirs.cpp b/src/dirs.cpp
index e64a54cbc..c1cd3ac49 100644
--- a/src/dirs.cpp
+++ b/src/dirs.cpp
@@ -488,9 +488,9 @@ void Dirs::initUpdatesDir()
const std::string updateDir("/" + settings.updatesDir);
// Verify that the updates directory exists. Create if necessary.
- if (!VirtFs::isDirectory(updateDir.c_str()))
+ if (!VirtFs::isDirectory(updateDir))
{
- if (!VirtFs::mkdir(updateDir.c_str()))
+ if (!VirtFs::mkdir(updateDir))
{
#if defined WIN32
std::string newDir = settings.localDataDir +
@@ -525,10 +525,10 @@ void Dirs::initUpdatesDir()
}
const std::string updateLocal = updateDir + "/local";
const std::string updateFix = updateDir + "/fix";
- if (!VirtFs::isDirectory(updateLocal.c_str()))
- VirtFs::mkdir(updateLocal.c_str());
- if (!VirtFs::isDirectory(updateFix.c_str()))
- VirtFs::mkdir(updateFix.c_str());
+ if (!VirtFs::isDirectory(updateLocal))
+ VirtFs::mkdir(updateLocal);
+ if (!VirtFs::isDirectory(updateFix))
+ VirtFs::mkdir(updateFix);
}
void Dirs::initScreenshotDir()
diff --git a/src/game.cpp b/src/game.cpp
index 69bf2fd9c..4d4ece3fe 100644
--- a/src/game.cpp
+++ b/src/game.cpp
@@ -1055,7 +1055,7 @@ void Game::changeMap(const std::string &mapPath)
std::string realFullMap = paths.getValue("maps", "maps/").append(
MapDB::getMapName(mMapName)).append(".tmx");
- if (!VirtFs::exists(realFullMap.c_str()))
+ if (!VirtFs::exists(realFullMap))
realFullMap.append(".gz");
// Attempt to load the new map
diff --git a/src/gui/theme.cpp b/src/gui/theme.cpp
index 96f09d324..0c3d80a50 100644
--- a/src/gui/theme.cpp
+++ b/src/gui/theme.cpp
@@ -65,8 +65,8 @@ static void initDefaultThemePath()
defaultThemePath = branding.getStringValue("guiThemePath");
logger->log("defaultThemePath: " + defaultThemePath);
- if (!defaultThemePath.empty() && VirtFs::isDirectory(
- defaultThemePath.c_str()))
+ if (!defaultThemePath.empty() &&
+ VirtFs::isDirectory(defaultThemePath))
{
return;
}
@@ -398,7 +398,7 @@ Skin *Theme::readSkin(const std::string &filename, const bool full)
return nullptr;
const std::string path = resolveThemePath(filename);
- if (!VirtFs::exists(path.c_str()))
+ if (!VirtFs::exists(path))
return nullptr;
XML::Document *const doc = Loader::getXml(path,
UseResman_true,
@@ -551,7 +551,7 @@ bool Theme::tryThemePath(const std::string &themeName)
if (!themeName.empty())
{
const std::string path = defaultThemePath + themeName;
- if (VirtFs::exists(path.c_str()))
+ if (VirtFs::exists(path))
{
mThemePath = path;
mThemeName = themeName;
@@ -583,8 +583,8 @@ void Theme::fillSoundsList(StringVect &list)
FOR_EACH (StringVectCIter, i, skins->names)
{
- if (!VirtFs::isDirectory((
- branding.getStringValue("systemsounds") + *i).c_str()))
+ if (!VirtFs::isDirectory((branding.getStringValue(
+ "systemsounds") + *i)))
{
std::string str = *i;
if (findCutLast(str, ".ogg"))
@@ -638,14 +638,14 @@ std::string Theme::resolveThemePath(const std::string &path)
if (file.find('/') != std::string::npos)
{
// Might be a valid path already
- if (VirtFs::exists(file.c_str()))
+ if (VirtFs::exists(file))
return path;
}
// Try the theme
file = getThemePath().append("/").append(file);
- if (VirtFs::exists(file.c_str()))
+ if (VirtFs::exists(file))
return getThemePath().append("/").append(path);
// Backup
diff --git a/src/gui/windows/minimap.cpp b/src/gui/windows/minimap.cpp
index ce316b1eb..f19fb2239 100644
--- a/src/gui/windows/minimap.cpp
+++ b/src/gui/windows/minimap.cpp
@@ -180,14 +180,14 @@ void Minimap::setMap(const Map *const map)
std::string minimapName = map->getProperty("minimap");
- if (minimapName.empty() && VirtFs::exists(tempname.c_str()))
+ if (minimapName.empty() && VirtFs::exists(tempname))
minimapName = tempname;
if (minimapName.empty())
{
tempname = std::string("graphics/minimaps/").append(
map->getFilename()).append(".png");
- if (VirtFs::exists(tempname.c_str()))
+ if (VirtFs::exists(tempname))
minimapName = tempname;
}
diff --git a/src/resources/atlas/atlasmanager.cpp b/src/resources/atlas/atlasmanager.cpp
index 6a141df27..ef06c9527 100644
--- a/src/resources/atlas/atlasmanager.cpp
+++ b/src/resources/atlas/atlasmanager.cpp
@@ -149,7 +149,7 @@ void AtlasManager::loadImages(const StringVect &files,
path = path.substr(0, p);
}
- SDL_RWops *const rw = VirtFs::RWopsOpenRead(path.c_str());
+ SDL_RWops *const rw = VirtFs::RWopsOpenRead(path);
if (rw)
{
Image *const image = d ? surfaceImageHelper->load(rw, *d)
diff --git a/src/resources/loaders/imageloader.cpp b/src/resources/loaders/imageloader.cpp
index 16a5022c3..b4826238a 100644
--- a/src/resources/loaders/imageloader.cpp
+++ b/src/resources/loaders/imageloader.cpp
@@ -63,7 +63,7 @@ namespace
d = new Dye(path1.substr(p + 1));
path1 = path1.substr(0, p);
}
- SDL_RWops *const rw = VirtFs::RWopsOpenRead(path1.c_str());
+ SDL_RWops *const rw = VirtFs::RWopsOpenRead(path1);
if (!rw)
{
delete d;
diff --git a/src/resources/loaders/musicloader.cpp b/src/resources/loaders/musicloader.cpp
index 8c6f483db..62fde088b 100644
--- a/src/resources/loaders/musicloader.cpp
+++ b/src/resources/loaders/musicloader.cpp
@@ -46,7 +46,7 @@ namespace
return nullptr;
const ResourceLoader *const
rl = static_cast<const ResourceLoader *const>(v);
- SDL_RWops *const rw = VirtFs::RWopsOpenRead(rl->path.c_str());
+ SDL_RWops *const rw = VirtFs::RWopsOpenRead(rl->path);
if (!rw)
{
reportAlways("Physfs error: %s", VirtFs::getLastError());
diff --git a/src/resources/loaders/soundloader.cpp b/src/resources/loaders/soundloader.cpp
index a70d188fa..35a938f76 100644
--- a/src/resources/loaders/soundloader.cpp
+++ b/src/resources/loaders/soundloader.cpp
@@ -46,7 +46,7 @@ namespace
return nullptr;
const ResourceLoader *const
rl = static_cast<const ResourceLoader *const>(v);
- SDL_RWops *const rw = VirtFs::RWopsOpenRead(rl->path.c_str());
+ SDL_RWops *const rw = VirtFs::RWopsOpenRead(rl->path);
if (!rw)
{
reportAlways("Physfs error: %s", VirtFs::getLastError());
diff --git a/src/resources/mapreader.cpp b/src/resources/mapreader.cpp
index 414b87987..35081c7ba 100644
--- a/src/resources/mapreader.cpp
+++ b/src/resources/mapreader.cpp
@@ -1279,7 +1279,7 @@ void MapReader::updateMusic(Map *const map)
if (p != std::string::npos)
name = name.substr(0, p);
name.append(".ogg");
- if (VirtFs::exists(paths.getStringValue("music").append(name).c_str()))
+ if (VirtFs::exists(paths.getStringValue("music").append(name)))
map->setProperty("music", name);
}
diff --git a/src/resources/wallpaper.cpp b/src/resources/wallpaper.cpp
index 63a8d755c..397f29af5 100644
--- a/src/resources/wallpaper.cpp
+++ b/src/resources/wallpaper.cpp
@@ -55,21 +55,21 @@ static void initDefaultWallpaperPaths()
// Init the path
wallpaperPath = branding.getStringValue("wallpapersPath");
- if (wallpaperPath.empty() || !VirtFs::isDirectory(wallpaperPath.c_str()))
+ if (wallpaperPath.empty() || !VirtFs::isDirectory(wallpaperPath))
wallpaperPath = paths.getValue("wallpapers", "");
- if (wallpaperPath.empty() || !VirtFs::isDirectory(wallpaperPath.c_str()))
+ if (wallpaperPath.empty() || !VirtFs::isDirectory(wallpaperPath))
wallpaperPath = "graphics/images/";
// Init the default file
wallpaperFile = branding.getStringValue("wallpaperFile");
- if (!wallpaperFile.empty() && !VirtFs::isDirectory(wallpaperFile.c_str()))
+ if (!wallpaperFile.empty() && !VirtFs::isDirectory(wallpaperFile))
return;
else
wallpaperFile = paths.getValue("wallpaperFile", "");
- if (wallpaperFile.empty() || VirtFs::isDirectory(wallpaperFile.c_str()))
+ if (wallpaperFile.empty() || VirtFs::isDirectory(wallpaperFile))
wallpaperFile = "login_wallpaper.png";
}
@@ -91,6 +91,7 @@ void Wallpaper::loadWallpapers()
{
// First, get the base filename of the image:
std::string filename = *i;
+ const std::string name = filename;
// If the backup file is found, we tell it.
if (filename.find(wallpaperFile) != std::string::npos)
haveBackup = true;
@@ -105,7 +106,6 @@ void Wallpaper::loadWallpapers()
separator = filename.find('%');
if (separator == std::string::npos)
{
- std::string name = filename;
// Then, append the width and height search mask.
filename.append("_%10dx%10d.png");
diff --git a/src/soundmanager.cpp b/src/soundmanager.cpp
index 026a987ed..940c51451 100644
--- a/src/soundmanager.cpp
+++ b/src/soundmanager.cpp
@@ -325,7 +325,7 @@ static SDLMusic *loadMusic(const std::string &fileName,
const SkipError skipError)
{
const std::string path = paths.getStringValue("music").append(fileName);
- if (!VirtFs::exists(path.c_str()))
+ if (!VirtFs::exists(path))
{
if (skipError == SkipError_false)
reportAlways("Music file not found: %s", fileName.c_str());
diff --git a/src/utils/files.cpp b/src/utils/files.cpp
index 57964f2f3..b2cba4c52 100644
--- a/src/utils/files.cpp
+++ b/src/utils/files.cpp
@@ -53,10 +53,10 @@ void Files::extractLocale()
FOR_EACH (StringVectCIter, i, rootDirs->names)
{
const std::string dir = std::string("locale/").append(*i);
- if (VirtFs::isDirectory(dir.c_str()))
+ if (VirtFs::isDirectory(dir))
{
const std::string moFile = dir + "/LC_MESSAGES/manaplus.mo";
- if (VirtFs::exists((moFile).c_str()))
+ if (VirtFs::exists((moFile)))
{
const std::string localFile = localDir + moFile;
const std::string localDir2 = localDir + dir + "/LC_MESSAGES";
@@ -114,7 +114,7 @@ void Files::copyPhysFsDir(const std::string &restrict inDir,
{
const std::string file = std::string(inDir).append("/").append(*i);
const std::string outDir2 = std::string(outDir).append("/").append(*i);
- if (VirtFs::isDirectory(file.c_str()))
+ if (VirtFs::isDirectory(file))
copyPhysFsDir(file, outDir2);
else
copyPhysFsFile(file, outDir2);
@@ -214,7 +214,7 @@ void Files::getFiles(const std::string &path, StringVect &list)
VirtList *const fonts = VirtFs::enumerateFiles(path);
FOR_EACH (StringVectCIter, i, fonts->names)
{
- if (!VirtFs::isDirectory((path + *i).c_str()))
+ if (!VirtFs::isDirectory(path + *i))
list.push_back(*i);
}
VirtFs::freeList(fonts);
@@ -225,7 +225,7 @@ void Files::getDirs(const std::string &path, StringVect &list)
VirtList *const fonts = VirtFs::enumerateFiles(path);
FOR_EACH (StringVectCIter, i, fonts->names)
{
- if (VirtFs::isDirectory((path + *i).c_str()))
+ if (VirtFs::isDirectory(path + *i))
list.push_back(*i);
}
VirtFs::freeList(fonts);
@@ -236,7 +236,7 @@ void Files::getFilesWithDir(const std::string &path, StringVect &list)
VirtList *const fonts = VirtFs::enumerateFiles(path);
FOR_EACH (StringVectCIter, i, fonts->names)
{
- if (!VirtFs::isDirectory((path + *i).c_str()))
+ if (!VirtFs::isDirectory(path + *i))
list.push_back(path + *i);
}
VirtFs::freeList(fonts);
@@ -256,7 +256,7 @@ bool Files::existsLocal(const std::string &path)
std::string Files::getPath(const std::string &file)
{
// get the real path to the file
- const char *const tmp = VirtFs::getRealDir(file.c_str());
+ const char *const tmp = VirtFs::getRealDir(file);
std::string path;
// if the file is not in the search path, then its nullptr
diff --git a/src/utils/translation/poparser.cpp b/src/utils/translation/poparser.cpp
index 7aaca2349..1bd051b48 100644
--- a/src/utils/translation/poparser.cpp
+++ b/src/utils/translation/poparser.cpp
@@ -262,7 +262,7 @@ PoDict *PoParser::getEmptyDict()
bool PoParser::checkLang(const std::string &lang)
{
// check is po file exists
- return VirtFs::exists(getFileName(lang).c_str());
+ return VirtFs::exists(getFileName(lang));
}
std::string PoParser::getFileName(const std::string &lang)
diff --git a/src/utils/virtfs.cpp b/src/utils/virtfs.cpp
index 6b87f87e9..5fcb568d3 100644
--- a/src/utils/virtfs.cpp
+++ b/src/utils/virtfs.cpp
@@ -39,18 +39,18 @@ const char *dirSeparator = nullptr;
namespace VirtFs
{
#if defined(__native_client__)
- void init(const char *restrict const name A_UNUSED)
+ void init(const std::string &restrict name A_UNUSED)
{
if (!PHYSFS_init("/fakebinary"))
#elif defined(ANDROID)
- void init(const char *restrict const name A_UNUSED)
+ void init(const std::string &restrict name A_UNUSED)
{
if (!PHYSFS_init((getRealPath(".").append("/fakebinary")).c_str()))
#else // defined(__native_client__)
- void init(const char *restrict const name)
+ void init(const std::string &restrict name)
{
- if (!PHYSFS_init(name))
+ if (!PHYSFS_init(name.c_str()))
#endif // defined(__native_client__)
{
std::cout << "Error while initializing PhysFS: "
@@ -81,9 +81,9 @@ namespace VirtFs
return PHYSFS_getUserDir();
}
- bool exists(const char *restrict const fname)
+ bool exists(const std::string &restrict name)
{
- return PHYSFS_exists(fname);
+ return PHYSFS_exists(name.c_str());
}
VirtList *enumerateFiles(const std::string &restrict dir)
@@ -101,9 +101,9 @@ namespace VirtFs
return files;
}
- bool isDirectory(const char *restrict const fname)
+ bool isDirectory(const std::string &restrict name)
{
- return PHYSFS_isDirectory(fname);
+ return PHYSFS_isDirectory(name.c_str());
}
void freeList(VirtList *restrict const handle)
@@ -111,9 +111,10 @@ namespace VirtFs
delete handle;
}
- VirtFile *openRead(const char *restrict const filename)
+ VirtFile *openRead(const std::string &restrict filename)
{
- PHYSFS_file *restrict const handle = PHYSFS_openRead(filename);
+ PHYSFS_file *restrict const handle = PHYSFS_openRead(
+ filename.c_str());
if (!handle)
return nullptr;
VirtFile *restrict const file = new VirtFile;
@@ -121,9 +122,10 @@ namespace VirtFs
return file;
}
- VirtFile *openWrite(const char *restrict const filename)
+ VirtFile *openWrite(const std::string &restrict filename)
{
- PHYSFS_file *restrict const handle = PHYSFS_openWrite(filename);
+ PHYSFS_file *restrict const handle = PHYSFS_openWrite(
+ filename.c_str());
if (!handle)
return nullptr;
VirtFile *restrict const file = new VirtFile;
@@ -131,9 +133,10 @@ namespace VirtFs
return file;
}
- VirtFile *openAppend(const char *restrict const filename)
+ VirtFile *openAppend(const std::string &restrict filename)
{
- PHYSFS_file *restrict const handle = PHYSFS_openAppend(filename);
+ PHYSFS_file *restrict const handle = PHYSFS_openAppend(
+ filename.c_str());
if (!handle)
return nullptr;
VirtFile *restrict const file = new VirtFile;
@@ -194,14 +197,14 @@ namespace VirtFs
return PHYSFS_removeFromSearchPath(oldDir.c_str());
}
- const char *getRealDir(const char *restrict const filename)
+ const char *getRealDir(const std::string &restrict filename)
{
- return PHYSFS_getRealDir(filename);
+ return PHYSFS_getRealDir(filename.c_str());
}
- bool mkdir(const char *restrict const dirname)
+ bool mkdir(const std::string &restrict dirname)
{
- return PHYSFS_mkdir(dirname);
+ return PHYSFS_mkdir(dirname.c_str());
}
bool deinit()
diff --git a/src/utils/virtfs.h b/src/utils/virtfs.h
index 5888d52eb..4f4471ad0 100644
--- a/src/utils/virtfs.h
+++ b/src/utils/virtfs.h
@@ -32,18 +32,18 @@ struct VirtList;
namespace VirtFs
{
- void init(const char *restrict const name);
+ void init(const std::string &restrict name);
void updateDirSeparator();
const char *getDirSeparator();
const char *getBaseDir();
const char *getUserDir();
- bool exists(const char *restrict const fname);
+ bool exists(const std::string &restrict name);
VirtList *enumerateFiles(const std::string &restrict dir) RETURNS_NONNULL;
- bool isDirectory(const char *restrict const fname);
+ bool isDirectory(const std::string &restrict name);
void freeList(VirtList *restrict const handle);
- VirtFile *openRead(const char *restrict const filename);
- VirtFile *openWrite(const char *restrict const filename);
- VirtFile *openAppend(const char *restrict const filename);
+ VirtFile *openRead(const std::string &restrict filename);
+ VirtFile *openWrite(const std::string &restrict filename);
+ VirtFile *openAppend(const std::string &restrict filename);
bool setWriteDir(const std::string &restrict newDir);
bool addDirToSearchPath(const std::string &restrict newDir,
const Append append);
@@ -51,8 +51,8 @@ namespace VirtFs
bool addZipToSearchPath(const std::string &restrict newDir,
const Append append);
bool removeZipFromSearchPath(const std::string &restrict oldDir);
- const char *getRealDir(const char *restrict const filename);
- bool mkdir(const char *restrict const dirName);
+ const char *getRealDir(const std::string &restrict filename);
+ bool mkdir(const std::string &restrict dirName);
bool deinit();
void permitLinks(const bool val);
const char *getLastError();
diff --git a/src/utils/virtfsrwops.cpp b/src/utils/virtfsrwops.cpp
index ade942385..837704465 100644
--- a/src/utils/virtfsrwops.cpp
+++ b/src/utils/virtfsrwops.cpp
@@ -343,9 +343,9 @@ SDL_RWops *VirtFs::MakeRWops(VirtFile *const handle)
} /* RWopsmakeRWops */
#ifdef __APPLE__
-static bool checkFilePath(const char *const fname)
+static bool checkFilePath(const std::string &restrict fname)
{
- if (!fname || !*fname)
+ if (fname.empty())
return false;
if (!VirtFs::exists(fname) || VirtFs::isDirectory(fname))
return false;
@@ -355,11 +355,11 @@ static bool checkFilePath(const char *const fname)
#ifdef DEBUG_VIRTFS
#undef RWopsOpenRead
-SDL_RWops *VirtFs::RWopsOpenRead(const char *const fname,
+SDL_RWops *VirtFs::RWopsOpenRead(const std::string &restrict fname,
const char *restrict const file,
const unsigned line)
#else // DEBUG_VIRTFS
-SDL_RWops *VirtFs::RWopsOpenRead(const char *const fname)
+SDL_RWops *VirtFs::RWopsOpenRead(const std::string &restrict fname)
#endif // DEBUG_VIRTFS
{
BLOCK_START("RWopsopenRead")
@@ -399,7 +399,7 @@ SDL_RWops *VirtFs::RWopsOpenRead(const char *const fname)
#endif // USE_PROFILER
} /* RWopsopenRead */
-SDL_RWops *VirtFs::RWopsOpenWrite(const char *const fname)
+SDL_RWops *VirtFs::RWopsOpenWrite(const std::string &restrict fname)
{
#ifdef __APPLE__
if (!checkFilePath(fname))
@@ -409,7 +409,7 @@ SDL_RWops *VirtFs::RWopsOpenWrite(const char *const fname)
return create_rwops(VirtFs::openWrite(fname));
} /* RWopsopenWrite */
-SDL_RWops *VirtFs::RWopsOpenAppend(const char *const fname)
+SDL_RWops *VirtFs::RWopsOpenAppend(const std::string &restrict fname)
{
#ifdef __APPLE__
if (!checkFilePath(fname))
diff --git a/src/utils/virtfsrwops.h b/src/utils/virtfsrwops.h
index 5a8871377..82bb740de 100644
--- a/src/utils/virtfsrwops.h
+++ b/src/utils/virtfsrwops.h
@@ -47,6 +47,7 @@
#include "localconsts.h"
+#include <string>
#include <SDL_rwops.h>
struct VirtFile;
@@ -54,16 +55,17 @@ struct VirtFile;
namespace VirtFs
{
#ifdef DEBUG_VIRTFS
- SDL_RWops *RWopsOpenRead(const char *const fname,
+ SDL_RWops *RWopsOpenRead(const std::string &restrict fname,
const char *restrict const file,
const unsigned line);
void reportLeaks();
#else // DEBUG_VIRTFS
- SDL_RWops *RWopsOpenRead(const char *const fname);
+ SDL_RWops *RWopsOpenRead(const std::string &restrict fname);
#endif // DEBUG_VIRTFS
- SDL_RWops *RWopsOpenWrite(const char *const fname) A_WARN_UNUSED;
- SDL_RWops *RWopsOpenAppend(const char *const fname) A_WARN_UNUSED;
+ SDL_RWops *RWopsOpenWrite(const std::string &restrict fname) A_WARN_UNUSED;
+ SDL_RWops *RWopsOpenAppend(const std::string &restrict fname)
+ A_WARN_UNUSED;
SDL_RWops *MakeRWops(VirtFile *const handle) A_WARN_UNUSED;
#ifdef DUMP_LEAKED_RESOURCES
void reportRWops();
diff --git a/src/utils/virtfstools.cpp b/src/utils/virtfstools.cpp
index d804dfd41..0b87670bf 100644
--- a/src/utils/virtfstools.cpp
+++ b/src/utils/virtfstools.cpp
@@ -33,7 +33,7 @@ namespace VirtFs
int &restrict fileSize)
{
// Attempt to open the specified file using PhysicsFS
- VirtFile *restrict const file = VirtFs::openRead(fileName.c_str());
+ VirtFile *restrict const file = VirtFs::openRead(fileName);
if (!file)
{
@@ -44,7 +44,7 @@ namespace VirtFs
}
logger->log("Loaded %s/%s",
- VirtFs::getRealDir(fileName.c_str()),
+ VirtFs::getRealDir(fileName),
fileName.c_str());
fileSize = CAST_S32(VirtFs::fileLength(file));
@@ -71,7 +71,7 @@ namespace VirtFs
{
const std::string file = path + str;
const std::string realPath = std::string(
- VirtFs::getRealDir(file.c_str()));
+ VirtFs::getRealDir(file));
VirtFs::addZipToSearchPath(std::string(realPath).append(
dirSeparator).append(file), append);
}
@@ -92,7 +92,7 @@ namespace VirtFs
{
const std::string file = path + str;
const std::string realPath = std::string(
- VirtFs::getRealDir(file.c_str()));
+ VirtFs::getRealDir(file));
VirtFs::removeZipFromSearchPath(std::string(
realPath).append(
dirSeparator).append(