| 1707 | } |
| 1708 | |
| 1709 | enum XML_Status XMLCALL |
| 1710 | XML_SetEncoding(XML_Parser parser, const XML_Char *encodingName) { |
| 1711 | if (parser == NULL) |
| 1712 | return XML_STATUS_ERROR; |
| 1713 | /* Block after XML_Parse()/XML_ParseBuffer() has been called. |
| 1714 | XXX There's no way for the caller to determine which of the |
| 1715 | XXX possible error cases caused the XML_STATUS_ERROR return. |
| 1716 | */ |
| 1717 | if (parserBusy(parser)) |
| 1718 | return XML_STATUS_ERROR; |
| 1719 | |
| 1720 | /* Get rid of any previous encoding name */ |
| 1721 | FREE(parser, (void *)parser->m_protocolEncodingName); |
| 1722 | |
| 1723 | if (encodingName == NULL) |
| 1724 | /* No new encoding name */ |
| 1725 | parser->m_protocolEncodingName = NULL; |
| 1726 | else { |
| 1727 | /* Copy the new encoding name into allocated memory */ |
| 1728 | parser->m_protocolEncodingName = copyString(encodingName, parser); |
| 1729 | if (! parser->m_protocolEncodingName) |
| 1730 | return XML_STATUS_ERROR; |
| 1731 | } |
| 1732 | return XML_STATUS_OK; |
| 1733 | } |
| 1734 | |
| 1735 | XML_Parser XMLCALL |
| 1736 | XML_ExternalEntityParserCreate(XML_Parser oldParser, const XML_Char *context, |
no test coverage detected
searching dependent graphs…