Pasaeta de cppcheck, ale

This commit is contained in:
2024-10-22 09:24:19 +02:00
parent 1d0c2e01a5
commit 5df85e1b1a
28 changed files with 164 additions and 194 deletions

View File

@@ -86,14 +86,13 @@ bool loadOptionsFile(std::string file_path)
bool success = true;
// Variables para manejar el fichero
const std::string file_name = file_path.substr(file_path.find_last_of("\\/") + 1);
std::ifstream file(file_path);
// Si el fichero se puede abrir
if (file.good())
{
// Procesa el fichero linea a linea
std::cout << "Reading file: " << file_name << std::endl;
std::cout << "Reading file: " << getFileName(file_path) << std::endl;
std::string line;
while (std::getline(file, line))
{
@@ -105,14 +104,12 @@ bool loadOptionsFile(std::string file_path)
// Procesa las dos subcadenas
if (!setOptions(line.substr(0, pos), line.substr(pos + 1, line.length())))
{
std::cout << "Warning: file " << file_name << std::endl;
std::cout << "Warning: file " << getFileName(file_path) << std::endl;
std::cout << "Unknown parameter " << line.substr(0, pos).c_str() << std::endl;
success = false;
}
}
}
// Cierra el fichero
file.close();
}
@@ -146,16 +143,15 @@ bool loadOptionsFile(std::string file_path)
// Guarda el fichero de configuración
bool saveOptionsFile(std::string file_path)
{
const std::string file_name = file_path.substr(file_path.find_last_of("\\/") + 1);
std::ofstream file(file_path);
if (!file.good())
{
std::cout << file_name << " can't be opened" << std::endl;
std::cout << getFileName(file_path) << " can't be opened" << std::endl;
return false;
}
std::cout << "Writing file: " << file_name << std::endl;
std::cout << "Writing file: " << getFileName(file_path) << std::endl;
// Opciones de video
const auto value_video_mode_winow = std::to_string(static_cast<int>(ScreenVideoMode::WINDOW));