* xmlFindExtraHandler: * @name: a string describing the char encoding. * @output: boolean, use handler for output * @out: pointer to resulting handler * * Search the non-default handlers for an exact match. * * Returns 0 on success, 1 if no handler was found, -1 if a memory * allocation failed. */
| 1670 | * allocation failed. |
| 1671 | */ |
| 1672 | static int |
| 1673 | xmlFindExtraHandler(const char *name, int output, |
| 1674 | xmlCharEncodingHandler **out) { |
| 1675 | int ret; |
| 1676 | int i; |
| 1677 | |
| 1678 | (void) ret; |
| 1679 | |
| 1680 | if (handlers != NULL) { |
| 1681 | for (i = 0; i < nbCharEncodingHandler; i++) { |
| 1682 | xmlCharEncodingHandler *handler = handlers[i]; |
| 1683 | |
| 1684 | if (!xmlStrcasecmp((const xmlChar *) name, |
| 1685 | (const xmlChar *) handler->name)) { |
| 1686 | if (output) { |
| 1687 | if (handler->output != NULL) { |
| 1688 | *out = handler; |
| 1689 | return(0); |
| 1690 | } |
| 1691 | } else { |
| 1692 | if (handler->input != NULL) { |
| 1693 | *out = handler; |
| 1694 | return(0); |
| 1695 | } |
| 1696 | } |
| 1697 | } |
| 1698 | } |
| 1699 | } |
| 1700 | |
| 1701 | #ifdef LIBXML_ICONV_ENABLED |
| 1702 | ret = xmlCreateIconvHandler(name, out); |
| 1703 | if (*out != NULL) |
| 1704 | return(0); |
| 1705 | if (ret != XML_ERR_UNSUPPORTED_ENCODING) |
| 1706 | return(ret); |
| 1707 | #endif /* LIBXML_ICONV_ENABLED */ |
| 1708 | |
| 1709 | #ifdef LIBXML_ICU_ENABLED |
| 1710 | ret = xmlCreateUconvHandler(name, out); |
| 1711 | if (*out != NULL) |
| 1712 | return(0); |
| 1713 | if (ret != XML_ERR_UNSUPPORTED_ENCODING) |
| 1714 | return(ret); |
| 1715 | #endif /* LIBXML_ICU_ENABLED */ |
| 1716 | |
| 1717 | return(XML_ERR_UNSUPPORTED_ENCODING); |
| 1718 | } |
| 1719 | |
| 1720 | /** |
| 1721 | * xmlFindHandler: |
no test coverage detected