diff options
author | arseny.kapoulkine@gmail.com <arseny.kapoulkine@gmail.com@99668b35-9821-0410-8761-19e4c4f06640> | 2012-03-23 04:24:56 +0000 |
---|---|---|
committer | arseny.kapoulkine@gmail.com <arseny.kapoulkine@gmail.com@99668b35-9821-0410-8761-19e4c4f06640> | 2012-03-23 04:24:56 +0000 |
commit | 5f9656c8b95a3df5ba9d7c06ecc8a6bfcf02ca2c (patch) | |
tree | 713455731c9000021da6007fef8e1fed360cf371 /src/pugixml.cpp | |
parent | 898b2cbabbe45847fb24f7c6185c62b89062122d (diff) |
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
Diffstat (limited to 'src/pugixml.cpp')
-rw-r--r-- | src/pugixml.cpp | 8 |
1 files changed, 5 insertions, 3 deletions
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 |