diff options
Diffstat (limited to 'libxsde/xsde/cxx/parser/non-validating/base64-binary.cxx')
-rw-r--r-- | libxsde/xsde/cxx/parser/non-validating/base64-binary.cxx | 35 |
1 files changed, 32 insertions, 3 deletions
diff --git a/libxsde/xsde/cxx/parser/non-validating/base64-binary.cxx b/libxsde/xsde/cxx/parser/non-validating/base64-binary.cxx index f84d2a4..fb90768 100644 --- a/libxsde/xsde/cxx/parser/non-validating/base64-binary.cxx +++ b/libxsde/xsde/cxx/parser/non-validating/base64-binary.cxx @@ -5,6 +5,10 @@ #include <xsde/cxx/config.hxx> +#ifdef XSDE_CUSTOM_ALLOCATOR +# include <xsde/cxx/allocator.hxx> +#endif + #include <xsde/cxx/parser/non-validating/base64-binary.hxx> static unsigned char @@ -34,11 +38,18 @@ namespace xsde { namespace non_validating { - base64_binary_pimpl:: + base64_binary_pimpl:: ~base64_binary_pimpl () { - if (!base_) + if (!base_ && buf_) + { +#ifndef XSDE_CUSTOM_ALLOCATOR delete buf_; +#else + buf_->~buffer (); + cxx::free (buf_); +#endif + } } void base64_binary_pimpl:: @@ -46,9 +57,14 @@ namespace xsde { base64_binary_pskel::_reset (); - if (!base_) + if (!base_ && buf_) { +#ifndef XSDE_CUSTOM_ALLOCATOR delete buf_; +#else + buf_->~buffer (); + cxx::free (buf_); +#endif buf_ = 0; } } @@ -70,7 +86,20 @@ namespace xsde { if (buf_ == 0) { +#ifndef XSDE_CUSTOM_ALLOCATOR buf_ = new buffer (); +#else + buf_ = static_cast<buffer*> (alloc (sizeof (buffer))); + +#ifdef XSDE_EXCEPTIONS + alloc_guard ag (buf_); + new (buf_) buffer (); + ag.release (); +#else + if (buf_) + new (buf_) buffer (); +#endif +#endif #ifndef XSDE_EXCEPTIONS if (buf_ == 0) |