Skip to content

Fix MSVC C4996/C4242 warnings in C API#214

Merged
wavefunction91 merged 2 commits into
wavefunction91:masterfrom
lorisercole:ler/fix/msvc-header-warnings
Jun 25, 2026
Merged

Fix MSVC C4996/C4242 warnings in C API#214
wavefunction91 merged 2 commits into
wavefunction91:masterfrom
lorisercole:ler/fix/msvc-header-warnings

Conversation

@lorisercole

Copy link
Copy Markdown
Contributor
  • c_status.hpp: replace std::strcpy with std::memcpy using the already computed length. Avoids C4996 (deprecation of strcpy) portably without resorting to _CRT_SECURE_NO_WARNINGS or the non-portable strcpy_s.
  • c_xc_integrator.cxx: replace ::toupper passed to std::transform with a lambda that takes unsigned char and casts the result back to char. Fixes C4242 (int->char loss-of-data) and avoids UB when char is signed.

- c_status.hpp: replace std::strcpy with std::memcpy using the already
  computed length. Avoids C4996 (deprecation of strcpy) portably without
  resorting to _CRT_SECURE_NO_WARNINGS or the non-portable strcpy_s.
- c_xc_integrator.cxx: replace ::toupper passed to std::transform with a
  lambda that takes unsigned char and casts the result back to char.
  Fixes C4242 (int->char loss-of-data) and avoids UB when char is signed.
@wavefunction91 wavefunction91 merged commit f05cd68 into wavefunction91:master Jun 25, 2026
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