Kaydet (Commit) ddd43218 authored tarafından Noel Grandin's avatar Noel Grandin

drop sax::tools::*base64 methods

and use the underlying comphelper methods rather. This is so that I can
break the dependency that tools has on sax, and can add methods that
make sax depend on tools.

Change-Id: I8a2d6ce2ffc3529a0020710ade6a1748ee5af7d5
Reviewed-on: https://gerrit.libreoffice.org/50767Tested-by: 's avatarJenkins <ci@libreoffice.org>
Reviewed-by: 's avatarNoel Grandin <noel.grandin@collabora.co.uk>
üst 9c036b1d
......@@ -13,6 +13,7 @@ $(eval $(call gb_CppunitTest_add_exception_objects,comphelper_test, \
comphelper/qa/string/test_string \
comphelper/qa/container/testifcontainer \
comphelper/qa/unit/test_hash \
comphelper/qa/unit/base64_test \
))
$(eval $(call gb_CppunitTest_use_sdk_api,comphelper_test))
......
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/*
* This file is part of the LibreOffice project.
*
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
*
* This file incorporates work covered by the following license notice:
*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed
* with this work for additional information regarding copyright
* ownership. The ASF licenses this file to you under the Apache
* License, Version 2.0 (the "License"); you may not use this file
* except in compliance with the License. You may obtain a copy of
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
#include <limits>
#include <sal/types.h>
#include <cppunit/TestAssert.h>
#include <cppunit/TestFixture.h>
#include <cppunit/extensions/HelperMacros.h>
#include <cppunit/plugin/TestPlugIn.h>
#include <rtl/ustrbuf.hxx>
#include <com/sun/star/util/DateTime.hpp>
#include <com/sun/star/util/Date.hpp>
#include <com/sun/star/util/Duration.hpp>
#include <com/sun/star/util/MeasureUnit.hpp>
#include <comphelper/sequence.hxx>
#include <comphelper/base64.hxx>
#include <sal/log.hxx>
using namespace ::com::sun::star;
using namespace ::com::sun::star::util;
namespace {
class Base64Test
: public ::CppUnit::TestFixture
{
public:
void testBase64();
CPPUNIT_TEST_SUITE(Base64Test);
CPPUNIT_TEST(testBase64);
CPPUNIT_TEST_SUITE_END();
private:
};
void doTestEncodeBase64(char const*const pis, const uno::Sequence<sal_Int8>& aPass)
{
OUString const is(OUString::createFromAscii(pis));
OUStringBuffer buf;
comphelper::Base64::encode(buf, aPass);
SAL_INFO("sax.cppunit","" << buf.toString());
CPPUNIT_ASSERT_EQUAL(is, buf.makeStringAndClear());
}
void doTestDecodeBase64(const uno::Sequence<sal_Int8>& aPass, char const*const pis)
{
OUString const is(OUString::createFromAscii(pis));
uno::Sequence< sal_Int8 > tempSequence;
comphelper::Base64::decode(tempSequence, is);
SAL_INFO("sax.cppunit","" << is);
bool b = (tempSequence==aPass);
CPPUNIT_ASSERT(b);
}
void Base64Test::testBase64()
{
std::vector< sal_Int8 > tempSeq { 0, 0, 0, 0, 0, 1, 2, 3 };
uno::Sequence< sal_Int8 > tempSequence = comphelper::containerToSequence(tempSeq);
doTestEncodeBase64("AAAAAAABAgM=", tempSequence);
doTestDecodeBase64(tempSequence, "AAAAAAABAgM=");
tempSeq[0] = sal_Int8(5);
tempSeq[1] = sal_Int8(2);
tempSeq[2] = sal_Int8(3);
tempSequence = comphelper::containerToSequence(tempSeq);
doTestEncodeBase64("BQIDAAABAgM=", tempSequence);
doTestDecodeBase64(tempSequence, "BQIDAAABAgM=");
tempSeq[0] = sal_Int8(sal_uInt8(200));
tempSeq[1] = sal_Int8(31);
tempSeq[2] = sal_Int8(77);
tempSeq[3] = sal_Int8(111);
tempSequence = comphelper::containerToSequence(tempSeq);
doTestEncodeBase64("yB9NbwABAgM=", tempSequence);
doTestDecodeBase64(tempSequence, "yB9NbwABAgM=");
}
CPPUNIT_TEST_SUITE_REGISTRATION(Base64Test);
}
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
......@@ -21,6 +21,7 @@
#include "svgfontexport.hxx"
#include "svgwriter.hxx"
#include <comphelper/base64.hxx>
#include <rtl/crc.h>
#include <vcl/unohelp.hxx>
#include <vcl/outdev.hxx>
......@@ -2731,7 +2732,7 @@ void SVGActionWriter::ImplWriteBmp( const BitmapEx& rBmpEx,
Size aSz;
Sequence< sal_Int8 > aSeq( static_cast<sal_Int8 const *>(aOStm.GetData()), aOStm.Tell() );
OUStringBuffer aBuffer( "data:image/png;base64," );
::sax::Converter::encodeBase64( aBuffer, aSeq );
::comphelper::Base64::encode( aBuffer, aSeq );
ImplMap( rPt, aPt );
ImplMap( rSz, aSz );
......
......@@ -30,6 +30,7 @@
#include <package/Deflater.hxx>
#include <cppuhelper/factory.hxx>
#include <comphelper/base64.hxx>
#include <comphelper/processfactory.hxx>
#include <com/sun/star/uno/Any.hxx>
#include <com/sun/star/uno/XInterface.hpp>
......@@ -75,7 +76,7 @@ namespace XSLT
void OleHandler::initRootStorageFromBase64(const OString& content)
{
Sequence<sal_Int8> oleData;
::sax::Converter::decodeBase64(oleData, OStringToOUString(
::comphelper::Base64::decode(oleData, OStringToOUString(
content, RTL_TEXTENCODING_UTF8));
m_rootStream = createTempFile();
Reference<XOutputStream> xOutput = m_rootStream->getOutputStream();
......@@ -142,7 +143,7 @@ namespace XSLT
decompresser.reset();
//return the base64 string of the uncompressed data
OUStringBuffer buf(oleLength);
::sax::Converter::encodeBase64(buf, result);
::comphelper::Base64::encode(buf, result);
return OUStringToOString(buf.toString(), RTL_TEXTENCODING_UTF8);
}
......@@ -175,7 +176,7 @@ namespace XSLT
xInput->readBytes(oledata, oleLength);
//return the base64 encoded string
OUStringBuffer buf(oleLength);
::sax::Converter::encodeBase64(buf, oledata);
::comphelper::Base64::encode(buf, oledata);
return OUStringToOString(buf.toString(), RTL_TEXTENCODING_UTF8);
}
return encodeSubStorage(streamName);
......@@ -186,7 +187,7 @@ namespace XSLT
{
//decode the base64 string
Sequence<sal_Int8> oledata;
::sax::Converter::decodeBase64(oledata,
::comphelper::Base64::decode(oledata,
OStringToOUString(content, RTL_TEXTENCODING_ASCII_US));
//create a temp stream to write data to
Reference<XStream> subStream = createTempFile();
......
......@@ -194,18 +194,6 @@ public:
static sal_Int32 indexOfComma( const OUString& rStr,
sal_Int32 nPos );
/** encodes the given byte sequence into Base64 */
static void encodeBase64(OUStringBuffer& aStrBuffer, const css::uno::Sequence<sal_Int8>& aPass);
// Decode a base 64 encoded string into a sequence of bytes. The first
// version can be used for attribute values only, because it does not
// return any chars left from conversion.
// For text submitted throgh the SAX characters call, the later method
// must be used!
static void decodeBase64(css::uno::Sequence<sal_Int8>& aPass, const OUString& sBuffer);
static sal_Int32 decodeBase64SomeChars(css::uno::Sequence<sal_Int8>& aPass, const OUString& sBuffer);
static double GetConversionFactor(OUStringBuffer& rUnit, sal_Int16 nSourceUnit, sal_Int16 nTargetUnit);
static sal_Int16 GetUnitFromString(const OUString& rString, sal_Int16 nDefaultUnit);
......
......@@ -10,6 +10,7 @@
#include <oox/crypto/DocumentDecryption.hxx>
#include <comphelper/base64.hxx>
#include <comphelper/sequenceashashmap.hxx>
#include <sax/tools/converter.hxx>
#include <cppuhelper/implbase.hxx>
......@@ -90,7 +91,7 @@ public:
if (localname(rAttribute.Name) == "saltValue")
{
Sequence<sal_Int8> keyDataSalt;
::sax::Converter::decodeBase64(keyDataSalt, rAttribute.Value);
::comphelper::Base64::decode(keyDataSalt, rAttribute.Value);
mInfo.keyDataSalt = convertToVector(keyDataSalt);
}
}
......@@ -135,25 +136,25 @@ public:
else if (rAttrLocalName == "saltValue")
{
Sequence<sal_Int8> saltValue;
::sax::Converter::decodeBase64(saltValue, rAttribute.Value);
::comphelper::Base64::decode(saltValue, rAttribute.Value);
mInfo.saltValue = convertToVector(saltValue);
}
else if (rAttrLocalName == "encryptedVerifierHashInput")
{
Sequence<sal_Int8> encryptedVerifierHashInput;
::sax::Converter::decodeBase64(encryptedVerifierHashInput, rAttribute.Value);
::comphelper::Base64::decode(encryptedVerifierHashInput, rAttribute.Value);
mInfo.encryptedVerifierHashInput = convertToVector(encryptedVerifierHashInput);
}
else if (rAttrLocalName == "encryptedVerifierHashValue")
{
Sequence<sal_Int8> encryptedVerifierHashValue;
::sax::Converter::decodeBase64(encryptedVerifierHashValue, rAttribute.Value);
::comphelper::Base64::decode(encryptedVerifierHashValue, rAttribute.Value);
mInfo.encryptedVerifierHashValue = convertToVector(encryptedVerifierHashValue);
}
else if (rAttrLocalName == "encryptedKeyValue")
{
Sequence<sal_Int8> encryptedKeyValue;
::sax::Converter::decodeBase64(encryptedKeyValue, rAttribute.Value);
::comphelper::Base64::decode(encryptedKeyValue, rAttribute.Value);
mInfo.encryptedKeyValue = convertToVector(encryptedKeyValue);
}
}
......
......@@ -32,6 +32,7 @@
#include <osl/diagnose.h>
#include <rtl/ustrbuf.hxx>
#include <comphelper/base64.hxx>
#include <comphelper/documentconstants.hxx>
#include <comphelper/attributelist.hxx>
......@@ -281,7 +282,7 @@ ManifestExport::ManifestExport( uno::Reference< xml::sax::XDocumentHandler > con
xHandler->ignorableWhitespace ( sWhiteSpace );
xHandler->startElement( sPgpKeyIDElement, nullptr );
::sax::Converter::encodeBase64(aBuffer, aPgpKeyID);
::comphelper::Base64::encode(aBuffer, aPgpKeyID);
xHandler->characters( aBuffer.makeStringAndClear() );
xHandler->endElement( sPgpKeyIDElement );
xHandler->ignorableWhitespace ( sWhiteSpace );
......@@ -290,7 +291,7 @@ ManifestExport::ManifestExport( uno::Reference< xml::sax::XDocumentHandler > con
if (aPgpKeyPacket.hasElements())
{
xHandler->startElement( sPGPKeyPacketElement, nullptr );
::sax::Converter::encodeBase64(aBuffer, aPgpKeyPacket);
::comphelper::Base64::encode(aBuffer, aPgpKeyPacket);
xHandler->characters( aBuffer.makeStringAndClear() );
xHandler->endElement( sPGPKeyPacketElement );
xHandler->ignorableWhitespace ( sWhiteSpace );
......@@ -306,7 +307,7 @@ ManifestExport::ManifestExport( uno::Reference< xml::sax::XDocumentHandler > con
xHandler->ignorableWhitespace ( sWhiteSpace );
xHandler->startElement( sCipherValueElement, nullptr );
::sax::Converter::encodeBase64(aBuffer, aCipherValue);
::comphelper::Base64::encode(aBuffer, aCipherValue);
xHandler->characters( aBuffer.makeStringAndClear() );
xHandler->endElement( sCipherValueElement );
xHandler->ignorableWhitespace ( sWhiteSpace );
......@@ -402,7 +403,7 @@ ManifestExport::ManifestExport( uno::Reference< xml::sax::XDocumentHandler > con
pNewAttrList->AddAttribute ( sChecksumTypeAttribute, sCdataAttribute, sChecksumType );
*pDigest >>= aSequence;
::sax::Converter::encodeBase64(aBuffer, aSequence);
::comphelper::Base64::encode(aBuffer, aSequence);
pNewAttrList->AddAttribute ( sChecksumAttribute, sCdataAttribute, aBuffer.makeStringAndClear() );
xHandler->startElement( sEncryptionDataElement , xNewAttrList);
......@@ -435,7 +436,7 @@ ManifestExport::ManifestExport( uno::Reference< xml::sax::XDocumentHandler > con
pNewAttrList->AddAttribute ( sAlgorithmNameAttribute, sCdataAttribute, sEncAlgName );
*pVector >>= aSequence;
::sax::Converter::encodeBase64(aBuffer, aSequence);
::comphelper::Base64::encode(aBuffer, aSequence);
pNewAttrList->AddAttribute ( sInitialisationVectorAttribute, sCdataAttribute, aBuffer.makeStringAndClear() );
xHandler->ignorableWhitespace ( sWhiteSpace );
......@@ -474,7 +475,7 @@ ManifestExport::ManifestExport( uno::Reference< xml::sax::XDocumentHandler > con
pNewAttrList->AddAttribute ( sIterationCountAttribute, sCdataAttribute, aBuffer.makeStringAndClear() );
*pSalt >>= aSequence;
::sax::Converter::encodeBase64(aBuffer, aSequence);
::comphelper::Base64::encode(aBuffer, aSequence);
pNewAttrList->AddAttribute ( sSaltAttribute, sCdataAttribute, aBuffer.makeStringAndClear() );
}
......
......@@ -25,6 +25,7 @@
#include <com/sun/star/xml/crypto/DigestID.hpp>
#include <com/sun/star/xml/crypto/CipherID.hpp>
#include <com/sun/star/beans/PropertyValue.hpp>
#include <comphelper/base64.hxx>
#include <comphelper/sequence.hxx>
using namespace com::sun::star::uno;
......@@ -176,7 +177,7 @@ void ManifestImport::doEncryptedCipherValue()
{
aKeyInfoSequence[2].Name = "CipherValue";
uno::Sequence < sal_Int8 > aDecodeBuffer;
::sax::Converter::decodeBase64(aDecodeBuffer, aCurrentCharacters);
::comphelper::Base64::decode(aDecodeBuffer, aCurrentCharacters);
aKeyInfoSequence[2].Value <<= aDecodeBuffer;
aCurrentCharacters = ""; // consumed
}
......@@ -190,7 +191,7 @@ void ManifestImport::doEncryptedKeyId()
{
aKeyInfoSequence[0].Name = "KeyId";
uno::Sequence < sal_Int8 > aDecodeBuffer;
::sax::Converter::decodeBase64(aDecodeBuffer, aCurrentCharacters);
::comphelper::Base64::decode(aDecodeBuffer, aCurrentCharacters);
aKeyInfoSequence[0].Value <<= aDecodeBuffer;
aCurrentCharacters = ""; // consumed
}
......@@ -204,7 +205,7 @@ void ManifestImport::doEncryptedKeyPacket()
{
aKeyInfoSequence[1].Name = "KeyPacket";
uno::Sequence < sal_Int8 > aDecodeBuffer;
::sax::Converter::decodeBase64(aDecodeBuffer, aCurrentCharacters);
::comphelper::Base64::decode(aDecodeBuffer, aCurrentCharacters);
aKeyInfoSequence[1].Value <<= aDecodeBuffer;
aCurrentCharacters = ""; // consumed
}
......@@ -231,7 +232,7 @@ void ManifestImport::doEncryptionData(StringHashMap &rConvertedAttribs)
if ( !bIgnoreEncryptData ) {
aString = rConvertedAttribs[sChecksumAttribute];
uno::Sequence < sal_Int8 > aDecodeBuffer;
::sax::Converter::decodeBase64(aDecodeBuffer, aString);
::comphelper::Base64::decode(aDecodeBuffer, aString);
aSequence[PKG_MNFST_DIGEST].Name = sDigestProperty;
aSequence[PKG_MNFST_DIGEST].Value <<= aDecodeBuffer;
}
......@@ -266,7 +267,7 @@ void ManifestImport::doAlgorithm(StringHashMap &rConvertedAttribs)
if ( !bIgnoreEncryptData ) {
aString = rConvertedAttribs[sInitialisationVectorAttribute];
uno::Sequence < sal_Int8 > aDecodeBuffer;
::sax::Converter::decodeBase64(aDecodeBuffer, aString);
::comphelper::Base64::decode(aDecodeBuffer, aString);
aSequence[PKG_MNFST_INIVECTOR].Name = sInitialisationVectorProperty;
aSequence[PKG_MNFST_INIVECTOR].Value <<= aDecodeBuffer;
}
......@@ -280,7 +281,7 @@ void ManifestImport::doKeyDerivation(StringHashMap &rConvertedAttribs)
if ( aString == sPBKDF2_Name || aString == sPBKDF2_URL ) {
aString = rConvertedAttribs[sSaltAttribute];
uno::Sequence < sal_Int8 > aDecodeBuffer;
::sax::Converter::decodeBase64(aDecodeBuffer, aString);
::comphelper::Base64::decode(aDecodeBuffer, aString);
aSequence[PKG_MNFST_SALT].Name = sSaltProperty;
aSequence[PKG_MNFST_SALT].Value <<= aDecodeBuffer;
......
......@@ -58,7 +58,6 @@ public:
void testPercent();
void testColor();
void testNumber();
void testBase64();
CPPUNIT_TEST_SUITE(ConverterTest);
CPPUNIT_TEST(testDuration);
......@@ -70,7 +69,6 @@ public:
CPPUNIT_TEST(testPercent);
CPPUNIT_TEST(testColor);
CPPUNIT_TEST(testNumber);
CPPUNIT_TEST(testBase64);
CPPUNIT_TEST_SUITE_END();
private:
......@@ -617,46 +615,6 @@ void ConverterTest::testNumber()
doTestStringToNumber(0, "666", -0, 0);
}
void doTestEncodeBase64(char const*const pis, const uno::Sequence<sal_Int8>& aPass)
{
OUString const is(OUString::createFromAscii(pis));
OUStringBuffer buf;
Converter::encodeBase64(buf, aPass);
SAL_INFO("sax.cppunit","" << buf.toString());
CPPUNIT_ASSERT_EQUAL(is, buf.makeStringAndClear());
}
void doTestDecodeBase64(const uno::Sequence<sal_Int8>& aPass, char const*const pis)
{
OUString const is(OUString::createFromAscii(pis));
uno::Sequence< sal_Int8 > tempSequence;
Converter::decodeBase64(tempSequence, is);
SAL_INFO("sax.cppunit","" << is);
bool b = (tempSequence==aPass);
CPPUNIT_ASSERT(b);
}
void ConverterTest::testBase64()
{
std::vector< sal_Int8 > tempSeq { 0, 0, 0, 0, 0, 1, 2, 3 };
uno::Sequence< sal_Int8 > tempSequence = comphelper::containerToSequence(tempSeq);
doTestEncodeBase64("AAAAAAABAgM=", tempSequence);
doTestDecodeBase64(tempSequence, "AAAAAAABAgM=");
tempSeq[0] = sal_Int8(5);
tempSeq[1] = sal_Int8(2);
tempSeq[2] = sal_Int8(3);
tempSequence = comphelper::containerToSequence(tempSeq);
doTestEncodeBase64("BQIDAAABAgM=", tempSequence);
doTestDecodeBase64(tempSequence, "BQIDAAABAgM=");
tempSeq[0] = sal_Int8(sal_uInt8(200));
tempSeq[1] = sal_Int8(31);
tempSeq[2] = sal_Int8(77);
tempSeq[3] = sal_Int8(111);
tempSequence = comphelper::containerToSequence(tempSeq);
doTestEncodeBase64("yB9NbwABAgM=", tempSequence);
doTestDecodeBase64(tempSequence, "yB9NbwABAgM=");
}
CPPUNIT_TEST_SUITE_REGISTRATION(ConverterTest);
}
......
......@@ -32,7 +32,6 @@
#include <rtl/math.hxx>
#include <sal/log.hxx>
#include <osl/diagnose.h>
#include <comphelper/base64.hxx>
#include <algorithm>
......@@ -1903,23 +1902,6 @@ sal_Int32 Converter::indexOfComma( const OUString& rStr,
return -1;
}
void Converter::encodeBase64(OUStringBuffer& aStrBuffer, const uno::Sequence<sal_Int8>& aPass)
{
comphelper::Base64::encode(aStrBuffer, aPass);
}
void Converter::decodeBase64(uno::Sequence<sal_Int8>& aBuffer, const OUString& sBuffer)
{
comphelper::Base64::decode(aBuffer, sBuffer);
}
sal_Int32 Converter::decodeBase64SomeChars(
uno::Sequence<sal_Int8>& rOutBuffer,
const OUString& rInBuffer)
{
return comphelper::Base64::decodeSomeChars(rOutBuffer, rInBuffer);
}
double Converter::GetConversionFactor(OUStringBuffer& rUnit, sal_Int16 nSourceUnit, sal_Int16 nTargetUnit)
{
double fRetval(1.0);
......
......@@ -33,6 +33,7 @@
#include <sax/tools/converter.hxx>
#include <svl/zforlist.hxx>
#include <svl/sharedstringpool.hxx>
#include <comphelper/base64.hxx>
#include <com/sun/star/text/XTextCursor.hpp>
#include <com/sun/star/text/ControlCharacter.hpp>
......@@ -375,7 +376,7 @@ ScXMLTrackedChangesContext::ScXMLTrackedChangesContext( ScXMLImport& rImport,
if( !aIter.isEmpty() )
{
uno::Sequence<sal_Int8> aPass;
::sax::Converter::decodeBase64( aPass, aIter.toString() );
::comphelper::Base64::decode( aPass, aIter.toString() );
pChangeTrackingImportHelper->SetProtection(aPass);
}
}
......
......@@ -49,6 +49,7 @@
#include <xmloff/xmlnmspe.hxx>
#include <xmloff/nmspmap.hxx>
#include <comphelper/base64.hxx>
#include <sax/tools/converter.hxx>
#include <sal/types.h>
......@@ -265,7 +266,7 @@ void SAL_CALL ScXMLBodyContext::endFastElement(sal_Int32 nElement)
uno::Sequence<sal_Int8> aPass;
if (!sPassword.isEmpty())
{
::sax::Converter::decodeBase64(aPass, sPassword);
::comphelper::Base64::decode(aPass, sPassword);
pProtection->setPasswordHash(aPass, meHash1, meHash2);
}
......
......@@ -111,6 +111,7 @@
#include <rtl/math.hxx>
#include <svl/zforlist.hxx>
#include <svx/unoshape.hxx>
#include <comphelper/base64.hxx>
#include <comphelper/extract.hxx>
#include <toolkit/helper/convert.hxx>
#include <svx/svdobj.hxx>
......@@ -1713,7 +1714,7 @@ void ScXMLExport::SetBodyAttributes()
eHashUsed = PASSHASH_XL;
}
}
::sax::Converter::encodeBase64(aBuffer, aPassHash);
::comphelper::Base64::encode(aBuffer, aPassHash);
if (!aBuffer.isEmpty())
{
AddAttribute(XML_NAMESPACE_TABLE, XML_PROTECTION_KEY, aBuffer.makeStringAndClear());
......@@ -2848,13 +2849,13 @@ void ScXMLExport::WriteTable(sal_Int32 nTable, const uno::Reference<sheet::XSpre
ScPasswordHash eHashUsed = PASSHASH_UNSPECIFIED;
if (pProtect->hasPasswordHash(PASSHASH_SHA1))
{
::sax::Converter::encodeBase64(aBuffer,
::comphelper::Base64::encode(aBuffer,
pProtect->getPasswordHash(PASSHASH_SHA1));
eHashUsed = PASSHASH_SHA1;
}
else if (pProtect->hasPasswordHash(PASSHASH_SHA256))
{
::sax::Converter::encodeBase64(aBuffer,
::comphelper::Base64::encode(aBuffer,
pProtect->getPasswordHash(PASSHASH_SHA256));
eHashUsed = PASSHASH_SHA256;
}
......@@ -2862,7 +2863,7 @@ void ScXMLExport::WriteTable(sal_Int32 nTable, const uno::Reference<sheet::XSpre
{
// Double-hash this by SHA1 on top of the legacy xls hash.
uno::Sequence<sal_Int8> aHash = pProtect->getPasswordHash(PASSHASH_XL, PASSHASH_SHA1);
::sax::Converter::encodeBase64(aBuffer, aHash);
::comphelper::Base64::encode(aBuffer, aHash);
eHashUsed = PASSHASH_XL;
}
if (!aBuffer.isEmpty())
......@@ -4906,7 +4907,7 @@ void ScXMLExport::GetConfigurationSettings(uno::Sequence<beans::PropertyValue>&
OUStringBuffer aTrackedChangesKey;
if (GetDocument() && GetDocument()->GetChangeTrack() && GetDocument()->GetChangeTrack()->IsProtected())
{
::sax::Converter::encodeBase64(aTrackedChangesKey,
::comphelper::Base64::encode(aTrackedChangesKey,
GetDocument()->GetChangeTrack()->GetProtection());
if (!aTrackedChangesKey.isEmpty())
++nPropsToAdd;
......
......@@ -77,6 +77,7 @@
#include <unonames.hxx>
#include <numformat.hxx>
#include <comphelper/base64.hxx>
#include <comphelper/extract.hxx>
#include <comphelper/propertysequence.hxx>
......@@ -1186,7 +1187,7 @@ void ScXMLImport::SetConfigurationSettings(const uno::Sequence<beans::PropertyVa
if (aConfigProps[i].Value >>= sKey)
{
uno::Sequence<sal_Int8> aPass;
::sax::Converter::decodeBase64(aPass, sKey);
::comphelper::Base64::decode(aPass, sKey);
if (aPass.getLength())
{
if (pDoc->GetChangeTrack())
......
......@@ -39,6 +39,7 @@
#include <xmloff/xmltkmap.hxx>
#include <xmloff/nmspmap.hxx>
#include <xmloff/xmlerror.hxx>
#include <comphelper/base64.hxx>
#include <com/sun/star/sheet/XSpreadsheetDocument.hpp>
#include <com/sun/star/drawing/XDrawPageSupplier.hpp>
......@@ -200,7 +201,7 @@ void ScMyTables::DeleteTable()
if (rImport.GetDocument() && maProtectionData.mbProtected)
{
uno::Sequence<sal_Int8> aHash;
::sax::Converter::decodeBase64(aHash, maProtectionData.maPassword);
::comphelper::Base64::decode(aHash, maProtectionData.maPassword);
std::unique_ptr<ScTableProtection> pProtect(new ScTableProtection);
pProtect->setProtected(maProtectionData.mbProtected);
......
......@@ -19,6 +19,7 @@
#include "ImagePreparer.hxx"
#include <comphelper/base64.hxx>
#include <comphelper/processfactory.hxx>
#include <osl/file.hxx>
#include <rtl/ustrbuf.hxx>
......@@ -88,7 +89,7 @@ void ImagePreparer::sendPreview( sal_uInt32 aSlideNumber )
return;
OUStringBuffer aStrBuffer;
::sax::Converter::encodeBase64( aStrBuffer, aImageData );
::comphelper::Base64::encode( aStrBuffer, aImageData );
OString aEncodedShortString = OUStringToOString(
aStrBuffer.makeStringAndClear(), RTL_TEXTENCODING_UTF8 );
......
......@@ -20,6 +20,7 @@
#include <config_features.h>
#include <comphelper/lok.hxx>
#include <comphelper/base64.hxx>
#include <com/sun/star/document/XDocumentProperties.hpp>
#include <unotools/historyoptions.hxx>
#include <unotools/useroptions.hxx>
......@@ -157,7 +158,7 @@ void SfxPickListImpl::AddDocumentToPickList( SfxObjectShell* pDocSh )
{
Sequence<sal_Int8> aSequence(static_cast<const sal_Int8*>(aStream.GetData()), aStream.Tell());
OUStringBuffer aBuffer;
::sax::Converter::encodeBase64(aBuffer, aSequence);
::comphelper::Base64::encode(aBuffer, aSequence);
aThumbnail = aBuffer.makeStringAndClear();
}
}
......
......@@ -17,6 +17,7 @@
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
#include <comphelper/base64.hxx>
#include <sax/tools/converter.hxx>
#include <sfx2/recentdocsview.hxx>
#include <sfx2/templatelocalview.hxx>
......@@ -190,7 +191,7 @@ void RecentDocsView::Reload()
if (!aBase64.isEmpty())
{
Sequence<sal_Int8> aDecoded;
sax::Converter::decodeBase64(aDecoded, aBase64);
comphelper::Base64::decode(aDecoded, aBase64);
SvMemoryStream aStream(aDecoded.getArray(), aDecoded.getLength(), StreamMode::READ);
vcl::PNGReader aReader(aStream);
......
......@@ -1593,6 +1593,7 @@ comphelper/inc/pch/precompiled_comphelper.hxx
comphelper/qa/container/comphelper_ifcontainer.cxx
comphelper/qa/container/testifcontainer.cxx
comphelper/qa/string/test_string.cxx
comphelper/qa/unit/base64_test.cxx
comphelper/qa/unit/syntaxhighlighttest.cxx
comphelper/qa/unit/test_hash.cxx
comphelper/qa/unit/threadpooltest.cxx
......
......@@ -34,6 +34,7 @@ $(eval $(call gb_Library_use_sdk_api,svgio))
$(eval $(call gb_Library_use_libraries,svgio,\
basegfx \
drawinglayer \
comphelper \
cppu \
cppuhelper \
sal \
......
......@@ -32,6 +32,7 @@
#include <basegfx/polygon/b2dpolygon.hxx>
#include <rtl/uri.hxx>
#include <drawinglayer/geometry/viewinformation2d.hxx>
#include <comphelper/base64.hxx>
namespace svgio
{
......@@ -212,7 +213,7 @@ namespace svgio
{
// use embedded base64 encoded data
css::uno::Sequence< sal_Int8 > aPass;
::sax::Converter::decodeBase64(aPass, maData);
::comphelper::Base64::decode(aPass, maData);
if(aPass.hasElements())
{
......
......@@ -19,6 +19,7 @@
#include <sal/config.h>
#include <comphelper/base64.hxx>
#include <tools/poly.hxx>
#include <vcl/bitmapaccess.hxx>
#include <vcl/virdev.hxx>
......@@ -391,7 +392,7 @@ bool XOutBitmap::GraphicToBase64(const Graphic& rGraphic, OUString& rOUString)
aOStm.Seek(STREAM_SEEK_TO_END);
css::uno::Sequence<sal_Int8> aOStmSeq( static_cast<sal_Int8 const *>(aOStm.GetData()),aOStm.Tell() );
OUStringBuffer aStrBuffer;
::sax::Converter::encodeBase64(aStrBuffer,aOStmSeq);
::comphelper::Base64::encode(aStrBuffer,aOStmSeq);
OUString aEncodedBase64Image = aStrBuffer.makeStringAndClear();
if( aLink.GetType() == GfxLinkType::NativeSvg )
{
......@@ -405,7 +406,7 @@ bool XOutBitmap::GraphicToBase64(const Graphic& rGraphic, OUString& rOUString)
*pOutBuffer++ = pBuffer[ite];
ite++;
}
::sax::Converter::encodeBase64(aStrBuffer, newTempSeq);
::comphelper::Base64::encode(aStrBuffer, newTempSeq);
aEncodedBase64Image = aStrBuffer.makeStringAndClear();
sal_Int32 SVGFixLength = aEncodedBase64Image.getLength();
aEncodedBase64Image = aEncodedBase64Image.replaceAt(SVGFixLength - 12, SVGFixLength, "") + "PC9zdmc+Cg=="; // removes rear 12 bits of garbage and adds svg closing tag in base64
......
......@@ -38,7 +38,6 @@ $(eval $(call gb_Library_use_libraries,tl,\
i18nlangtag \
cppu \
sal \
sax \
))