1
0
mirror of https://github.com/gnss-sdr/gnss-sdr synced 2024-12-15 20:50:33 +00:00

Fix some defects detected by Coverity Scan

This commit is contained in:
Carles Fernandez 2017-11-20 11:02:17 +01:00
parent c45c8f80af
commit 72be91ad1f

View File

@ -1895,12 +1895,13 @@ bool Gnuplot::get_program_path()
else else
{ {
std::list<std::string> ls; std::list<std::string> ls;
std::string path_str = path;
//split path (one long string) into list ls of strings //split path (one long string) into list ls of strings
#if defined(WIN32) || defined(_WIN32) || defined(__WIN32__) || defined(__TOS_WIN__) #if defined(WIN32) || defined(_WIN32) || defined(__WIN32__) || defined(__TOS_WIN__)
stringtok(ls,path,";"); stringtok(ls,path_str,";");
#elif defined(unix) || defined(__unix) || defined(__unix__) || defined(__APPLE__) #elif defined(unix) || defined(__unix) || defined(__unix__) || defined(__APPLE__)
stringtok(ls,path,":"); stringtok(ls,path_str,":");
#endif #endif
// scan list for Gnuplot program files // scan list for Gnuplot program files
@ -1921,10 +1922,8 @@ bool Gnuplot::get_program_path()
tmp = "Can't find gnuplot neither in PATH nor in \"" + tmp = "Can't find gnuplot neither in PATH nor in \"" +
Gnuplot::m_sGNUPlotPath + "\""; Gnuplot::m_sGNUPlotPath + "\"";
throw GnuplotException(tmp);
Gnuplot::m_sGNUPlotPath = ""; Gnuplot::m_sGNUPlotPath = "";
return false; throw GnuplotException(tmp);
} }
} }
@ -2046,7 +2045,6 @@ std::string Gnuplot::create_tmpfile(std::ofstream &tmp)
std::ostringstream except; std::ostringstream except;
except << "Cannot create temporary file \"" << name << "\""; except << "Cannot create temporary file \"" << name << "\"";
throw GnuplotException(except.str()); throw GnuplotException(except.str());
return "";
} }
// //
@ -2064,7 +2062,8 @@ void Gnuplot::remove_tmpfiles()
if ((tmpfile_list).size() > 0) if ((tmpfile_list).size() > 0)
{ {
for (unsigned int i = 0; i < tmpfile_list.size(); i++) for (unsigned int i = 0; i < tmpfile_list.size(); i++)
remove( tmpfile_list[i].c_str() ); if(remove( tmpfile_list[i].c_str() ) != 0)
std::cout << "Problem closing files" << std::endl;
Gnuplot::tmpfile_num -= tmpfile_list.size(); Gnuplot::tmpfile_num -= tmpfile_list.size();
} }