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

Function xmlTextWriterWriteBase64

ThirdParty/libxml2/vtklibxml2/xmlwriter.c:1615–1650  ·  view source on GitHub ↗

* xmlTextWriterWriteBase64: * @writer: the xmlTextWriterPtr * @data: binary data * @start: the position within the data of the first byte to encode * @len: the number of bytes to encode * * Write an base64 encoded xml text. * * Returns the bytes written (may be 0 because of buffering) or -1 in case of error */

Source from the content-addressed store, hash-verified

1613 * Returns the bytes written (may be 0 because of buffering) or -1 in case of error
1614 */
1615int
1616xmlTextWriterWriteBase64(xmlTextWriterPtr writer, const char *data,
1617 int start, int len)
1618{
1619 int count;
1620 int sum;
1621 xmlLinkPtr lk;
1622 xmlTextWriterStackEntry *p;
1623
1624 if ((writer == NULL) || (data == NULL) || (start < 0) || (len < 0))
1625 return -1;
1626
1627 sum = 0;
1628 lk = xmlListFront(writer->nodes);
1629 if (lk != 0) {
1630 p = (xmlTextWriterStackEntry *) xmlLinkGetData(lk);
1631 if (p != 0) {
1632 count = xmlTextWriterHandleStateDependencies(writer, p);
1633 if (count < 0)
1634 return -1;
1635 sum += count;
1636 }
1637 }
1638
1639 if (writer->indent)
1640 writer->doindent = 0;
1641
1642 count =
1643 xmlOutputBufferWriteBase64(writer->out, len,
1644 (unsigned char *) data + start);
1645 if (count < 0)
1646 return -1;
1647 sum += count;
1648
1649 return sum;
1650}
1651
1652/**
1653 * xmlOutputBufferWriteBinHex:

Callers

nothing calls this directly

Calls 4

xmlListFrontFunction · 0.85
xmlLinkGetDataFunction · 0.85

Tested by

no test coverage detected