* Check to see that the conversion is safe and sane. */
| 2673 | * Check to see that the conversion is safe and sane. |
| 2674 | */ |
| 2675 | static int |
| 2676 | xo_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 | |
| 2693 | static int |
| 2694 | xo_format_string_direct (xo_handle_t *xop, xo_buffer_t *xbp, |
no test coverage detected