diff options
author | Tomaž Vajngerl <tomaz.vajngerl@collabora.co.uk> | 2024-11-20 18:41:35 +0900 |
---|---|---|
committer | Tomaž Vajngerl <quikee@gmail.com> | 2024-12-21 05:59:37 +0100 |
commit | f44becfdb8bc0dad2d3ec7abd3aaa889d9e0bfea (patch) | |
tree | 0b7a7c37ab7fc475f9a672cb321d957bba66343f /vcl/source | |
parent | 0c09e5fb6eca9d3128e69779a654c4c6f01d9c02 (diff) |
pdf: add function to pad the vector as required by PDF specs
Change-Id: I7196ad523b3084124a3b03fb2e4998d42fd91779
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/176883
Reviewed-by: Miklos Vajna <vmiklos@collabora.com>
Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoffice@gmail.com>
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/178757
Tested-by: Jenkins
Reviewed-by: Tomaž Vajngerl <quikee@gmail.com>
Diffstat (limited to 'vcl/source')
-rw-r--r-- | vcl/source/pdf/PDFEncryptorR6.cxx | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/vcl/source/pdf/PDFEncryptorR6.cxx b/vcl/source/pdf/PDFEncryptorR6.cxx index b3850a5929f8..b3e6f9e3059e 100644 --- a/vcl/source/pdf/PDFEncryptorR6.cxx +++ b/vcl/source/pdf/PDFEncryptorR6.cxx @@ -238,6 +238,17 @@ std::vector<sal_uInt8> computeHashR6(const sal_uInt8* pPassword, size_t nPasswor return std::vector<sal_uInt8>(K.begin(), K.begin() + 32); } +size_t addPaddingToVector(std::vector<sal_uInt8>& rVector, size_t nBlockSize) +{ + size_t nPaddedSize = comphelper::roundUp(rVector.size(), size_t(nBlockSize)); + if (nPaddedSize > rVector.size()) + { + sal_uInt8 nPaddedValue = sal_uInt8(nPaddedSize - rVector.size()); + rVector.resize(nPaddedSize, nPaddedValue); + } + return nPaddedSize; +} + } // end vcl::pdf /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ |