various static analyser bug fixes

This commit is contained in:
Scott Fennell 2018-09-26 14:27:03 -05:00
parent 53f3b308f5
commit a9f84d1d9f
3 changed files with 9 additions and 4 deletions

View File

@ -64,16 +64,19 @@ bool isInUserOrTrickCode( clang::CompilerInstance & ci , clang::SourceLocation s
std::string getFileName( clang::CompilerInstance & ci , clang::SourceLocation sl , HeaderSearchDirs & hsd ) {
clang::FileID fid = ci.getSourceManager().getFileID(sl) ;
std::string file_name;
char* resolved_path;
if ( ! fid.isInvalid() ) {
const clang::FileEntry * fe = ci.getSourceManager().getFileEntryForID(fid) ;
if ( fe != NULL ) {
char * resolved_path = almostRealPath( fe->getName() ) ;
if ( resolved_path != NULL and hsd.isPathInUserDir(resolved_path)) {
return std::string(resolved_path) ;
file_name.append(resolved_path);
}
free(resolved_path);
}
}
return std::string() ;
return file_name;
}
#include <iostream>

View File

@ -315,6 +315,7 @@ RK2MidpointGeneralizedStepSecondOrderODEIntegrator::integrate (
step_factor = 1.0;
break;
default:
step_factor = 1.0;
break;
}

View File

@ -26,14 +26,15 @@ void DeleteTblEntry(TBLENTRY * entry)
/* create an iterator */
StrMapIterator *SMI_Create(MapStrToPtr * pTable)
{
StrMapIterator *pIter = (StrMapIterator *) malloc(sizeof(StrMapIterator));
StrMapIterator *pIter;
if (pTable == NULL) {
fprintf(stderr, "Table is NULL");
return NULL;
}
pIter = (StrMapIterator *) malloc(sizeof(StrMapIterator));
pIter->m_pTable = pTable;
pIter->m_Index = 0; /* set the current index of the list array to 0 */
pIter->m_ListPos = NULL; /* set the position reference to null indicating there is not a current element */