Skip to content

fix clang/gcc warnings for undefined behavior, also fix a bug

Thomas E. Dickey requested to merge dickey/libxaw:code-cleanup into master

XtConvertAndStore may update the XrmValue value, changing its size. clang and gcc warn about undefined behavior in the case-statement following the call (which uses the size), but do not explain what the problem is. Since this code is not intended to handle changes of the size, simply reject that case. That quiets the gcc warnings and is actually all that is needed for correctness. clang still complains (neither knows what the call does), but can be quieted by initializing the variable before calling the function.

The code happens to work without the fix as long as it is not used to convert between resource types which would increase the size.

Signed-off-by: Thomas E. Dickey dickey@invisible-island.net

Merge request reports

Loading