Skip to content

[pull] master from sebi2k1:master#26

Open
pull[bot] wants to merge 75 commits into
stackriot:masterfrom
sebi2k1:master
Open

[pull] master from sebi2k1:master#26
pull[bot] wants to merge 75 commits into
stackriot:masterfrom
sebi2k1:master

Conversation

@pull
Copy link
Copy Markdown

@pull pull Bot commented Nov 5, 2022

See Commits and Changes for more details.


Created by pull[bot]

Can you help keep this open source service alive? 💖 Please sponsor : )

@pull pull Bot added the ⤵️ pull label Nov 5, 2022
sebi2k1 and others added 28 commits November 6, 2022 17:32
* huge progress porting to typescript and modernizing - still not done

* few more tweaks

* mode typing progress

* add node id to the node def

* add more typing

* code compiles

* fix unit tests

* switch URL back

* add .d.ts files for consuming projects

* refactored native code typing

* fix exports

* adjust function parameters

* lower node version

* remove @types/node

* added node  dep back

* fix parsing errors with Message producers

* attempt to tweak compilation for CICD

* provide default Value if none provided in kcd

* revert Value class back to Signal to keep changes API compatible with original code

* small tweaks

* make sure we publish everything we need

* huge progress porting to typescript and modernizing - still not done

* few more tweaks

* mode typing progress

* add node id to the node def

* add more typing

* code compiles

* fix unit tests

* switch URL back

* add .d.ts files for consuming projects

* refactored native code typing

* fix exports

* adjust function parameters

* lower node version

* remove @types/node

* added node  dep back

* fix parsing errors with Message producers

* attempt to tweak compilation for CICD

* provide default Value if none provided in kcd

* revert Value class back to Signal to keep changes API compatible with original code

* small tweaks

* make sure we publish everything we need

* update dependencies and tweak cicd

* refactored native type declarations

* upgrade dependencies

* fix parsing unit test

* mocha doesn't need to be globally installed

* tweak workflows

* removed some incorrectly installed dependencies

* make sure npm is up to date

* fix eslint config

* drop support for node 12.x, it is EOL

