Skip to content

Commit

Permalink
Remove unnecessary std::string::c_str() calls
Browse files Browse the repository at this point in the history
  • Loading branch information
ChrisThrasher authored and eXpl0it3r committed Apr 6, 2023
1 parent 61aeff1 commit f5e6c67
Show file tree
Hide file tree
Showing 4 changed files with 5 additions and 5 deletions.
2 changes: 1 addition & 1 deletion src/SFML/Audio/SoundFileWriterOgg.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ bool SoundFileWriterOgg::open(const std::filesystem::path& filename, unsigned in
vorbis_analysis_init(&m_state, &m_vorbis);

// 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)
{
err() << "Failed to write ogg/vorbis file (cannot open file)\n" << formatDebugPathInfo(filename) << std::endl;
Expand Down
2 changes: 1 addition & 1 deletion src/SFML/Audio/SoundFileWriterWav.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ SoundFileWriterWav::~SoundFileWriterWav()
bool SoundFileWriterWav::open(const std::filesystem::path& filename, unsigned int sampleRate, unsigned int channelCount)
{
// Open the file
m_file.open(filename.c_str(), std::ios::binary);
m_file.open(filename, std::ios::binary);
if (!m_file)
{
err() << "Failed to open WAV sound file for writing\n" << formatDebugPathInfo(filename) << std::endl;
Expand Down
2 changes: 1 addition & 1 deletion src/SFML/Graphics/Shader.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ std::size_t getMaxTextureUnits()
// Read the contents of a file into an array of char
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)
{
file.seekg(0, std::ios_base::end);
Expand Down
4 changes: 2 additions & 2 deletions src/SFML/Network/Ftp.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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 (!response.isOk())
std::remove(filepath.string().c_str());
std::filesystem::remove(filepath);
}
}

Expand All @@ -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)
{
// 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)
return Response(Response::Status::InvalidFile);

Expand Down

0 comments on commit f5e6c67

Please sign in to comment.