Skip to content

json: fix vajson shadow/sign-conversion warnings - #690

Merged
4og merged 1 commit into
eclipse-score:mainfrom
mihajlo-k:mk_fix_compiler_warnings
Oct 15, 2026
Merged

4og merged 1 commit into
eclipse-score:mainfrom
mihajlo-k:mk_fix_compiler_warnings

Conversation

@mihajlo-k

@mihajlo-k mihajlo-k commented Oct 14, 2026 •

Copy link
Copy Markdown
Contributor
  • In JsonOps::ReadExactly the lambda passed to and_then declared a local result while an enclosing local of the same name was in scope. Rename the inner one to read_result.
  • In JsonData::Restore, static_cast<std::streampos> does not suppress -Wsign-conversion, because std::streampos is the class std::fpos<std::mbstate_t>: the unsigned-to-signed conversion happens implicitly on its std::streamoff constructor argument, where the explicit cast gives no cover. Cast to std::streamoff directly, which is what the two-argument seekg overload takes anyway, and which also drops a pointless fpos round-trip. The value is already range-checked against std::int64_t above the call.
  • Enable COMPILER_WARNING_FEATURES on vajson_impl

Fixes #686

@github-actions

Copy link
Copy Markdown
Contributor

Documentation preview for this pull request is available at:
pr-690: https://eclipse-score.github.io/baselibs/pr-690/

@mihajlo-k
mihajlo-k force-pushed the mk_fix_compiler_warnings branch from f818abc to 8f8cbfe Compare October 14, 2026 19:53
@github-actions github-actions Bot added the bazel Bazel and Starlark build files label Oct 14, 2026
In `JsonOps::ReadExactly` the lambda passed to and_then declared a local
`result` while an enclosing local of the same name was in scope. Rename
the inner one to `read_result`.

In `JsonData::Restore`, `static_cast<std::streampos>` does not suppress
`-Wsign-conversion`, because `std::streampos` is the class
`std::fpos<std::mbstate_t>`: the unsigned-to-signed conversion happens
implicitly on its `std::streamoff` constructor argument, where the
explicit cast gives no cover. Cast to `std::streamoff` directly, which
is what the two-argument `seekg` overload takes anyway, and which also
drops a pointless `fpos` round-trip. The value is already range-checked
against `std::int64_t` above the call.

Enable COMPILER_WARNING_FEATURES on vajson_impl.

Fixes eclipse-score#686
@mihajlo-k
mihajlo-k force-pushed the mk_fix_compiler_warnings branch from 8f8cbfe to 0798860 Compare October 15, 2026 10:09
@mihajlo-k
mihajlo-k temporarily deployed to workflow-approval October 15, 2026 10:09 — with GitHub Actions Inactive
@mihajlo-k
mihajlo-k temporarily deployed to workflow-approval October 15, 2026 10:09 — with GitHub Actions Inactive
@mihajlo-k
mihajlo-k temporarily deployed to workflow-approval October 15, 2026 10:09 — with GitHub Actions Inactive
@mihajlo-k
mihajlo-k temporarily deployed to workflow-approval October 15, 2026 10:09 — with GitHub Actions Inactive
@mihajlo-k
mihajlo-k temporarily deployed to workflow-approval October 15, 2026 10:09 — with GitHub Actions Inactive
@4og
4og requested a balanced review from Copilot October 15, 2026 10:33
@github-project-automation github-project-automation Bot moved this from In Progress to On Hold in BAS - Baselibs FT Oct 15, 2026

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

🟢 Approval recommended

The changes are narrowly scoped, preserve existing behavior, and have no identified blocking issues.

0 open findings

What changed in this PR

Fixes vajson compiler warnings reported in #686 and enables the repository’s compiler warning features.

Changes:

  • Renames a shadowing local variable in ReadExactly.
  • Casts the seek offset directly to std::streamoff.
  • Enables COMPILER_WARNING_FEATURES for vajson_impl.
File Description
score/​json/​internal/​parser/​vajson/​vajson_impl/​reader/​json_data.cpp Fixes the sign-conversion warning.
score/​json/​internal/​parser/​vajson/​vajson_impl/​reader/​internal/​json_ops.cpp Removes local-variable shadowing.
score/​json/​internal/​parser/​vajson/​vajson_impl/​BUILD Enables compiler warning features.

🧠 Review effort: Balanced


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

@4og
4og enabled auto-merge October 15, 2026 10:41
@4og
4og added this pull request to the merge queue Oct 15, 2026
Merged via the queue into eclipse-score:main with commit 8535148 Oct 15, 2026
28 of 29 checks passed
@github-project-automation github-project-automation Bot moved this from On Hold to Done in BAS - Baselibs FT Oct 15, 2026

This branch was previously deployed

1 inactive deployment
workflow-approval — 07988608 Deployed Oct 15, 2026 by mihajlo-k via Approval (fork PRs only) #45
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bazel Bazel and Starlark build files c++ C++ code comp-json Related to score/json component

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

Shadow and sign conversion warnings in vajson

3 participants