From 75ef722702299e077a55e7099597d35939d1b0a6 Mon Sep 17 00:00:00 2001 From: Raul Metsma Date: Wed, 24 Jan 2024 08:50:20 +0200 Subject: [PATCH] Fix build with recent Xcode (#571) IB-7888 Signed-off-by: Raul Metsma --- src/SiVaContainer.cpp | 25 ++++++++++++------------- 1 file changed, 12 insertions(+), 13 deletions(-) diff --git a/src/SiVaContainer.cpp b/src/SiVaContainer.cpp index 793abf90b..250086d50 100644 --- a/src/SiVaContainer.cpp +++ b/src/SiVaContainer.cpp @@ -194,7 +194,7 @@ SiVaContainer::SiVaContainer(const string &path, ContainerOpenCB *cb, bool useHa else THROW("Unknown file"); - if(cb && !cb->validateOnline()) + if(useHashCode && cb && !cb->validateOnline()) THROW("Online validation disabled"); array buf{}; @@ -364,28 +364,27 @@ unique_ptr SiVaContainer::openInternal(const string &path, ContainerO unique_ptr SiVaContainer::parseDDoc(bool useHashCode) { namespace xml = xsd::cxx::xml; - using cpXMLCh = const XMLCh*; try { unique_ptr dom(SecureDOMParser().parseIStream(*d->ddoc)); - DOMNodeList *nodeList = dom->getElementsByTagName(cpXMLCh(u"DataFile")); + DOMNodeList *nodeList = dom->getElementsByTagName(u"DataFile"); for(XMLSize_t i = 0; i < nodeList->getLength(); ++i) { auto *item = static_cast(nodeList->item(i)); if(!item) continue; - if(XMLString::compareString(item->getAttribute(cpXMLCh(u"ContentType")), cpXMLCh(u"HASHCODE")) == 0) + if(XMLString::compareString(item->getAttribute(u"ContentType"), u"HASHCODE") == 0) THROW("Currently supports only content types EMBEDDED_BASE64 for DDOC format"); - if(XMLString::compareString(item->getAttribute(cpXMLCh(u"ContentType")), cpXMLCh(u"EMBEDDED_BASE64")) != 0) + if(XMLString::compareString(item->getAttribute(u"ContentType"), u"EMBEDDED_BASE64") != 0) continue; if(const XMLCh *b64 = item->getTextContent()) { d->dataFiles.push_back(new DataFilePrivate(base64_decode(b64), - xml::transcode(item->getAttribute(cpXMLCh(u"Filename"))), - xml::transcode(item->getAttribute(cpXMLCh(u"MimeType"))), - xml::transcode(item->getAttribute(cpXMLCh(u"Id"))))); + xml::transcode(item->getAttribute(u"Filename")), + xml::transcode(item->getAttribute(u"MimeType")), + xml::transcode(item->getAttribute(u"Id")))); } if(!useHashCode) @@ -395,22 +394,22 @@ unique_ptr SiVaContainer::parseDDoc(bool useHashCode) vector digest = calc.result(); if(XMLSize_t size = 0; XMLByte *out = Base64::encode(digest.data(), XMLSize_t(digest.size()), &size)) { - item->setAttribute(cpXMLCh(u"ContentType"), cpXMLCh(u"HASHCODE")); - item->setAttribute(cpXMLCh(u"DigestType"), cpXMLCh(u"sha1")); + item->setAttribute(u"ContentType", u"HASHCODE"); + item->setAttribute(u"DigestType", u"sha1"); xml::string outXMLCh(reinterpret_cast(out)); - item->setAttribute(cpXMLCh(u"DigestValue"), outXMLCh.c_str()); + item->setAttribute(u"DigestValue", outXMLCh.c_str()); item->setTextContent(nullptr); delete out; } } - DOMImplementation *pImplement = DOMImplementationRegistry::getDOMImplementation(cpXMLCh(u"LS")); + DOMImplementation *pImplement = DOMImplementationRegistry::getDOMImplementation(u"LS"); unique_ptr pDomLsOutput(pImplement->createLSOutput()); unique_ptr pSerializer(pImplement->createLSSerializer()); auto result = make_unique(); xml::dom::ostream_format_target out(*result); pDomLsOutput->setByteStream(&out); - pSerializer->setNewLine(cpXMLCh(u"\n")); + pSerializer->setNewLine(u"\n"); pSerializer->write(dom.get(), pDomLsOutput.get()); return result; }