Skip to content

Commit

Permalink
- Do not do mk_scon() on a MetaModelica-style string ;)
Browse files Browse the repository at this point in the history
git-svn-id: https://openmodelica.org/svn/OpenModelica/trunk@10634 f25d12d1-65f4-0310-ae8a-bbce733d8d8e
  • Loading branch information
sjoelund committed Dec 2, 2011
1 parent 9168366 commit c9a746e
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions c_runtime/meta/realString.c
Expand Up @@ -78,7 +78,7 @@ exponent(char *p0, int expo)
* Does not check for inf/NaN in the default mode since realString
* handles them in a more efficient manner (static data, no allocation)
*/
static char * dtostr(double d)
static void* dtostr(double d)
{
const int prec = 16 /* 1 more than mathematically relevant */;
int signflag,i,totalsz;
Expand Down Expand Up @@ -129,6 +129,7 @@ static char * dtostr(double d)
}
retval = mmc_mk_scon_len(totalsz);
res = MMC_STRINGDATA(retval);
*res = '\0';

if (signflag) *res++ = '-';
if (expt == ndig) {
Expand Down Expand Up @@ -191,7 +192,7 @@ modelica_string realString(modelica_real r)
return MMC_REFSTRINGLIT(_OMC_LIT_POS_INF);
else if (isnan(r))
return MMC_REFSTRINGLIT(_OMC_LIT_NAN);
return mmc_mk_scon(dtostr(r));
return dtostr(r);
}

#ifdef REAL_STRING_TEST_MAIN
Expand Down

0 comments on commit c9a746e

Please sign in to comment.