[Libreoffice-commits] core.git: 3 commits - comphelper/source filter/source i18npool/source include/comphelper sw/source
Stephan Bergmann
sbergman at redhat.com
Fri Feb 7 01:05:18 PST 2014
comphelper/source/misc/docpasswordhelper.cxx | 16 ++++++++++++++--
filter/source/msfilter/mscodec.cxx | 2 +-
i18npool/source/localedata/LocaleNode.cxx | 14 ++++++++++++--
include/comphelper/docpasswordhelper.hxx | 8 ++++++++
sw/source/core/doc/docbm.cxx | 13 -------------
5 files changed, 35 insertions(+), 18 deletions(-)
New commits:
commit 0443d296720971697c48453912cc9ffb742f8640
Author: Stephan Bergmann <sbergman at redhat.com>
Date: Fri Feb 7 10:04:31 2014 +0100
Avoid generation of unused replaceFrom* variables
Change-Id: I2a65485b8dcaa7b6ed4a049f97d460878b8bb17d
diff --git a/i18npool/source/localedata/LocaleNode.cxx b/i18npool/source/localedata/LocaleNode.cxx
index 69360de..05762c6 100644
--- a/i18npool/source/localedata/LocaleNode.cxx
+++ b/i18npool/source/localedata/LocaleNode.cxx
@@ -617,9 +617,14 @@ void LCFormatNode::generateCode (const OFileWriter &of) const
::std::vector< OUString > theDateAcceptancePatterns;
+ OUString useLocale(getAttr().getValueByName("ref"));
+
OUString str;
OUString strFrom( getAttr().getValueByName("replaceFrom"));
- of.writeParameter("replaceFrom", strFrom, mnSection);
+ if (useLocale.isEmpty())
+ {
+ of.writeParameter("replaceFrom", strFrom, mnSection);
+ }
str = getAttr().getValueByName("replaceTo");
if (!strFrom.isEmpty() && str.isEmpty())
incErrorStr("replaceFrom=\"%s\" replaceTo=\"\" is empty replacement.", strFrom);
@@ -640,9 +645,14 @@ void LCFormatNode::generateCode (const OFileWriter &of) const
}
}
- OUString useLocale = getAttr().getValueByName("ref");
if (!useLocale.isEmpty())
{
+ if (!strFrom.isEmpty() && strFrom != "[CURRENCY]") //???
+ {
+ incErrorStrStr(
+ "non-empty replaceFrom=\"%s\" with non-empty ref=\"%s\".",
+ strFrom, useLocale);
+ }
useLocale = useLocale.replace( '-', '_');
switch (mnSection)
{
commit 91fcdd5a8d5c71103220c97bc0bb48acf0a502ba
Author: Caolán McNamara <caolanm at redhat.com>
Date: Fri Feb 7 08:52:20 2014 +0000
fix debug=2 build
Change-Id: I9b5b2efc3b8fc3164264775b608348baa72d31b1
diff --git a/sw/source/core/doc/docbm.cxx b/sw/source/core/doc/docbm.cxx
index e4837a3..bf8ef76 100644
--- a/sw/source/core/doc/docbm.cxx
+++ b/sw/source/core/doc/docbm.cxx
@@ -1073,19 +1073,6 @@ namespace sw { namespace mark
sortSubsetMarks();
}
-#if OSL_DEBUG_LEVEL > 1
- void MarkManager::dumpFieldmarks( ) const
- {
- const_iterator_t pIt = m_vFieldmarks.begin();
- for (; pIt != m_vFieldmarks.end( ); pIt++)
- {
- rtl::OUString str = (*pIt)->ToString();
- OSL_TRACE("%s\n",
- ::rtl::OUStringToOString(str, RTL_TEXTENCODING_UTF8).getStr());
- }
- }
-#endif
-
bool MarkManager::hasMark(const OUString& rName) const
{
return (m_aMarkNamesSet.find(rName) != m_aMarkNamesSet.end());
commit 3ec9bccaabb4a2998c9bd29992af1d1880b284d8
Author: Caolán McNamara <caolanm at redhat.com>
Date: Thu Feb 6 21:07:19 2014 +0000
silence coverity#1027865 Out-of-bounds access
and coverity#1027864
Change-Id: Ic3d1b91ef77ab3510c7428b7135dd9f249d56b4b
diff --git a/comphelper/source/misc/docpasswordhelper.cxx b/comphelper/source/misc/docpasswordhelper.cxx
index 9d312a3..72b8636 100644
--- a/comphelper/source/misc/docpasswordhelper.cxx
+++ b/comphelper/source/misc/docpasswordhelper.cxx
@@ -284,7 +284,18 @@ Sequence< sal_Int8 > DocPasswordHelper::GetXLHashAsSequence(
/*static*/ uno::Sequence< sal_Int8 > DocPasswordHelper::GenerateStd97Key( const sal_uInt16 pPassData[16], const uno::Sequence< sal_Int8 >& aDocId )
{
uno::Sequence< sal_Int8 > aResultKey;
- if ( pPassData[0] && aDocId.getLength() == 16 )
+
+ if ( aDocId.getLength() == 16 )
+ aResultKey = GenerateStd97Key(pPassData, (const sal_uInt8*)aDocId.getConstArray());
+
+ return aResultKey;
+}
+
+// ============================================================================
+/*static*/ uno::Sequence< sal_Int8 > DocPasswordHelper::GenerateStd97Key( const sal_uInt16 pPassData[16], const sal_uInt8 pDocId[16] )
+{
+ uno::Sequence< sal_Int8 > aResultKey;
+ if ( pPassData[0] )
{
sal_uInt8 pKeyData[64];
memset( pKeyData, 0, sizeof(pKeyData) );
@@ -312,7 +323,7 @@ Sequence< sal_Int8 > DocPasswordHelper::GetXLHashAsSequence(
for ( nInd = 0; nInd < 16; nInd++ )
{
rtl_digest_updateMD5( hDigest, pKeyData, 5 );
- rtl_digest_updateMD5( hDigest, (const sal_uInt8*)aDocId.getConstArray(), aDocId.getLength() );
+ rtl_digest_updateMD5( hDigest, pDocId, 16 );
}
// Update digest with padding.
@@ -334,6 +345,7 @@ Sequence< sal_Int8 > DocPasswordHelper::GetXLHashAsSequence(
return aResultKey;
}
+
// ============================================================================
/*static*/ ::com::sun::star::uno::Sequence< ::com::sun::star::beans::NamedValue > DocPasswordHelper::requestAndVerifyDocPassword(
diff --git a/filter/source/msfilter/mscodec.cxx b/filter/source/msfilter/mscodec.cxx
index b911822..eb5ea4c 100644
--- a/filter/source/msfilter/mscodec.cxx
+++ b/filter/source/msfilter/mscodec.cxx
@@ -331,7 +331,7 @@ void MSCodec_Std97::InitKey (
#if DEBUG_MSO_ENCRYPTION_STD97
fprintf(stdout, "MSCodec_Std97::InitKey: --begin\n");fflush(stdout);
#endif
- uno::Sequence< sal_Int8 > aKey = ::comphelper::DocPasswordHelper::GenerateStd97Key( pPassData, uno::Sequence< sal_Int8 >( (sal_Int8*)pDocId, 16 ) );
+ uno::Sequence< sal_Int8 > aKey = ::comphelper::DocPasswordHelper::GenerateStd97Key(pPassData, pDocId);
// Fill raw digest of above updates into DigestValue.
if ( aKey.getLength() == sizeof(m_pDigestValue) )
diff --git a/include/comphelper/docpasswordhelper.hxx b/include/comphelper/docpasswordhelper.hxx
index 8c160fd..92b2731 100644
--- a/include/comphelper/docpasswordhelper.hxx
+++ b/include/comphelper/docpasswordhelper.hxx
@@ -220,6 +220,14 @@ public:
const sal_uInt16 pPassData[16],
const ::com::sun::star::uno::Sequence< sal_Int8 >& aDocId );
+ /** This helper function generates a byte sequence representing the
+ key digest value used by MSCodec_Std97 codec.
+ */
+
+ static ::com::sun::star::uno::Sequence< sal_Int8 > GenerateStd97Key(
+ const sal_uInt16 pPassData[16],
+ const sal_uInt8 pDocId[16] );
+
// ------------------------------------------------------------------------
/** This helper function tries to request and verify a password to load a
More information about the Libreoffice-commits
mailing list