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.

chore(lint): compose Windows file times without ULARGE_INTEGER

Martin Vogele47d932c8921
diff --git a/internal/cbm/extract_usages.c b/internal/cbm/extract_usages.c
index 87de74a0f..b758fa15b 100644
--- a/internal/cbm/extract_usages.c
+++ b/internal/cbm/extract_usages.c
@@ -1467,8 +1467,7 @@ static TSNode paren_wrapped_direct_argument_site(TSNode node, TSNode parent, TST
* extra parent resolution. Walking up with ts_node_parent here instead
* costs one slow fallback per identifier in the file, which the linearity
* guard in test_extraction.c rightly rejects. */
- if (ts_node_is_null(parent) ||
- strcmp(ts_node_type(parent), "parenthesized_expression") != 0) {
+ if (ts_node_is_null(parent) || strcmp(ts_node_type(parent), "parenthesized_expression") != 0) {
return (TSNode){0};
}
TSNode site = node;
diff --git a/src/foundation/compat_fs.c b/src/foundation/compat_fs.c
index 2d40c5713..89a102a70 100644
--- a/src/foundation/compat_fs.c
+++ b/src/foundation/compat_fs.c
@@ -139,18 +139,20 @@ int cbm_path_info_utf8(const char *path, cbm_path_info_t *out) {
out->is_directory = (data.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY) != 0;
out->is_symlink = (data.dwFileAttributes & FILE_ATTRIBUTE_REPARSE_POINT) != 0;
out->is_regular = !out->is_directory && !out->is_symlink;
- ULARGE_INTEGER file_size;
- file_size.LowPart = data.nFileSizeLow;
- file_size.HighPart = data.nFileSizeHigh;
- out->size = (int64_t)file_size.QuadPart;
- ULARGE_INTEGER written;
- written.LowPart = data.ftLastWriteTime.dwLowDateTime;
- written.HighPart = data.ftLastWriteTime.dwHighDateTime;
+ /* Compose the 64-bit values arithmetically rather than through
+ * ULARGE_INTEGER. Writing .LowPart/.HighPart and reading .QuadPart is
+ * correct -- it is a union -- but cppcheck does not model that aliasing and
+ * reports all four halves as assigned-but-never-read. This form says the
+ * same thing without the union, so the checker needs no exception. */
+ uint64_t file_size = ((uint64_t)data.nFileSizeHigh << 32) | (uint64_t)data.nFileSizeLow;
+ out->size = (int64_t)file_size;
+ uint64_t written = ((uint64_t)data.ftLastWriteTime.dwHighDateTime << 32) |
+ (uint64_t)data.ftLastWriteTime.dwLowDateTime;
enum { NANOSECONDS_PER_WINDOWS_TICK = 100 };
const uint64_t windows_to_unix_ticks = UINT64_C(116444736000000000);
out->mtime_ns =
- written.QuadPart >= windows_to_unix_ticks
- ? (int64_t)((written.QuadPart - windows_to_unix_ticks) * NANOSECONDS_PER_WINDOWS_TICK)
+ written >= windows_to_unix_ticks
+ ? (int64_t)((written - windows_to_unix_ticks) * NANOSECONDS_PER_WINDOWS_TICK)
: 0;
return 0;
}
diff --git a/src/pipeline/pipeline.c b/src/pipeline/pipeline.c
index 32f2cc550..436d6e8e7 100644
--- a/src/pipeline/pipeline.c
+++ b/src/pipeline/pipeline.c
@@ -2191,8 +2191,7 @@ static bool db_sidecars_absent(const char *db_path) {
* failed rename can put it back. It is zeroed here and is only meaningful on a
* 0 return. */
static int prepare_publish_destination(const char *final_path, bool final_existed,
- bool backup_succeeded,
- cbm_replacement_prepare_t *prepared) {
+ bool backup_succeeded, cbm_replacement_prepare_t *prepared) {
memset(prepared, 0, sizeof(*prepared));
struct stat current_st;
bool final_exists_now = stat(final_path, &current_st) == 0;
@@ -2345,8 +2344,8 @@ int cbm_pipeline_run(cbm_pipeline_t *p) {
}
cbm_replacement_prepare_t prepared = {0};
- int prepare_rc = prepare_publish_destination(final_path, final_existed, backup_succeeded,
- &prepared);
+ int prepare_rc =
+ prepare_publish_destination(final_path, final_existed, backup_succeeded, &prepared);
if (prepare_rc != 0) {
cbm_log_error("pipeline.err", "phase", "publish", "path", final_path);
cleanup_staging_db(staging_path);
diff --git a/src/pipeline/pipeline_incremental.c b/src/pipeline/pipeline_incremental.c
index 1c97a6b1f..66531ebc7 100644
--- a/src/pipeline/pipeline_incremental.c
+++ b/src/pipeline/pipeline_incremental.c
@@ -906,7 +906,6 @@ static void incr_free_edge_capture(cbm_edge_capture_t *cap) {
/* ── Persist file hashes ─────────────────────────────────────────── */
-
/* ── Registry seed visitor ────────────────────────────────────────── */
/* Labels the full-index definition pass seeds into the registry