From 5f9656c8b95a3df5ba9d7c06ecc8a6bfcf02ca2c Mon Sep 17 00:00:00 2001 From: "arseny.kapoulkine@gmail.com" Date: Fri, 23 Mar 2012 04:24:56 +0000 Subject: xml_document::save_file now checks for file I/O errors, fixed compilation git-svn-id: http://pugixml.googlecode.com/svn/trunk@881 99668b35-9821-0410-8761-19e4c4f06640 --- src/pugixml.cpp | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) (limited to 'src') diff --git a/src/pugixml.cpp b/src/pugixml.cpp index e814970..ce9d36c 100644 --- a/src/pugixml.cpp +++ b/src/pugixml.cpp @@ -3676,9 +3676,11 @@ PUGI__NS_BEGIN xml_writer_file writer(file); doc.save(writer, indent, flags, encoding); + int result = ferror(file); + fclose(file); - return true; + return result == 0; } PUGI__NS_END @@ -5255,13 +5257,13 @@ namespace pugi PUGI__FN bool xml_document::save_file(const char* path_, const char_t* indent, unsigned int flags, xml_encoding encoding) const { FILE* file = fopen(path_, "wb"); - return save_file_impl(*this, file, indent, flags, encoding); + return impl::save_file_impl(*this, file, indent, flags, encoding); } PUGI__FN bool xml_document::save_file(const wchar_t* path_, const char_t* indent, unsigned int flags, xml_encoding encoding) const { FILE* file = impl::open_file_wide(path_, L"wb"); - return save_file_impl(*this, file, indent, flags, encoding); + return impl::save_file_impl(*this, file, indent, flags, encoding); } PUGI__FN xml_node xml_document::document_element() const -- cgit v1.2.3