8000 Replace deprecated UTF-8 conversion and reduce build warnings by ptahmose · Pull Request #27 · ptahmose/MEXlibCZI · GitHub
[go: up one dir, main page]

Skip to content

Replace deprecated UTF-8 conversion and reduce build warnings - #27

Merged
ptahmose merged 4 commits into
masterfrom
jbl/reduce_build_warnings
Oct 31, 2026
Merged

ptahmose merged 4 commits into
masterfrom
jbl/reduce_build_warnings

Conversation

@ptahmose
Copy link
Copy Markdown
Owner

Remove warnings from MEXlibCZI's code and replace deprecated std::wstring_convert/std::codecvt_utf8 on Unix. The macOS release log had 38 compiler warnings; the updated macOS build has one, in upstream libCZI code.

  • Prefer system iconv when CMake finds it, using explicit UTF-8 to native-endian UTF-32 conversion. Ubuntu uses glibc's built-in iconv; macOS links Apple's /usr/lib/libiconv.2.dylib. Keep the Windows API conversion and a RapidJSON fallback for Unix systems without iconv.
  • Validate UTF-8 before iconv because the macOS implementation accepted malformed sequences in regression tests. Reject malformed, truncated, and lossy conversions and close the converter on every exit path.
  • Guard the static-libCZI macro definition, explicitly reject unsupported pixel types, and account for release builds compiling out exception logging.
  • Convert Octave dimension arrays to mwSize element by element instead of passing incompatible size_t pointers.
  • Test multilingual filenames, supplementary characters, Unicode boundaries, locale independence, and malformed input. Exercise both iconv and the fallback in Unix CI, and make the RapidJSON build dependency explicit.

Validation: CI run passed on Ubuntu 22.04/24.04/26.04, Windows x64, and macOS 15 ARM64, including native tests and MATLAB/Octave regression suites. All three Unix native tests passed, and Windows passed both native tests. git diff --check passed.

Remaining compiler warnings originate in the pinned libCZI/JPEG XR/Zstd dependency sources; this change does not suppress them. No release was published.

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

No active review issues are recorded for the Unix UTF-8 conversion and compatibility updates.

No open issues 🎉

What changed in this PR

This PR modernizes MEXlibCZI’s Unix UTF-8 conversion and reduces compiler warnings while preserving Windows conversion behavior.

Changes:

  • Replace deprecated conversion APIs with validated iconv conversion and a RapidJSON fallback.
  • Fix Octave dimension-type compatibility and address warnings in library code.
  • Add native Unicode and malformed-input tests, including fallback coverage.
File Description
tests/​native/​utf8_conversion_test.cpp Test Unicode filenames, boundaries, locale independence, and malformed input.
tests/​native/​CMakeLists.txt Register conversion tests for the default and fallback implementations.
OctaveMex/​octavelibczi.c Convert dimension arrays explicitly between size_t and mwSize.
lib/​src/​implementation/​utils.cpp Replace deprecated Unix conversion with iconv and RapidJSON paths.
lib/​src/​implementation/​inc_libczi.h Guard the static-library macro against redefinition.
lib/​src/​implementation/​argsutils.cpp Explicitly reject unsupported pixel types in the switch.
lib/​src/​functions/​func_createcziwriter.cpp Avoid unused-exception warnings when logging is disabled.
lib/​CMakeLists.txt Configure iconv support and declare the RapidJSON build dependency.
CMakeLists.txt Discover iconv in the parent scope for library and test configuration.

Review effort: Balanced

@ptahmose
ptahmose merged commit d979c46 into master Oct 31, 2026
7 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

0