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
This commit is contained in:
parent
dae6d908e5
commit
898b2cbabb
@ -3376,7 +3376,7 @@ PUGI__NS_BEGIN
|
|||||||
}
|
}
|
||||||
|
|
||||||
// set value with conversion functions
|
// 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
|
#ifdef PUGIXML_WCHAR_MODE
|
||||||
char_t wbuf[128];
|
char_t wbuf[128];
|
||||||
@ -3668,6 +3668,18 @@ PUGI__NS_BEGIN
|
|||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
#endif
|
#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
|
PUGI__NS_END
|
||||||
|
|
||||||
namespace pugi
|
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
|
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");
|
FILE* file = fopen(path_, "wb");
|
||||||
if (!file) return false;
|
return save_file_impl(*this, file, indent, flags, encoding);
|
||||||
|
|
||||||
xml_writer_file writer(file);
|
|
||||||
save(writer, indent, flags, encoding);
|
|
||||||
|
|
||||||
fclose(file);
|
|
||||||
|
|
||||||
return true;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
PUGI__FN bool xml_document::save_file(const wchar_t* path_, const char_t* indent, unsigned int flags, xml_encoding encoding) const
|
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");
|
FILE* file = impl::open_file_wide(path_, L"wb");
|
||||||
if (!file) return false;
|
return save_file_impl(*this, file, indent, flags, encoding);
|
||||||
|
|
||||||
xml_writer_file writer(file);
|
|
||||||
save(writer, indent, flags, encoding);
|
|
||||||
|
|
||||||
fclose(file);
|
|
||||||
|
|
||||||
return true;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
PUGI__FN xml_node xml_document::document_element() const
|
PUGI__FN xml_node xml_document::document_element() const
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user