Conversation
Note: This changes the type in Databus `origInfos` from `VectorChannelInfo` to `ChannelInfo`, but the uses of `DatabusGetOutVectorChannelInfo` haven't been updated. That means that this change breaks all components using `DatabusGetOutVectorChannelInfo`.
Previously, only local results were written in Initialize. This resulted in no timing data being written at startTime (i.e. the RTFactor results started at startTime + deltaTime).
When the step sizes are multiples of one another (sync and coupling), it is possible to use a bigger epsilon (half of the smaller step size) in order to push back the moment when components might fall out of sync due to floating point operation errors.
- do not flip dimensions from the asix file (dim0-major)
src/core/Databus.c
Outdated
| mcx_log(LOG_ERROR, "Ports: Read port infos: Could not read element specific data of port %zu", i); | ||
| return RETURN_ERROR; | ||
| } | ||
| mcx_log(LOG_ERROR, "Ports: Read port infos: Could not read element specific data of port %d", i); |
Check failure
Code scanning / CodeQL
Wrong type of arguments to formatting function High
Show autofix suggestion
Hide autofix suggestion
Copilot Autofix
AI 12 months ago
To fix the problem, we need to ensure that the format specifier matches the type of the variable i. Since i is of type size_t, the correct format specifier to use is %zu. This change will ensure that the printf function correctly interprets the bits of i as an unsigned long.
- Change the format specifier from
%dto%zuon line 351. - No additional methods, imports, or definitions are needed.
| @@ -350,3 +350,3 @@ | ||
| if (RETURN_ERROR == retVal) { | ||
| mcx_log(LOG_ERROR, "Ports: Read port infos: Could not read element specific data of port %d", i); | ||
| mcx_log(LOG_ERROR, "Ports: Read port infos: Could not read element specific data of port %zu", i); | ||
| goto cleanup; |
| mcx_os_fprintf(dotFile, " <table %s>\n", tableArgs); | ||
| for (j = 0; j < GetDependencyNumIn(A); j++) { | ||
| mcx_os_fprintf(dotFile, " <tr>\n"); | ||
| mcx_os_fprintf(dotFile, " <td port=\"in%zu\">%zu</td>\n", j, j); |
Check failure
Code scanning / CodeQL
Wrong type of arguments to formatting function High
Show autofix suggestion
Hide autofix suggestion
Copilot Autofix
AI 12 months ago
To fix the problem, we need to ensure that the format specifier matches the type of the argument. Since c->GetID(c) returns an unsigned long, we should use the format specifier %lu which is intended for unsigned long types.
- Change the format specifier from
%dto%luon line 1656. - Ensure that the argument passed to the format specifier is indeed of type
unsigned long.
| @@ -1655,3 +1655,3 @@ | ||
| mcx_os_fprintf(dotFile, " </tr>\n"); | ||
| mcx_os_fprintf(dotFile, "</table>>] comp%d;\n", c->GetID(c)); | ||
| mcx_os_fprintf(dotFile, "</table>>] comp%lu;\n", c->GetID(c)); | ||
| } |
| @@ -1457,7 +1567,7 @@ McxStatus PrintComponentGraph(Component * comp, | |||
| } | |||
Check failure
Code scanning / CodeQL
Wrong type of arguments to formatting function High
Show autofix suggestion
Hide autofix suggestion
Copilot Autofix
AI 12 months ago
To fix the problem, we need to ensure that the format specifier matches the type of the argument. Since j is of type unsigned long, we should use the %lu format specifier instead of %d. This change will ensure that the printf function correctly interprets the argument type, preventing undefined behavior.
| @@ -1670,3 +1670,3 @@ | ||
| mcx_os_fprintf(dotFile, " <tr>\n"); | ||
| mcx_os_fprintf(dotFile, " <td port=\"in%d\">%d</td>\n", j, j); | ||
| mcx_os_fprintf(dotFile, " <td port=\"in%lu\">%lu</td>\n", j, j); | ||
| mcx_os_fprintf(dotFile, " </tr>\n"); |
| @@ -1457,7 +1567,7 @@ McxStatus PrintComponentGraph(Component * comp, | |||
| } | |||
Check failure
Code scanning / CodeQL
Wrong type of arguments to formatting function High
Show autofix suggestion
Hide autofix suggestion
Copilot Autofix
AI 12 months ago
To fix the problem, we need to ensure that the format specifier matches the type of the argument being passed. In this case, the variable j is of type unsigned long, so we should use the %lu format specifier instead of %d. This change will ensure that the mcx_os_fprintf function correctly interprets the argument type and produces the expected output.
| @@ -1670,3 +1670,3 @@ | ||
| mcx_os_fprintf(dotFile, " <tr>\n"); | ||
| mcx_os_fprintf(dotFile, " <td port=\"in%d\">%d</td>\n", j, j); | ||
| mcx_os_fprintf(dotFile, " <td port=\"in%lu\">%lu</td>\n", j, j); | ||
| mcx_os_fprintf(dotFile, " </tr>\n"); |
| @@ -1499,14 +1609,14 @@ McxStatus PrintModelGraph(ObjectContainer * comps, Vector * conns, Component * i | |||
Check failure
Code scanning / CodeQL
Wrong type of arguments to formatting function High
Show autofix suggestion
Hide autofix suggestion
Copilot Autofix
AI 12 months ago
To fix the problem, we need to ensure that the format specifier matches the type of the argument being passed. In this case, the argument comps->Size(comps) + 1 is of type unsigned long, so we should use the %lu format specifier instead of %d. This change will ensure that the value is correctly interpreted and printed.
| @@ -1678,3 +1678,3 @@ | ||
| mcx_os_fprintf(dotFile, " </tr>\n"); | ||
| mcx_os_fprintf(dotFile, "</table>>] comp%d;\n", comps->Size(comps) + 1); | ||
| mcx_os_fprintf(dotFile, "</table>>] comp%lu;\n", comps->Size(comps) + 1); | ||
| } |
63c6e9b to
79a57c0
Compare
No description provided.