opencl,sc: convert callers of rtl_digest_MD5 to comphelper::Hash
Signed-off-by: Michael Stahl <michael.stahl@collabora.com> Change-Id: Ib507b0e73fce064a7dbd2426849d9bf32bb95295 Reviewed-on: https://gerrit.collaboraoffice.com/c/online/+/4672 Reviewed-by: Stephan Bergmann <stephan.bergmann@collabora.com> (cherry picked from commit abd6c2a86dfc250ba9110afa48f10cb2d149bafb) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/207204 Reviewed-by: Xisco Fauli <xiscofauli@libreoffice.org> Tested-by: Jenkins
This commit is contained in:
committed by
Xisco Fauli
parent
592e67c4f2
commit
6e9c3fb2be
@@ -17,11 +17,11 @@
|
|||||||
#include <opencl/platforminfo.hxx>
|
#include <opencl/platforminfo.hxx>
|
||||||
#include <osl/file.hxx>
|
#include <osl/file.hxx>
|
||||||
#include <rtl/bootstrap.hxx>
|
#include <rtl/bootstrap.hxx>
|
||||||
#include <rtl/digest.h>
|
|
||||||
#include <rtl/strbuf.hxx>
|
#include <rtl/strbuf.hxx>
|
||||||
#include <rtl/ustring.hxx>
|
#include <rtl/ustring.hxx>
|
||||||
#include <sal/config.h>
|
#include <sal/config.h>
|
||||||
#include <sal/log.hxx>
|
#include <sal/log.hxx>
|
||||||
|
#include <comphelper/hash.hxx>
|
||||||
#include <opencl/OpenCLZone.hxx>
|
#include <opencl/OpenCLZone.hxx>
|
||||||
|
|
||||||
#include <memory>
|
#include <memory>
|
||||||
@@ -66,14 +66,12 @@ namespace
|
|||||||
|
|
||||||
OString generateMD5(const void* pData, size_t length)
|
OString generateMD5(const void* pData, size_t length)
|
||||||
{
|
{
|
||||||
sal_uInt8 pBuffer[RTL_DIGEST_LENGTH_MD5];
|
::std::vector<unsigned char> hash{
|
||||||
rtlDigestError aError = rtl_digest_MD5(pData, length,
|
::comphelper::Hash::calculateHash(pData, length, ::comphelper::HashType::MD5)};
|
||||||
pBuffer, RTL_DIGEST_LENGTH_MD5);
|
|
||||||
SAL_WARN_IF(aError != rtl_Digest_E_None, "opencl", "md5 generation failed");
|
|
||||||
|
|
||||||
OStringBuffer aBuffer(length * 2);
|
OStringBuffer aBuffer(length * 2);
|
||||||
const char* const pString = "0123456789ABCDEF";
|
const char* const pString = "0123456789ABCDEF";
|
||||||
for(sal_uInt8 val : pBuffer)
|
for(sal_uInt8 val : hash)
|
||||||
{
|
{
|
||||||
aBuffer.append(OStringChar(pString[val/16]) + OStringChar(pString[val%16]));
|
aBuffer.append(OStringChar(pString[val/16]) + OStringChar(pString[val%16]));
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -13,6 +13,7 @@
|
|||||||
#include <formulacell.hxx>
|
#include <formulacell.hxx>
|
||||||
#include <tokenarray.hxx>
|
#include <tokenarray.hxx>
|
||||||
#include <compiler.hxx>
|
#include <compiler.hxx>
|
||||||
|
#include <comphelper/hash.hxx>
|
||||||
#include <comphelper/random.hxx>
|
#include <comphelper/random.hxx>
|
||||||
#include <scmatrix.hxx>
|
#include <scmatrix.hxx>
|
||||||
#include <sal/log.hxx>
|
#include <sal/log.hxx>
|
||||||
@@ -60,9 +61,6 @@ const char* const publicFunc =
|
|||||||
#include <map>
|
#include <map>
|
||||||
#include <iostream>
|
#include <iostream>
|
||||||
#include <algorithm>
|
#include <algorithm>
|
||||||
|
|
||||||
#include <rtl/digest.h>
|
|
||||||
|
|
||||||
#include <memory>
|
#include <memory>
|
||||||
|
|
||||||
using namespace formula;
|
using namespace formula;
|
||||||
@@ -2556,12 +2554,11 @@ std::string const & DynamicKernel::GetMD5()
|
|||||||
{
|
{
|
||||||
outputstream md5s;
|
outputstream md5s;
|
||||||
// Compute MD5SUM of kernel body to obtain the name
|
// Compute MD5SUM of kernel body to obtain the name
|
||||||
sal_uInt8 result[RTL_DIGEST_LENGTH_MD5];
|
::std::vector<unsigned char> hash{
|
||||||
rtl_digest_MD5(
|
::comphelper::Hash::calculateHash(mFullProgramSrc.c_str(),
|
||||||
mFullProgramSrc.c_str(),
|
mFullProgramSrc.length(), ::comphelper::HashType::MD5)};
|
||||||
mFullProgramSrc.length(), result,
|
|
||||||
RTL_DIGEST_LENGTH_MD5);
|
for (sal_uInt8 i : hash)
|
||||||
for (sal_uInt8 i : result)
|
|
||||||
{
|
{
|
||||||
md5s << std::hex << static_cast<int>(i);
|
md5s << std::hex << static_cast<int>(i);
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user