[ooo-build-commit] .: 4 commits - sw/inc sw/qa sw/source
Caolán McNamara
caolan at kemper.freedesktop.org
Thu Oct 7 05:50:13 PDT 2010
sw/inc/calc.hxx | 10 ++--
sw/qa/unoapi/knownissues.xcl | 3 -
sw/source/core/bastyp/calc.cxx | 75 +++++++++++++++++------------------
sw/source/core/crsr/callnk.cxx | 4 +
sw/source/ui/docvw/AnnotationWin.cxx | 3 -
sw/source/ui/docvw/SidebarWin.cxx | 3 -
sw/source/ui/uno/unomod.cxx | 2
sw/source/ui/utlui/initui.cxx | 3 -
sw/source/ui/utlui/uitool.cxx | 3 -
9 files changed, 57 insertions(+), 49 deletions(-)
New commits:
commit 8069c03c64748662b36aa760181806af6cfa19b4
Author: Caolán McNamara <caolanm at redhat.com>
Date: Thu Oct 7 11:37:07 2010 +0100
#i114412# dubious delete in SwCalc::Str2Double
diff --git a/sw/inc/calc.hxx b/sw/inc/calc.hxx
index f402b73..885cdcd 100644
--- a/sw/inc/calc.hxx
+++ b/sw/inc/calc.hxx
@@ -230,11 +230,11 @@ public:
void SetCalcError( SwCalcError eErr ) { eError = eErr; }
BOOL IsCalcError() const { return 0 != eError; }
- static BOOL Str2Double( const String& rStr, xub_StrLen& rPos,
+ static bool Str2Double( const String& rStr, xub_StrLen& rPos,
double& rVal,
- const LocaleDataWrapper* pData = 0 );
- static BOOL Str2Double( const String& rStr, xub_StrLen& rPos,
- double& rVal, SwDoc* pDoc );
+ LocaleDataWrapper const*const pData = 0 );
+ static bool Str2Double( const String& rStr, xub_StrLen& rPos,
+ double& rVal, SwDoc *const pDoc );
SW_DLLPUBLIC static BOOL IsValidVarName( const String& rStr,
String* pValidName = 0 );
diff --git a/sw/source/core/bastyp/calc.cxx b/sw/source/core/bastyp/calc.cxx
index eda1895..4863799 100644
--- a/sw/source/core/bastyp/calc.cxx
+++ b/sw/source/core/bastyp/calc.cxx
@@ -37,6 +37,7 @@
#include <climits>
#include <cfloat>
#include <hintids.hxx>
+#include <osl/diagnose.hxx>
#include <rtl/math.hxx>
#include <editeng/langitem.hxx>
#include <com/sun/star/lang/XMultiServiceFactory.hpp>
@@ -1605,65 +1606,63 @@ String SwCalc::GetDBName(const String& rName)
//------------------------------------------------------------------------------
-/******************************************************************************
- * Methode : BOOL SwCalc::Str2Double( double& )
- * Beschreibung:
- * Erstellt : OK 07.06.94 12:56
- * Aenderung : JP 27.10.98
- ******************************************************************************/
-BOOL SwCalc::Str2Double( const String& rCommand, xub_StrLen& rCommandPos,
- double& rVal, const LocaleDataWrapper* pLclData )
+namespace
{
- const SvtSysLocale aSysLocale;
- const LocaleDataWrapper* pLclD = pLclData;
- if( !pLclD )
- pLclD = aSysLocale.GetLocaleDataPtr();
+static bool
+lcl_Str2Double( const String& rCommand, xub_StrLen& rCommandPos, double& rVal,
+ const LocaleDataWrapper* const pLclData )
+{
+ OSL_ASSERT(pLclData);
const xub_Unicode nCurrCmdPos = rCommandPos;
rtl_math_ConversionStatus eStatus;
const sal_Unicode* pEnd;
rVal = rtl_math_uStringToDouble( rCommand.GetBuffer() + rCommandPos,
rCommand.GetBuffer() + rCommand.Len(),
- pLclD->getNumDecimalSep().GetChar(0),
- pLclD->getNumThousandSep().GetChar(0),
+ pLclData->getNumDecimalSep().GetChar(0),
+ pLclData->getNumThousandSep().GetChar(0),
&eStatus, &pEnd );
rCommandPos = static_cast<xub_StrLen>(pEnd - rCommand.GetBuffer());
- if( !pLclData && pLclD != &aSysLocale.GetLocaleData() )
- delete (LocaleDataWrapper*)pLclD;
-
return rtl_math_ConversionStatus_Ok == eStatus && nCurrCmdPos != rCommandPos;
}
-BOOL SwCalc::Str2Double( const String& rCommand, xub_StrLen& rCommandPos,
- double& rVal, SwDoc* pDoc )
+}
+
+/******************************************************************************
+ * Methode : BOOL SwCalc::Str2Double( double& )
+ * Beschreibung:
+ * Erstellt : OK 07.06.94 12:56
+ * Aenderung : JP 27.10.98
+ ******************************************************************************/
+bool SwCalc::Str2Double( const String& rCommand, xub_StrLen& rCommandPos,
+ double& rVal, const LocaleDataWrapper* const pLclData )
+{
+ const SvtSysLocale aSysLocale;
+ return lcl_Str2Double( rCommand, rCommandPos, rVal,
+ pLclData ? pLclData : aSysLocale.GetLocaleDataPtr() );
+}
+
+bool SwCalc::Str2Double( const String& rCommand, xub_StrLen& rCommandPos,
+ double& rVal, SwDoc* const pDoc )
{
const SvtSysLocale aSysLocale;
- const LocaleDataWrapper* pLclD = aSysLocale.GetLocaleDataPtr();
+ ::std::auto_ptr<const LocaleDataWrapper> pLclD;
if( pDoc )
{
-
LanguageType eLang = GetDocAppScriptLang( *pDoc );
if( eLang != SvxLocaleToLanguage( pLclD->getLocale() ) )
- pLclD = new LocaleDataWrapper(
+ {
+ pLclD.reset( new LocaleDataWrapper(
::comphelper::getProcessServiceFactory(),
- SvxCreateLocale( eLang ) );
+ SvxCreateLocale( eLang ) ) );
+ }
}
- const xub_Unicode nCurrCmdPos = rCommandPos;
- rtl_math_ConversionStatus eStatus;
- const sal_Unicode* pEnd;
- rVal = rtl_math_uStringToDouble( rCommand.GetBuffer() + rCommandPos,
- rCommand.GetBuffer() + rCommand.Len(),
- pLclD->getNumDecimalSep().GetChar(0),
- pLclD->getNumThousandSep().GetChar(0),
- &eStatus, &pEnd );
- rCommandPos = static_cast<xub_StrLen>(pEnd - rCommand.GetBuffer());
-
- if( pLclD != &aSysLocale.GetLocaleData() )
- delete (LocaleDataWrapper*)pLclD;
+ bool const bRet = lcl_Str2Double( rCommand, rCommandPos, rVal,
+ (pLclD.get()) ? pLclD.get() : aSysLocale.GetLocaleDataPtr() );
- return rtl_math_ConversionStatus_Ok == eStatus && nCurrCmdPos != rCommandPos;
+ return bRet;
}
//------------------------------------------------------------------------------
commit 5e15a110c90b442709e4fbf702f1aec787e5bbeb
Author: Caolán McNamara <caolanm at redhat.com>
Date: Thu Oct 7 11:34:51 2010 +0100
#i112111# API test fails caused by property ShowHiddenCharacters
diff --git a/sw/qa/unoapi/knownissues.xcl b/sw/qa/unoapi/knownissues.xcl
index 08e4412..4f8e395 100644
--- a/sw/qa/unoapi/knownissues.xcl
+++ b/sw/qa/unoapi/knownissues.xcl
@@ -21,9 +21,6 @@ sw.XMLStylesImporter::com::sun::star::xml::sax::XDocumentHandler
### i23422 ###
sw.SwXTextViewCursor::com::sun::star::beans::XMultiPropertyStates
-### i112111 ###
-sw.SwXViewSettings::com::sun::star::beans::XPropertySet
-
### i23623 ###
sw.SwXStyleFamily::com::sun::star::container::XNameReplace
diff --git a/sw/source/ui/uno/unomod.cxx b/sw/source/ui/uno/unomod.cxx
index 50c19ca..3c319b3 100644
--- a/sw/source/ui/uno/unomod.cxx
+++ b/sw/source/ui/uno/unomod.cxx
@@ -918,7 +918,7 @@ void SwXViewSettings::_getSingleValue( const comphelper::PropertyInfo & rInfo, u
case HANDLE_VIEWSET_TABSTOPS : bBoolVal = mpConstViewOption->IsTab(sal_True); break;
case HANDLE_VIEWSET_BREAKS : bBoolVal = mpConstViewOption->IsLineBreak(sal_True); break;
case HANDLE_VIEWSET_HIDDEN_TEXT : bBoolVal = mpConstViewOption->IsShowHiddenField(); break;
- case HANDLE_VIEWSET_HIDDEN_CHARACTERS : bBoolVal = mpConstViewOption->IsShowHiddenChar(); break;
+ case HANDLE_VIEWSET_HIDDEN_CHARACTERS : bBoolVal = mpConstViewOption->IsShowHiddenChar(sal_True); break;
case HANDLE_VIEWSET_HIDDEN_PARAGRAPHS : bBoolVal = mpConstViewOption->IsShowHiddenPara(); break;
case HANDLE_VIEWSET_TABLE_BOUNDARIES : bBoolVal = SwViewOption::IsTableBoundaries(); break;
case HANDLE_VIEWSET_TEXT_BOUNDARIES : bBoolVal = SwViewOption::IsDocBoundaries(); break;
commit 2f059bdf757fc64af34ddcb2b3b938921e33d96e
Author: Caolán McNamara <caolanm at redhat.com>
Date: Thu Oct 7 11:27:28 2010 +0100
dangling pointer dereference in SwCalc::Str2Double
diff --git a/sw/inc/calc.hxx b/sw/inc/calc.hxx
index 5b5a052..f402b73 100644
--- a/sw/inc/calc.hxx
+++ b/sw/inc/calc.hxx
@@ -28,6 +28,7 @@
#define _CALC_HXX
#include <svl/svarray.hxx>
+#include <unotools/syslocale.hxx>
#ifndef __SBX_SBXVALUE //autogen
#include <basic/sbxvar.hxx>
@@ -185,6 +186,7 @@ class SwCalc
xub_StrLen nCommandPos;
SwDoc& rDoc;
+ SvtSysLocale m_aSysLocale;
const LocaleDataWrapper* pLclData;
CharClass* pCharClass;
diff --git a/sw/source/core/bastyp/calc.cxx b/sw/source/core/bastyp/calc.cxx
index c68a230..eda1895 100644
--- a/sw/source/core/bastyp/calc.cxx
+++ b/sw/source/core/bastyp/calc.cxx
@@ -267,7 +267,7 @@ SwCalc::SwCalc( SwDoc& rD )
:
aErrExpr( aEmptyStr, SwSbxValue(), 0 ),
rDoc( rD ),
- pLclData( &SvtSysLocale().GetLocaleData() ),
+ pLclData( m_aSysLocale.GetLocaleDataPtr() ),
pCharClass( &GetAppCharClass() ),
nListPor( 0 ),
eError( CALC_NOERR )
@@ -416,7 +416,7 @@ SwCalc::~SwCalc()
{
for( USHORT n = 0; n < TBLSZ; ++n )
delete VarTable[n];
- if( pLclData != &SvtSysLocale().GetLocaleData() )
+ if( pLclData != m_aSysLocale.GetLocaleDataPtr() )
delete pLclData;
if( pCharClass != &GetAppCharClass() )
delete pCharClass;
@@ -1614,9 +1614,10 @@ String SwCalc::GetDBName(const String& rName)
BOOL SwCalc::Str2Double( const String& rCommand, xub_StrLen& rCommandPos,
double& rVal, const LocaleDataWrapper* pLclData )
{
+ const SvtSysLocale aSysLocale;
const LocaleDataWrapper* pLclD = pLclData;
if( !pLclD )
- pLclD = &SvtSysLocale().GetLocaleData();
+ pLclD = aSysLocale.GetLocaleDataPtr();
const xub_Unicode nCurrCmdPos = rCommandPos;
rtl_math_ConversionStatus eStatus;
@@ -1628,7 +1629,7 @@ BOOL SwCalc::Str2Double( const String& rCommand, xub_StrLen& rCommandPos,
&eStatus, &pEnd );
rCommandPos = static_cast<xub_StrLen>(pEnd - rCommand.GetBuffer());
- if( !pLclData && pLclD != &SvtSysLocale().GetLocaleData() )
+ if( !pLclData && pLclD != &aSysLocale.GetLocaleData() )
delete (LocaleDataWrapper*)pLclD;
return rtl_math_ConversionStatus_Ok == eStatus && nCurrCmdPos != rCommandPos;
@@ -1637,7 +1638,8 @@ BOOL SwCalc::Str2Double( const String& rCommand, xub_StrLen& rCommandPos,
BOOL SwCalc::Str2Double( const String& rCommand, xub_StrLen& rCommandPos,
double& rVal, SwDoc* pDoc )
{
- const LocaleDataWrapper* pLclD = &SvtSysLocale().GetLocaleData();
+ const SvtSysLocale aSysLocale;
+ const LocaleDataWrapper* pLclD = aSysLocale.GetLocaleDataPtr();
if( pDoc )
{
@@ -1658,7 +1660,7 @@ BOOL SwCalc::Str2Double( const String& rCommand, xub_StrLen& rCommandPos,
&eStatus, &pEnd );
rCommandPos = static_cast<xub_StrLen>(pEnd - rCommand.GetBuffer());
- if( pLclD != &SvtSysLocale().GetLocaleData() )
+ if( pLclD != &aSysLocale.GetLocaleData() )
delete (LocaleDataWrapper*)pLclD;
return rtl_math_ConversionStatus_Ok == eStatus && nCurrCmdPos != rCommandPos;
diff --git a/sw/source/ui/docvw/AnnotationWin.cxx b/sw/source/ui/docvw/AnnotationWin.cxx
index 91ea1e1..08fb91d 100644
--- a/sw/source/ui/docvw/AnnotationWin.cxx
+++ b/sw/source/ui/docvw/AnnotationWin.cxx
@@ -208,7 +208,8 @@ void SwAnnotationWin::InitAnswer(OutlinerParaObject* pText)
{
//collect our old meta data
SwSidebarWin* pWin = Mgr().GetNextPostIt(KEY_PAGEUP, this);
- const LocaleDataWrapper& rLocalData = SvtSysLocale().GetLocaleData();
+ const SvtSysLocale aSysLocale;
+ const LocaleDataWrapper& rLocalData = aSysLocale.GetLocaleData();
String aText = String(SW_RES(STR_REPLY));
SwRewriter aRewriter;
aRewriter.AddRule(UNDO_ARG1, pWin->GetAuthor());
diff --git a/sw/source/ui/docvw/SidebarWin.cxx b/sw/source/ui/docvw/SidebarWin.cxx
index 8caf11c..ea95d1d 100644
--- a/sw/source/ui/docvw/SidebarWin.cxx
+++ b/sw/source/ui/docvw/SidebarWin.cxx
@@ -389,7 +389,8 @@ void SwSidebarWin::InitControls()
void SwSidebarWin::CheckMetaText()
{
- const LocaleDataWrapper& rLocalData = SvtSysLocale().GetLocaleData();
+ const SvtSysLocale aSysLocale;
+ const LocaleDataWrapper& rLocalData = aSysLocale.GetLocaleData();
String sMeta = GetAuthor();
if (sMeta.Len() == 0)
{
diff --git a/sw/source/ui/utlui/initui.cxx b/sw/source/ui/utlui/initui.cxx
index ff4f48d..5c5cc14 100644
--- a/sw/source/ui/utlui/initui.cxx
+++ b/sw/source/ui/utlui/initui.cxx
@@ -252,7 +252,8 @@ ImpAutoFmtNameListLoader::ImpAutoFmtNameListLoader( SvStringsDtor& rLst )
p->SearchAndReplace(C2S("%1"), C2S(",,"));
p->SearchAndReplace(C2S("%2"), C2S("''"));
#else
- const LocaleDataWrapper& rLclD = SvtSysLocale().GetLocaleData();
+ const SvtSysLocale aSysLocale;
+ const LocaleDataWrapper& rLclD = aSysLocale.GetLocaleData();
//unter richtigen Betriebssystemen funktioniert es auch so
p->SearchAndReplace(C2S("%1"), rLclD.getDoubleQuotationMarkStart());
p->SearchAndReplace(C2S("%2"), rLclD.getDoubleQuotationMarkEnd());
diff --git a/sw/source/ui/utlui/uitool.cxx b/sw/source/ui/utlui/uitool.cxx
index 119592b..b75785e 100644
--- a/sw/source/ui/utlui/uitool.cxx
+++ b/sw/source/ui/utlui/uitool.cxx
@@ -714,7 +714,8 @@ SwTwips GetTableWidth( SwFrmFmt* pFmt, SwTabCols& rCols, USHORT *pPercent,
String GetAppLangDateTimeString( const DateTime& rDT )
{
- const LocaleDataWrapper& rAppLclData = SvtSysLocale().GetLocaleData();
+ const SvtSysLocale aSysLocale;
+ const LocaleDataWrapper& rAppLclData = aSysLocale.GetLocaleData();
String sRet( rAppLclData.getDate( rDT ));
( sRet += ' ' ) += rAppLclData.getTime( rDT, FALSE, FALSE );
return sRet;
commit 220f844815c80a5ad65d176a016edddcc4caf35c
Author: Caolán McNamara <caolanm at redhat.com>
Date: Thu Oct 7 11:25:10 2010 +0100
#i114198# NULL pIndex in SwCallLink::~SwCallLink
diff --git a/sw/source/core/crsr/callnk.cxx b/sw/source/core/crsr/callnk.cxx
index f3d9124..df11a55 100644
--- a/sw/source/core/crsr/callnk.cxx
+++ b/sw/source/core/crsr/callnk.cxx
@@ -244,6 +244,10 @@ SwCallLink::~SwCallLink()
{
const SwNodeIndex* pIndex = pFlyFrm->GetFmt()->GetCntnt().GetCntntIdx();
ASSERT( pIndex, "Fly ohne Cntnt" );
+
+ if (!pIndex)
+ return;
+
const SwNode& rStNd = pIndex->GetNode();
if( rStNd.EndOfSectionNode()->StartOfSectionIndex() > nNode ||
More information about the ooo-build-commit
mailing list