diff -ru libreoffice-3.4.5.2.orig/binfilter/bf_sc/source/filter/xml/sc_xmlbodyi.cxx libreoffice-3.4.5.2/binfilter/bf_sc/source/filter/xml/sc_xmlbodyi.cxx
--- libreoffice-3.4.5.2.orig/binfilter/bf_sc/source/filter/xml/sc_xmlbodyi.cxx 2012-07-16 10:12:05.277589241 +0100
+++ libreoffice-3.4.5.2/binfilter/bf_sc/source/filter/xml/sc_xmlbodyi.cxx 2012-07-16 10:20:28.146605369 +0100
@@ -56,6 +56,9 @@
#include <com/sun/star/sheet/XSpreadsheetDocument.hpp>
#include <sal/types.h>
+
+#include <sax/tools/converter.hxx>
+
namespace binfilter {
using namespace ::com::sun::star;
@@ -193,7 +196,7 @@
{
uno::Sequence<sal_Int8> aPass;
if (sPassword.getLength())
- SvXMLUnitConverter::decodeBase64(aPass, sPassword);
+ ::sax::Converter::decodeBase64(aPass, sPassword);
pDoc->SetDocProtection(bProtected, aPass);
}
uno::Reference <sheet::XSpreadsheetDocument> xSpreadDoc( GetScImport().GetModel(), uno::UNO_QUERY );
diff -ru libreoffice-3.4.5.2.orig/binfilter/bf_sc/source/filter/xml/sc_XMLChangeTrackingExportHelper.cxx libreoffice-3.4.5.2/binfilter/bf_sc/source/filter/xml/sc_XMLChangeTrackingExportHelper.cxx
--- libreoffice-3.4.5.2.orig/binfilter/bf_sc/source/filter/xml/sc_XMLChangeTrackingExportHelper.cxx 2012-07-16 10:12:05.286589351 +0100
+++ libreoffice-3.4.5.2/binfilter/bf_sc/source/filter/xml/sc_XMLChangeTrackingExportHelper.cxx 2012-07-16 10:20:28.145605377 +0100
@@ -39,6 +39,9 @@
#include <bf_xmloff/xmluconv.hxx>
#include <bf_svtools/zforlist.hxx>
+
+#include <sax/tools/converter.hxx>
+
namespace binfilter {
#define SC_CHANGE_ID_PREFIX "ct"
@@ -758,7 +761,7 @@
if (pChangeTrack->IsProtected())
{
::rtl::OUStringBuffer aBuffer;
- SvXMLUnitConverter::encodeBase64(aBuffer, pChangeTrack->GetProtection());
+ ::sax::Converter::encodeBase64(aBuffer, pChangeTrack->GetProtection());
if (aBuffer.getLength())
rExport.AddAttribute(XML_NAMESPACE_TABLE, XML_PROTECTION_KEY, aBuffer.makeStringAndClear());
}
diff -ru libreoffice-3.4.5.2.orig/binfilter/bf_sc/source/filter/xml/sc_xmlexprt.cxx libreoffice-3.4.5.2/binfilter/bf_sc/source/filter/xml/sc_xmlexprt.cxx
--- libreoffice-3.4.5.2.orig/binfilter/bf_sc/source/filter/xml/sc_xmlexprt.cxx 2012-07-16 10:12:05.249588907 +0100
+++ libreoffice-3.4.5.2/binfilter/bf_sc/source/filter/xml/sc_xmlexprt.cxx 2012-07-16 10:20:28.151605300 +0100
@@ -86,6 +86,7 @@
#include <com/sun/star/sheet/NamedRangeFlag.hpp>
#include <com/sun/star/form/XFormsSupplier.hpp>
#include <legacysmgr/legacy_binfilters_smgr.hxx>
+#include <sax/tools/converter.hxx>
namespace binfilter {
//! not found in unonames.hxx
#define SC_STANDARDFORMAT "StandardFormat"
@@ -1213,7 +1214,7 @@
{
AddAttribute(XML_NAMESPACE_TABLE, XML_STRUCTURE_PROTECTED, XML_TRUE);
::rtl::OUStringBuffer aBuffer;
- SvXMLUnitConverter::encodeBase64(aBuffer, pDoc->GetDocPassword());
+ ::sax::Converter::encodeBase64(aBuffer, pDoc->GetDocPassword());
if (aBuffer.getLength())
AddAttribute(XML_NAMESPACE_TABLE, XML_PROTECTION_KEY, aBuffer.makeStringAndClear());
}
@@ -1285,7 +1286,7 @@
AddAttribute(XML_NAMESPACE_TABLE, XML_PROTECTED, XML_TRUE);
::rtl::OUStringBuffer aBuffer;
if (pDoc)
- SvXMLUnitConverter::encodeBase64(aBuffer, pDoc->GetTabPassword(nTable));
+ ::sax::Converter::encodeBase64(aBuffer, pDoc->GetTabPassword(nTable));
if (aBuffer.getLength())
AddAttribute(XML_NAMESPACE_TABLE, XML_PROTECTION_KEY, aBuffer.makeStringAndClear());
}
diff -ru libreoffice-3.4.5.2.orig/binfilter/bf_sc/source/filter/xml/sc_xmlsubti.cxx libreoffice-3.4.5.2/binfilter/bf_sc/source/filter/xml/sc_xmlsubti.cxx
--- libreoffice-3.4.5.2.orig/binfilter/bf_sc/source/filter/xml/sc_xmlsubti.cxx 2012-07-16 10:12:05.256588992 +0100
+++ libreoffice-3.4.5.2/binfilter/bf_sc/source/filter/xml/sc_xmlsubti.cxx 2012-07-16 10:20:28.151605300 +0100
@@ -45,6 +45,8 @@
#include <com/sun/star/sheet/XCellRangeAddressable.hpp>
#include <com/sun/star/sheet/XCellRangeMovement.hpp>
#include <com/sun/star/drawing/XDrawPageSupplier.hpp>
+
+#include <sax/tools/converter.hxx>
namespace binfilter {
//------------------------------------------------------------------
@@ -593,7 +595,7 @@
if (rImport.GetDocument() && bProtection)
{
uno::Sequence<sal_Int8> aPass;
- SvXMLUnitConverter::decodeBase64(aPass, sPassword);
+ ::sax::Converter::decodeBase64SomeChars(aPass, sPassword);
rImport.GetDocument()->SetTabProtection(nCurrentSheet, bProtection, aPass);
/*uno::Reference <util::XProtectable> xProtectable(xCurrentSheet, uno::UNO_QUERY);
if (xProtectable.is())
diff -ru libreoffice-3.4.5.2.orig/binfilter/bf_sc/source/filter/xml/sc_XMLTrackedChangesContext.cxx libreoffice-3.4.5.2/binfilter/bf_sc/source/filter/xml/sc_XMLTrackedChangesContext.cxx
--- libreoffice-3.4.5.2.orig/binfilter/bf_sc/source/filter/xml/sc_XMLTrackedChangesContext.cxx 2012-07-16 10:12:05.266589111 +0100
+++ libreoffice-3.4.5.2/binfilter/bf_sc/source/filter/xml/sc_XMLTrackedChangesContext.cxx 2012-07-16 10:20:28.146605369 +0100
@@ -47,6 +47,9 @@
#include <bf_svtools/zforlist.hxx>
#include <com/sun/star/text/ControlCharacter.hpp>
+
+#include <sax/tools/converter.hxx>
+
namespace binfilter {
using namespace ::com::sun::star;
@@ -562,7 +565,7 @@
if (sValue.getLength())
{
uno::Sequence<sal_Int8> aPass;
- SvXMLUnitConverter::decodeBase64(aPass, sValue);
+ ::sax::Converter::decodeBase64(aPass, sValue);
pChangeTrackingImportHelper->SetProtection(aPass);
}
}
diff -ru libreoffice-3.4.5.2.orig/binfilter/bf_sc/util/makefile.mk libreoffice-3.4.5.2/binfilter/bf_sc/util/makefile.mk
--- libreoffice-3.4.5.2.orig/binfilter/bf_sc/util/makefile.mk 2012-07-16 10:12:05.288589374 +0100
+++ libreoffice-3.4.5.2/binfilter/bf_sc/util/makefile.mk 2012-07-16 10:20:28.152605289 +0100
@@ -70,6 +70,7 @@
$(BFSVXLIB) \
$(BFOFALIB) \
$(VCLLIB) \
+ $(SAXLIB) \
$(CPPULIB) \
$(CPPUHELPERLIB) \
$(COMPHELPERLIB) \
diff -ru libreoffice-3.4.5.2.orig/binfilter/bf_xmloff/source/core/xmloff_DocumentSettingsContext.cxx libreoffice-3.4.5.2/binfilter/bf_xmloff/source/core/xmloff_DocumentSettingsContext.cxx
--- libreoffice-3.4.5.2.orig/binfilter/bf_xmloff/source/core/xmloff_DocumentSettingsContext.cxx 2012-07-16 10:12:05.382590501 +0100
+++ libreoffice-3.4.5.2/binfilter/bf_xmloff/source/core/xmloff_DocumentSettingsContext.cxx 2012-07-16 10:20:28.152605289 +0100
@@ -37,9 +37,7 @@
#include "xmluconv.hxx"
#include <tools/debug.hxx>
-#ifndef __SGI_STL_LIST
#include <list>
-#endif
#include <com/sun/star/i18n/XForbiddenCharacters.hpp>
#include <com/sun/star/container/XIndexContainer.hpp>
@@ -48,6 +46,7 @@
#include <com/sun/star/util/DateTime.hpp>
#include <com/sun/star/document/XViewDataSupplier.hpp>
#include <com/sun/star/document/PrinterIndependentLayout.hpp>
+#include <sax/tools/converter.hxx>
#include <xmlenums.hxx>
namespace binfilter {
@@ -516,8 +515,7 @@
}
uno::Sequence<sal_Int8> aBuffer((sChars.getLength() / 4) * 3 );
sal_Int32 nCharsDecoded =
- GetImport().GetMM100UnitConverter().
- decodeBase64SomeChars( aBuffer, sChars );
+ ::sax::Converter::decodeBase64SomeChars(aBuffer, sChars);
sal_uInt32 nStartPos(aDecoded.getLength());
sal_uInt32 nCount(aBuffer.getLength());
aDecoded.realloc(nStartPos + nCount);
diff -ru libreoffice-3.4.5.2.orig/binfilter/bf_xmloff/source/core/xmloff_SettingsExportHelper.cxx libreoffice-3.4.5.2/binfilter/bf_xmloff/source/core/xmloff_SettingsExportHelper.cxx
--- libreoffice-3.4.5.2.orig/binfilter/bf_xmloff/source/core/xmloff_SettingsExportHelper.cxx 2012-07-16 10:12:05.371590369 +0100
+++ libreoffice-3.4.5.2/binfilter/bf_xmloff/source/core/xmloff_SettingsExportHelper.cxx 2012-07-16 10:20:28.152605289 +0100
@@ -39,6 +39,7 @@
#include <com/sun/star/util/DateTime.hpp>
#include <com/sun/star/container/XIndexContainer.hpp>
#include <com/sun/star/document/PrinterIndependentLayout.hpp>
+#include <sax/tools/converter.hxx>
#include <xmlenums.hxx>
namespace binfilter {
@@ -355,7 +356,7 @@
if(nLength)
{
::rtl::OUStringBuffer sBuffer;
- SvXMLUnitConverter::encodeBase64(sBuffer, aProps);
+ ::sax::Converter::encodeBase64(sBuffer, aProps);
rExport.GetDocHandler()->characters(sBuffer.makeStringAndClear());
}
}
diff -ru libreoffice-3.4.5.2.orig/binfilter/bf_xmloff/source/core/xmloff_XMLBase64Export.cxx libreoffice-3.4.5.2/binfilter/bf_xmloff/source/core/xmloff_XMLBase64Export.cxx
--- libreoffice-3.4.5.2.orig/binfilter/bf_xmloff/source/core/xmloff_XMLBase64Export.cxx 2012-07-16 10:12:05.370590357 +0100
+++ libreoffice-3.4.5.2/binfilter/bf_xmloff/source/core/xmloff_XMLBase64Export.cxx 2012-07-16 10:20:28.152605289 +0100
@@ -28,6 +28,7 @@
#include <com/sun/star/io/XInputStream.hpp>
+#include <sax/tools/converter.hxx>
#include "xmluconv.hxx"
#include "xmlexp.hxx"
@@ -62,8 +63,7 @@
nRead = rIn->readBytes( aInBuff, INPUT_BUFFER_SIZE );
if( nRead > 0 )
{
- GetExport().GetMM100UnitConverter().encodeBase64( aOutBuff,
- aInBuff );
+ ::sax::Converter::encodeBase64(aOutBuff, aInBuff);
GetExport().Characters( aOutBuff.makeStringAndClear() );
if( nRead == INPUT_BUFFER_SIZE )
GetExport().IgnorableWhitespace();
diff -ru libreoffice-3.4.5.2.orig/binfilter/bf_xmloff/source/core/xmloff_XMLBase64ImportContext.cxx libreoffice-3.4.5.2/binfilter/bf_xmloff/source/core/xmloff_XMLBase64ImportContext.cxx
--- libreoffice-3.4.5.2.orig/binfilter/bf_xmloff/source/core/xmloff_XMLBase64ImportContext.cxx 2012-07-16 10:12:05.382590501 +0100
+++ libreoffice-3.4.5.2/binfilter/bf_xmloff/source/core/xmloff_XMLBase64ImportContext.cxx 2012-07-16 10:22:06.591780916 +0100
@@ -31,6 +31,8 @@
#include <com/sun/star/io/XOutputStream.hpp>
+#include <sax/tools/converter.hxx>
+
#include "XMLBase64ImportContext.hxx"
namespace binfilter {
@@ -82,8 +84,7 @@
}
Sequence< sal_Int8 > aBuffer( (sChars.getLength() / 4) * 3 );
sal_Int32 nCharsDecoded =
- GetImport().GetMM100UnitConverter().
- decodeBase64SomeChars( aBuffer, sChars );
+ ::sax::Converter::decodeBase64SomeChars(aBuffer, sChars);
xOut->writeBytes( aBuffer );
if( nCharsDecoded != sChars.getLength() )
sBase64CharsLeft = sChars.copy( nCharsDecoded );
diff -ru libreoffice-3.4.5.2.orig/binfilter/bf_xmloff/source/core/xmloff_xmluconv.cxx libreoffice-3.4.5.2/binfilter/bf_xmloff/source/core/xmloff_xmluconv.cxx
--- libreoffice-3.4.5.2.orig/binfilter/bf_xmloff/source/core/xmloff_xmluconv.cxx 2012-07-16 10:12:05.374590403 +0100
+++ libreoffice-3.4.5.2/binfilter/bf_xmloff/source/core/xmloff_xmluconv.cxx 2012-07-16 10:21:17.455194287 +0100
@@ -1537,100 +1537,6 @@
sBuffer.setCharAt(3, aBase64EncodeTable [nIndex]);
}
-void SvXMLUnitConverter::encodeBase64( ::rtl::OUStringBuffer& aStrBuffer, const uno::Sequence<sal_Int8>& aPass)
-{
- sal_Int32 i(0);
- sal_Int32 nBufferLength(aPass.getLength());
- const sal_Int8* pBuffer = aPass.getConstArray();
- while (i < nBufferLength)
- {
- ::rtl::OUStringBuffer sBuffer;
- ThreeByteToFourByte (pBuffer, i, nBufferLength, sBuffer);
- aStrBuffer.append(sBuffer);
- i += 3;
- }
-}
-
-void SvXMLUnitConverter::decodeBase64(uno::Sequence<sal_Int8>& aBuffer, const ::rtl::OUString& sBuffer)
-{
-#if OSL_DEBUG_LEVEL > 0
- sal_Int32 nCharsDecoded =
-#endif
- decodeBase64SomeChars( aBuffer, sBuffer );
- OSL_ENSURE( nCharsDecoded == sBuffer.getLength(),
- "some bytes left in base64 decoding!" );
-}
-
-sal_Int32 SvXMLUnitConverter::decodeBase64SomeChars(
- uno::Sequence<sal_Int8>& rOutBuffer,
- const ::rtl::OUString& rInBuffer)
-{
- sal_Int32 nInBufferLen = rInBuffer.getLength();
- sal_Int32 nMinOutBufferLen = (nInBufferLen / 4) * 3;
- if( rOutBuffer.getLength() < nMinOutBufferLen )
- rOutBuffer.realloc( nMinOutBufferLen );
-
- const sal_Unicode *pInBuffer = rInBuffer.getStr();
- sal_Int8 *pOutBuffer = rOutBuffer.getArray();
- sal_Int8 *pOutBufferStart = pOutBuffer;
- sal_Int32 nCharsDecoded = 0;
-
- sal_uInt8 aDecodeBuffer[4];
- sal_Int32 nBytesToDecode = 0;
- sal_Int32 nBytesGotFromDecoding = 3;
- sal_Int32 nInBufferPos= 0;
- while( nInBufferPos < nInBufferLen )
- {
- sal_Unicode cChar = *pInBuffer;
- if( cChar >= '+' && cChar <= 'z' )
- {
- sal_uInt8 nByte = aBase64DecodeTable[cChar-'+'];
- if( nByte != 255 )
- {
- // We have found a valid character!
- aDecodeBuffer[nBytesToDecode++] = nByte;
-
- // One '=' character at the end means 2 out bytes
- // Two '=' characters at the end mean 1 out bytes
- if( '=' == cChar && nBytesToDecode > 2 )
- nBytesGotFromDecoding--;
- if( 4 == nBytesToDecode )
- {
- // Four characters found, so we may convert now!
- sal_uInt32 nOut = (aDecodeBuffer[0] << 18) +
- (aDecodeBuffer[1] << 12) +
- (aDecodeBuffer[2] << 6) +
- aDecodeBuffer[3];
-
- *pOutBuffer++ = (sal_Int8)((nOut & 0xff0000) >> 16);
- if( nBytesGotFromDecoding > 1 )
- *pOutBuffer++ = (sal_Int8)((nOut & 0xff00) >> 8);
- if( nBytesGotFromDecoding > 2 )
- *pOutBuffer++ = (sal_Int8)(nOut & 0xff);
- nCharsDecoded = nInBufferPos + 1;
- nBytesToDecode = 0;
- nBytesGotFromDecoding = 3;
- }
- }
- else
- {
- nCharsDecoded++;
- }
- }
- else
- {
- nCharsDecoded++;
- }
-
- nInBufferPos++;
- pInBuffer++;
- }
- if( (pOutBuffer - pOutBufferStart) != rOutBuffer.getLength() )
- rOutBuffer.realloc( pOutBuffer - pOutBufferStart );
-
- return nCharsDecoded;
-}
-
sal_Bool SvXMLUnitConverter::convertNumFormat(
sal_Int16& rType,
const OUString& rNumFmt,
diff -ru libreoffice-3.4.5.2.orig/binfilter/bf_xmloff/source/text/xmloff_XMLRedlineExport.cxx libreoffice-3.4.5.2/binfilter/bf_xmloff/source/text/xmloff_XMLRedlineExport.cxx
--- libreoffice-3.4.5.2.orig/binfilter/bf_xmloff/source/text/xmloff_XMLRedlineExport.cxx 2012-07-16 10:12:05.466591507 +0100
+++ libreoffice-3.4.5.2/binfilter/bf_xmloff/source/text/xmloff_XMLRedlineExport.cxx 2012-07-16 10:20:34.414683340 +0100
@@ -45,6 +45,7 @@
#include <com/sun/star/util/DateTime.hpp>
+#include <sax/tools/converter.hxx>
#include "xmlnmspe.hxx"
@@ -238,7 +239,7 @@
if ( aKey.getLength() > 0 )
{
OUStringBuffer aBuffer;
- SvXMLUnitConverter::encodeBase64( aBuffer, aKey );
+ ::sax::Converter::encodeBase64(aBuffer, aKey);
rExport.AddAttribute( XML_NAMESPACE_TEXT, XML_PROTECTION_KEY,
aBuffer.makeStringAndClear() );
}
diff -ru libreoffice-3.4.5.2.orig/binfilter/bf_xmloff/source/text/xmloff_XMLSectionExport.cxx libreoffice-3.4.5.2/binfilter/bf_xmloff/source/text/xmloff_XMLSectionExport.cxx
--- libreoffice-3.4.5.2.orig/binfilter/bf_xmloff/source/text/xmloff_XMLSectionExport.cxx 2012-07-16 10:12:05.432591099 +0100
+++ libreoffice-3.4.5.2/binfilter/bf_xmloff/source/text/xmloff_XMLSectionExport.cxx 2012-07-16 10:22:37.289148284 +0100
@@ -39,6 +39,8 @@
#include <com/sun/star/text/XTextFieldsSupplier.hpp>
#include <com/sun/star/text/XChapterNumberingSupplier.hpp>
+#include <sax/tools/converter.hxx>
+
#include "xmlkywd.hxx"
#include "xmluconv.hxx"
#include "xmlexp.hxx"
@@ -452,7 +454,7 @@
if (aPassword.getLength() > 0)
{
OUStringBuffer aBuffer;
- SvXMLUnitConverter::encodeBase64(aBuffer, aPassword);
+ ::sax::Converter::encodeBase64(aBuffer, aPassword);
GetExport().AddAttribute(XML_NAMESPACE_TEXT, XML_PROTECTION_KEY,
aBuffer.makeStringAndClear());
}
diff -ru libreoffice-3.4.5.2.orig/binfilter/bf_xmloff/source/text/xmloff_XMLSectionImportContext.cxx libreoffice-3.4.5.2/binfilter/bf_xmloff/source/text/xmloff_XMLSectionImportContext.cxx
--- libreoffice-3.4.5.2.orig/binfilter/bf_xmloff/source/text/xmloff_XMLSectionImportContext.cxx 2012-07-16 10:12:05.490591795 +0100
+++ libreoffice-3.4.5.2/binfilter/bf_xmloff/source/text/xmloff_XMLSectionImportContext.cxx 2012-07-16 10:20:34.416683154 +0100
@@ -40,6 +40,8 @@
#include <com/sun/star/text/XTextContent.hpp>
#include <com/sun/star/text/ControlCharacter.hpp>
+#include <sax/tools/converter.hxx>
+
namespace binfilter {
@@ -308,7 +310,7 @@
}
break;
case XML_TOK_SECTION_PROTECTION_KEY:
- SvXMLUnitConverter::decodeBase64(aSequence, sAttr);
+ ::sax::Converter::decodeBase64(aSequence, sAttr);
bSequenceOK = sal_True;
break;
case XML_TOK_SECTION_PROTECT:
diff -ru libreoffice-3.4.5.2.orig/binfilter/bf_xmloff/source/text/xmloff_XMLTextFrameContext.cxx libreoffice-3.4.5.2/binfilter/bf_xmloff/source/text/xmloff_XMLTextFrameContext.cxx
--- libreoffice-3.4.5.2.orig/binfilter/bf_xmloff/source/text/xmloff_XMLTextFrameContext.cxx 2012-07-16 10:12:05.491591807 +0100
+++ libreoffice-3.4.5.2/binfilter/bf_xmloff/source/text/xmloff_XMLTextFrameContext.cxx 2012-07-16 10:24:27.898468897 +0100
@@ -35,6 +35,7 @@
#include <com/sun/star/io/XOutputStream.hpp>
#include <com/sun/star/text/HoriOrientation.hpp>
#include <com/sun/star/text/VertOrientation.hpp>
+#include <sax/tools/converter.hxx>
#include "xmlimp.hxx"
#include "xmlnmspe.hxx"
#include "xmlkywd.hxx"
@@ -1112,7 +1113,6 @@
Sequence< sal_Int8 > aBuffer( (sChars.getLength() / 4) * 3 );
sal_Int32 nCharsDecoded =
- GetImport().GetMM100UnitConverter().
- decodeBase64SomeChars( aBuffer, sChars );
+ ::sax::Converter::decodeBase64SomeChars(aBuffer, sChars);
xBase64Stream->writeBytes( aBuffer );
if( nCharsDecoded != sChars.getLength() )
sBase64CharsLeft = sChars.copy( nCharsDecoded );
diff -ru libreoffice-3.4.5.2.orig/binfilter/bf_xmloff/source/text/xmloff_XMLTrackedChangesImportContext.cxx libreoffice-3.4.5.2/binfilter/bf_xmloff/source/text/xmloff_XMLTrackedChangesImportContext.cxx
--- libreoffice-3.4.5.2.orig/binfilter/bf_xmloff/source/text/xmloff_XMLTrackedChangesImportContext.cxx 2012-07-16 10:12:05.454591363 +0100
+++ libreoffice-3.4.5.2/binfilter/bf_xmloff/source/text/xmloff_XMLTrackedChangesImportContext.cxx 2012-07-16 10:24:55.985804228 +0100
@@ -30,6 +30,7 @@
#include "XMLChangedRegionImportContext.hxx"
#include <com/sun/star/uno/Reference.h>
#include <com/sun/star/uno/Sequence.h>
+#include <sax/tools/converter.hxx>
#include "xmlimp.hxx"
#include "xmlnmspe.hxx"
#include "nmspmap.hxx"
@@ -84,7 +85,7 @@
}
else if ( IsXMLToken( sLocalName, XML_PROTECTION_KEY ) ) {
Sequence<sal_Int8> aSequence;
- SvXMLUnitConverter::decodeBase64(
+ ::sax::Converter::decodeBase64(
aSequence, xAttrList->getValueByIndex(i));
if ( aSequence.getLength() > 0 )
{
diff -ru libreoffice-3.4.5.2.orig/binfilter/bf_xmloff/util/makefile.mk libreoffice-3.4.5.2/binfilter/bf_xmloff/util/makefile.mk
--- libreoffice-3.4.5.2.orig/binfilter/bf_xmloff/util/makefile.mk 2012-07-16 10:12:05.671593962 +0100
+++ libreoffice-3.4.5.2/binfilter/bf_xmloff/util/makefile.mk 2012-07-16 10:20:34.417683064 +0100
@@ -71,6 +71,7 @@
SHL1STDLIBS= \
$(BFSVTOOLLIB) \
+ $(SAXLIB) \
$(TOOLSLIB) \
$(I18NISOLANGLIB) \
$(CPPULIB) \
diff -ru libreoffice-3.4.5.2.orig/binfilter/inc/bf_xmloff/xmluconv.hxx libreoffice-3.4.5.2/binfilter/inc/bf_xmloff/xmluconv.hxx
--- libreoffice-3.4.5.2.orig/binfilter/inc/bf_xmloff/xmluconv.hxx 2012-07-16 10:12:06.925608979 +0100
+++ libreoffice-3.4.5.2/binfilter/inc/bf_xmloff/xmluconv.hxx 2012-07-16 10:20:34.418682974 +0100
@@ -309,17 +309,6 @@
static sal_Int32 indexOfComma( const ::rtl::OUString& rStr,
sal_Int32 nPos );
- static void encodeBase64( ::rtl::OUStringBuffer& aStrBuffer, const ::com::sun::star::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, bacause 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( ::com::sun::star::uno::Sequence<sal_Int8>& aPass, const ::rtl::OUString& sBuffer);
-
- static sal_Int32 decodeBase64SomeChars( ::com::sun::star::uno::Sequence<sal_Int8>& aPass, const ::rtl::OUString& sBuffer);
-
/** convert num-forat and num-letter-sync values to NumberingType */
sal_Bool convertNumFormat( sal_Int16& rType,
const ::rtl::OUString& rNumFormat,
diff -ru libreoffice-3.4.5.2.orig/filter/source/placeware/Base64Codec.cxx libreoffice-3.4.5.2/filter/source/placeware/Base64Codec.cxx
--- libreoffice-3.4.5.2.orig/filter/source/placeware/Base64Codec.cxx 2012-07-16 10:13:54.572897852 +0100
+++ libreoffice-3.4.5.2/filter/source/placeware/Base64Codec.cxx 2012-07-16 10:31:52.092768057 +0100
@@ -1,210 +0,0 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/*************************************************************************
- *
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * Copyright 2000, 2010 Oracle and/or its affiliates.
- *
- * OpenOffice.org - a multi-platform office productivity suite
- *
- * This file is part of OpenOffice.org.
- *
- * OpenOffice.org is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License version 3
- * only, as published by the Free Software Foundation.
- *
- * OpenOffice.org is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Lesser General Public License version 3 for more details
- * (a copy is included in the LICENSE file that accompanied this code).
- *
- * You should have received a copy of the GNU Lesser General Public License
- * version 3 along with OpenOffice.org. If not, see
- * <http://www.openoffice.org/license.html>
- * for a copy of the LGPLv3 License.
- *
- ************************************************************************/
-
-// MARKER(update_precomp.py): autogen include statement, do not remove
-#include "precompiled_filter.hxx"
-#include "Base64Codec.hxx"
-#include <rtl/ustrbuf.hxx>
-#include <osl/diagnose.h>
-using namespace osl;
-using namespace com::sun::star;
-using ::rtl::OUString;
-using ::rtl::OUStringBuffer;
-const
- sal_Char aBase64EncodeTable[] =
- { 'A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J', 'K', 'L', 'M',
- 'N', 'O', 'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W', 'X', 'Y', 'Z',
- 'a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l', 'm',
- 'n', 'o', 'p', 'q', 'r', 's', 't', 'u', 'v', 'w', 'x', 'y', 'z',
- '0', '1', '2', '3', '4', '5', '6', '7', '8', '9', '+', '/' };
-
-const
- sal_uInt8 aBase64DecodeTable[] =
- { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // 0-15
-
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // 16-31
-
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 62, 0, 0, 0, 63, // 32-47
-// + /
-
- 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 0, 0, 0, 0, 0, 0, // 48-63
-// 0 1 2 3 4 5 6 7 8 9 =
-
- 0, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, // 64-79
-// A B C D E F G H I J K L M N O
-
- 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 0, 0, 0, 0, 0, // 80-95
-// P Q R S T U V W X Y Z
-
- 0, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, // 96-111
-// a b c d e f g h i j k l m n o
-
- 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 0, 0, 0, 0, 0, // 112-127
-// p q r s t u v w x y z
-
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0};
-
-
-void ThreeByteToFourByte (const sal_uInt8* pBuffer, const sal_Int32 nStart, const sal_Int32 nFullLen, rtl::OUStringBuffer& sBuffer)
-{
- sal_Int32 nLen(nFullLen - nStart);
- if (nLen > 3)
- nLen = 3;
- if (nLen == 0)
- {
- sBuffer.setLength(0);
- return;
- }
-
- sal_Int32 nBinaer;
- switch (nLen)
- {
- case 1:
- {
- nBinaer = ((sal_uInt8)pBuffer[nStart + 0]) << 16;
- }
- break;
- case 2:
- {
- nBinaer = (((sal_uInt8)pBuffer[nStart + 0]) << 16) +
- (((sal_uInt8)pBuffer[nStart + 1]) << 8);
- }
- break;
- default:
- {
- nBinaer = (((sal_uInt8)pBuffer[nStart + 0]) << 16) +
- (((sal_uInt8)pBuffer[nStart + 1]) << 8) +
- ((sal_uInt8)pBuffer[nStart + 2]);
- }
- break;
- }
-
- sBuffer.appendAscii("====");
-
- sal_uInt8 nIndex = static_cast< sal_uInt8 >((nBinaer & 0xFC0000) >> 18);
- sBuffer.setCharAt(0, aBase64EncodeTable [nIndex]);
-
- nIndex = static_cast< sal_uInt8 >((nBinaer & 0x3F000) >> 12);
- sBuffer.setCharAt(1, aBase64EncodeTable [nIndex]);
- if (nLen == 1)
- return;
-
- nIndex = static_cast< sal_uInt8 >((nBinaer & 0xFC0) >> 6);
- sBuffer.setCharAt(2, aBase64EncodeTable [nIndex]);
- if (nLen == 2)
- return;
-
- nIndex = static_cast< sal_uInt8 >((nBinaer & 0x3F));
- sBuffer.setCharAt(3, aBase64EncodeTable [nIndex]);
-}
-
-void Base64Codec::encodeBase64(rtl::OUStringBuffer& aStrBuffer, const uno::Sequence < sal_Int8 >& aPass)
-{
- sal_Int32 i(0);
- sal_Int32 nBufferLength(aPass.getLength());
- const sal_Int8* pBuffer = aPass.getConstArray();
- while (i < nBufferLength)
- {
- rtl::OUStringBuffer sBuffer;
- ThreeByteToFourByte ((const sal_uInt8*)pBuffer, i, nBufferLength, sBuffer);
- aStrBuffer.append(sBuffer);
- i += 3;
- }
-}
-
-const rtl::OUString s2equal(RTL_CONSTASCII_USTRINGPARAM("=="));
-const rtl::OUString s1equal(RTL_CONSTASCII_USTRINGPARAM("="));
-#if 0
-void FourByteToThreeByte (sal_uInt8* pBuffer, sal_Int32& nLength, const sal_Int32 nStart, const rtl::OUString& sString)
-{
- nLength = 0;
- sal_Int32 nLen (sString.getLength());
-
- if (nLen != 4)
- {
- return;
- }
-
-
- if (sString.indexOf(s2equal) == 2)
- nLength = 1;
- else if (sString.indexOf(s1equal) == 3)
- nLength = 2;
- else
- nLength = 3;
-
- sal_Int32 nBinaer ((aBase64DecodeTable [sString [0]] << 18) +
- (aBase64DecodeTable [sString [1]] << 12) +
- (aBase64DecodeTable [sString [2]] << 6) +
- (aBase64DecodeTable [sString [3]]));
-
- sal_uInt8 OneByte = static_cast< sal_uInt8 >((nBinaer & 0xFF0000) >> 16);
- pBuffer[nStart + 0] = (sal_uInt8)OneByte;
-
- if (nLength == 1)
- return;
-
- OneByte = static_cast< sal_uInt8 >((nBinaer & 0xFF00) >> 8);
- pBuffer[nStart + 1] = (sal_uInt8)OneByte;
-
- if (nLength == 2)
- return;
-
- OneByte = static_cast< sal_uInt8 >(nBinaer & 0xFF);
- pBuffer[nStart + 2] = (sal_uInt8)OneByte;
-}
-
-void Base64Codec::decodeBase64(uno::Sequence< sal_uInt8 >& aBuffer, const rtl::OUString& sBuffer)
-{
- sal_Int32 nFirstLength((sBuffer.getLength() / 4) * 3);
- sal_uInt8* pBuffer = new sal_uInt8[nFirstLength];
- sal_Int32 nSecondLength(0);
- sal_Int32 nLength(0);
- sal_Int32 i = 0;
- sal_Int32 k = 0;
- while (i < sBuffer.getLength())
- {
- FourByteToThreeByte (pBuffer, nLength, k, sBuffer.copy(i, 4));
- nSecondLength += nLength;
- nLength = 0;
- i += 4;
- k += 3;
- }
- aBuffer = uno::Sequence<sal_uInt8>(pBuffer, nSecondLength);
- delete[] pBuffer;
-}
-#endif
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff -ru libreoffice-3.4.5.2.orig/filter/source/placeware/Base64Codec.hxx libreoffice-3.4.5.2/filter/source/placeware/Base64Codec.hxx
--- libreoffice-3.4.5.2.orig/filter/source/placeware/Base64Codec.hxx 2012-07-16 10:13:54.563897744 +0100
+++ libreoffice-3.4.5.2/filter/source/placeware/Base64Codec.hxx 2012-07-16 10:31:26.924467980 +0100
@@ -1,50 +0,0 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/*************************************************************************
- *
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * Copyright 2000, 2010 Oracle and/or its affiliates.
- *
- * OpenOffice.org - a multi-platform office productivity suite
- *
- * This file is part of OpenOffice.org.
- *
- * OpenOffice.org is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License version 3
- * only, as published by the Free Software Foundation.
- *
- * OpenOffice.org is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Lesser General Public License version 3 for more details
- * (a copy is included in the LICENSE file that accompanied this code).
- *
- * You should have received a copy of the GNU Lesser General Public License
- * version 3 along with OpenOffice.org. If not, see
- * <http://www.openoffice.org/license.html>
- * for a copy of the LGPLv3 License.
- *
- ************************************************************************/
-
-#ifndef _BASE64_CODEC_HXX
-#define _BASE64_CODEC_HXX
-
-#include <com/sun/star/uno/Sequence.hxx>
-
-namespace rtl
-{
-class OUString;
-class OUStringBuffer;
-}
-
-class Base64Codec
-{
-public:
- static void encodeBase64(rtl::OUStringBuffer& aStrBuffer, const com::sun::star::uno::Sequence<sal_Int8>& aPass);
-#if 0
- static void decodeBase64(com::sun::star::uno::Sequence<sal_uInt8>& aPass, const rtl::OUString& sBuffer);
-#endif
-};
-#endif
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff -ru libreoffice-3.4.5.2.orig/filter/source/placeware/exporter.cxx libreoffice-3.4.5.2/filter/source/placeware/exporter.cxx
--- libreoffice-3.4.5.2.orig/filter/source/placeware/exporter.cxx 2012-07-16 10:13:54.563897744 +0100
+++ libreoffice-3.4.5.2/filter/source/placeware/exporter.cxx 2012-07-16 10:26:42.868079939 +0100
@@ -41,12 +41,12 @@
#include <com/sun/star/task/XStatusIndicatorFactory.hpp>
#include <rtl/ustrbuf.hxx>
#include <rtl/string.hxx>
+#include <sax/tools/converter.hxx>
#include <osl/diagnose.h>
#include <vector>
#include "exporter.hxx"
-#include "Base64Codec.hxx"
#include "zip.hxx"
#include "tempfile.hxx"
@@ -163,7 +163,7 @@
nLen -= nRead;
rtl::OUStringBuffer aStrBuffer;
- Base64Codec::encodeBase64( aStrBuffer, aInBuffer );
+ ::sax::Converter::encodeBase64(aStrBuffer, aInBuffer);
sal_Int32 nCount = aStrBuffer.getLength();
diff -ru libreoffice-3.4.5.2.orig/filter/source/placeware/makefile.mk libreoffice-3.4.5.2/filter/source/placeware/makefile.mk
--- libreoffice-3.4.5.2.orig/filter/source/placeware/makefile.mk 2012-07-16 10:13:54.564897756 +0100
+++ libreoffice-3.4.5.2/filter/source/placeware/makefile.mk 2012-07-16 10:32:15.022041345 +0100
@@ -42,7 +42,6 @@
$(SLO)$/filter.obj \
$(SLO)$/uno.obj \
$(SLO)$/exporter.obj \
- $(SLO)$/Base64Codec.obj \
$(SLO)$/tempfile.obj
# --- Library -----------------------------------
@@ -50,6 +49,7 @@
SHL1TARGET=$(TARGET)$(DLLPOSTFIX)
SHL1STDLIBS= \
+ $(SAXLIB) \
$(CPPULIB) \
$(CPPUHELPERLIB) \
$(SALLIB)
diff -ru libreoffice-3.4.5.2.orig/package/inc/PackageConstants.hxx libreoffice-3.4.5.2/package/inc/PackageConstants.hxx
--- libreoffice-3.4.5.2.orig/package/inc/PackageConstants.hxx 2012-07-16 10:14:11.502100491 +0100
+++ libreoffice-3.4.5.2/package/inc/PackageConstants.hxx 2012-07-16 11:01:35.545971401 +0100
@@ -40,19 +40,19 @@
const sal_Int32 n_ConstDigestDecrypt = 1056; // 1024 + 32
// the constants related to the manifest.xml entries
-#define PKG_MNFST_MEDIATYPE 0
-#define PKG_MNFST_VERSION 1
-#define PKG_MNFST_FULLPATH 2
+#define PKG_MNFST_FULLPATH 0 //FullPath (Put full-path property first for MBA)
+#define PKG_MNFST_VERSION 1 //Version
+#define PKG_MNFST_MEDIATYPE 2 //MediaType
-#define PKG_MNFST_INIVECTOR 3
-#define PKG_MNFST_SALT 4
-#define PKG_MNFST_ITERATION 5
-#define PKG_MNFST_UCOMPSIZE 6
-#define PKG_MNFST_DIGEST 7
-#define PKG_MNFST_ENCALG 8
-#define PKG_MNFST_STARTALG 9
-#define PKG_MNFST_DIGESTALG 10
-#define PKG_MNFST_DERKEYSIZE 11
+#define PKG_MNFST_INIVECTOR 3 //InitialisationVector
+#define PKG_MNFST_SALT 4 //Salt
+#define PKG_MNFST_ITERATION 5 //IterationCount
+#define PKG_MNFST_UCOMPSIZE 6 //Size
+#define PKG_MNFST_DIGEST 7 //Digest
+#define PKG_MNFST_ENCALG 8 //EncryptionAlgorithm
+#define PKG_MNFST_STARTALG 9 //StartKeyAlgorithm
+#define PKG_MNFST_DIGESTALG 10 //DigestAlgorithm
+#define PKG_MNFST_DERKEYSIZE 11 //DerivedKeySize
#define PKG_SIZE_NOENCR_MNFST 3
#define PKG_SIZE_ENCR_MNFST 12
diff -ru libreoffice-3.4.5.2.orig/package/prj/build.lst libreoffice-3.4.5.2/package/prj/build.lst
--- libreoffice-3.4.5.2.orig/package/prj/build.lst 2012-07-16 10:14:11.442099773 +0100
+++ libreoffice-3.4.5.2/package/prj/build.lst 2012-07-16 10:26:44.475098650 +0100
@@ -1,4 +1,4 @@
-pk package : cppu cppuhelper comphelper ucbhelper sal ZLIB:zlib LIBXSLT:libxslt NULL
+pk package : cppu cppuhelper comphelper ucbhelper sal ZLIB:zlib LIBXSLT:libxslt sax NULL
pk package usr1 - all pk_mkout NULL
pk package\inc nmake - all pk_inc NULL
pk package\source\zipapi nmake - all pk_zipapi pk_inc NULL
diff -ru libreoffice-3.4.5.2.orig/package/source/manifest/Base64Codec.cxx libreoffice-3.4.5.2/package/source/manifest/Base64Codec.cxx
--- libreoffice-3.4.5.2.orig/package/source/manifest/Base64Codec.cxx 2012-07-16 10:14:11.342098576 +0100
+++ libreoffice-3.4.5.2/package/source/manifest/Base64Codec.cxx 2012-07-16 10:30:12.507580720 +0100
@@ -1,208 +0,0 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/*************************************************************************
- *
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * Copyright 2000, 2010 Oracle and/or its affiliates.
- *
- * OpenOffice.org - a multi-platform office productivity suite
- *
- * This file is part of OpenOffice.org.
- *
- * OpenOffice.org is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License version 3
- * only, as published by the Free Software Foundation.
- *
- * OpenOffice.org is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Lesser General Public License version 3 for more details
- * (a copy is included in the LICENSE file that accompanied this code).
- *
- * You should have received a copy of the GNU Lesser General Public License
- * version 3 along with OpenOffice.org. If not, see
- * <http://www.openoffice.org/license.html>
- * for a copy of the LGPLv3 License.
- *
- ************************************************************************/
-
-// MARKER(update_precomp.py): autogen include statement, do not remove
-#include "precompiled_package.hxx"
-#include "Base64Codec.hxx"
-#include <rtl/ustrbuf.hxx>
-#include <osl/diagnose.h>
-using namespace osl;
-using namespace com::sun::star;
-
-using ::rtl::OUStringBuffer;
-
-const
- sal_Char aBase64EncodeTable[] =
- { 'A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J', 'K', 'L', 'M',
- 'N', 'O', 'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W', 'X', 'Y', 'Z',
- 'a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l', 'm',
- 'n', 'o', 'p', 'q', 'r', 's', 't', 'u', 'v', 'w', 'x', 'y', 'z',
- '0', '1', '2', '3', '4', '5', '6', '7', '8', '9', '+', '/' };
-
-const
- sal_uInt8 aBase64DecodeTable[] =
- { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // 0-15
-
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, // 16-31
-
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 62, 0, 0, 0, 63, // 32-47
-// + /
-
- 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 0, 0, 0, 0, 0, 0, // 48-63
-// 0 1 2 3 4 5 6 7 8 9 =
-
- 0, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, // 64-79
-// A B C D E F G H I J K L M N O
-
- 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 0, 0, 0, 0, 0, // 80-95
-// P Q R S T U V W X Y Z
-
- 0, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, // 96-111
-// a b c d e f g h i j k l m n o
-
- 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 0, 0, 0, 0, 0, // 112-127
-// p q r s t u v w x y z
-
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0};
-
-
-void ThreeByteToFourByte (const sal_uInt8* pBuffer, const sal_Int32 nStart, const sal_Int32 nFullLen, rtl::OUStringBuffer& sBuffer)
-{
- sal_Int32 nLen(nFullLen - nStart);
- if (nLen > 3)
- nLen = 3;
- if (nLen == 0)
- {
- sBuffer.setLength(0);
- return;
- }
-
- sal_Int32 nBinaer;
- switch (nLen)
- {
- case 1:
- {
- nBinaer = ((sal_uInt8)pBuffer[nStart + 0]) << 16;
- }
- break;
- case 2:
- {
- nBinaer = (((sal_uInt8)pBuffer[nStart + 0]) << 16) +
- (((sal_uInt8)pBuffer[nStart + 1]) << 8);
- }
- break;
- default:
- {
- nBinaer = (((sal_uInt8)pBuffer[nStart + 0]) << 16) +
- (((sal_uInt8)pBuffer[nStart + 1]) << 8) +
- ((sal_uInt8)pBuffer[nStart + 2]);
- }
- break;
- }
-
- sBuffer.appendAscii("====");
-
- sal_uInt8 nIndex = static_cast< sal_uInt8 >((nBinaer & 0xFC0000) >> 18);
- sBuffer.setCharAt(0, aBase64EncodeTable [nIndex]);
-
- nIndex = static_cast< sal_uInt8 >((nBinaer & 0x3F000) >> 12);
- sBuffer.setCharAt(1, aBase64EncodeTable [nIndex]);
- if (nLen == 1)
- return;
-
- nIndex = static_cast< sal_uInt8 >((nBinaer & 0xFC0) >> 6);
- sBuffer.setCharAt(2, aBase64EncodeTable [nIndex]);
- if (nLen == 2)
- return;
-
- nIndex = static_cast< sal_uInt8 >(nBinaer & 0x3F);
- sBuffer.setCharAt(3, aBase64EncodeTable [nIndex]);
-}
-
-void Base64Codec::encodeBase64(rtl::OUStringBuffer& aStrBuffer, const uno::Sequence < sal_Int8 >& aPass)
-{
- sal_Int32 i(0);
- sal_Int32 nBufferLength(aPass.getLength());
- const sal_uInt8* pBuffer = reinterpret_cast< const sal_uInt8* >( aPass.getConstArray() );
- while (i < nBufferLength)
- {
- rtl::OUStringBuffer sBuffer;
- ThreeByteToFourByte (pBuffer, i, nBufferLength, sBuffer);
- aStrBuffer.append(sBuffer);
- i += 3;
- }
-}
-
-const rtl::OUString s2equal(RTL_CONSTASCII_USTRINGPARAM("=="));
-const rtl::OUString s1equal(RTL_CONSTASCII_USTRINGPARAM("="));
-
-void FourByteToThreeByte (sal_uInt8* pBuffer, sal_Int32& nLength, const sal_Int32 nStart, const rtl::OUString& sString)
-{
- nLength = 0;
- sal_Int32 nLen (sString.getLength());
-
- OSL_ASSERT( nLen == 4 );
- if (nLen != 4)
- return;
-
- if (sString.indexOf(s2equal) == 2)
- nLength = 1;
- else if (sString.indexOf(s1equal) == 3)
- nLength = 2;
- else
- nLength = 3;
-
- sal_Int32 nBinaer ((aBase64DecodeTable [sString [0]] << 18) +
- (aBase64DecodeTable [sString [1]] << 12) +
- (aBase64DecodeTable [sString [2]] << 6) +
- (aBase64DecodeTable [sString [3]]));
-
- sal_uInt8 OneByte = static_cast< sal_uInt8 >((nBinaer & 0xFF0000) >> 16);
- pBuffer[nStart + 0] = (sal_uInt8)OneByte;
-
- if (nLength == 1)
- return;
-
- OneByte = static_cast< sal_uInt8 >((nBinaer & 0xFF00) >> 8);
- pBuffer[nStart + 1] = OneByte;
-
- if (nLength == 2)
- return;
-
- OneByte = static_cast< sal_uInt8 >(nBinaer & 0xFF);
- pBuffer[nStart + 2] = OneByte;
-}
-
-void Base64Codec::decodeBase64(uno::Sequence< sal_Int8 >& aBuffer, const rtl::OUString& sBuffer)
-{
- sal_Int32 nFirstLength((sBuffer.getLength() / 4) * 3);
- sal_uInt8* pBuffer = new sal_uInt8[nFirstLength];
- sal_Int32 nSecondLength(0);
- sal_Int32 nLength(0);
- sal_Int32 i = 0;
- sal_Int32 k = 0;
- while (i < sBuffer.getLength())
- {
- FourByteToThreeByte (pBuffer, nLength, k, sBuffer.copy(i, 4));
- nSecondLength += nLength;
- nLength = 0;
- i += 4;
- k += 3;
- }
- aBuffer = uno::Sequence<sal_Int8>( reinterpret_cast< sal_Int8* >( pBuffer ), nSecondLength );
- delete[] pBuffer;
-}
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff -ru libreoffice-3.4.5.2.orig/package/source/manifest/Base64Codec.hxx libreoffice-3.4.5.2/package/source/manifest/Base64Codec.hxx
--- libreoffice-3.4.5.2.orig/package/source/manifest/Base64Codec.hxx 2012-07-16 10:14:11.330098433 +0100
+++ libreoffice-3.4.5.2/package/source/manifest/Base64Codec.hxx 2012-07-16 10:30:02.284458821 +0100
@@ -1,48 +0,0 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/*************************************************************************
- *
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * Copyright 2000, 2010 Oracle and/or its affiliates.
- *
- * OpenOffice.org - a multi-platform office productivity suite
- *
- * This file is part of OpenOffice.org.
- *
- * OpenOffice.org is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License version 3
- * only, as published by the Free Software Foundation.
- *
- * OpenOffice.org is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Lesser General Public License version 3 for more details
- * (a copy is included in the LICENSE file that accompanied this code).
- *
- * You should have received a copy of the GNU Lesser General Public License
- * version 3 along with OpenOffice.org. If not, see
- * <http://www.openoffice.org/license.html>
- * for a copy of the LGPLv3 License.
- *
- ************************************************************************/
-
-#ifndef _BASE64_CODEC_HXX
-#define _BASE64_CODEC_HXX
-
-#include <com/sun/star/uno/Sequence.hxx>
-
-namespace rtl
-{
-class OUString;
-class OUStringBuffer;
-}
-
-class Base64Codec
-{
-public:
- static void encodeBase64(rtl::OUStringBuffer& aStrBuffer, const com::sun::star::uno::Sequence<sal_Int8>& aPass);
- static void decodeBase64(com::sun::star::uno::Sequence<sal_Int8>& aPass, const rtl::OUString& sBuffer);
-};
-#endif
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff -ru libreoffice-3.4.5.2.orig/package/source/manifest/makefile.mk libreoffice-3.4.5.2/package/source/manifest/makefile.mk
--- libreoffice-3.4.5.2.orig/package/source/manifest/makefile.mk 2012-07-16 10:14:11.331098445 +0100
+++ libreoffice-3.4.5.2/package/source/manifest/makefile.mk 2012-07-16 10:31:08.556249065 +0100
@@ -45,7 +45,6 @@
$(SLO)$/ManifestWriter.obj \
$(SLO)$/ManifestImport.obj \
$(SLO)$/ManifestExport.obj \
- $(SLO)$/Base64Codec.obj \
$(SLO)$/UnoRegister.obj
.ENDIF # L10N_framework
diff -ru libreoffice-3.4.5.2.orig/package/source/manifest/ManifestExport.cxx libreoffice-3.4.5.2/package/source/manifest/ManifestExport.cxx
--- libreoffice-3.4.5.2.orig/package/source/manifest/ManifestExport.cxx 2012-07-16 10:14:11.342098576 +0100
+++ libreoffice-3.4.5.2/package/source/manifest/ManifestExport.cxx 2012-07-16 10:29:38.875179695 +0100
@@ -32,7 +32,7 @@
#include <ManifestDefines.hxx>
#include <com/sun/star/xml/sax/XAttributeList.hpp>
#include <rtl/ustrbuf.hxx>
-#include <Base64Codec.hxx>
+#include <sax/tools/converter.hxx>
#include <com/sun/star/xml/sax/XExtendedDocumentHandler.hpp>
#include <com/sun/star/xml/sax/XDocumentHandler.hpp>
#include <com/sun/star/beans/PropertyValue.hpp>
@@ -246,7 +246,7 @@
{
pNewAttrList->AddAttribute ( sChecksumTypeAttribute, sCdataAttribute, sChecksumType );
pDigest->Value >>= aSequence;
- Base64Codec::encodeBase64 ( aBuffer, aSequence );
+ ::sax::Converter::encodeBase64( aBuffer, aSequence );
pNewAttrList->AddAttribute ( sChecksumAttribute, sCdataAttribute, aBuffer.makeStringAndClear() );
}
xHandler->startElement( sEncryptionDataElement , xNewAttrList);
@@ -258,7 +258,7 @@
pNewAttrList->AddAttribute ( sAlgorithmNameAttribute, sCdataAttribute, sBlowfish );
pVector->Value >>= aSequence;
- Base64Codec::encodeBase64 ( aBuffer, aSequence );
+ ::sax::Converter::encodeBase64( aBuffer, aSequence );
pNewAttrList->AddAttribute ( sInitialisationVectorAttribute, sCdataAttribute, aBuffer.makeStringAndClear() );
xHandler->ignorableWhitespace ( sWhiteSpace );
@@ -281,7 +281,7 @@
pNewAttrList->AddAttribute ( sIterationCountAttribute, sCdataAttribute, aBuffer.makeStringAndClear() );
pSalt->Value >>= aSequence;
- Base64Codec::encodeBase64 ( aBuffer, aSequence );
+ ::sax::Converter::encodeBase64( aBuffer, aSequence );
pNewAttrList->AddAttribute ( sSaltAttribute, sCdataAttribute, aBuffer.makeStringAndClear() );
xHandler->ignorableWhitespace ( sWhiteSpace );
diff -ru libreoffice-3.4.5.2.orig/package/source/manifest/ManifestImport.cxx libreoffice-3.4.5.2/package/source/manifest/ManifestImport.cxx
--- libreoffice-3.4.5.2.orig/package/source/manifest/ManifestImport.cxx 2012-07-16 10:14:11.341098564 +0100
+++ libreoffice-3.4.5.2/package/source/manifest/ManifestImport.cxx 2012-07-16 11:03:31.155672727 +0100
@@ -30,7 +30,7 @@
#include "precompiled_package.hxx"
#include <ManifestImport.hxx>
#include <ManifestDefines.hxx>
-#include <Base64Codec.hxx>
+#include <sax/tools/converter.hxx>
#include <com/sun/star/xml/sax/XAttributeList.hpp>
#include <com/sun/star/xml/crypto/DigestID.hpp>
#include <com/sun/star/xml/crypto/CipherID.hpp>
@@ -45,8 +45,7 @@
// ---------------------------------------------------
ManifestImport::ManifestImport( vector < Sequence < PropertyValue > > & rNewManVector )
-: nNumProperty ( 0 )
-, bIgnoreEncryptData ( sal_False )
+: bIgnoreEncryptData ( sal_False )
, nDerivedKeySize( 0 )
, rManVector ( rNewManVector )
@@ -126,176 +125,235 @@
}
// ---------------------------------------------------
-void SAL_CALL ManifestImport::startElement( const OUString& aName, const uno::Reference< xml::sax::XAttributeList >& xAttribs )
- throw( xml::sax::SAXException, uno::RuntimeException )
+void ManifestImport::doFileEntry(StringHashMap &rConvertedAttribs)
+ throw( uno::RuntimeException )
{
- StringHashMap aConvertedAttribs;
- ::rtl::OUString aConvertedName = PushNameAndNamespaces( aName, xAttribs, aConvertedAttribs );
+ aSequence.resize(PKG_SIZE_ENCR_MNFST);
- if ( aConvertedName == sFileEntryElement )
+ aSequence[PKG_MNFST_FULLPATH].Name = sFullPathProperty;
+ aSequence[PKG_MNFST_FULLPATH].Value <<= rConvertedAttribs[sFullPathAttribute];
+ aSequence[PKG_MNFST_MEDIATYPE].Name = sMediaTypeProperty;
+ aSequence[PKG_MNFST_MEDIATYPE].Value <<= rConvertedAttribs[sMediaTypeAttribute];
+
+ OUString sVersion = rConvertedAttribs[sVersionAttribute];
+ if ( sVersion.getLength() )
{
- aSequence.realloc ( PKG_SIZE_ENCR_MNFST );
+ aSequence[PKG_MNFST_VERSION].Name = sVersionProperty;
+ aSequence[PKG_MNFST_VERSION].Value <<= sVersion;
+ }
- // Put full-path property first for MBA
- aSequence[nNumProperty].Name = sFullPathProperty;
- aSequence[nNumProperty++].Value <<= aConvertedAttribs[sFullPathAttribute];
- aSequence[nNumProperty].Name = sMediaTypeProperty;
- aSequence[nNumProperty++].Value <<= aConvertedAttribs[sMediaTypeAttribute];
+ OUString sSize = rConvertedAttribs[sSizeAttribute];
+ if ( sSize.getLength() )
+ {
+ sal_Int32 nSize = sSize.toInt32();
+ aSequence[PKG_MNFST_UCOMPSIZE].Name = sSizeProperty;
+ aSequence[PKG_MNFST_UCOMPSIZE].Value <<= nSize;
+ }
+}
- OUString sVersion = aConvertedAttribs[sVersionAttribute];
- if ( sVersion.getLength() )
+void ManifestImport::doEncryptionData(StringHashMap &rConvertedAttribs)
+ throw( uno::RuntimeException )
+{
+ // If this element exists, then this stream is encrypted and we need
+ // to import the initialisation vector, salt and iteration count used
+ nDerivedKeySize = 0;
+ OUString aString = rConvertedAttribs[sChecksumTypeAttribute];
+ if ( !bIgnoreEncryptData )
+ {
+ if ( aString.equals( sSHA1_1k_Name ) || aString.equals( sSHA1_1k_URL ) )
+ {
+ aSequence[PKG_MNFST_DIGESTALG].Name = sDigestAlgProperty;
+ aSequence[PKG_MNFST_DIGESTALG].Value <<= xml::crypto::DigestID::SHA1_1K;
+ }
+ else if ( aString.equals( sSHA256_1k_URL ) )
{
- aSequence[nNumProperty].Name = sVersionProperty;
- aSequence[nNumProperty++].Value <<= sVersion;
+ aSequence[PKG_MNFST_DIGESTALG].Name = sDigestAlgProperty;
+ aSequence[PKG_MNFST_DIGESTALG].Value <<= xml::crypto::DigestID::SHA256_1K;
}
+ else
+ bIgnoreEncryptData = sal_True;
- OUString sSize = aConvertedAttribs[sSizeAttribute];
- if ( sSize.getLength() )
+ if ( !bIgnoreEncryptData )
{
- sal_Int32 nSize;
- nSize = sSize.toInt32();
- aSequence[nNumProperty].Name = sSizeProperty;
- aSequence[nNumProperty++].Value <<= nSize;
+ aString = rConvertedAttribs[sChecksumAttribute];
+ uno::Sequence < sal_Int8 > aDecodeBuffer;
+ ::sax::Converter::decodeBase64(aDecodeBuffer, aString);
+ aSequence[PKG_MNFST_DIGEST].Name = sDigestProperty;
+ aSequence[PKG_MNFST_DIGEST].Value <<= aDecodeBuffer;
}
}
- else if ( aStack.size() > 1 )
+}
+
+void ManifestImport::doAlgorithm(StringHashMap &rConvertedAttribs)
+ throw( uno::RuntimeException )
+{
+ if ( !bIgnoreEncryptData )
{
- ManifestStack::reverse_iterator aIter = aStack.rbegin();
- ++aIter;
+ OUString aString = rConvertedAttribs[sAlgorithmNameAttribute];
+ if ( aString.equals( sBlowfish_Name ) || aString.equals( sBlowfish_URL ) )
+ {
+ aSequence[PKG_MNFST_ENCALG].Name = sEncryptionAlgProperty;
+ aSequence[PKG_MNFST_ENCALG].Value <<= xml::crypto::CipherID::BLOWFISH_CFB_8;
+ }
+ else if ( aString.equals( sAES256_URL ) )
+ {
+ aSequence[PKG_MNFST_ENCALG].Name = sEncryptionAlgProperty;
+ aSequence[PKG_MNFST_ENCALG].Value <<= xml::crypto::CipherID::AES_CBC_W3C_PADDING;
+ OSL_ENSURE( !nDerivedKeySize || nDerivedKeySize == 32, "Unexpected derived key length!" );
+ nDerivedKeySize = 32;
+ }
+ else if ( aString.equals( sAES192_URL ) )
+ {
+ aSequence[PKG_MNFST_ENCALG].Name = sEncryptionAlgProperty;
+ aSequence[PKG_MNFST_ENCALG].Value <<= xml::crypto::CipherID::AES_CBC_W3C_PADDING;
+ OSL_ENSURE( !nDerivedKeySize || nDerivedKeySize == 24, "Unexpected derived key length!" );
+ nDerivedKeySize = 24;
+ }
+ else if ( aString.equals( sAES128_URL ) )
+ {
+ aSequence[PKG_MNFST_ENCALG].Name = sEncryptionAlgProperty;
+ aSequence[PKG_MNFST_ENCALG].Value <<= xml::crypto::CipherID::AES_CBC_W3C_PADDING;
+ OSL_ENSURE( !nDerivedKeySize || nDerivedKeySize == 16, "Unexpected derived key length!" );
+ nDerivedKeySize = 16;
+ }
+ else
+ bIgnoreEncryptData = sal_True;
+
+ if ( !bIgnoreEncryptData )
+ {
+ aString = rConvertedAttribs[sInitialisationVectorAttribute];
+ uno::Sequence < sal_Int8 > aDecodeBuffer;
+ ::sax::Converter::decodeBase64(aDecodeBuffer, aString);
+ aSequence[PKG_MNFST_INIVECTOR].Name = sInitialisationVectorProperty;
+ aSequence[PKG_MNFST_INIVECTOR].Value <<= aDecodeBuffer;
+ }
+ }
+}
- if ( aIter->m_aConvertedName.equals( sFileEntryElement ) )
+void ManifestImport::doKeyDerivation(StringHashMap &rConvertedAttribs)
+ throw( uno::RuntimeException )
+{
+ if ( !bIgnoreEncryptData )
+ {
+ OUString aString = rConvertedAttribs[sKeyDerivationNameAttribute];
+ if ( aString.equals( sPBKDF2_Name ) || aString.equals( sPBKDF2_URL ) )
{
- if ( aConvertedName.equals( sEncryptionDataElement ) )
+ aString = rConvertedAttribs[sSaltAttribute];
+ uno::Sequence < sal_Int8 > aDecodeBuffer;
+ ::sax::Converter::decodeBase64(aDecodeBuffer, aString);
+ aSequence[PKG_MNFST_SALT].Name = sSaltProperty;
+ aSequence[PKG_MNFST_SALT].Value <<= aDecodeBuffer;
+
+ aString = rConvertedAttribs[sIterationCountAttribute];
+ aSequence[PKG_MNFST_ITERATION].Name = sIterationCountProperty;
+ aSequence[PKG_MNFST_ITERATION].Value <<= aString.toInt32();
+
+ aString = rConvertedAttribs[sKeySizeAttribute];
+ if ( aString.getLength() )
{
- // If this element exists, then this stream is encrypted and we need
- // to import the initialisation vector, salt and iteration count used
- nDerivedKeySize = 0;
- OUString aString = aConvertedAttribs[sChecksumTypeAttribute];
- if ( !bIgnoreEncryptData )
- {
- if ( aString.equals( sSHA1_1k_Name ) || aString.equals( sSHA1_1k_URL ) )
- {
- aSequence[nNumProperty].Name = sDigestAlgProperty;
- aSequence[nNumProperty++].Value <<= xml::crypto::DigestID::SHA1_1K;
- }
- else if ( aString.equals( sSHA256_1k_URL ) )
- {
- aSequence[nNumProperty].Name = sDigestAlgProperty;
- aSequence[nNumProperty++].Value <<= xml::crypto::DigestID::SHA256_1K;
- }
- else
- bIgnoreEncryptData = sal_True;
-
- if ( !bIgnoreEncryptData )
- {
- aString = aConvertedAttribs[sChecksumAttribute];
- Sequence < sal_Int8 > aDecodeBuffer;
- Base64Codec::decodeBase64 ( aDecodeBuffer, aString );
- aSequence[nNumProperty].Name = sDigestProperty;
- aSequence[nNumProperty++].Value <<= aDecodeBuffer;
- }
+ sal_Int32 nKey = aString.toInt32();
+ OSL_ENSURE( !nDerivedKeySize || nKey == nDerivedKeySize , "Provided derived key length differs from the expected one!" );
+ nDerivedKeySize = nKey;
}
+ else if ( !nDerivedKeySize )
+ nDerivedKeySize = 16;
+ else if ( nDerivedKeySize != 16 )
+ OSL_ENSURE( sal_False, "Default derived key length differs from the expected one!" );
+
+ aSequence[PKG_MNFST_DERKEYSIZE].Name = sDerivedKeySizeProperty;
+ aSequence[PKG_MNFST_DERKEYSIZE].Value <<= nDerivedKeySize;
}
+ else
+ bIgnoreEncryptData = sal_True;
+ }
+}
+
+void ManifestImport::doStartKeyAlg(StringHashMap &rConvertedAttribs)
+ throw( uno::RuntimeException )
+{
+ OUString aString = rConvertedAttribs[sStartKeyAlgNameAttribute];
+ if ( aString.equals( sSHA256_URL ) )
+ {
+ aSequence[PKG_MNFST_STARTALG].Name = sStartKeyAlgProperty;
+ aSequence[PKG_MNFST_STARTALG].Value <<= xml::crypto::DigestID::SHA256;
+ }
+ else if ( aString.equals( sSHA1_Name ) || aString.equals( sSHA1_URL ) )
+ {
+ aSequence[PKG_MNFST_STARTALG].Name = sStartKeyAlgProperty;
+ aSequence[PKG_MNFST_STARTALG].Value <<= xml::crypto::DigestID::SHA1;
+ }
+ else
+ bIgnoreEncryptData = sal_True;
+}
+
+// ---------------------------------------------------
+void SAL_CALL ManifestImport::startElement( const OUString& aName, const uno::Reference< xml::sax::XAttributeList >& xAttribs )
+ throw( xml::sax::SAXException, uno::RuntimeException )
+{
+ StringHashMap aConvertedAttribs;
+ ::rtl::OUString aConvertedName = PushNameAndNamespaces( aName, xAttribs, aConvertedAttribs );
+
+ size_t nLevel = aStack.size();
+
+ assert(nLevel >= 1);
+
+ switch (nLevel)
+ {
+ case 1:
+ {
+ if (!aConvertedName.equalsAscii(ELEMENT_MANIFEST)) //manifest:manifest
+ aStack.back().m_bValid = false;
+ break;
}
- else if ( aIter->m_aConvertedName.equals( sEncryptionDataElement ) )
+ case 2:
{
- if ( aConvertedName == sAlgorithmElement )
- {
- if ( !bIgnoreEncryptData )
- {
- OUString aString = aConvertedAttribs[sAlgorithmNameAttribute];
- if ( aString.equals( sBlowfish_Name ) || aString.equals( sBlowfish_URL ) )
- {
- aSequence[nNumProperty].Name = sEncryptionAlgProperty;
- aSequence[nNumProperty++].Value <<= xml::crypto::CipherID::BLOWFISH_CFB_8;
- }
- else if ( aString.equals( sAES256_URL ) )
- {
- aSequence[nNumProperty].Name = sEncryptionAlgProperty;
- aSequence[nNumProperty++].Value <<= xml::crypto::CipherID::AES_CBC_W3C_PADDING;
- OSL_ENSURE( !nDerivedKeySize || nDerivedKeySize == 32, "Unexpected derived key length!" );
- nDerivedKeySize = 32;
- }
- else if ( aString.equals( sAES192_URL ) )
- {
- aSequence[nNumProperty].Name = sEncryptionAlgProperty;
- aSequence[nNumProperty++].Value <<= xml::crypto::CipherID::AES_CBC_W3C_PADDING;
- OSL_ENSURE( !nDerivedKeySize || nDerivedKeySize == 24, "Unexpected derived key length!" );
- nDerivedKeySize = 24;
- }
- else if ( aString.equals( sAES128_URL ) )
- {
- aSequence[nNumProperty].Name = sEncryptionAlgProperty;
- aSequence[nNumProperty++].Value <<= xml::crypto::CipherID::AES_CBC_W3C_PADDING;
- OSL_ENSURE( !nDerivedKeySize || nDerivedKeySize == 16, "Unexpected derived key length!" );
- nDerivedKeySize = 16;
- }
- else
- bIgnoreEncryptData = sal_True;
-
- if ( !bIgnoreEncryptData )
- {
- aString = aConvertedAttribs[sInitialisationVectorAttribute];
- Sequence < sal_Int8 > aDecodeBuffer;
- Base64Codec::decodeBase64 ( aDecodeBuffer, aString );
- aSequence[nNumProperty].Name = sInitialisationVectorProperty;
- aSequence[nNumProperty++].Value <<= aDecodeBuffer;
- }
- }
- }
- else if ( aConvertedName == sKeyDerivationElement )
- {
- if ( !bIgnoreEncryptData )
- {
- OUString aString = aConvertedAttribs[sKeyDerivationNameAttribute];
- if ( aString.equals( sPBKDF2_Name ) || aString.equals( sPBKDF2_URL ) )
- {
- aString = aConvertedAttribs[sSaltAttribute];
- Sequence < sal_Int8 > aDecodeBuffer;
- Base64Codec::decodeBase64 ( aDecodeBuffer, aString );
- aSequence[nNumProperty].Name = sSaltProperty;
- aSequence[nNumProperty++].Value <<= aDecodeBuffer;
-
- aString = aConvertedAttribs[sIterationCountAttribute];
- aSequence[nNumProperty].Name = sIterationCountProperty;
- aSequence[nNumProperty++].Value <<= aString.toInt32();
-
- aString = aConvertedAttribs[sKeySizeAttribute];
- if ( aString.getLength() )
- {
- sal_Int32 nKey = aString.toInt32();
- OSL_ENSURE( !nDerivedKeySize || nKey == nDerivedKeySize , "Provided derived key length differs from the expected one!" );
- nDerivedKeySize = nKey;
- }
- else if ( !nDerivedKeySize )
- nDerivedKeySize = 16;
- else if ( nDerivedKeySize != 16 )
- OSL_ENSURE( sal_False, "Default derived key length differs from the expected one!" );
-
- aSequence[nNumProperty].Name = sDerivedKeySizeProperty;
- aSequence[nNumProperty++].Value <<= nDerivedKeySize;
- }
- else
- bIgnoreEncryptData = sal_True;
- }
- }
- else if ( aConvertedName == sStartKeyAlgElement )
- {
- OUString aString = aConvertedAttribs[sStartKeyAlgNameAttribute];
- if (aString.equals(sSHA256_URL) || aString.equals(sSHA256_URL_TYPO))
- {
- aSequence[nNumProperty].Name = sStartKeyAlgProperty;
- aSequence[nNumProperty++].Value <<= xml::crypto::DigestID::SHA256;
- }
- else if ( aString.equals( sSHA1_Name ) || aString.equals( sSHA1_URL ) )
- {
- aSequence[nNumProperty].Name = sStartKeyAlgProperty;
- aSequence[nNumProperty++].Value <<= xml::crypto::DigestID::SHA1;
- }
- else
- bIgnoreEncryptData = sal_True;
- }
+ if (aConvertedName == sFileEntryElement) //manifest:file-entry
+ doFileEntry(aConvertedAttribs);
+ else
+ aStack.back().m_bValid = false;
+ break;
}
+ case 3:
+ {
+ ManifestStack::reverse_iterator aIter = aStack.rbegin();
+ ++aIter;
+
+ if (!aIter->m_bValid)
+ aStack.back().m_bValid = false;
+ else if (aConvertedName.equals(sEncryptionDataElement)) //manifest:encryption-data
+ doEncryptionData(aConvertedAttribs);
+ else
+ aStack.back().m_bValid = false;
+ break;
+ }
+ case 4:
+ {
+ ManifestStack::reverse_iterator aIter = aStack.rbegin();
+ ++aIter;
+
+ if (!aIter->m_bValid)
+ aStack.back().m_bValid = false;
+ else if (aConvertedName.equals(sAlgorithmElement)) //manifest:algorithm,
+ doAlgorithm(aConvertedAttribs);
+ else if (aConvertedName.equals(sKeyDerivationElement)) //manifest:key-derivation,
+ doKeyDerivation(aConvertedAttribs);
+ else if (aConvertedName.equals(sStartKeyAlgElement)) //manifest:start-key-generation
+ doStartKeyAlg(aConvertedAttribs);
+ else
+ aStack.back().m_bValid = false;
+ break;
+ }
+ default:
+ aStack.back().m_bValid = false;
+ break;
+ }
+}
+
+namespace
+{
+ bool isEmpty(const com::sun::star::beans::PropertyValue &rProp)
+ {
+ return rProp.Name.isEmpty();
}
}
@@ -306,12 +364,16 @@
::rtl::OUString aConvertedName = ConvertName( aName );
if ( !aStack.empty() && aStack.rbegin()->m_aConvertedName.equals( aConvertedName ) )
{
- if ( aConvertedName.equals( sFileEntryElement ) )
+ if ( aConvertedName.equals( sFileEntryElement ) && aStack.back().m_bValid )
{
- aSequence.realloc ( nNumProperty );
+ com::sun::star::beans::PropertyValue aEmpty;
+ aSequence.erase(std::remove_if(aSequence.begin(), aSequence.end(),
+ isEmpty), aSequence.end());
+
bIgnoreEncryptData = sal_False;
- rManVector.push_back ( aSequence );
- nNumProperty = 0;
+ rManVector.push_back ( aSequence.getAsConstList() );
+
+ aSequence.clear();
}
aStack.pop_back();
diff -ru libreoffice-3.4.5.2.orig/package/source/manifest/ManifestImport.hxx libreoffice-3.4.5.2/package/source/manifest/ManifestImport.hxx
--- libreoffice-3.4.5.2.orig/package/source/manifest/ManifestImport.hxx 2012-07-16 10:14:11.340098552 +0100
+++ libreoffice-3.4.5.2/package/source/manifest/ManifestImport.hxx 2012-07-16 11:02:04.459397522 +0100
@@ -31,6 +31,7 @@
#include <cppuhelper/implbase1.hxx> // helper for implementations
#include <com/sun/star/xml/sax/XDocumentHandler.hpp>
+#include <comphelper/sequenceasvector.hxx>
#include <vector>
#include <HashMaps.hxx>
@@ -46,10 +47,12 @@
{
::rtl::OUString m_aConvertedName;
StringHashMap m_aNamespaces;
+ bool m_bValid;
ManifestScopeEntry( const ::rtl::OUString& aConvertedName, const StringHashMap& aNamespaces )
: m_aConvertedName( aConvertedName )
, m_aNamespaces( aNamespaces )
+ , m_bValid( true )
{}
~ManifestScopeEntry()
@@ -61,8 +64,7 @@
class ManifestImport : public cppu::WeakImplHelper1 < com::sun::star::xml::sax::XDocumentHandler >
{
protected:
- com::sun::star::uno::Sequence < com::sun::star::beans::PropertyValue > aSequence;
- sal_Int16 nNumProperty;
+ comphelper::SequenceAsVector< com::sun::star::beans::PropertyValue > aSequence;
ManifestStack aStack;
sal_Bool bIgnoreEncryptData;
sal_Int32 nDerivedKeySize;
@@ -149,6 +151,12 @@
throw(::com::sun::star::xml::sax::SAXException, ::com::sun::star::uno::RuntimeException);
virtual void SAL_CALL setDocumentLocator( const ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XLocator >& xLocator )
throw(::com::sun::star::xml::sax::SAXException, ::com::sun::star::uno::RuntimeException);
+private:
+ void doFileEntry(StringHashMap &rConvertedAttribs) throw(::com::sun::star::uno::RuntimeException);
+ void doEncryptionData(StringHashMap &rConvertedAttribs) throw(::com::sun::star::uno::RuntimeException);
+ void doAlgorithm(StringHashMap &rConvertedAttribs) throw(::com::sun::star::uno::RuntimeException);
+ void doKeyDerivation(StringHashMap &rConvertedAttribs) throw(::com::sun::star::uno::RuntimeException);
+ void doStartKeyAlg(StringHashMap &rConvertedAttribs) throw(::com::sun::star::uno::RuntimeException);
};
#endif
diff -ru libreoffice-3.4.5.2.orig/package/source/zipapi/ZipFile.cxx libreoffice-3.4.5.2/package/source/zipapi/ZipFile.cxx
--- libreoffice-3.4.5.2.orig/package/source/zipapi/ZipFile.cxx 2012-07-16 10:14:11.391099163 +0100
+++ libreoffice-3.4.5.2/package/source/zipapi/ZipFile.cxx 2012-07-16 10:34:13.201449076 +0100
@@ -194,6 +194,12 @@
try
{
+ if (xEncryptionData->m_nDerivedKeySize < 0)
+ {
+ throw ZipIOException( ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("Invalid derived key length!") ),
+ uno::Reference< XInterface >() );
+ }
+
uno::Sequence< sal_Int8 > aDerivedKey( xEncryptionData->m_nDerivedKeySize );
if ( rtl_Digest_E_None != rtl_digest_PBKDF2( reinterpret_cast< sal_uInt8* >( aDerivedKey.getArray() ),
aDerivedKey.getLength(),
@@ -229,7 +235,7 @@
uno::Reference< XInterface >() );
}
}
- catch( uno::Exception& )
+ catch( ... )
{
OSL_ENSURE( sal_False, "Can not create cipher context!" );
}
@@ -807,7 +813,7 @@
|| rEntry.nPathLen != nPathLen
|| !rEntry.sPath.equals( sLOCPath );
}
- catch(::std::bad_alloc &)
+ catch(...)
{
bBroken = sal_True;
}
--- libreoffice-3.4.5.2.orig/package/util/makefile.mk 2012-07-16 10:14:11.441099761 +0100
+++ libreoffice-3.4.5.2/package/util/makefile.mk 2012-07-16 15:48:57.360289921 +0100
@@ -58,6 +58,7 @@
SHL1USE_EXPORTS=name
SHL1STDLIBS=\
+ $(SAXLIB) \
$(CPPULIB) \
$(UCBHELPERLIB) \
$(CPPUHELPERLIB) \
--- libreoffice-3.4.5.2.orig/filter/source/xsltfilter/OleHandler.cxx 2012-07-20 09:29:02.209638174 +0100
+++ libreoffice-3.4.5.2/filter/source/xsltfilter/OleHandler.cxx 2012-07-20 09:30:14.585489410 +0100
@@ -46,6 +46,8 @@
#include <package/Inflater.hxx>
#include <package/Deflater.hxx>
+#include <sax/tools/converter.hxx>
+
#include <cppuhelper/factory.hxx>
#include <cppuhelper/servicefactory.hxx>
#include <com/sun/star/uno/Any.hxx>
@@ -95,7 +97,7 @@
void SAL_CALL OleHandler::initRootStorageFromBase64(const OString& content)
{
Sequence<sal_Int8> oleData;
- SvXMLUnitConverter::decodeBase64(oleData, ::rtl::OStringToOUString(content, RTL_TEXTENCODING_UTF8, OSTRING_TO_OUSTRING_CVTFLAGS));
+ ::sax::Converter::decodeBase64(oleData, ::rtl::OStringToOUString(content, RTL_TEXTENCODING_UTF8, OSTRING_TO_OUSTRING_CVTFLAGS));
m_rootStream = createTempFile();
Reference<XOutputStream> xOutput = m_rootStream->getOutputStream();
xOutput->writeBytes(oleData);
@@ -154,7 +156,7 @@
delete decompresser;
//return the base64 string of the uncompressed data
OUStringBuffer buf(oleLength);
- SvXMLUnitConverter::encodeBase64(buf, result);
+ ::sax::Converter::encodeBase64(buf, result);
return ::rtl::OUStringToOString(buf.toString(), RTL_TEXTENCODING_UTF8);
}
@@ -187,7 +189,7 @@
xInput->readBytes(oledata, oleLength);
//return the base64 encoded string
OUStringBuffer buf(oleLength);
- SvXMLUnitConverter::encodeBase64(buf, oledata);
+ ::sax::Converter::encodeBase64(buf, oledata);
return ::rtl::OUStringToOString(buf.toString(), RTL_TEXTENCODING_UTF8);
}
else
@@ -202,7 +204,7 @@
{
//decode the base64 string
Sequence<sal_Int8> oledata;
- SvXMLUnitConverter::decodeBase64(oledata, rtl::OUString::createFromAscii(content));
+ ::sax::Converter::decodeBase64(oledata, rtl::OUString::createFromAscii(content));
//create a temp stream to write data to
Reference<XStream> subStream = createTempFile();
Reference<XInputStream> xInput = subStream->getInputStream();
--- libreoffice-3.4.5.2.orig/filter/source/svg/svgwriter.cxx 2012-07-20 09:31:25.700326497 +0100
+++ libreoffice-3.4.5.2/filter/source/svg/svgwriter.cxx 2012-07-20 09:31:56.762692339 +0100
@@ -28,7 +28,7 @@
// MARKER(update_precomp.py): autogen include statement, do not remove
#include "precompiled_filter.hxx"
-
+#include <sax/tools/converter.hxx>
#include "svgfontexport.hxx"
#include "svgwriter.hxx"
@@ -1284,7 +1284,7 @@
Sequence< sal_Int8 > aSeq( (sal_Int8*) aOStm.GetData(), aOStm.Tell() );
NMSP_RTL::OUStringBuffer aBuffer;
aBuffer.appendAscii( "data:image/png;base64," );
- SvXMLUnitConverter::encodeBase64( aBuffer, aSeq );
+ ::sax::Converter::encodeBase64( aBuffer, aSeq );
mrExport.AddAttribute( XML_NAMESPACE_NONE, aXMLAttrX, GetValueString( aPt.X() ) );
mrExport.AddAttribute( XML_NAMESPACE_NONE, aXMLAttrY, GetValueString( aPt.Y() ) );
--- libreoffice-3.4.5.2.orig/filter/source/svg/svgreader.cxx 2012-07-20 09:33:01.141450969 +0100
+++ libreoffice-3.4.5.2/filter/source/svg/svgreader.cxx 2012-07-20 09:33:29.708787774 +0100
@@ -51,7 +51,7 @@
#include <com/sun/star/xml/sax/XParser.hpp>
#include <com/sun/star/xml/dom/XDocumentBuilder.hpp>
#include <com/sun/star/xml/dom/NodeType.hpp>
-
+#include <sax/tools/converter.hxx>
#include <comphelper/processfactory.hxx>
#include <basegfx/polygon/b2dpolygoncutandtouch.hxx>
#include <basegfx/polygon/b2dpolypolygoncutter.hxx>
@@ -2309,7 +2309,7 @@
Graphic aGraphic;
uno::Sequence<sal_Int8> aData;
- SvXMLUnitConverter::decodeBase64(aData,
+ ::sax::Converter::decodeBase64(aData,
rtl::OUString::createFromAscii(sLinkValue.c_str()));
SvMemoryStream aSrc(aData.getArray(),
aData.getLength(),
--- libreoffice-3.4.5.2.orig/filter/source/xsltfilter/makefile.mk 2012-07-20 09:37:15.952431808 +0100
+++ libreoffice-3.4.5.2/filter/source/xsltfilter/makefile.mk 2012-07-20 09:37:40.710708814 +0100
@@ -54,6 +54,7 @@
DEF1NAME=$(SHL1TARGET)
SHL1STDLIBS= \
+ $(SAXLIB) \
$(TOOLSLIB) \
$(CPPUHELPERLIB) \
$(CPPULIB) \
--- libreoffice-3.4.5.2.orig/filter/source/svg/makefile.mk 2012-07-20 09:38:47.336454795 +0100
+++ libreoffice-3.4.5.2/filter/source/svg/makefile.mk 2012-07-20 09:38:43.848415721 +0100
@@ -65,6 +65,7 @@
SHL1TARGET=$(TARGET)$(DLLPOSTFIX)
SHL1STDLIBS=\
+ $(SAXLIB) \
$(EDITENGLIB) \
$(SVXCORELIB) \
$(BASEGFXLIB) \