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

Function xmlBufferWriteQuotedString

ThirdParty/libxml2/vtklibxml2/tree.c:7704–7739  ·  view source on GitHub ↗

* xmlBufferWriteQuotedString: * @buf: the XML buffer output * @string: the string to add * * routine which manage and grows an output buffer. This one writes * a quoted or double quoted #xmlChar string, checking first if it holds * quote or double-quotes internally */

Source from the content-addressed store, hash-verified

7702 * quote or double-quotes internally
7703 */
7704void
7705xmlBufferWriteQuotedString(xmlBufferPtr buf, const xmlChar *string) {
7706 const xmlChar *cur, *base;
7707 if (buf == NULL)
7708 return;
7709 if (xmlStrchr(string, '\"')) {
7710 if (xmlStrchr(string, '\'')) {
7711 xmlBufferCCat(buf, "\"");
7712 base = cur = string;
7713 while(*cur != 0){
7714 if(*cur == '"'){
7715 if (base != cur)
7716 xmlBufferAdd(buf, base, cur - base);
7717 xmlBufferAdd(buf, BAD_CAST """, 6);
7718 cur++;
7719 base = cur;
7720 }
7721 else {
7722 cur++;
7723 }
7724 }
7725 if (base != cur)
7726 xmlBufferAdd(buf, base, cur - base);
7727 xmlBufferCCat(buf, "\"");
7728 }
7729 else{
7730 xmlBufferCCat(buf, "\'");
7731 xmlBufferCat(buf, string);
7732 xmlBufferCCat(buf, "\'");
7733 }
7734 } else {
7735 xmlBufferCCat(buf, "\"");
7736 xmlBufferCat(buf, string);
7737 xmlBufferCCat(buf, "\"");
7738 }
7739}
7740
7741
7742/**

Callers

nothing calls this directly

Calls 4

xmlStrchrFunction · 0.85
xmlBufferCCatFunction · 0.85
xmlBufferAddFunction · 0.85
xmlBufferCatFunction · 0.85

Tested by

no test coverage detected