MCPcopy Create free account
hub / github.com/Kitware/VTK / xmlBufDumpEntityContent

Function xmlBufDumpEntityContent

ThirdParty/libxml2/vtklibxml2/xmlsave.c:707–737  ·  view source on GitHub ↗

* xmlBufDumpEntityContent: * @buf: output buffer * @content: entity content. * * This will dump the quoted string value, taking care of the special * treatment required by % */

Source from the content-addressed store, hash-verified

705 * treatment required by %
706 */
707static void
708xmlBufDumpEntityContent(xmlOutputBufferPtr buf, const xmlChar *content) {
709 if (xmlStrchr(content, '%')) {
710 const char * base, *cur;
711
712 xmlOutputBufferWrite(buf, 1, "\"");
713 base = cur = (const char *) content;
714 while (*cur != 0) {
715 if (*cur == '"') {
716 if (base != cur)
717 xmlOutputBufferWrite(buf, cur - base, base);
718 xmlOutputBufferWrite(buf, 6, """);
719 cur++;
720 base = cur;
721 } else if (*cur == '%') {
722 if (base != cur)
723 xmlOutputBufferWrite(buf, cur - base, base);
724 xmlOutputBufferWrite(buf, 6, "%");
725 cur++;
726 base = cur;
727 } else {
728 cur++;
729 }
730 }
731 if (base != cur)
732 xmlOutputBufferWrite(buf, cur - base, base);
733 xmlOutputBufferWrite(buf, 1, "\"");
734 } else {
735 xmlOutputBufferWriteQuotedString(buf, content);
736 }
737}
738
739/**
740 * xmlBufDumpEntityDecl:

Callers 1

xmlBufDumpEntityDeclFunction · 0.85

Calls 3

xmlStrchrFunction · 0.85
xmlOutputBufferWriteFunction · 0.85

Tested by

no test coverage detected