Skip to content

Conversation

@klausschuch
Copy link
Contributor

No description provided.

klausschuch and others added 30 commits March 5, 2025 19:39
filtered->PushBack(filtered, obj);
}
}

Check failure

Code scanning / CodeQL

Wrong type of arguments to formatting function High

This format specifier for type 'unsigned int' does not match the argument type 'unsigned long'.

Copilot Autofix

AI 10 months ago

To fix the problem, we need to update the format specifier in the mcx_log call to use %zu for size_t arguments. This ensures that the format specifier matches the type of the argument across all platforms.

  • Change the format specifier from %u to %zu for the pos and container->size arguments in the mcx_log call on line 479.
  • This change should be made in the file src/objects/ObjectContainer.c.
Suggested changeset 1
src/objects/ObjectContainer.c

Autofix patch

Autofix patch
Run the following command in your local git repository to apply this patch
cat << 'EOF' | git apply
diff --git a/src/objects/ObjectContainer.c b/src/objects/ObjectContainer.c
--- a/src/objects/ObjectContainer.c
+++ b/src/objects/ObjectContainer.c
@@ -478,3 +478,3 @@
     if (pos >= container->size) {
-        mcx_log(LOG_ERROR, "ObjectContainer: SetElementName: Position %u out of bounds, max is %u", pos, container->size);
+        mcx_log(LOG_ERROR, "ObjectContainer: SetElementName: Position %zu out of bounds, max is %zu", pos, container->size);
         return RETURN_ERROR;
EOF
@@ -478,3 +478,3 @@
if (pos >= container->size) {
mcx_log(LOG_ERROR, "ObjectContainer: SetElementName: Position %u out of bounds, max is %u", pos, container->size);
mcx_log(LOG_ERROR, "ObjectContainer: SetElementName: Position %zu out of bounds, max is %zu", pos, container->size);
return RETURN_ERROR;
Copilot is powered by AI and may make mistakes. Always verify output.
Unable to commit as this autofix suggestion is now outdated
filtered->PushBack(filtered, obj);
}
}

Check failure

Code scanning / CodeQL

Wrong type of arguments to formatting function High

This format specifier for type 'unsigned int' does not match the argument type 'unsigned long'.

Copilot Autofix

AI 10 months ago

To fix the problem, we need to update the format specifier in the mcx_log function call on line 479 to match the type of the container->size argument. Specifically, we should change %u to %lu to correctly handle the size_t type, which is typically defined as unsigned long.

  • Update the format specifier in the mcx_log function call on line 479 from %u to %lu.
  • Ensure that the change is made only in the relevant line to avoid altering existing functionality.
Suggested changeset 1
src/objects/ObjectContainer.c

Autofix patch

Autofix patch
Run the following command in your local git repository to apply this patch
cat << 'EOF' | git apply
diff --git a/src/objects/ObjectContainer.c b/src/objects/ObjectContainer.c
--- a/src/objects/ObjectContainer.c
+++ b/src/objects/ObjectContainer.c
@@ -478,3 +478,3 @@
     if (pos >= container->size) {
-        mcx_log(LOG_ERROR, "ObjectContainer: SetElementName: Position %u out of bounds, max is %u", pos, container->size);
+        mcx_log(LOG_ERROR, "ObjectContainer: SetElementName: Position %lu out of bounds, max is %lu", pos, container->size);
         return RETURN_ERROR;
EOF
@@ -478,3 +478,3 @@
if (pos >= container->size) {
mcx_log(LOG_ERROR, "ObjectContainer: SetElementName: Position %u out of bounds, max is %u", pos, container->size);
mcx_log(LOG_ERROR, "ObjectContainer: SetElementName: Position %lu out of bounds, max is %lu", pos, container->size);
return RETURN_ERROR;
Copilot is powered by AI and may make mistakes. Always verify output.
Unable to commit as this autofix suggestion is now outdated
@klausschuch klausschuch changed the base branch from main to performance_improvements March 5, 2025 18:52
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants