[Libreoffice-commits] .: Branch 'libreoffice-3-5' - editeng/source sw/source

2012-08-02 Thread Petr Mladek
 editeng/source/rtf/svxrtf.cxx |6 +-
 sw/source/core/doc/docnum.cxx |8 
 sw/source/filter/rtf/rtffld.cxx   |   19 ++-
 sw/source/filter/rtf/rtffly.cxx   |8 +++-
 sw/source/filter/rtf/rtftbl.cxx   |   24 ++--
 sw/source/filter/rtf/swparrtf.cxx |7 ---
 sw/source/filter/rtf/swparrtf.hxx |1 -
 7 files changed, 48 insertions(+), 25 deletions(-)

New commits:
commit 151ed37ea46e718ada412f37e7e540131effa0e5
Author: Michael Stahl m...@openoffice.org
Date:   Thu Aug 2 15:54:46 2012 +0200

some tweaks in RTF filter

Signed-off-by: Petr Mladek pmla...@suse.cz

diff --git a/editeng/source/rtf/svxrtf.cxx b/editeng/source/rtf/svxrtf.cxx
index 240fccd..0c0f156 100644
--- a/editeng/source/rtf/svxrtf.cxx
+++ b/editeng/source/rtf/svxrtf.cxx
@@ -29,6 +29,7 @@
 
 #include ctype.h
 #include tools/datetime.hxx
+#include tools/diagnose_ex.h
 #include rtl/tencinfo.h
 #include svl/itemiter.hxx
 #include svl/whiter.hxx
@@ -801,12 +802,14 @@ void SvxRTFParser::ClearFontTbl()
 {
 for( sal_uInt32 nCnt = aFontTbl.Count(); nCnt; )
 delete aFontTbl.GetObject( --nCnt );
+aFontTbl.Clear();
 }
 
 void SvxRTFParser::ClearStyleTbl()
 {
 for( sal_uInt32 nCnt = aStyleTbl.Count(); nCnt; )
 delete aStyleTbl.GetObject( --nCnt );
+aStyleTbl.Clear();
 }
 
 void SvxRTFParser::ClearAttrStack()
@@ -1263,7 +1266,8 @@ bool SvxRTFParser::UncompressableStackEntry(const 
SvxRTFItemStackType ) const
 
 void SvxRTFItemStackType::Compress( const SvxRTFParser rParser )
 {
-DBG_ASSERT( pChildList, There is no child list );
+ENSURE_OR_RETURN_VOID(pChildList, Compress: no ChildList );
+ENSURE_OR_RETURN_VOID(pChildList-Count(), Compress: ChildList empty);
 
 sal_uInt16 n;
 SvxRTFItemStackType* pTmp = (*pChildList)[0];
diff --git a/sw/source/core/doc/docnum.cxx b/sw/source/core/doc/docnum.cxx
index d5a609a..9970743 100644
--- a/sw/source/core/doc/docnum.cxx
+++ b/sw/source/core/doc/docnum.cxx
@@ -89,6 +89,9 @@ namespace {
 }
 }
 
+#include stdlib.h
+
+
 inline sal_uInt8 GetUpperLvlChg( sal_uInt8 nCurLvl, sal_uInt8 nLevel, 
sal_uInt16 nMask )
 {
 if( 1  nLevel )
@@ -2169,6 +2172,11 @@ SwNumRule* SwDoc::FindNumRulePtr( const String rName ) 
const
 
 void SwDoc::AddNumRule(SwNumRule * pRule)
 {
+if ((SAL_MAX_UINT16 - 1) = pNumRuleTbl-Count())
+{
+OSL_ENSURE(false, SwDoc::AddNumRule: table full.);
+abort(); // this should never happen on real documents
+}
 pNumRuleTbl-Insert(pRule, pNumRuleTbl-Count());
 maNumRuleMap[pRule-GetName()] = pRule;
 pRule-SetNumRuleMap(maNumRuleMap);
diff --git a/sw/source/filter/rtf/rtffld.cxx b/sw/source/filter/rtf/rtffld.cxx
index 51741e1..c42a6a5 100644
--- a/sw/source/filter/rtf/rtffld.cxx
+++ b/sw/source/filter/rtf/rtffld.cxx
@@ -156,7 +156,10 @@ static RTF_FLD_TYPES _WhichFld( String rName, String 
rNext )
 {
 rName = rName.Copy( nFndPos, static_cast xub_StrLen (nLen) );
 nFndPos += nTokenStt + static_cast xub_StrLen (nLen);
-while( rNext.GetChar( nFndPos ) == ' ' )++nFndPos;
+while ((nFndPos  rNext.Len())  (rNext.GetChar(nFndPos) == ' '))
+{
+++nFndPos;
+}
 rNext.Erase( 0, nFndPos );
 rNext = comphelper::string::stripEnd(rNext, ' ');
 return aFldNmArr[n].eFldType;
@@ -388,8 +391,10 @@ int SwRTFParser::MakeFieldInst( String rFieldStr )
 {
 xub_StrLen nStartDel = nPos;
 nPos += 2;
-while (aSaveStr.GetChar(nPos) == ' ')
+while ((nPos  aSaveStr.Len())  (aSaveStr.GetChar(nPos) == ' '))
+{
 ++nPos;
+}
 if (aSaveStr.EqualsIgnoreCaseAscii(MERGEFORMAT, nPos, 11))
 {
 xub_StrLen nNoDel = (nPos + 11 ) - nStartDel;
@@ -431,7 +436,9 @@ int SwRTFParser::MakeFieldInst( String rFieldStr )
 if( STRING_NOTFOUND != ( nPos = aSaveStr.SearchAscii( \\* )) )
 {
 nPos += 2;
-while( aSaveStr.GetChar(nPos) == ' ' ) nPos++;
+while ((nPos  aSaveStr.Len()) 
+   (aSaveStr.GetChar(nPos) == ' '))
+{ nPos++; }
 aSaveStr.Erase( 0, nPos );
 
 // steht jetzt geanu auf dem Format-Namen
@@ -450,7 +457,9 @@ int SwRTFParser::MakeFieldInst( String rFieldStr )
 if( STRING_NOTFOUND != ( nPos = aSaveStr.SearchAscii( \\* )) )
 {
 nPos += 2;
-while( aSaveStr.GetChar(nPos) == ' ' ) nPos++;
+while ((nPos  aSaveStr.Len()) 
+   (aSaveStr.GetChar(nPos) == ' '))
+{ nPos++; }
 aSaveStr.Erase( 0, nPos );
 
 // steht jetzt geanu auf dem Format-Namen
@@ -530,7 +539,7 @@ int SwRTFParser::MakeFieldInst( String rFieldStr )
 // werden:
 //  \\data - Datenbank-Name als Field
 

[Libreoffice-commits] .: Branch 'libreoffice-3-5' - editeng/source sw/source

2012-05-10 Thread Michael Stahl
 editeng/source/editeng/impedit4.cxx |   25 +
 sw/source/core/txtnode/txtedt.cxx   |   21 -
 2 files changed, 25 insertions(+), 21 deletions(-)

New commits:
commit 414152c1ed10ec01b6ea385960c53304e4ec95cc
Author: Caolán McNamara caol...@redhat.com
Date:   Thu May 10 10:15:34 2012 +0100

Resolves: fdo#37044 two different TransliterationChgData structs

There are two structs called TransliterationChgData with different
layout. The crashes on MacOSX must be due to this. Rename them
so they've different names.

Change-Id: I887a33bed26b339e229b7fb1ef8192f6fae3
(cherry picked from commit 7080d629c82422a419d38051536c7711f8abe53e)

Conflicts:

editeng/source/editeng/impedit4.cxx

Signed-off-by: Michael Stahl mst...@redhat.com

diff --git a/editeng/source/editeng/impedit4.cxx 
b/editeng/source/editeng/impedit4.cxx
index ff441f1..5b80c17 100644
--- a/editeng/source/editeng/impedit4.cxx
+++ b/editeng/source/editeng/impedit4.cxx
@@ -2659,16 +2659,17 @@ void ImpEditEngine::SetAutoCompleteText( const String 
rStr, sal_Bool bClearTipW
 Help::ShowQuickHelp( pActiveView-GetWindow(), Rectangle(), String(), 
0 );
 }
 
-
-struct TransliterationChgData
+namespace
 {
-sal_uInt16  nStart;
-xub_StrLen  nLen;
-EditSelection   aSelection;
-String  aNewText;
-uno::Sequence sal_Int32   aOffsets;
-};
-
+struct eeTransliterationChgData
+{
+sal_uInt16  nStart;
+xub_StrLen  nLen;
+EditSelection   aSelection;
+String  aNewText;
+uno::Sequence sal_Int32   aOffsets;
+};
+}
 
 EditSelection ImpEditEngine::TransliterateText( const EditSelection 
rSelection, sal_Int32 nTransliterationMode )
 {
@@ -2721,8 +2722,8 @@ EditSelection ImpEditEngine::TransliterateText( const 
EditSelection rSelection,
 //! This way the offsets for the yet to be changed words will be
 //! left unchanged by the already replaced text.
 //! For this we temporarily save the changes to be done in this vector
-std::vector TransliterationChgDataaChanges;
-TransliterationChgData  aChgData;
+std::vector eeTransliterationChgDataaChanges;
+eeTransliterationChgData  aChgData;
 
 if (nTransliterationMode == 
i18n::TransliterationModulesExtra::TITLE_CASE)
 {
@@ -2945,7 +2946,7 @@ EditSelection ImpEditEngine::TransliterateText( const 
EditSelection rSelection,
 // yet unchanged text parts remain the same.
 for (size_t i = 0; i  aChanges.size(); ++i)
 {
-const TransliterationChgData rData = aChanges[ 
aChanges.size() - 1 - i ];
+const eeTransliterationChgData rData = aChanges[ 
aChanges.size() - 1 - i ];
 
 bChanges = sal_True;
 if (rData.nLen != rData.aNewText.Len())
diff --git a/sw/source/core/txtnode/txtedt.cxx 
b/sw/source/core/txtnode/txtedt.cxx
index 186d4ea..d153212 100644
--- a/sw/source/core/txtnode/txtedt.cxx
+++ b/sw/source/core/txtnode/txtedt.cxx
@@ -1498,13 +1498,16 @@ sal_Bool SwTxtNode::Hyphenate( SwInterHyphInfo 
rHyphInf )
 return sal_False;
 }
 
-struct TransliterationChgData
+namespace
 {
-xub_StrLen  nStart;
-xub_StrLen  nLen;
-String  sChanged;
-Sequence sal_Int32aOffsets;
-};
+struct swTransliterationChgData
+{
+xub_StrLen  nStart;
+xub_StrLen  nLen;
+String  sChanged;
+Sequence sal_Int32aOffsets;
+};
+}
 
 // change text to Upper/Lower/Hiragana/Katagana/...
 void SwTxtNode::TransliterateText(
@@ -1527,8 +1530,8 @@ void SwTxtNode::TransliterateText(
 //! This way the offsets for the yet to be changed words will be
 //! left unchanged by the already replaced text.
 //! For this we temporarily save the changes to be done in this vector
-std::vector TransliterationChgDataaChanges;
-TransliterationChgData  aChgData;
+std::vector swTransliterationChgDataaChanges;
+swTransliterationChgData  aChgData;
 
 if (rTrans.getType() == 
(sal_uInt32)TransliterationModulesExtra::TITLE_CASE)
 {
@@ -1732,7 +1735,7 @@ void SwTxtNode::TransliterateText(
 // yet unchanged text parts remain the same.
 for (size_t i = 0; i  aChanges.size(); ++i)
 {
-TransliterationChgData rData = aChanges[ aChanges.size() - 1 
- i ];
+swTransliterationChgData rData = aChanges[ aChanges.size() - 
1 - i ];
 if (pUndo)
 pUndo-AddChanges( *this, rData.nStart, rData.nLen, 
rData.aOffsets );