Refactor code and declaration more local

This commit is contained in:
GermanAizek 2021-01-04 23:54:14 +03:00 committed by Lukas Dürrenberger
parent a262636590
commit 9029118536
6 changed files with 7 additions and 6 deletions

View File

@ -39,7 +39,7 @@ namespace priv
////////////////////////////////////////////////////////////
bool SoundFileWriterFlac::check(const std::string& filename)
{
std::string extension = filename.substr(filename.find_last_of(".") + 1);
std::string extension = filename.substr(filename.find_last_of('.') + 1);
std::transform(extension.begin(), extension.end(), extension.begin(), ::tolower);
return extension == "flac";

View File

@ -40,7 +40,7 @@ namespace priv
////////////////////////////////////////////////////////////
bool SoundFileWriterOgg::check(const std::string& filename)
{
std::string extension = filename.substr(filename.find_last_of(".") + 1);
std::string extension = filename.substr(filename.find_last_of('.') + 1);
std::transform(extension.begin(), extension.end(), extension.begin(), ::tolower);
return extension == "ogg";

View File

@ -77,7 +77,7 @@ namespace priv
////////////////////////////////////////////////////////////
bool SoundFileWriterWav::check(const std::string& filename)
{
std::string extension = filename.substr(filename.find_last_of(".") + 1);
std::string extension = filename.substr(filename.find_last_of('.') + 1);
std::transform(extension.begin(), extension.end(), extension.begin(), ::tolower);
return extension == "wav";

View File

@ -366,7 +366,7 @@ Ftp::Response Ftp::sendCommand(const std::string& command, const std::string& pa
{
// Build the command string
std::string commandStr;
if (parameter != "")
if (!parameter.empty())
commandStr = command + " " + parameter + "\r\n";
else
commandStr = command + "\r\n";

View File

@ -327,7 +327,7 @@ void Http::setHost(const std::string& host, unsigned short port)
{
// HTTPS protocol -- unsupported (requires encryption and certificates and stuff...)
err() << "HTTPS protocol is not supported by sf::Http" << std::endl;
m_hostName = "";
m_hostName.clear();
m_port = 0;
}
else

View File

@ -181,7 +181,6 @@ void WindowImpl::processJoystickEvents()
// Copy the previous state of the joystick and get the new one
JoystickState previousState = m_joystickStates[i];
m_joystickStates[i] = JoystickManager::getInstance().getState(i);
JoystickCaps caps = JoystickManager::getInstance().getCapabilities(i);
// Connection state
bool connected = m_joystickStates[i].connected;
@ -199,6 +198,8 @@ void WindowImpl::processJoystickEvents()
if (connected)
{
JoystickCaps caps = JoystickManager::getInstance().getCapabilities(i);
// Axes
for (unsigned int j = 0; j < Joystick::AxisCount; ++j)
{