mirror of
https://github.com/zeux/pugixml.git
synced 2024-12-28 23:03:00 +08:00
Fix MSVC6 header-only build
name_sentry dtor results in multiple symbol definition errors in MSVC6.
This commit is contained in:
parent
0e09571f21
commit
809f992f83
@ -4891,6 +4891,22 @@ PUGI__NS_BEGIN
|
|||||||
|
|
||||||
return ferror(file) == 0;
|
return ferror(file) == 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
struct name_null_sentry
|
||||||
|
{
|
||||||
|
xml_node_struct* node;
|
||||||
|
char_t* name;
|
||||||
|
|
||||||
|
name_null_sentry(xml_node_struct* node): node(node), name(node->name)
|
||||||
|
{
|
||||||
|
node->name = 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
~name_null_sentry()
|
||||||
|
{
|
||||||
|
node->name = name;
|
||||||
|
}
|
||||||
|
};
|
||||||
PUGI__NS_END
|
PUGI__NS_END
|
||||||
|
|
||||||
namespace pugi
|
namespace pugi
|
||||||
@ -5920,17 +5936,7 @@ namespace pugi
|
|||||||
doc->extra_buffers = extra;
|
doc->extra_buffers = extra;
|
||||||
|
|
||||||
// name of the root has to be NULL before parsing - otherwise closing node mismatches will not be detected at the top level
|
// name of the root has to be NULL before parsing - otherwise closing node mismatches will not be detected at the top level
|
||||||
struct name_sentry
|
impl::name_null_sentry sentry(_root);
|
||||||
{
|
|
||||||
xml_node_struct* node;
|
|
||||||
char_t* name;
|
|
||||||
|
|
||||||
~name_sentry() { node->name = name; }
|
|
||||||
};
|
|
||||||
|
|
||||||
name_sentry sentry = { _root, _root->name };
|
|
||||||
|
|
||||||
sentry.node->name = 0;
|
|
||||||
|
|
||||||
return impl::load_buffer_impl(doc, _root, const_cast<void*>(contents), size, options, encoding, false, false, &extra->buffer);
|
return impl::load_buffer_impl(doc, _root, const_cast<void*>(contents), size, options, encoding, false, false, &extra->buffer);
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user