summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorarseny.kapoulkine@gmail.com <arseny.kapoulkine@gmail.com@99668b35-9821-0410-8761-19e4c4f06640>2012-03-23 04:21:45 +0000
committerarseny.kapoulkine@gmail.com <arseny.kapoulkine@gmail.com@99668b35-9821-0410-8761-19e4c4f06640>2012-03-23 04:21:45 +0000
commit898b2cbabbe45847fb24f7c6185c62b89062122d (patch)
tree86a34f5d57ca229fe8d3239506db6784bd18e01a /src
parentdae6d908e5abff3090cc7378878b0c083c492bf8 (diff)
Extracted file saving into a separate function, fixed DMC compilation (set_value_buffer cast error)
git-svn-id: http://pugixml.googlecode.com/svn/trunk@880 99668b35-9821-0410-8761-19e4c4f06640
Diffstat (limited to 'src')
-rw-r--r--src/pugixml.cpp32
1 files changed, 15 insertions, 17 deletions
diff --git a/src/pugixml.cpp b/src/pugixml.cpp
index 13034f4..e814970 100644
--- a/src/pugixml.cpp
+++ b/src/pugixml.cpp
@@ -3376,7 +3376,7 @@ PUGI__NS_BEGIN
}
// set value with conversion functions
- PUGI__FN bool set_value_buffer(char_t*& dest, uintptr_t& header, uintptr_t header_mask, const char (&buf)[128])
+ PUGI__FN bool set_value_buffer(char_t*& dest, uintptr_t& header, uintptr_t header_mask, char (&buf)[128])
{
#ifdef PUGIXML_WCHAR_MODE
char_t wbuf[128];
@@ -3668,6 +3668,18 @@ PUGI__NS_BEGIN
return result;
}
#endif
+
+ PUGI__FN bool save_file_impl(const xml_document& doc, FILE* file, const char_t* indent, unsigned int flags, xml_encoding encoding)
+ {
+ if (!file) return false;
+
+ xml_writer_file writer(file);
+ doc.save(writer, indent, flags, encoding);
+
+ fclose(file);
+
+ return true;
+ }
PUGI__NS_END
namespace pugi
@@ -5243,27 +5255,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");
- if (!file) return false;
-
- xml_writer_file writer(file);
- save(writer, indent, flags, encoding);
-
- fclose(file);
-
- return true;
+ return 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");
- if (!file) return false;
-
- xml_writer_file writer(file);
- save(writer, indent, flags, encoding);
-
- fclose(file);
-
- return true;
+ return save_file_impl(*this, file, indent, flags, encoding);
}
PUGI__FN xml_node xml_document::document_element() const