* xmlFindHandler: * @name: a string describing the char encoding. * @output: boolean, use handler for output * @out: pointer to resulting handler * * Search all handlers for an exact match. * * Returns 0 on success, 1 if no handler was found, -1 if a memory * allocation failed. */
| 1729 | * allocation failed. |
| 1730 | */ |
| 1731 | static int |
| 1732 | xmlFindHandler(const char *name, int output, xmlCharEncodingHandler **out) { |
| 1733 | int i; |
| 1734 | |
| 1735 | /* |
| 1736 | * Check for default handlers |
| 1737 | */ |
| 1738 | for (i = 0; i < (int) NUM_DEFAULT_HANDLERS; i++) { |
| 1739 | xmlCharEncodingHandler *handler; |
| 1740 | |
| 1741 | handler = (xmlCharEncodingHandler *) &defaultHandlers[i]; |
| 1742 | |
| 1743 | if (xmlStrcasecmp((const xmlChar *) name, |
| 1744 | (const xmlChar *) handler->name) == 0) { |
| 1745 | if (output) { |
| 1746 | if (handler->output != NULL) { |
| 1747 | *out = handler; |
| 1748 | return(0); |
| 1749 | } |
| 1750 | } else { |
| 1751 | if (handler->input != NULL) { |
| 1752 | *out = handler; |
| 1753 | return(0); |
| 1754 | } |
| 1755 | } |
| 1756 | } |
| 1757 | } |
| 1758 | |
| 1759 | /* |
| 1760 | * Check for other handlers |
| 1761 | */ |
| 1762 | return(xmlFindExtraHandler(name, output, out)); |
| 1763 | } |
| 1764 | |
| 1765 | /** |
| 1766 | * xmlLookupCharEncodingHandler: |
no test coverage detected