mirror of
https://gitlab.gnome.org/GNOME/libxml2.git
synced 2025-10-24 13:33:01 +03:00
writer: Implement xmlTextWriterClose
This function can be used to make sure that closing the output stream succeeded. Fixes #513.
This commit is contained in:
29
xmlwriter.c
29
xmlwriter.c
@@ -4236,6 +4236,35 @@ xmlTextWriterFlush(xmlTextWriterPtr writer)
|
||||
return count;
|
||||
}
|
||||
|
||||
/**
|
||||
* xmlTextWriterClose:
|
||||
* @writer: the xmlTextWriterPtr
|
||||
*
|
||||
* Flushes and closes the output buffer.
|
||||
*
|
||||
* Available since 2.13.0.
|
||||
*
|
||||
* Returns an xmlParserErrors code.
|
||||
*/
|
||||
int
|
||||
xmlTextWriterClose(xmlTextWriterPtr writer)
|
||||
{
|
||||
int result;
|
||||
|
||||
if ((writer == NULL) || (writer->out == NULL))
|
||||
return XML_ERR_ARGUMENT;
|
||||
|
||||
result = xmlOutputBufferClose(writer->out);
|
||||
writer->out = NULL;
|
||||
|
||||
if (result >= 0)
|
||||
result = XML_ERR_OK;
|
||||
else
|
||||
result = -result;
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
/**
|
||||
* misc
|
||||
*/
|
||||
|
||||
Reference in New Issue
Block a user