Skip to content

Commit

Permalink
Fix Windows build. (#9723)
Browse files Browse the repository at this point in the history
  - Variable length arrays are not allowed by msvc.
  • Loading branch information
mahge committed Nov 18, 2022
1 parent b6a5256 commit 30e4565
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions OMCompiler/SimulationRuntime/c/util/utility.c
Expand Up @@ -314,10 +314,11 @@ extern modelica_string OpenModelica_uriToFilename_impl(threadData_t *threadData,

FILE_INFO info = omc_dummyFileInfo;
char buf[PATH_MAX];
char uribuf[MMC_STRLEN(uri_om)+1];
char *uri = uribuf;
modelica_string dir;

char* uri = (char*)omc_alloc_interface.malloc_atomic(sizeof(char) * (MMC_STRLEN(uri_om)+1));
strcpy(uri, MMC_STRINGDATA(uri_om));

modelica_string dir;
if (0==strncasecmp(uri, "modelica://", 11)) {
omc_stat_t stat_buf;
uri += 11;
Expand Down Expand Up @@ -394,6 +395,7 @@ extern modelica_string OpenModelica_uriToFilename_impl(threadData_t *threadData,
omc_assert(threadData, info, "Unknown URI schema: %s", MMC_STRINGDATA(uri_om));
MMC_THROW();
}

return uriToFilenameRegularPaths(uri_om, uri, buf, MMC_STRINGDATA(uri_om), resourcesDir);
}

Expand Down

0 comments on commit 30e4565

Please sign in to comment.