Skip to content
This repository was archived by the owner on May 18, 2019. It is now read-only.

Commit 69f2571

Browse files
rfrankeOpenModelica-Hudson
authored andcommitted
Change int to size_t in FMU accessors
Belonging to [master]: - #1954
1 parent a33d4f3 commit 69f2571

File tree

1 file changed

+13
-13
lines changed

1 file changed

+13
-13
lines changed

Compiler/Template/CodegenFMUCpp.tpl

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -177,16 +177,16 @@ case SIMCODE(modelInfo=MODELINFO(__)) then
177177
virtual void initialize();
178178
179179
// getters for given value references
180-
virtual void getReal(const unsigned int vr[], int nvr, double value[]);
181-
virtual void getInteger(const unsigned int vr[], int nvr, int value[]);
182-
virtual void getBoolean(const unsigned int vr[], int nvr, int value[]);
183-
virtual void getString(const unsigned int vr[], int nvr, string value[]);
180+
virtual void getReal(const unsigned int vr[], size_t nvr, double value[]);
181+
virtual void getInteger(const unsigned int vr[], size_t nvr, int value[]);
182+
virtual void getBoolean(const unsigned int vr[], size_t nvr, int value[]);
183+
virtual void getString(const unsigned int vr[], size_t nvr, string value[]);
184184
185185
// setters for given value references
186-
virtual void setReal(const unsigned int vr[], int nvr, const double value[]);
187-
virtual void setInteger(const unsigned int vr[], int nvr, const int value[]);
188-
virtual void setBoolean(const unsigned int vr[], int nvr, const int value[]);
189-
virtual void setString(const unsigned int vr[], int nvr, const string value[]);
186+
virtual void setReal(const unsigned int vr[], size_t nvr, const double value[]);
187+
virtual void setInteger(const unsigned int vr[], size_t nvr, const int value[]);
188+
virtual void setBoolean(const unsigned int vr[], size_t nvr, const int value[]);
189+
virtual void setString(const unsigned int vr[], size_t nvr, const string value[]);
190190
};
191191

192192
/// create instance of <%modelShortName%>FMU
@@ -499,7 +499,7 @@ case MODELINFO(vars=SIMVARS(__)) then
499499
<%accessVarsFunctionFMU1(simCode, direction, modelShortName, "Integer", "int", "_pointerToIntVars")%>
500500
<%accessVarsFunctionFMU1(simCode, direction, modelShortName, "Boolean", "int", "_pointerToBoolVars")%>
501501

502-
void <%modelShortName%>FMU::<%direction%>String(const unsigned int vr[], int nvr, <%qualifier%> string value[]) {
502+
void <%modelShortName%>FMU::<%direction%>String(const unsigned int vr[], size_t nvr, <%qualifier%> string value[]) {
503503
}
504504
>>
505505
end accessFunctionsFMU1;
@@ -509,8 +509,8 @@ template accessVarsFunctionFMU1(SimCode simCode, String direction, String modelS
509509
::=
510510
let qualifier = if stringEq(direction, "set") then "const"
511511
<<
512-
void <%modelShortName%>FMU::<%direction%><%typeName%>(const unsigned int vr[], int nvr, <%qualifier%> <%typeImpl%> value[]) {
513-
for (int i = 0; i < nvr; i++)
512+
void <%modelShortName%>FMU::<%direction%><%typeName%>(const unsigned int vr[], size_t nvr, <%qualifier%> <%typeImpl%> value[]) {
513+
for (size_t i = 0; i < nvr; i++)
514514
{
515515
<%if stringEq(direction, "get") then
516516
'value[i] = <%arrayName%>[vr[i]];'
@@ -539,8 +539,8 @@ template accessVarsFunctionFMU2(SimCode simCode, String direction, String modelS
539539
::=
540540
let qualifier = if stringEq(direction, "set") then "const"
541541
<<
542-
void <%modelShortName%>FMU::<%direction%><%typeName%>(const unsigned int vr[], int nvr, <%qualifier%> <%typeImpl%> value[]) {
543-
for (int i = 0; i < nvr; i++, vr++, value++) {
542+
void <%modelShortName%>FMU::<%direction%><%typeName%>(const unsigned int vr[], size_t nvr, <%qualifier%> <%typeImpl%> value[]) {
543+
for (size_t i = 0; i < nvr; i++, vr++, value++) {
544544
// access variables and aliases in SimVars memory
545545
if (*vr < _dim<%typeName%>)
546546
<%if stringEq(direction, "get") then

0 commit comments

Comments
 (0)