summaryrefslogtreecommitdiff
path: root/vcl/source/filter
diff options
context:
space:
mode:
authorAshod Nakashian <ashod.nakashian@collabora.co.uk>2017-08-01 15:04:56 -0400
committerAshod Nakashian <ashnakash@gmail.com>2017-08-04 02:11:24 +0200
commit0a64fa41045eea8ea179bbf0eee306ffb5851500 (patch)
tree4ef71c9e6739da9e60bbde6e7eadfbb195d2894c /vcl/source/filter
parent12e13f1f177d6f203edfbef4b31e1e7d3d3d7e78 (diff)
svl: move DecodeHexString from vcl
Change-Id: I86da993050bde20f9ff0413ad5424673647a0e5c Reviewed-on: https://gerrit.libreoffice.org/40720 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Ashod Nakashian <ashnakash@gmail.com>
Diffstat (limited to 'vcl/source/filter')
-rw-r--r--vcl/source/filter/ipdf/pdfdocument.cxx46
1 files changed, 1 insertions, 45 deletions
diff --git a/vcl/source/filter/ipdf/pdfdocument.cxx b/vcl/source/filter/ipdf/pdfdocument.cxx
index 96960c407c1a..619041595c6b 100644
--- a/vcl/source/filter/ipdf/pdfdocument.cxx
+++ b/vcl/source/filter/ipdf/pdfdocument.cxx
@@ -1892,53 +1892,9 @@ std::vector<PDFObjectElement*> PDFDocument::GetSignatureWidgets()
return aRet;
}
-int PDFDocument::AsHex(char ch)
-{
- int nRet = 0;
- if (rtl::isAsciiDigit(static_cast<unsigned char>(ch)))
- nRet = ch - '0';
- else
- {
- if (ch >= 'a' && ch <= 'f')
- nRet = ch - 'a';
- else if (ch >= 'A' && ch <= 'F')
- nRet = ch - 'A';
- else
- return -1;
- nRet += 10;
- }
- return nRet;
-}
-
std::vector<unsigned char> PDFDocument::DecodeHexString(PDFHexStringElement const* pElement)
{
- std::vector<unsigned char> aRet;
- const OString& rHex = pElement->GetValue();
- size_t nHexLen = rHex.getLength();
- {
- int nByte = 0;
- int nCount = 2;
- for (size_t i = 0; i < nHexLen; ++i)
- {
- nByte = nByte << 4;
- sal_Int8 nParsed = AsHex(rHex[i]);
- if (nParsed == -1)
- {
- SAL_WARN("vcl.filter", "PDFDocument::DecodeHexString: invalid hex value");
- return aRet;
- }
- nByte += nParsed;
- --nCount;
- if (!nCount)
- {
- aRet.push_back(nByte);
- nCount = 2;
- nByte = 0;
- }
- }
- }
-
- return aRet;
+ return svl::crypto::DecodeHexString(pElement->GetValue());
}
PDFCommentElement::PDFCommentElement(PDFDocument& rDoc)