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

Function htmlBufNodeDumpFormat

ThirdParty/libxml2/vtklibxml2/HTMLtree.c:415–447  ·  view source on GitHub ↗

* htmlBufNodeDumpFormat: * @buf: the xmlBufPtr output * @doc: the document * @cur: the current node * @format: should formatting spaces been added * * Dump an HTML node, recursive behaviour,children are printed too. * * Returns the number of byte written or -1 in case of error */

Source from the content-addressed store, hash-verified

413 * Returns the number of byte written or -1 in case of error
414 */
415static size_t
416htmlBufNodeDumpFormat(xmlBufPtr buf, xmlDocPtr doc, xmlNodePtr cur,
417 int format) {
418 size_t use;
419 size_t ret;
420 xmlOutputBufferPtr outbuf;
421
422 if (cur == NULL) {
423 return ((size_t) -1);
424 }
425 if (buf == NULL) {
426 return ((size_t) -1);
427 }
428 outbuf = (xmlOutputBufferPtr) xmlMalloc(sizeof(xmlOutputBuffer));
429 if (outbuf == NULL)
430 return ((size_t) -1);
431 memset(outbuf, 0, sizeof(xmlOutputBuffer));
432 outbuf->buffer = buf;
433 outbuf->encoder = NULL;
434 outbuf->writecallback = NULL;
435 outbuf->closecallback = NULL;
436 outbuf->context = NULL;
437 outbuf->written = 0;
438
439 use = xmlBufUse(buf);
440 htmlNodeDumpFormatOutput(outbuf, doc, cur, NULL, format);
441 if (outbuf->error)
442 ret = (size_t) -1;
443 else
444 ret = xmlBufUse(buf) - use;
445 xmlFree(outbuf);
446 return (ret);
447}
448
449/**
450 * htmlNodeDump:

Callers 1

htmlNodeDumpFunction · 0.85

Calls 2

xmlBufUseFunction · 0.85
htmlNodeDumpFormatOutputFunction · 0.85

Tested by

no test coverage detected