Skip to content

Commit

Permalink
- fix windows build, asprintf: These functions are GNU extensions, no…
Browse files Browse the repository at this point in the history
…t in C or POSIX.

git-svn-id: https://openmodelica.org/svn/OpenModelica/trunk@15078 f25d12d1-65f4-0310-ae8a-bbce733d8d8e
  • Loading branch information
Jens Frenkel committed Feb 6, 2013
1 parent 9943446 commit a89bed2
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion SimulationRuntime/c/simulation/simulation_info_xml.c
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
* ANY USE, REPRODUCTION OR DISTRIBUTION OF THIS PROGRAM CONSTITUTES
* RECIPIENT'S ACCEPTANCE OF THE OSMC PUBLIC LICENSE OR THE GPL VERSION 3,
* ACCORDING TO RECIPIENTS CHOICE.
*
*
* The OpenModelica software and the OSMC (Open Source Modelica Consortium)
* Public License (OSMC-PL) are obtained from OSMC, either from the above
* address, from the URLs: http://www.openmodelica.org or
Expand Down Expand Up @@ -81,7 +81,12 @@ static void XMLCALL endElement(void *userData, const char *name) {
return;
}
if (0==strcmp("nonlinear",name)) {
#if defined(__MINGW32__) || defined(_MSC_VER)
xml->equationInfo[curIndex].name = malloc(snprintf(NULL, 0, "Nonlinear function (residualFunc%d, size %d)", curIndex, xml->equationInfo[curIndex].numVar) + 1);
sprintf(&xml->equationInfo[curIndex].name, "Nonlinear function (residualFunc%d, size %d)", curIndex, xml->equationInfo[curIndex].numVar);
#else
asprintf(&xml->equationInfo[curIndex].name, "Nonlinear function (residualFunc%d, size %d)", curIndex, xml->equationInfo[curIndex].numVar);
#endif
xml->equationInfo[curIndex].profileBlockIndex = curProfileIndex;
((void**)userData)[2] = (void*) (curProfileIndex+1);
return;
Expand Down

0 comments on commit a89bed2

Please sign in to comment.