Co-authored-by: Joshua Chaitin-Pollak <josh@arcmotive.com>
Co-authored-by: Joshua Chaitin-Pollak <josh@arcmotive.com>
Co-authored-by: Joshua Chaitin-Pollak <josh@arcmotive.com>
Added symbol "fd_brs" (boolean). If set, the CANFD_BRS (defined in socket can kernel headers) is added to frameFD.flags when transmitting CANFD frame in SendFD method. As discussed with @sebi2k1, this new feature is available in native only for now (proper integration of KCD is separated).
Bumps [json5](https://github.com/json5/json5) from 2.2.1 to 2.2.3.
- [Release notes](https://github.com/json5/json5/releases)
- [Changelog](https://github.com/json5/json5/blob/main/CHANGELOG.md)
- [Commits](json5/json5@v2.2.1...v2.2.3)

---
updated-dependencies:
- dependency-name: json5
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <support@github.com>

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
New release after updating dependencies
Bumps [http-cache-semantics](https://github.com/kornelski/http-cache-semantics) from 4.1.0 to 4.1.1.
- [Release notes](https://github.com/kornelski/http-cache-semantics/releases)
- [Commits](kornelski/http-cache-semantics@v4.1.0...v4.1.1)

---
updated-dependencies:
- dependency-name: http-cache-semantics
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
* Fix #116 by referencing ambient declarations

* disable a few eslint rules

both of these rules are good in general, so I don't recommend disabling them, but in this case the triple-slash rule is incorrect for referencing .node files, and the `any` rule is too complicated to build a full type definition for just one use case.

---------

Co-authored-by: Joshua Chaitin-Pollak <josh@arcmotive.com>
Pump version to release fixes for library check and dependabot.
Bumps [xml2js](https://github.com/Leonidas-from-XIV/node-xml2js) from 0.4.23 to 0.5.0.
- [Release notes](https://github.com/Leonidas-from-XIV/node-xml2js/releases)
- [Commits](https://github.com/Leonidas-from-XIV/node-xml2js/commits/0.5.0)

---
updated-dependencies:
- dependency-name: xml2js
  dependency-type: direct:production
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Bumps [semver](https://github.com/npm/node-semver) from 6.3.0 to 6.3.1.
- [Release notes](https://github.com/npm/node-semver/releases)
- [Changelog](https://github.com/npm/node-semver/blob/v6.3.1/CHANGELOG.md)
- [Commits](npm/node-semver@v6.3.0...v6.3.1)

---
updated-dependencies:
- dependency-name: semver
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Bumps [word-wrap](https://github.com/jonschlinkert/word-wrap) from 1.2.3 to 1.2.4.
- [Release notes](https://github.com/jonschlinkert/word-wrap/releases)
- [Commits](jonschlinkert/word-wrap@1.2.3...1.2.4)

---
updated-dependencies:
- dependency-name: word-wrap
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
* add typescript usage

* minor

* Message from *can.node
dependabot Bot and others added 30 commits April 17, 2025 18:55
Bumps [serialize-javascript](https://github.com/yahoo/serialize-javascript) to 6.0.2 and updates ancestor dependency [mocha](https://github.com/mochajs/mocha). These dependencies need to be updated together.


Updates `serialize-javascript` from 6.0.0 to 6.0.2
- [Release notes](https://github.com/yahoo/serialize-javascript/releases)
- [Commits](yahoo/serialize-javascript@v6.0.0...v6.0.2)

Updates `mocha` from 10.1.0 to 10.8.2
- [Release notes](https://github.com/mochajs/mocha/releases)
- [Changelog](https://github.com/mochajs/mocha/blob/main/CHANGELOG.md)
- [Commits](mochajs/mocha@v10.1.0...v10.8.2)

---
updated-dependencies:
- dependency-name: serialize-javascript
  dependency-type: indirect
- dependency-name: mocha
  dependency-type: direct:development
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
* Add err boolean type to can.d.ts Message

* make optional for can DatabaseService.send
New release, updated mocha/json-serialize and incorporated two changes to allow listener on message-received event in database and additionally make err flag available in TS without additionally ts-ignore.
Bumps [brace-expansion](https://github.com/juliangruber/brace-expansion) from 1.1.11 to 1.1.12.
- [Release notes](https://github.com/juliangruber/brace-expansion/releases)
- [Commits](juliangruber/brace-expansion@1.1.11...v1.1.12)

---
updated-dependencies:
- dependency-name: brace-expansion
  dependency-version: 1.1.12
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Bumps [tar](https://github.com/isaacs/node-tar) to 7.5.9 and updates ancestor dependency [node-gyp](https://github.com/nodejs/node-gyp). These dependencies need to be updated together.


Updates `tar` from 6.2.1 to 7.5.9
- [Release notes](https://github.com/isaacs/node-tar/releases)
- [Changelog](https://github.com/isaacs/node-tar/blob/main/CHANGELOG.md)
- [Commits](isaacs/node-tar@v6.2.1...v7.5.9)

Updates `node-gyp` from 9.3.0 to 12.2.0
- [Release notes](https://github.com/nodejs/node-gyp/releases)
- [Changelog](https://github.com/nodejs/node-gyp/blob/main/CHANGELOG.md)
- [Commits](nodejs/node-gyp@v9.3.0...v12.2.0)

---
updated-dependencies:
- dependency-name: tar
  dependency-version: 7.5.9
  dependency-type: indirect
- dependency-name: node-gyp
  dependency-version: 12.2.0
  dependency-type: direct:production
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Bumps [js-yaml](https://github.com/nodeca/js-yaml) from 3.14.1 to 3.14.2.
- [Changelog](https://github.com/nodeca/js-yaml/blob/master/CHANGELOG.md)
- [Commits](nodeca/js-yaml@3.14.1...3.14.2)

---
updated-dependencies:
- dependency-name: js-yaml
  dependency-version: 3.14.2
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
* Migrate native addon from nan to node-addon-api (N-API)

Replace nan with node-addon-api in both native source files and the
build configuration. N-API provides ABI stability across Node.js major
versions, so a binary compiled once continues to load on Node.js 20,
22, and 24 without recompilation.

Changes:
- binding.gyp: switch include path to node-addon-api, add
  NAPI_DISABLE_CPP_EXCEPTIONS define
- native/can.cc: rewrite RawChannel to use Napi::ObjectWrap<T>,
  instance methods, Napi::FunctionReference/ObjectReference for
  persistent listener handles, and napi_env stored for uv_async
  callbacks
- native/signals.cc: rewrite DecodeSignal/EncodeSignal as plain
  Napi::Value functions
- package.json: replace nan dependency with node-addon-api ^8.0.0
- Dockerfile.build-test: new file for verifying compilation on Linux

Verified: compiles cleanly on Node.js 22 / Linux arm64 (Debian
bookworm) with no warnings.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>

* Bump version to 4.1.0, add CHANGELOG

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>

* Dockerfile.build-test: add TypeScript build and test run

Run test-parsing and test-signal_conversion (the tests that exercise the
migrated can_signals native module) inside the container. The two vcan-
dependent test suites (test-raw_basic, test-signal_generation) require a
real Linux kernel with the vcan module and cannot run in Docker Desktop.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>

* Update package-lock.json for node-addon-api

Regenerate lock file after replacing nan with node-addon-api.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>

* can.cc: add Napi::HandleScope to uv_async callbacks

uv_async callbacks run on the Node.js main thread but are not entered
via NAPI, so no HandleScope is open when they fire. Accessing any
Napi::Reference value (FunctionReference::Value()) without one causes
a fatal: "Cannot create a handle without a HandleScope".

Add Napi::HandleScope scope(env) at the top of async_channel_stopped()
and async_receiver_ready(), matching the Nan::HandleScope that the
previous NAN implementation had in the same two functions.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>

* CI: add Node.js 24.x to test matrix; revert Dockerfile to build-only

Now that the native addon uses N-API, the same binary should load
unchanged across all LTS releases. Adding 24.x to the matrix verifies
this on every PR.

Dockerfile.build-test reverted to build-only — its purpose is to
quickly verify compilation on Linux without a CAN interface.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>

* Fix TypeScript build and drop EOL Node.js versions

- Bump typescript devDep to ^5.4.0 (resolves incompatibility with @types/node v22)
- Bump @types/node to ^22.0.0 to match supported runtime
- Add prepare script so dist/ is built automatically on npm install
- Add rootDir to tsconfig to prevent stray file pickup
- Add engines field declaring node >=22.0.0
- CI matrix: drop 18.x and 20.x (both EOL); keep 22.x and 24.x
- Publish workflow: update node-version from 18 to 22

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>

* Update package-lock.json after rebase onto master

Regenerated lockfile incorporating dependabot security bumps from master
(js-yaml 4.1.0, node-gyp 12.3.0, tar 7.5.15) alongside branch dependency
updates (typescript 5.9.3, @types/node 22.19.19).

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>

* Add CLAUDE.md with project overview and architecture

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>

* can.cc: fix segfault when RawChannel is used inside a worker thread

uv_default_loop() always returns the main thread's event loop. When
start() is called from a worker thread, the uv_async callbacks fired on
the main loop but m_napi_env held the worker's environment — accessing
a worker-thread V8 context from the wrong isolate caused a segfault on
any received message.

Fix: use napi_get_uv_event_loop to obtain the event loop that owns the
current napi_env, so async callbacks always fire on the correct loop.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>

* test: add worker_threads test for RawChannel onMessage

Verifies that a RawChannel created and started inside a Worker thread
can receive CAN frames without segfaulting.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>

* test: fix worker_thread test — graceful shutdown instead of terminate()

worker.terminate() force-kills the worker without closing the uv_async
handles (that only happens via ch.stop()), causing Node to abort with
"uv_loop_close() while having open handles".

Instead, the worker calls ch.stop() via setImmediate after forwarding
the first message. This runs async_channel_stopped() which closes both
handles and Unref()s the channel, allowing the event loop to drain and
the worker to exit naturally. The main thread waits on worker 'exit'
before calling done().

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>

---------

Co-authored-by: Claude Sonnet 4.6 <noreply@anthropic.com>
Bumps [minimatch](https://github.com/isaacs/minimatch) from 3.1.2 to 3.1.5.
- [Changelog](https://github.com/isaacs/minimatch/blob/main/changelog.md)
- [Commits](isaacs/minimatch@v3.1.2...v3.1.5)

---
updated-dependencies:
- dependency-name: minimatch
  dependency-version: 3.1.5
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Bumps [picomatch](https://github.com/micromatch/picomatch) from 2.3.1 to 2.3.2.
- [Release notes](https://github.com/micromatch/picomatch/releases)
- [Changelog](https://github.com/micromatch/picomatch/blob/master/CHANGELOG.md)
- [Commits](micromatch/picomatch@2.3.1...2.3.2)

---
updated-dependencies:
- dependency-name: picomatch
  dependency-version: 2.3.2
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Bumps [flatted](https://github.com/WebReflection/flatted) from 3.2.7 to 3.4.2.
- [Commits](WebReflection/flatted@v3.2.7...v3.4.2)

---
updated-dependencies:
- dependency-name: flatted
  dependency-version: 3.4.2
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Bumps [brace-expansion](https://github.com/juliangruber/brace-expansion) from 1.1.12 to 1.1.14.
- [Release notes](https://github.com/juliangruber/brace-expansion/releases)
- [Commits](juliangruber/brace-expansion@v1.1.12...v1.1.14)

---
updated-dependencies:
- dependency-name: brace-expansion
  dependency-version: 1.1.14
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
…sage callbacks (#161)

The N-API migration replaced Nan::Callback::Call() with fn.Call()
(napi_call_function).  The NaN version used node::MakeCallback internally,
which runs a microtask checkpoint and fires async hooks after each JS
callback.  napi_call_function does neither.

On a busy bus the entire batch of up to MAX_FRAMES_PER_ASYNC_EVENT frames
fired back-to-back with no opportunity for Promise continuations or
process.nextTick callbacks to run.  Adapters that queue processing work
asynchronously inside onMessage (e.g. ioBroker.e3oncan) saw their internal
queue fill faster than it drained, producing "Evaluation of messages
overloaded. Counter=400" warnings and cascading "Bad frame" errors.

Fix: replace fn.Call() with napi_make_callback(), using a napi_async_context
created in Start() and destroyed in async_channel_stopped().  This restores
the node::MakeCallback semantics from the NaN era.

Also replace the silent env.IsExceptionPending()+break pattern with
napi_get_and_clear_last_exception + napi_fatal_exception, matching what
Nan::FatalException / Nan::TryCatch did: exceptions from callbacks are
forwarded to Node's uncaughtException handler rather than left pending in the
env (where they would silently corrupt subsequent napi calls, delivering empty
{} objects to listeners and triggering further "bad frame" warnings).

Add test/test-callback_ordering.js to verify that a microtask (Promise and
process.nextTick) scheduled in callback N resolves before callback N+1 fires.

Co-authored-by: Claude Sonnet 4.6 <noreply@anthropic.com>
* chore: upgrade all dependencies to latest and bump version to 4.2.0

- Bump all devDependencies to latest major versions (eslint 10, typescript 6,
  mocha 11, prettier 3, @typescript-eslint 8, nyc 18)
- Migrate ESLint config from legacy .eslintrc.json to flat config (eslint.config.js),
  required for ESLint 9+; add @eslint/js and globals as new devDependencies
- Update dependencies: node-addon-api 8.8.0, node-gyp 12, xml2js 0.6.2
- Fix tsconfig.json: moduleResolution "node" → "node10" (required for TypeScript 6)

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>

* chore: regenerate package-lock.json for updated dependencies

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>

* fix(tsconfig): migrate to module/moduleResolution node16 for TypeScript 6

"module": "CommonJS" + "moduleResolution": "node10" are deprecated in TS 6.
No code changes needed: the project has no "type": "module" so all .ts files
are still emitted as CJS under node16 resolution.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>

---------

Co-authored-by: Claude Sonnet 4.6 <noreply@anthropic.com>
- Add LICENSE file (MIT, 2012)
- Add types field to package.json pointing to dist/socketcan.d.ts
- Add keywords, homepage, bugs, and coverage script to package.json
- Add SECURITY.md with private vulnerability reporting guidance
- Add GitHub issue templates (bug report, feature request) and PR template
- Fix npm publish workflow: trigger on release instead of package.json
  changes, run full build+test before publishing, drop JS-DevTools action
  in favour of npm publish with NODE_AUTH_TOKEN
- Update GitHub Actions to actions/checkout@v4 and actions/setup-node@v4
- Update TESTING.md to remove stale nodeunit reference

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Updated package ecosystem to 'npm' for Dependabot.
Pin transitive dev dependencies to non-vulnerable versions:
- diff ^9.0.0 (was 6-8.0.2, DoS in parsePatch/applyPatch via mocha)
- serialize-javascript ^7.0.5 (was <=7.0.4, RCE via mocha)
- uuid ^14.0.0 (was <11.1.1, buffer bounds issue via nyc)

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
…n permissions

Co-authored-by: Copilot Autofix powered by AI <62310815+github-advanced-security[bot]@users.noreply.github.com>
Bumps [eslint](https://github.com/eslint/eslint) from 10.4.0 to 10.4.1.
- [Release notes](https://github.com/eslint/eslint/releases)
- [Commits](eslint/eslint@v10.4.0...v10.4.1)

---
updated-dependencies:
- dependency-name: eslint
  dependency-version: 10.4.1
  dependency-type: direct:development
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
Bumps [@types/node](https://github.com/DefinitelyTyped/DefinitelyTyped/tree/HEAD/types/node) from 22.19.19 to 25.9.1.
- [Release notes](https://github.com/DefinitelyTyped/DefinitelyTyped/releases)
- [Commits](https://github.com/DefinitelyTyped/DefinitelyTyped/commits/HEAD/types/node)

---
updated-dependencies:
- dependency-name: "@types/node"
  dependency-version: 25.9.1
  dependency-type: direct:development
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>
…n permissions

Co-authored-by: Copilot Autofix powered by AI <62310815+github-advanced-security[bot]@users.noreply.github.com>
Closes #59. Extends encodeSignal/decodeSignal in the native addon to
handle IEEE-754 float and double types via a new SIGNAL_TYPE enum
(0=unsigned, 1=signed, 2=float32, 3=float64). Byte order (Intel/Motorola)
is handled correctly by the existing _getvalue/_setvalue infrastructure
through a plain memcpy reinterpretation after byte-swapping. The TS layer
maps KCD type="single"/"double" to the new codes and skips Math.round()
for float signal encoding. All existing integer tests continue to pass.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
- native/signals.cc: compute effectiveBitLength from the signal type before
  calling _getvalue so a mismatched JS bitLength can never produce a silently
  wrong float result; add bounds check in _parse_signal_type (values > 3 fall
  back to unsigned instead of being cast to an undefined enum value); fix
  "bufer" typo in both buffer comments
- src/can_signals.d.ts: tighten SignalType back to boolean | 0 | 1 | 2 | 3
- src/socketcan.ts: narrow signalTypeCode() return type to 0|1|2|3 to satisfy
  the tighter SignalType; add console.warn for unrecognised type strings
- test/test-signal_conversion.js: move SIGNAL_FLOAT32/FLOAT64 constants to
  module scope alongside new SIGNAL_UNSIGNED/SIGNAL_SIGNED; add tests for
  negative float64, IEEE-754 special values (Inf, -Inf, NaN) for both float32
  and float64, and a dedicated test that the effectiveBitLength override
  produces the correct result even when the caller passes the wrong bitLength

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
parse_kcd.ts
- Export SignalType = "unsigned"|"signed"|"single"|"double" so the type
  is named once and referenced everywhere instead of inlined as a literal

socketcan.ts
- Export SignalType const object (UNSIGNED/SIGNED/FLOAT32/FLOAT64) so
  callers of the native addon never need raw numeric literals
- signalTypeCode() now takes kcd.SignalType instead of string — the
  exhaustive switch lets the compiler catch any new type added to the union
- Add isFloatSignal() predicate, removing the duplicated string comparison
- Name UINT32_MAX and TWO_TO_32 constants in place of 0xffffffff and
  Math.pow(2,32) in the integer word-split path
- Fix == to === for all string comparisons on changed lines

native/signals.cc
- Add signal_type_bit_width() helper so the IEEE-754 widths (32/64) are
  derived from the enum in one place; both DecodeSignal and EncodeSignal
  now call it instead of hardcoding the numbers independently
- Unify all new/changed variable declarations to uint32_t/uint64_t (C99
  standard names) in place of the POSIX u_int32_t/u_int64_t

can_signals.d.ts
- Update comment to point callers toward the named SignalType constants

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
- Build: add -std=c++20 to both addon targets in binding.gyp
- Remove vestigial __STDC_LIMIT_MACROS (unnecessary since C++11)
- Switch to C++ headers (<cstdint>, <cstring>) and add <bit>
- Convert typedef enum to enum class for ENDIANESS and SIGNAL_TYPE
- Fix strict-aliasing UB in _getvalue/_setvalue: replace pointer casts
  with memcpy-based loads; _getvalue now takes const uint8_t*
- Fix misleading _setvalue signature: data[8] -> uint8_t* (64-byte buf)
- Replace u_int*_t (POSIX-only) with uint*_t (ISO C++) throughout
- Add [[nodiscard]] to _getvalue
- _parse_signal_type: pass env, throw TypeError on unknown value instead
  of silently falling back to unsigned; callers check IsExceptionPending
- Replace memcpy type-punning with std::bit_cast for float/double
- Replace C-style casts with static_cast<> throughout
- Fix signed decode: int32_t -> int64_t; use XOR-subtract sign-extension
  to correctly handle signals wider than 32 bits without UB

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants