1
0
mirror of https://github.com/VCMP-SqMod/SqMod.git synced 2024-11-08 00:37:15 +01:00

Update the PUGIXML library to the latest version.

This commit is contained in:
Sandu Liviu Catalin 2016-05-22 23:37:26 +03:00
parent 6e99f0d2d5
commit edf4d6cd38
2 changed files with 43 additions and 36 deletions

View File

@ -1,21 +1,22 @@
The MIT License (MIT)
Copyright (c) 2006-2016 Arseny Kapoulkine
Copyright (c) 2006-2014 Arseny Kapoulkine
Permission is hereby granted, free of charge, to any person
obtaining a copy of this software and associated documentation
files (the "Software"), to deal in the Software without
restriction, including without limitation the rights to use,
copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the
Software is furnished to do so, subject to the following
conditions:
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be
included in all copies or substantial portions of the Software.
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
OTHER DEALINGS IN THE SOFTWARE.

View File

@ -234,8 +234,10 @@ PUGI__NS_END
// auto_ptr-like object for exception recovery
PUGI__NS_BEGIN
template <typename T, typename D = void(*)(T*)> struct auto_deleter
template <typename T> struct auto_deleter
{
typedef void (*D)(T*);
T* data;
D deleter;
@ -401,14 +403,6 @@ PUGI__NS_END
#endif
PUGI__NS_BEGIN
static const size_t xml_memory_page_size =
#ifdef PUGIXML_MEMORY_PAGE_SIZE
PUGIXML_MEMORY_PAGE_SIZE
#else
32768
#endif
;
#ifdef PUGIXML_COMPACT
static const uintptr_t xml_memory_block_alignment = 4;
#else
@ -474,6 +468,14 @@ PUGI__NS_BEGIN
#endif
};
static const size_t xml_memory_page_size =
#ifdef PUGIXML_MEMORY_PAGE_SIZE
(PUGIXML_MEMORY_PAGE_SIZE)
#else
32768
#endif
- sizeof(xml_memory_page);
struct xml_memory_string_header
{
uint16_t page_offset; // offset from page->data
@ -4012,7 +4014,10 @@ PUGI__NS_BEGIN
{
if (!node->first_child)
{
writer.write(' ', '/', '>');
if ((flags & format_raw) == 0)
writer.write(' ');
writer.write('/', '>');
return false;
}
@ -4706,6 +4711,11 @@ PUGI__NS_BEGIN
return load_buffer_impl(doc, doc, contents, zero_terminate_buffer(contents, size, real_encoding), options, real_encoding, true, true, out_buffer);
}
PUGI__FN void close_file(FILE* file)
{
fclose(file);
}
#ifndef PUGIXML_NO_STL
template <typename T> struct xml_stream_chunk
{
@ -6865,8 +6875,7 @@ namespace pugi
reset();
using impl::auto_deleter; // MSVC7 workaround
typedef int (*fclose_t)(FILE*); // BCC5 workaround
auto_deleter<FILE, fclose_t> file(fopen(path_, "rb"), fclose);
auto_deleter<FILE> file(fopen(path_, "rb"), impl::close_file);
return impl::load_file_impl(static_cast<impl::xml_document_struct*>(_root), file.data, options, encoding, &_buffer);
}
@ -6876,8 +6885,7 @@ namespace pugi
reset();
using impl::auto_deleter; // MSVC7 workaround
typedef int (*fclose_t)(FILE*); // BCC5 workaround
auto_deleter<FILE, fclose_t> file(impl::open_file_wide(path_, L"rb"), fclose);
auto_deleter<FILE> file(impl::open_file_wide(path_, L"rb"), impl::close_file);
return impl::load_file_impl(static_cast<impl::xml_document_struct*>(_root), file.data, options, encoding, &_buffer);
}
@ -6950,8 +6958,7 @@ namespace pugi
PUGI__FN bool xml_document::save_file(const char* path_, const char_t* indent, unsigned int flags, xml_encoding encoding) const
{
using impl::auto_deleter; // MSVC7 workaround
typedef int (*fclose_t)(FILE*); // BCC5 workaround
auto_deleter<FILE, fclose_t> file(fopen(path_, (flags & format_save_file_text) ? "w" : "wb"), fclose);
auto_deleter<FILE> file(fopen(path_, (flags & format_save_file_text) ? "w" : "wb"), impl::close_file);
return impl::save_file_impl(*this, file.data, indent, flags, encoding);
}
@ -6959,8 +6966,7 @@ namespace pugi
PUGI__FN bool xml_document::save_file(const wchar_t* path_, const char_t* indent, unsigned int flags, xml_encoding encoding) const
{
using impl::auto_deleter; // MSVC7 workaround
typedef int (*fclose_t)(FILE*); // BCC5 workaround
auto_deleter<FILE, fclose_t> file(impl::open_file_wide(path_, (flags & format_save_file_text) ? L"w" : L"wb"), fclose);
auto_deleter<FILE> file(impl::open_file_wide(path_, (flags & format_save_file_text) ? L"w" : L"wb"), impl::close_file);
return impl::save_file_impl(*this, file.data, indent, flags, encoding);
}