Repository navigation
fix(core): resolve C pointer qualifier errors and implement BLI_strncpy_wchar_from_utf8 - #77
Conversation
…py_wchar_from_utf8 - Cast int * to unsigned int * in BLI_endian_switch_int32 to prevent pointer sign mismatch warnings/errors. - Drop const cast passed to MEM_freeN(void *) in BLI_ghashutil_pairfree. - Swap const float * segment pointers explicitly in isect_seg_seg_v2_point_ex instead of BUI_SWAP, which fails when typeof preserves const on the temporary variable. - Implement UTF-8 to wchar_t decoding loop in BLI_strncpy_wchar_from_utf8, which had an empty function body missing a return statement. Signed-off-by: Dr. Mohammed Lubbad <[email protected]>
|
No actionable comments were generated in the recent review. Walkthrough
Merge Risk:
|
|
Thank you very much for the PR! |
What does this change?
Fixes four strict C11/Clang compilation bugs in
core/:core/intern/string_utf8.c(BLI_strncpy_wchar_from_utf8): After theWIN32utfconvbranch was removed,BLI_strncpy_wchar_from_utf8was left with an empty body and noreturnstatement (-Wreturn-typeundefined behavior). Implemented safe UTF-8 decoding intodst_wviaBLI_str_utf8_as_unicode_step_safewith NUL termination.core/intern/math_geom.c(isect_seg_seg_v2_point_ex):BUI_SWAP(v0, v2)onconst float v0[2]expandstypeof(v0)toconst float *in Clang/GCC, causing assignment to aconst-qualified temporary to fail under strict C flags; replaced with an explicitconst float *v_tmppointer swap.core/include/BLI_endian_switch_inline.h: Added explicit(unsigned int *)cast inBLI_endian_switch_int32(-Wpointer-sign).core/intern/BLI_ghash_utils.c: Passedptrdirectly toMEM_freeN(ptr)without casting toconst GHashPair *(-Wdiscarded-qualifiers).How was it tested?
clang -fsyntax-only) on modifiedcore/translation units.Checklist
Summary by CodeRabbit