MCPcopy Create free account
hub / github.com/F-Stack/f-stack / xo_check_conversion

Function xo_check_conversion

tools/libxo/libxo/libxo.c:2675–2691  ·  view source on GitHub ↗

* Check to see that the conversion is safe and sane. */

Source from the content-addressed store, hash-verified

2673 * Check to see that the conversion is safe and sane.
2674 */
2675static int
2676xo_check_conversion (xo_handle_t *xop, int have_enc, int need_enc)
2677{
2678 switch (CONVERT(have_enc, need_enc)) {
2679 case CONVERT(XF_ENC_UTF8, XF_ENC_UTF8):
2680 case CONVERT(XF_ENC_UTF8, XF_ENC_LOCALE):
2681 case CONVERT(XF_ENC_WIDE, XF_ENC_UTF8):
2682 case CONVERT(XF_ENC_WIDE, XF_ENC_LOCALE):
2683 case CONVERT(XF_ENC_LOCALE, XF_ENC_LOCALE):
2684 case CONVERT(XF_ENC_LOCALE, XF_ENC_UTF8):
2685 return 0;
2686
2687 default:
2688 xo_failure(xop, "invalid conversion (%c:%c)", have_enc, need_enc);
2689 return 1;
2690 }
2691}
2692
2693static int
2694xo_format_string_direct (xo_handle_t *xop, xo_buffer_t *xbp,

Callers 1

xo_format_stringFunction · 0.85

Calls 1

xo_failureFunction · 0.85

Tested by

no test coverage detected