Skip to content

Commit

Permalink
- bug-fix: avoid infinite-loop in mapToDymolaVars
Browse files Browse the repository at this point in the history
git-svn-id: https://openmodelica.org/svn/OpenModelica/trunk@13139 f25d12d1-65f4-0310-ae8a-bbce733d8d8e
  • Loading branch information
lochel committed Oct 2, 2012
1 parent 76a8dc2 commit c6f6ab1
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions SimulationRuntime/c/simulation/solver/initialization.c
Original file line number Diff line number Diff line change
Expand Up @@ -533,6 +533,9 @@ char* mapToDymolaVars(const char* varname)
if(newVarname[pos] == '.')
break;

if(pos == 3)
break;

memcpy((void*)newVarname, (const void*)(newVarname+4), (pos-3)*sizeof(char));
memcpy((void*)(newVarname+pos-3), (const void*)"der(", 4*sizeof(char));
}
Expand Down Expand Up @@ -675,8 +678,7 @@ static int importStartValues(DATA *data, const char* pInitFile, double initTime)
*
* \author lochel
*/
int initialization(DATA *data, const char* pInitMethod, const char* pOptiMethod,
const char* pInitFile, double initTime)
int initialization(DATA *data, const char* pInitMethod, const char* pOptiMethod, const char* pInitFile, double initTime)
{
int initMethod = IIM_STATE; /* default method */
int optiMethod = IOM_NELDER_MEAD_EX; /* default method */
Expand Down

0 comments on commit c6f6ab1

Please sign in to comment.