@@ -233,7 +233,9 @@ struct XMLNode: public XMLElem<xmlNode>
233
233
{
234
234
if (!d)
235
235
return *this ;
236
- xmlNodeAddContentLen (d, pcxmlChar (text.data ()), int (text.length ()));
236
+ xmlNodeSetContentLen (d, nullptr , 0 );
237
+ if (!text.empty ())
238
+ xmlNodeAddContentLen (d, pcxmlChar (text.data ()), int (text.length ()));
237
239
return *this ;
238
240
}
239
241
@@ -281,7 +283,7 @@ struct XMLNode: public XMLElem<xmlNode>
281
283
}
282
284
};
283
285
284
- struct XMLDocument : public unique_free_t <xmlDoc >, public XMLNode
286
+ struct XMLDocument : public unique_free_d <xmlFreeDoc >, public XMLNode
285
287
{
286
288
static constexpr std::string_view C14D_ID_1_0 {" http://www.w3.org/TR/2001/REC-xml-c14n-20010315" };
287
289
static constexpr std::string_view C14D_ID_1_0_COM {" http://www.w3.org/TR/2001/REC-xml-c14n-20010315#WithComments" };
@@ -293,7 +295,7 @@ struct XMLDocument: public unique_free_t<xmlDoc>, public XMLNode
293
295
using XMLNode::operator bool ;
294
296
295
297
XMLDocument (element_type *ptr = {}, const XMLName &n = {}) noexcept
296
- : unique_free_t <xmlDoc >(ptr, xmlFreeDoc )
298
+ : unique_free_d<xmlFreeDoc >(ptr)
297
299
, XMLNode{xmlDocGetRootElement (get ())}
298
300
{
299
301
if (d && !n.name .empty () && n.name != name () && !n.ns .empty () && n.ns != ns ())
@@ -438,8 +440,8 @@ struct XMLDocument: public unique_free_t<xmlDoc>, public XMLNode
438
440
{
439
441
for (xmlSecSize i = 0 ; i < xmlSecPtrListGetSize (&(ctx->signedInfoReferences )); ++i)
440
442
{
441
- auto *ref = xmlSecDSigReferenceCtxPtr (xmlSecPtrListGetItem (&(ctx->signedInfoReferences ), i));
442
- if ( ref->status != xmlSecDSigStatusSucceeded)
443
+ if ( auto *ref = xmlSecDSigReferenceCtxPtr (xmlSecPtrListGetItem (&(ctx->signedInfoReferences ), i));
444
+ ref && ref->status != xmlSecDSigStatusSucceeded)
443
445
{
444
446
if (e)
445
447
e->addCause (Exception (EXCEPTION_PARAMS (" Failed to validate Reference '%s'" , ref->uri )));
0 commit comments