Remove unnecessary std::string::c_str() calls

This commit is contained in:
Chris Thrasher 2023-01-31 14:49:40 -07:00 committed by Lukas Dürrenberger
parent 61aeff13c9
commit f5e6c67daf
4 changed files with 5 additions and 5 deletions

View File

@ -80,7 +80,7 @@ bool SoundFileWriterOgg::open(const std::filesystem::path& filename, unsigned in
vorbis_analysis_init(&m_state, &m_vorbis); vorbis_analysis_init(&m_state, &m_vorbis);
// Open the file after the vorbis setup is ok // Open the file after the vorbis setup is ok
m_file.open(filename.c_str(), std::ios::binary); m_file.open(filename, std::ios::binary);
if (!m_file) if (!m_file)
{ {
err() << "Failed to write ogg/vorbis file (cannot open file)\n" << formatDebugPathInfo(filename) << std::endl; err() << "Failed to write ogg/vorbis file (cannot open file)\n" << formatDebugPathInfo(filename) << std::endl;

View File

@ -86,7 +86,7 @@ SoundFileWriterWav::~SoundFileWriterWav()
bool SoundFileWriterWav::open(const std::filesystem::path& filename, unsigned int sampleRate, unsigned int channelCount) bool SoundFileWriterWav::open(const std::filesystem::path& filename, unsigned int sampleRate, unsigned int channelCount)
{ {
// Open the file // Open the file
m_file.open(filename.c_str(), std::ios::binary); m_file.open(filename, std::ios::binary);
if (!m_file) if (!m_file)
{ {
err() << "Failed to open WAV sound file for writing\n" << formatDebugPathInfo(filename) << std::endl; err() << "Failed to open WAV sound file for writing\n" << formatDebugPathInfo(filename) << std::endl;

View File

@ -79,7 +79,7 @@ std::size_t getMaxTextureUnits()
// Read the contents of a file into an array of char // Read the contents of a file into an array of char
bool getFileContents(const std::filesystem::path& filename, std::vector<char>& buffer) bool getFileContents(const std::filesystem::path& filename, std::vector<char>& buffer)
{ {
std::ifstream file(filename.c_str(), std::ios_base::binary); std::ifstream file(filename, std::ios_base::binary);
if (file) if (file)
{ {
file.seekg(0, std::ios_base::end); file.seekg(0, std::ios_base::end);

View File

@ -310,7 +310,7 @@ Ftp::Response Ftp::download(const std::filesystem::path& remoteFile, const std::
// If the download was unsuccessful, delete the partial file // If the download was unsuccessful, delete the partial file
if (!response.isOk()) if (!response.isOk())
std::remove(filepath.string().c_str()); std::filesystem::remove(filepath);
} }
} }
@ -322,7 +322,7 @@ Ftp::Response Ftp::download(const std::filesystem::path& remoteFile, const std::
Ftp::Response Ftp::upload(const std::string& localFile, const std::string& remotePath, TransferMode mode, bool append) Ftp::Response Ftp::upload(const std::string& localFile, const std::string& remotePath, TransferMode mode, bool append)
{ {
// Get the contents of the file to send // Get the contents of the file to send
std::ifstream file(localFile.c_str(), std::ios_base::binary); std::ifstream file(localFile, std::ios_base::binary);
if (!file) if (!file)
return Response(Response::Status::InvalidFile); return Response(Response::Status::InvalidFile);