Skip to content

Commit

Permalink
-Fixed bug in System.trim
Browse files Browse the repository at this point in the history
git-svn-id: https://openmodelica.org/svn/OpenModelica/branches/MathCoreOSMC@3950 f25d12d1-65f4-0310-ae8a-bbce733d8d8e
  • Loading branch information
Peter Aronsson committed Mar 16, 2009
1 parent d73218e commit 30af5d3
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions Compiler/runtime/systemimpl.c
Expand Up @@ -533,12 +533,13 @@ RML_BEGIN_LABEL(System__trim)
start_pos++;
if(str_contain_char(chars_to_be_removed,res[end_pos]))
end_pos--;
if (start_pos == end_pos) break;
}


res[length] = '\0';
}
if(start_pos < end_pos)
if(start_pos <= end_pos)
{
res[end_pos+1] = '\0';
rmlA0 = (void*) mk_scon(&res[start_pos]);
Expand Down Expand Up @@ -2512,12 +2513,13 @@ RML_BEGIN_LABEL(System__trim)
start_pos++;
if(str_contain_char(chars_to_be_removed,res[end_pos]))
end_pos--;
if (start_pos == end_pos) break;
}


res[length] = '\0';
}
if(start_pos < end_pos)
if(start_pos <= end_pos)
{
res[end_pos+1] = '\0';
rmlA0 = (void*) mk_scon(&res[start_pos]);
Expand Down

0 comments on commit 30af5d3

Please sign in to comment.