Skip to content

fix(sqlite-objstore): make hex-id buffer size a compile-time constant for MSVC - #24

Merged
gabewillen merged 1 commit into
mainfrom
fix/sqlite-objstore-win32-vla
Aug 18, 2026
Merged

gabewillen merged 1 commit into
mainfrom
fix/sqlite-objstore-win32-vla

Conversation

@gabewillen

Copy link
Copy Markdown
Contributor

Round 3 of the Windows port for the npm release of @augmem/cortext v1.3.3
(follow-up to PR #22 dirent and PR #23 unistd/fcntl). After those, both
Windows matrix jobs failed with:

backend_file.c(603,35): error C2057: expected constant expression
backend_file.c(603,15): error C2466: cannot allocate an array of constant size 0
backend_file.c(603,8): error C2133: 'hex_id': unknown size

MSVC C does not treat a static const size_t as a compile-time constant, so
char hex_id[kObjstoreIdHexChars + 1] is a VLA. This turns kObjstoreIdHexChars
into a #define of OBJSTORE_ID_SIZE * 2 (already a preprocessor constant).
No other const-sized stack arrays exist in the embedded objstore sources.

Copilot AI lite review requested due to automatic review settings August 18, 2026 00:47

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR fixes an MSVC C build failure in the embedded sqlite-objstore file backend by making the hex-ID buffer length a compile-time constant (avoiding MSVC treating a static const size_t as a non-constant and therefore producing a VLA error).

Changes:

  • Replace static const size_t kObjstoreIdHexChars with a preprocessor constant so char hex_id[kObjstoreIdHexChars + 1] is a true constant-sized stack array under MSVC C.

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

@gabewillen
gabewillen merged commit 1503d37 into main Aug 18, 2026
12 of 13 checks passed
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.

2 participants