Skip to content

Local code intelligence for developers and AI agents. Connect code, docs and infrastructure in a persistent graph, with CBM Lens, MCP tools, agent integrations and change-aware test selection.

Fix cppcheck findings in distilled log + excluded summary (#411, #413)

Martin Vogel118c327ff7f4
diff --git a/src/foundation/log.c b/src/foundation/log.c
index eda658dba..011ee5d4f 100644
--- a/src/foundation/log.c
+++ b/src/foundation/log.c
@@ -27,7 +27,7 @@ void cbm_log_init_from_env(void) {
static const char *const names[] = {"debug", "info", "warn", "error", "none"};
char lower[8];
size_t i = 0;
- for (; raw[i] != '\0' && i < sizeof(lower) - 1; i++) {
+ for (; i < sizeof(lower) - 1 && raw[i] != '\0'; i++) {
lower[i] = (char)tolower((unsigned char)raw[i]);
}
lower[i] = '\0';
diff --git a/src/mcp/mcp.c b/src/mcp/mcp.c
index 0c939d5d6..26b232d20 100644
--- a/src/mcp/mcp.c
+++ b/src/mcp/mcp.c
@@ -2518,7 +2518,7 @@ static void add_excluded_summary(yyjson_mut_doc *doc, yyjson_mut_val *root, char
}
yyjson_mut_obj_add_val(doc, excluded, "dirs", dirs);
yyjson_mut_obj_add_int(doc, excluded, "count", excluded_count);
- yyjson_mut_obj_add_bool(doc, excluded, "truncated", excluded_count > shown);
+ yyjson_mut_obj_add_bool(doc, excluded, "truncated", excluded_count > INDEX_EXCLUDED_DIR_CAP);
yyjson_mut_obj_add_val(doc, root, "excluded", excluded);
}