Skip to content

Commit

Permalink
Fix stringUpdateStringChar by writing the 0-char at the end...
Browse files Browse the repository at this point in the history
git-svn-id: https://openmodelica.org/svn/OpenModelica/trunk@19945 f25d12d1-65f4-0310-ae8a-bbce733d8d8e
  • Loading branch information
sjoelund committed Apr 3, 2014
1 parent 5e17f81 commit a6c53f6
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions SimulationRuntime/c/meta/meta_modelica_builtin.c
Expand Up @@ -374,7 +374,7 @@ modelica_metatype boxptr_stringUpdateStringChar(threadData_t *threadData,metamod

MMC_CHECK_STRING(str);
MMC_CHECK_STRING(c);
/* fprintf(stderr, "stringUpdateStringChar(%s,%s,%ld)\n", anyString(str),anyString(c),ix); */
/* fprintf(stderr, "stringUpdateStringChar(%s,%s,%ld)\n", MMC_STRINGDATA(str),MMC_STRINGDATA(c),ix); */

if (ix < 1 || MMC_STRLEN(c) != 1)
MMC_THROW_INTERNAL();
Expand All @@ -383,7 +383,7 @@ modelica_metatype boxptr_stringUpdateStringChar(threadData_t *threadData,metamod
MMC_THROW_INTERNAL();
p = (struct mmc_string *) mmc_alloc_words_atomic(nwords);
p->header = header;
memcpy(p->data, MMC_STRINGDATA(str), length);
memcpy(p->data, MMC_STRINGDATA(str), length+1 /* include NULL */);
p->data[ix-1] = MMC_STRINGDATA(c)[0];
res = MMC_TAGPTR(p);
MMC_CHECK_STRING(res);
Expand Down

0 comments on commit a6c53f6

Please sign in to comment.