From 92f8fc0691a08cd4329f3d389711287eb0f2dcf9 Mon Sep 17 00:00:00 2001 From: Raul Metsma Date: Tue, 23 Jan 2024 17:31:47 +0200 Subject: [PATCH] Workaround c++20 has stringstream move override (#564) IB-7851 Signed-off-by: Raul Metsma --- .github/workflows/build.yml | 2 +- cmake | 2 +- src/SiVaContainer.cpp | 13 ++++++------- 3 files changed, 8 insertions(+), 9 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 4694be747..d8ae118e8 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -227,7 +227,7 @@ jobs: cmake -B build -S . cmake --build build --target docs - name: Deploy - uses: peaceiris/actions-gh-pages@v4 + uses: peaceiris/actions-gh-pages@v3 with: github_token: ${{ secrets.GITHUB_TOKEN }} publish_dir: ./build/doc diff --git a/cmake b/cmake index 0ead93415..bf6d6327f 160000 --- a/cmake +++ b/cmake @@ -1 +1 @@ -Subproject commit 0ead93415bb874083a46d8ef812d9d8b0dedb169 +Subproject commit bf6d6327f226c79834b8ab3034e0f3dac7f4d39a diff --git a/src/SiVaContainer.cpp b/src/SiVaContainer.cpp index 5ed0e9181..793abf90b 100644 --- a/src/SiVaContainer.cpp +++ b/src/SiVaContainer.cpp @@ -55,7 +55,7 @@ using namespace std; using namespace xercesc; using json = nlohmann::json; -static string base64_decode(const XMLCh *in) { +static auto base64_decode(const XMLCh *in) { static constexpr array T{ 0x64, 0x64, 0x64, 0x64, 0x64, 0x64, 0x64, 0x64, 0x64, 0x64, 0x64, 0x64, 0x64, 0x64, 0x64, 0x64, 0x64, 0x64, 0x64, 0x64, 0x64, 0x64, 0x64, 0x64, 0x64, 0x64, 0x64, 0x64, 0x64, 0x64, 0x64, 0x64, @@ -67,7 +67,7 @@ static string base64_decode(const XMLCh *in) { 0x29, 0x2A, 0x2B, 0x2C, 0x2D, 0x2E, 0x2F, 0x30, 0x31, 0x32, 0x33, 0x64, 0x64, 0x64, 0x64, 0x64 }; - string out; + auto out = make_unique(); int value = 0; int bits = -8; for(; in; ++in) @@ -79,9 +79,9 @@ static string base64_decode(const XMLCh *in) { if(check == 0x64) break; value = (value << 6) + check; - if((bits += 6) < 0) + if(bits += 6; bits < 0) continue; - out.push_back(char((value >> bits) & 0xFF)); + out->put(char((value >> bits) & 0xFF)); bits -= 8; } return out; @@ -382,7 +382,7 @@ unique_ptr SiVaContainer::parseDDoc(bool useHashCode) if(const XMLCh *b64 = item->getTextContent()) { - d->dataFiles.push_back(new DataFilePrivate(make_unique(base64_decode(b64)), + 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"))))); @@ -393,8 +393,7 @@ unique_ptr SiVaContainer::parseDDoc(bool useHashCode) Digest calc(URI_SHA1); SecureDOMParser::calcDigestOnNode(&calc, "http://www.w3.org/TR/2001/REC-xml-c14n-20010315", item); vector digest = calc.result(); - XMLSize_t size = 0; - if(XMLByte *out = Base64::encode(digest.data(), XMLSize_t(digest.size()), &size)) + 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"));