filter/source/msfilter/msvbahelper.cxx | 2 framework/source/uielement/menubarmerger.cxx | 1 include/tools/string.hxx | 4 - lotuswordpro/source/filter/lwptoc.cxx | 3 rsc/source/parser/rscyacc.y | 3 rsc/source/tools/rscdef.cxx | 1 sw/source/core/crsr/findattr.cxx | 2 sw/source/core/doc/doccomp.cxx | 38 +++++------- sw/source/core/doc/doctxm.cxx | 23 +++---- sw/source/core/fields/authfld.cxx | 4 - sw/source/core/txtnode/ndtxt.cxx | 82 ++++++++++++++++++++++++--- sw/source/core/unocore/unoidx.cxx | 4 - sw/source/core/unocore/unosect.cxx | 22 +++---- sw/source/ui/app/applab.cxx | 3 sw/source/ui/dbui/mmoutputpage.cxx | 32 +++++----- sw/source/ui/dialog/regionsw.cxx | 11 ++- sw/source/ui/dialog/uiregionsw.cxx | 14 +--- sw/source/ui/envelp/envlop1.cxx | 5 + tools/source/string/strascii.cxx | 58 ------------------- tools/source/string/tustring.cxx | 38 ------------ unusedcode.easy | 1 21 files changed, 160 insertions(+), 191 deletions(-)
New commits: commit 8254648828e4f4d65a0516e160e5732f3d85765a Author: Caolán McNamara <caol...@redhat.com> Date: Wed Oct 9 16:39:28 2013 +0100 CID#736174 yikes, sizeof(char[]) includes 0, so 4 not 3 Change-Id: Ia54ecab9e08485ebffe98dc064f328360c17a120 diff --git a/filter/source/msfilter/msvbahelper.cxx b/filter/source/msfilter/msvbahelper.cxx index e143ba4..4a5576f 100644 --- a/filter/source/msfilter/msvbahelper.cxx +++ b/filter/source/msfilter/msvbahelper.cxx @@ -618,7 +618,7 @@ bool getModifier( char c, sal_uInt16& mod ) static const char modifiers[] = "+^%"; static const sal_uInt16 KEY_MODS[] = {KEY_SHIFT, KEY_MOD1, KEY_MOD2}; - for ( unsigned int i=0; i<SAL_N_ELEMENTS(modifiers); ++i ) + for ( unsigned int i=0; i<SAL_N_ELEMENTS(KEY_MODS); ++i ) { if ( c == modifiers[i] ) { commit 333ec5789a01dfc165598ade66de518132c64865 Author: Caolán McNamara <caol...@redhat.com> Date: Wed Oct 9 16:32:39 2013 +0100 CID#736180 out of bounds Change-Id: I2e775a49a1c852053e3c7996381f20d3eda1189c diff --git a/lotuswordpro/source/filter/lwptoc.cxx b/lotuswordpro/source/filter/lwptoc.cxx index ef4af45..8e802a6 100644 --- a/lotuswordpro/source/filter/lwptoc.cxx +++ b/lotuswordpro/source/filter/lwptoc.cxx @@ -353,6 +353,9 @@ sal_Bool LwpTocSuperLayout::GetUsePageNumber(sal_uInt16 index) */ sal_uInt16 LwpTocSuperLayout::GetSeparatorType(sal_uInt16 index) { + if (index >= MAX_LEVELS) + return NONE; + sal_uInt16 Flag = (sal_uInt16)m_nFlags[index]; if (Flag & TS_LEADERDOTS) commit 894dac7b8c85e041d609fc91b89bf3bc01edf82a Author: Caolán McNamara <caol...@redhat.com> Date: Wed Oct 9 16:30:29 2013 +0100 CID736196 out of bounds Change-Id: Iaf9774c84f9ffe1a3d8fcd64c9ce950aacb317ba diff --git a/sw/source/core/txtnode/ndtxt.cxx b/sw/source/core/txtnode/ndtxt.cxx index 4895242..6f07f4f 100644 --- a/sw/source/core/txtnode/ndtxt.cxx +++ b/sw/source/core/txtnode/ndtxt.cxx @@ -2707,8 +2707,16 @@ OUString SwTxtNode::GetNumString( const bool _bInclPrefixAndSuffixStrings, if ( pRule && IsCountedInList() ) { + int nLevel = GetActualListLevel(); + + if (nLevel < 0) + nLevel = 0; + + if (nLevel >= MAXLEVEL) + nLevel = MAXLEVEL - 1; + SvxNumberType const& rNumberType( - pRule->Get( static_cast<sal_uInt16>(GetActualListLevel()) ) ); + pRule->Get( static_cast<sal_uInt16>(nLevel) ) ); if (rNumberType.IsTxtFmt() || // (style::NumberingType::NUMBER_NONE == rNumberType.GetNumberingType())) @@ -2797,7 +2805,7 @@ sal_Bool SwTxtNode::GetFirstLineOfsWithNum( short& rFLOffset ) const const SwNumFmt& rFmt = pRule->Get(static_cast<sal_uInt16>(nLevel)); if ( rFmt.GetPositionAndSpaceMode() == SvxNumberFormat::LABEL_WIDTH_AND_POSITION ) { - rFLOffset = pRule->Get( static_cast<sal_uInt16>(GetActualListLevel() )).GetFirstLineOffset(); + rFLOffset = rFmt.GetFirstLineOffset(); if (!getIDocumentSettingAccess()->get(IDocumentSettingAccess::IGNORE_FIRST_LINE_INDENT_IN_NUMBERING)) { commit 9692c7d285f85dd8a90cf156ff212969bc79135b Author: Caolán McNamara <caol...@redhat.com> Date: Wed Oct 9 16:27:28 2013 +0100 CID#736197 out of bounds Change-Id: I9b105926b812e4341700d87d77288fe429beda53 diff --git a/sw/source/core/txtnode/ndtxt.cxx b/sw/source/core/txtnode/ndtxt.cxx index e002cee..4895242 100644 --- a/sw/source/core/txtnode/ndtxt.cxx +++ b/sw/source/core/txtnode/ndtxt.cxx @@ -2729,7 +2729,15 @@ long SwTxtNode::GetLeftMarginWithNum( sal_Bool bTxtLeft ) const const SwNumRule* pRule = GetNum() ? GetNum()->GetNumRule() : 0L; if( pRule ) { - const SwNumFmt& rFmt = pRule->Get(static_cast<sal_uInt16>(GetActualListLevel())); + int nLevel = GetActualListLevel(); + + if (nLevel < 0) + nLevel = 0; + + if (nLevel >= MAXLEVEL) + nLevel = MAXLEVEL - 1; + + const SwNumFmt& rFmt = pRule->Get(static_cast<sal_uInt16>(nLevel)); if ( rFmt.GetPositionAndSpaceMode() == SvxNumberFormat::LABEL_WIDTH_AND_POSITION ) { commit 540e817e7b59953d1036cdbdf1c47358b6ed98be Author: Caolán McNamara <caol...@redhat.com> Date: Wed Oct 9 16:26:20 2013 +0100 CID#736198 out of bounds Change-Id: Idb564e9e2d3d8a8d23ff2c3065c8368c558e3069 diff --git a/sw/source/core/txtnode/ndtxt.cxx b/sw/source/core/txtnode/ndtxt.cxx index 397b46c..e002cee 100644 --- a/sw/source/core/txtnode/ndtxt.cxx +++ b/sw/source/core/txtnode/ndtxt.cxx @@ -2778,7 +2778,15 @@ sal_Bool SwTxtNode::GetFirstLineOfsWithNum( short& rFLOffset ) const { if ( IsCountedInList() ) { - const SwNumFmt& rFmt = pRule->Get(static_cast<sal_uInt16>(GetActualListLevel())); + int nLevel = GetActualListLevel(); + + if (nLevel < 0) + nLevel = 0; + + if (nLevel >= MAXLEVEL) + nLevel = MAXLEVEL - 1; + + const SwNumFmt& rFmt = pRule->Get(static_cast<sal_uInt16>(nLevel)); if ( rFmt.GetPositionAndSpaceMode() == SvxNumberFormat::LABEL_WIDTH_AND_POSITION ) { rFLOffset = pRule->Get( static_cast<sal_uInt16>(GetActualListLevel() )).GetFirstLineOffset(); commit 6dd4cfeeca9e8a790904d5e06a0ad14919d98fc5 Author: Caolán McNamara <caol...@redhat.com> Date: Wed Oct 9 16:02:40 2013 +0100 CID#736199 out of bounds Change-Id: I77123f6641dc1166820e3e9da583b331af53641d diff --git a/sw/source/core/txtnode/ndtxt.cxx b/sw/source/core/txtnode/ndtxt.cxx index b273f06..397b46c 100644 --- a/sw/source/core/txtnode/ndtxt.cxx +++ b/sw/source/core/txtnode/ndtxt.cxx @@ -3892,10 +3892,18 @@ bool SwTxtNode::HasVisibleNumberingOrBullet() const const SwNumRule* pRule = GetNum() ? GetNum()->GetNumRule() : 0L; if ( pRule && IsCountedInList()) { + int nLevel = GetActualListLevel(); + + if (nLevel < 0) + nLevel = 0; + + if (nLevel >= MAXLEVEL) + nLevel = MAXLEVEL - 1; + // #i87154# // Correction of #newlistlevelattrs#: // The numbering type has to be checked for bullet lists. - const SwNumFmt& rFmt = pRule->Get( static_cast<sal_uInt16>(GetActualListLevel() )); + const SwNumFmt& rFmt = pRule->Get( static_cast<sal_uInt16>(nLevel )); return SVX_NUM_NUMBER_NONE != rFmt.GetNumberingType() || !pRule->MakeNumString( *(GetNum()) ).isEmpty(); } commit a6baaa652a591c6aa5b2f86ce1908191c5be2c50 Author: Caolán McNamara <caol...@redhat.com> Date: Wed Oct 9 15:59:33 2013 +0100 CID#736200 out of bounds Change-Id: I8ef64d3eac9430fba5b5eef55b8391f351225f2e diff --git a/sw/source/core/txtnode/ndtxt.cxx b/sw/source/core/txtnode/ndtxt.cxx index 7c53f65..b273f06 100644 --- a/sw/source/core/txtnode/ndtxt.cxx +++ b/sw/source/core/txtnode/ndtxt.cxx @@ -2873,7 +2873,15 @@ void SwTxtNode::ClearLRSpaceItemDueToListLevelIndents( SvxLRSpaceItem& o_rLRSpac const SwNumRule* pRule = GetNumRule(); if ( pRule && GetActualListLevel() >= 0 ) { - const SwNumFmt& rFmt = pRule->Get(static_cast<sal_uInt16>(GetActualListLevel())); + int nLevel = GetActualListLevel(); + + if (nLevel < 0) + nLevel = 0; + + if (nLevel >= MAXLEVEL) + nLevel = MAXLEVEL - 1; + + const SwNumFmt& rFmt = pRule->Get(static_cast<sal_uInt16>(nLevel)); if ( rFmt.GetPositionAndSpaceMode() == SvxNumberFormat::LABEL_ALIGNMENT ) { SvxLRSpaceItem aLR( RES_LR_SPACE ); commit 125f9bb308059696af5452c34eea1e8ee6af638c Author: Caolán McNamara <caol...@redhat.com> Date: Wed Oct 9 15:58:45 2013 +0100 CID#736201 out of bounds Change-Id: Id8e4fe4b303c34d83e47b9b3e78081ceaec730b5 diff --git a/sw/source/core/txtnode/ndtxt.cxx b/sw/source/core/txtnode/ndtxt.cxx index e74d801..7c53f65 100644 --- a/sw/source/core/txtnode/ndtxt.cxx +++ b/sw/source/core/txtnode/ndtxt.cxx @@ -2821,7 +2821,15 @@ SwTwips SwTxtNode::GetAdditionalIndentForStartingNewList() const const SwNumRule* pRule = GetNum() ? GetNum()->GetNumRule() : 0L; if ( pRule ) { - const SwNumFmt& rFmt = pRule->Get(static_cast<sal_uInt16>(GetActualListLevel())); + int nLevel = GetActualListLevel(); + + if (nLevel < 0) + nLevel = 0; + + if (nLevel >= MAXLEVEL) + nLevel = MAXLEVEL - 1; + + const SwNumFmt& rFmt = pRule->Get(static_cast<sal_uInt16>(nLevel)); if ( rFmt.GetPositionAndSpaceMode() == SvxNumberFormat::LABEL_WIDTH_AND_POSITION ) { nAdditionalIndent = GetSwAttrSet().GetLRSpace().GetLeft(); commit ee93bc1cc196b4c88dfabf10b161f725ee917ace Author: Caolán McNamara <caol...@redhat.com> Date: Wed Oct 9 15:57:06 2013 +0100 CID#736202 out of bounds Change-Id: I37bf129c3f60b602081f6bf94e99de9a2e63152b diff --git a/sw/source/core/txtnode/ndtxt.cxx b/sw/source/core/txtnode/ndtxt.cxx index b00a4ab..e74d801 100644 --- a/sw/source/core/txtnode/ndtxt.cxx +++ b/sw/source/core/txtnode/ndtxt.cxx @@ -2676,7 +2676,15 @@ sal_Bool SwTxtNode::HasBullet() const const SwNumRule* pRule = GetNum() ? GetNum()->GetNumRule() : 0L; if ( pRule ) { - SwNumFmt aFmt(pRule->Get( static_cast<sal_uInt16>(GetActualListLevel()))); + int nLevel = GetActualListLevel(); + + if (nLevel < 0) + nLevel = 0; + + if (nLevel >= MAXLEVEL) + nLevel = MAXLEVEL - 1; + + SwNumFmt aFmt(pRule->Get( static_cast<sal_uInt16>(nLevel) )); bResult = aFmt.IsItemize(); } commit b40d092b960648b3a0af388e4813d977e5284427 Author: Caolán McNamara <caol...@redhat.com> Date: Wed Oct 9 15:53:00 2013 +0100 CID#736203 out of bounds access Change-Id: I4db4e241b6b2348a48536a7dd0f1aecbf04cb675 diff --git a/sw/source/core/txtnode/ndtxt.cxx b/sw/source/core/txtnode/ndtxt.cxx index e816998..b00a4ab 100644 --- a/sw/source/core/txtnode/ndtxt.cxx +++ b/sw/source/core/txtnode/ndtxt.cxx @@ -2651,7 +2651,15 @@ sal_Bool SwTxtNode::HasNumber() const const SwNumRule* pRule = GetNum() ? GetNum()->GetNumRule() : 0L; if ( pRule ) { - SwNumFmt aFmt(pRule->Get( static_cast<sal_uInt16>(GetActualListLevel()))); + int nLevel = GetActualListLevel(); + + if (nLevel < 0) + nLevel = 0; + + if (nLevel >= MAXLEVEL) + nLevel = MAXLEVEL - 1; + + SwNumFmt aFmt(pRule->Get(static_cast<sal_uInt16>(nLevel))); // #i40041# bResult = aFmt.IsEnumeration() && commit 49325659ca66958c2063c491e03b731cf1c53798 Author: Caolán McNamara <caol...@redhat.com> Date: Wed Oct 9 15:49:40 2013 +0100 CID#736205 out of bounds access and CID#736204 Change-Id: I5bfb7101c3e330958a3c883ce3c8114781f7e033 diff --git a/sw/source/core/unocore/unoidx.cxx b/sw/source/core/unocore/unoidx.cxx index d392908..25b51b9 100644 --- a/sw/source/core/unocore/unoidx.cxx +++ b/sw/source/core/unocore/unoidx.cxx @@ -2603,7 +2603,7 @@ throw (lang::IllegalArgumentException, lang::IndexOutOfBoundsException, { SolarMutexGuard aGuard; - if(nIndex < 0 || nIndex > MAXLEVEL) + if(nIndex < 0 || nIndex >= MAXLEVEL) { throw lang::IndexOutOfBoundsException(); } @@ -2646,7 +2646,7 @@ throw (lang::IndexOutOfBoundsException, lang::WrappedTargetException, { SolarMutexGuard aGuard; - if(nIndex < 0 || nIndex > MAXLEVEL) + if(nIndex < 0 || nIndex >= MAXLEVEL) { throw lang::IndexOutOfBoundsException(); } commit 293890e0d07d0f28cd10bfe7c2bf53865dbfb1fc Author: Caolán McNamara <caol...@redhat.com> Date: Wed Oct 9 15:45:00 2013 +0100 CID#736504 memleak and CID#736503 Change-Id: Id70f081f809b6fae82ecf5869f0e14a621393525 diff --git a/sw/source/core/crsr/findattr.cxx b/sw/source/core/crsr/findattr.cxx index d224cfb..9ebb8c0 100644 --- a/sw/source/core/crsr/findattr.cxx +++ b/sw/source/core/crsr/findattr.cxx @@ -454,6 +454,7 @@ int SwAttrCheckArr::SetAttrFwd( const SwTxtAttr& rAttr ) else break; } + delete pIter; return Found(); } @@ -604,6 +605,7 @@ int SwAttrCheckArr::SetAttrBwd( const SwTxtAttr& rAttr ) else break; } + delete pIter; return Found(); } commit d47ce6b69b32ea5c6971069bb9ee2a132e35fe3f Author: Caolán McNamara <caol...@redhat.com> Date: Wed Oct 9 15:34:23 2013 +0100 CID#736509 memleaks on early exit also CID#736508 Change-Id: If3df76d6ff797224fe4214938e50ab624c0617da diff --git a/sw/source/core/doc/doccomp.cxx b/sw/source/core/doc/doccomp.cxx index 944baf7..1fcf25e 100644 --- a/sw/source/core/doc/doccomp.cxx +++ b/sw/source/core/doc/doccomp.cxx @@ -1282,43 +1282,40 @@ bool SwCompareLine::ChangesInLine( const SwCompareLine& rLine, int nMinLen = std::min( nDstLen , nSrcLen ); int nAvgLen = ( nDstLen + nSrcLen )/2; - int *pLcsDst = new int[ nMinLen + 1 ]; - int *pLcsSrc = new int[ nMinLen + 1 ]; + std::vector<int> aLcsDst( nMinLen + 1 ); + std::vector<int> aLcsSrc( nMinLen + 1 ); if( CmpOptions.eCmpMode == SVX_CMP_BY_WORD ) { - int *pTmpLcsDst = new int[ nMinLen + 1 ]; - int *pTmpLcsSrc = new int[ nMinLen + 1 ]; + std::vector<int> aTmpLcsDst( nMinLen + 1 ); + std::vector<int> aTmpLcsSrc( nMinLen + 1 ); WordArrayComparator aCmp( &rDstNd, &rSrcNd ); LgstCommonSubseq aSeq( aCmp ); - nLcsLen = aSeq.Find( pTmpLcsDst, pTmpLcsSrc ); + nLcsLen = aSeq.Find( &aTmpLcsDst[0], &aTmpLcsSrc[0] ); if( CmpOptions.nIgnoreLen ) { - nLcsLen = aSeq.IgnoreIsolatedPieces( pTmpLcsDst, pTmpLcsSrc, + nLcsLen = aSeq.IgnoreIsolatedPieces( &aTmpLcsDst[0], &aTmpLcsSrc[0], aCmp.GetLen1(), aCmp.GetLen2(), nLcsLen, CmpOptions.nIgnoreLen ); } - nLcsLen = aCmp.GetCharSequence( pTmpLcsDst, pTmpLcsSrc, - pLcsDst, pLcsSrc, nLcsLen ); - - delete[] pTmpLcsDst; - delete[] pTmpLcsSrc; + nLcsLen = aCmp.GetCharSequence( &aTmpLcsDst[0], &aTmpLcsSrc[0], + &aLcsDst[0], &aLcsSrc[0], nLcsLen ); } else { CharArrayComparator aCmp( &rDstNd, &rSrcNd ); LgstCommonSubseq aSeq( aCmp ); - nLcsLen = aSeq.Find( pLcsDst, pLcsSrc ); + nLcsLen = aSeq.Find( &aLcsDst[0], &aLcsSrc[0] ); if( CmpOptions.nIgnoreLen ) { - nLcsLen = aSeq.IgnoreIsolatedPieces( pLcsDst, pLcsSrc, nDstLen, + nLcsLen = aSeq.IgnoreIsolatedPieces( &aLcsDst[0], &aLcsSrc[0], nDstLen, nSrcLen, nLcsLen, CmpOptions.nIgnoreLen ); } @@ -1329,8 +1326,8 @@ bool SwCompareLine::ChangesInLine( const SwCompareLine& rLine, int nCnt = 1; for( int i = 0; i < nLcsLen; i++ ) { - if( i != nLcsLen - 1 && pLcsDst[i] + 1 == pLcsDst[i + 1] - && pLcsSrc[i] + 1 == pLcsSrc[i + 1] ) + if( i != nLcsLen - 1 && aLcsDst[i] + 1 == aLcsDst[i + 1] + && aLcsSrc[i] + 1 == aLcsSrc[i + 1] ) { nCnt++; } @@ -1351,10 +1348,10 @@ bool SwCompareLine::ChangesInLine( const SwCompareLine& rLine, int nSkip = 0; for( int i = 0; i <= nLcsLen; i++ ) { - int nDstFrom = i ? (pLcsDst[i - 1] + 1) : 0; - int nDstTo = ( i == nLcsLen ) ? nDstLen : pLcsDst[i]; - int nSrcFrom = i ? (pLcsSrc[i - 1] + 1) : 0; - int nSrcTo = ( i == nLcsLen ) ? nSrcLen : pLcsSrc[i]; + int nDstFrom = i ? (aLcsDst[i - 1] + 1) : 0; + int nDstTo = ( i == nLcsLen ) ? nDstLen : aLcsDst[i]; + int nSrcFrom = i ? (aLcsSrc[i - 1] + 1) : 0; + int nSrcTo = ( i == nLcsLen ) ? nSrcLen : aLcsSrc[i]; SwPaM aPam( rDstNd, nDstTo + nSkip ); @@ -1395,9 +1392,6 @@ bool SwCompareLine::ChangesInLine( const SwCompareLine& rLine, } } - delete[] pLcsDst; - delete[] pLcsSrc; - bRet = true; } commit 4bcdaabecf2b91eac322047183d0fd10771dd643 Author: Caolán McNamara <caol...@redhat.com> Date: Wed Oct 9 15:28:57 2013 +0100 CID#736516 memleaks on early exit Change-Id: I125735e593b26894d3abe34e662ffaf8d585fe6b diff --git a/sw/source/core/doc/doctxm.cxx b/sw/source/core/doc/doctxm.cxx index 2ac32a6..fa87c20 100644 --- a/sw/source/core/doc/doctxm.cxx +++ b/sw/source/core/doc/doctxm.cxx @@ -1978,7 +1978,7 @@ void SwTOXBaseSection::_UpdatePageNum( SwTxtNode* pNd, const SwTOXInternational& rIntl ) { // collect starts end ends of main entry character style - std::vector<sal_uInt16>* pCharStyleIdx = pMainEntryNums ? new std::vector<sal_uInt16> : 0; + boost::scoped_ptr< std::vector<sal_uInt16> > xCharStyleIdx(pMainEntryNums ? new std::vector<sal_uInt16> : 0); OUString sSrchStr = OUStringBuffer().append(cNumRepl). append(sPageDeli).append(cNumRepl).makeStringAndClear(); @@ -1999,10 +1999,10 @@ void SwTOXBaseSection::_UpdatePageNum( SwTxtNode* pNd, nCount = 0; String aNumStr( SvxNumberType( rDescs[0]->GetNumType() ). GetNumStr( nBeg ) ); - if( pCharStyleIdx && lcl_HasMainEntry( pMainEntryNums, nBeg )) + if( xCharStyleIdx && lcl_HasMainEntry( pMainEntryNums, nBeg )) { sal_uInt16 nTemp = 0; - pCharStyleIdx->push_back( nTemp ); + xCharStyleIdx->push_back( nTemp ); } // Delete place holder @@ -2061,9 +2061,9 @@ void SwTOXBaseSection::_UpdatePageNum( SwTxtNode* pNd, nBeg = rNums[i]; aNumStr.AppendAscii( sPageDeli ); //the change of the character style must apply after sPageDeli is appended - if(pCharStyleIdx && bMainEntryChanges) + if (xCharStyleIdx && bMainEntryChanges) { - pCharStyleIdx->push_back(aNumStr.Len()); + xCharStyleIdx->push_back(aNumStr.Len()); } aNumStr += aType.GetNumStr( nBeg ); nCount = 0; @@ -2107,11 +2107,11 @@ void SwTOXBaseSection::_UpdatePageNum( SwTxtNode* pNd, } // The main entries should get their character style - if(pCharStyleIdx && !pCharStyleIdx->empty() && !GetMainEntryCharStyle().isEmpty()) + if (xCharStyleIdx && !xCharStyleIdx->empty() && !GetMainEntryCharStyle().isEmpty()) { // eventually the last index must me appended - if(pCharStyleIdx->size()&0x01) - pCharStyleIdx->push_back(aNumStr.Len()); + if (xCharStyleIdx->size()&0x01) + xCharStyleIdx->push_back(aNumStr.Len()); // search by name SwDoc* pDoc = pNd->GetDoc(); @@ -2127,15 +2127,14 @@ void SwTOXBaseSection::_UpdatePageNum( SwTxtNode* pNd, // find the page numbers in aNumStr and set the character style xub_StrLen nOffset = pNd->GetTxt().getLength() - aNumStr.Len(); SwFmtCharFmt aCharFmt(pCharFmt); - for(sal_uInt16 j = 0; j < pCharStyleIdx->size(); j += 2) + for (sal_uInt16 j = 0; j < xCharStyleIdx->size(); j += 2) { - xub_StrLen nStartIdx = (*pCharStyleIdx)[j] + nOffset; - xub_StrLen nEndIdx = (*pCharStyleIdx)[j + 1] + nOffset; + xub_StrLen nStartIdx = (*xCharStyleIdx)[j] + nOffset; + xub_StrLen nEndIdx = (*xCharStyleIdx)[j + 1] + nOffset; pNd->InsertItem(aCharFmt, nStartIdx, nEndIdx, nsSetAttrMode::SETATTR_DONTEXPAND); } } - delete pCharStyleIdx; } void SwTOXBaseSection::InsertSorted(SwTOXSortTabBase* pNew) commit fd4d263d2d3af206af613b118e352e47dea8e8db Author: Caolán McNamara <caol...@redhat.com> Date: Wed Oct 9 15:24:50 2013 +0100 CID#738544 unitialized member Change-Id: I4f2342776467594f3512af624a653a9b827a0afe diff --git a/framework/source/uielement/menubarmerger.cxx b/framework/source/uielement/menubarmerger.cxx index 2f5b915..7417074 100644 --- a/framework/source/uielement/menubarmerger.cxx +++ b/framework/source/uielement/menubarmerger.cxx @@ -88,6 +88,7 @@ ReferencePathInfo MenuBarMerger::FindReferencePath( ReferencePathInfo aResult; if ( !nCount ) { + aResult.pPopupMenu = NULL; aResult.eResult = RP_MENUITEM_NOT_FOUND; return aResult; } commit 84cbee6029107bd879b078858519aab6f93b55af Author: Caolán McNamara <caol...@redhat.com> Date: Wed Oct 9 15:21:15 2013 +0100 CID#705759 why such an obvious mem leak here Change-Id: I88cc0b371df9c827917a408c1bcc9a14e752a20f diff --git a/sw/source/ui/dialog/uiregionsw.cxx b/sw/source/ui/dialog/uiregionsw.cxx index faedf79..63e8bb3 100644 --- a/sw/source/ui/dialog/uiregionsw.cxx +++ b/sw/source/ui/dialog/uiregionsw.cxx @@ -82,11 +82,10 @@ static void lcl_FillList( SwWrtShell& rSh, ComboBox& rSubRegions, ComboBox* pAva (eTmpType = pFmt->GetSection()->GetType()) != TOX_CONTENT_SECTION && TOX_HEADER_SECTION != eTmpType ) { - String* pString = - new String(pFmt->GetSection()->GetSectionName()); + OUString sString(pFmt->GetSection()->GetSectionName()); if(pAvailNames) - pAvailNames->InsertEntry(*pString); - rSubRegions.InsertEntry(*pString); + pAvailNames->InsertEntry(sString); + rSubRegions.InsertEntry(sString); lcl_FillList( rSh, rSubRegions, pAvailNames, pFmt ); } } @@ -103,11 +102,10 @@ static void lcl_FillList( SwWrtShell& rSh, ComboBox& rSubRegions, ComboBox* pAva (eTmpType = pFmt->GetSection()->GetType()) != TOX_CONTENT_SECTION && TOX_HEADER_SECTION != eTmpType ) { - String* pString = - new String(pFmt->GetSection()->GetSectionName()); + OUString sString(pFmt->GetSection()->GetSectionName()); if(pAvailNames) - pAvailNames->InsertEntry(*pString); - rSubRegions.InsertEntry(*pString); + pAvailNames->InsertEntry(sString); + rSubRegions.InsertEntry(sString); lcl_FillList( rSh, rSubRegions, pAvailNames, pFmt ); } } commit dc76fc4eda2a67a7e877216171f96514d46baa14 Author: Caolán McNamara <caol...@redhat.com> Date: Wed Oct 9 15:17:46 2013 +0100 CID#707521 unintialized member Change-Id: Ieb4417ae89718d8c5e9abf77cb3e1830c080ae4e diff --git a/rsc/source/tools/rscdef.cxx b/rsc/source/tools/rscdef.cxx index c220f5a..02fda0f 100644 --- a/rsc/source/tools/rscdef.cxx +++ b/rsc/source/tools/rscdef.cxx @@ -69,6 +69,7 @@ RscId::RscId( RscDefine * pDef ) aExpType.aExp.pDef = pDef; aExpType.cType = RSCEXP_DEF; + aExpType.cUnused = 0; Create( aExpType ); } commit dd0999570a467582a577f99fca01e181895fb7b3 Author: Caolán McNamara <caol...@redhat.com> Date: Wed Oct 9 15:16:56 2013 +0100 CID#707522 uninitialized member Change-Id: Iaadc8ea9f14dc2596f252e2f06a1613e6080f9ff diff --git a/rsc/source/parser/rscyacc.y b/rsc/source/parser/rscyacc.y index 5117e769..c0a68e8 100644 --- a/rsc/source/parser/rscyacc.y +++ b/rsc/source/parser/rscyacc.y @@ -386,9 +386,10 @@ resource_definition } else if( $4.IsDefinition() ) { - RscExpType aExpType; + RscExpType aExpType; RscExpression * pExpr; + aExpType.cUnused = 0; aExpType.cType = RSCEXP_NOTHING; aExpType.SetLong( 0 ); aExpType.cType = RSCEXP_LONG; commit 2fb8d40bac26c3555b6db0bbba5b50a68957f075 Author: Caolán McNamara <caol...@redhat.com> Date: Wed Oct 9 16:05:25 2013 +0100 fix string Change-Id: I3116dbf41b5672bb90c255b22403c8ce0ff57265 diff --git a/sw/source/ui/dbui/mmoutputpage.cxx b/sw/source/ui/dbui/mmoutputpage.cxx index 395f3ee..57aff12 100644 --- a/sw/source/ui/dbui/mmoutputpage.cxx +++ b/sw/source/ui/dbui/mmoutputpage.cxx @@ -903,7 +903,7 @@ IMPL_LINK(SwMailMergeOutputPage, SendTypeHdl_Impl, ListBox*, pBox) sal_Int32 nTokenCount = comphelper::string::getTokenCount(sAttach, '.'); if( 2 > nTokenCount) { - sAttach += '.'; + sAttach += OUString('.'); ++nTokenCount; } sAttach = comphelper::string::setToken(sAttach, nTokenCount - 1, '.', lcl_GetExtensionForDocType( nDocType )); @@ -1058,7 +1058,7 @@ IMPL_LINK(SwMailMergeOutputPage, SendDocumentsHdl_Impl, PushButton*, pButton) sal_Int32 nTokenCount = comphelper::string::getTokenCount(sAttach, '.'); if (2 > nTokenCount) { - sAttach += '.'; + sAttach += OUString('.'); ++nTokenCount; } sAttach = comphelper::string::setToken(sAttach, nTokenCount - 1, '.', lcl_GetExtensionForDocType( @@ -1198,10 +1198,10 @@ IMPL_LINK(SwMailMergeOutputPage, SendDocumentsHdl_Impl, PushButton*, pButton) sal_Int32 nTokenCount = comphelper::string::getTokenCount(sAttachment, '.'); if (2 > nTokenCount) { - sAttachment += '.'; + sAttachment += OUString('.'); sAttachment = comphelper::string::setToken(sAttachment, nTokenCount, '.', sExtension); } - else if(sAttachment.GetToken( nTokenCount - 1, '.') != sExtension) + else if (sAttachment.getToken( nTokenCount - 1, '.') != sExtension) sAttachment += sExtension; aDesc.sAttachmentName = sAttachment; aDesc.sMimeType = sMimeType; diff --git a/sw/source/ui/envelp/envlop1.cxx b/sw/source/ui/envelp/envlop1.cxx index 0586e8c..a8faf02 100644 --- a/sw/source/ui/envelp/envlop1.cxx +++ b/sw/source/ui/envelp/envlop1.cxx @@ -35,6 +35,7 @@ #include "view.hxx" #include <comphelper/processfactory.hxx> +#include <comphelper/string.hxx> #include <unomid.h> commit d63a69a087c9c7641e28e2002d7ad56076d08ca1 Author: Caolán McNamara <caol...@redhat.com> Date: Wed Oct 9 15:57:59 2013 +0100 fix string Change-Id: Ibd3598f1d053605dd7dab2fd08896ab4dbd25add diff --git a/sw/source/ui/dialog/regionsw.cxx b/sw/source/ui/dialog/regionsw.cxx index cf376fe..7b3c77e 100644 --- a/sw/source/ui/dialog/regionsw.cxx +++ b/sw/source/ui/dialog/regionsw.cxx @@ -19,6 +19,7 @@ #include <hintids.hxx> #include <uitool.hxx> +#include <comphelper/string.hxx> #include <svl/urihelper.hxx> #include <svl/PasswordHelper.hxx> #include <vcl/msgbox.hxx> @@ -159,7 +160,7 @@ void SwBaseShell::InsertRegionDialog(SfxRequest& rReq) if(aFile.Len() || aSub.Len()) { OUString sLinkFileName = OUString(sfx2::cTokenSeparator); - sLinkFileName += sfx2::cTokenSeparator; + sLinkFileName += OUString(sfx2::cTokenSeparator); sLinkFileName = comphelper::string::setToken(sLinkFileName, 0, sfx2::cTokenSeparator, aFile); if(SFX_ITEM_SET == commit 43e01ae9700fafab5441a61be088554737ce5437 Author: Caolán McNamara <caol...@redhat.com> Date: Wed Oct 9 15:56:09 2013 +0100 fix string Change-Id: Id441395365d3cb6f598760042d5e54e905783b91 diff --git a/sw/source/core/unocore/unosect.cxx b/sw/source/core/unocore/unosect.cxx index 5f7be3d..957eb12 100644 --- a/sw/source/core/unocore/unosect.cxx +++ b/sw/source/core/unocore/unosect.cxx @@ -728,11 +728,11 @@ throw (beans::UnknownPropertyException, beans::PropertyVetoException, OUString sSectLink(pSectionData->GetLinkFileName()); while (3 < comphelper::string::getTokenCount(sSectLink, sfx2::cTokenSeparator)) { - sSectLink += sfx2::cTokenSeparator; + sSectLink += OUString(sfx2::cTokenSeparator); } sSectLink = comphelper::string::setToken(sSectLink, 2, sfx2::cTokenSeparator, sLink); pSectionData->SetLinkFileName(sSectLink); - if (sSectLink.Len() < 3) + if (sSectLink.getLength() < 3) { pSectionData->SetType(CONTENT_SECTION); } diff --git a/sw/source/ui/app/applab.cxx b/sw/source/ui/app/applab.cxx index bfe3481..5309f86 100644 --- a/sw/source/ui/app/applab.cxx +++ b/sw/source/ui/app/applab.cxx @@ -22,6 +22,7 @@ #include <hintids.hxx> +#include <comphelper/string.hxx> #include <vcl/svapp.hxx> #include <vcl/wrkwin.hxx> #include <vcl/msgbox.hxx> commit ae95703819348938bf9e44bd635365e3e48cd05d Author: Caolán McNamara <caol...@redhat.com> Date: Wed Oct 9 13:31:44 2013 +0100 Related: fdo#38838 remove UniString::SetToken & UniString::SearchAscii Change-Id: I5219578fbeb40a0fe363f03c64021a83f7e505fb diff --git a/include/tools/string.hxx b/include/tools/string.hxx index 008a822..3ab5532 100644 --- a/include/tools/string.hxx +++ b/include/tools/string.hxx @@ -105,8 +105,6 @@ private: TOOLS_DLLPRIVATE inline void ImplCopyData(); TOOLS_DLLPRIVATE inline sal_Unicode * ImplCopyStringData(sal_Unicode *); - TOOLS_DLLPRIVATE xub_StrLen SearchAscii( const sal_Char* pAsciiStr, xub_StrLen nIndex ) const; - UniString( const int* pDummy ); // not implemented: to prevent UniString( NULL ) UniString(int); // not implemented; to detect misuses of // UniString(sal_Unicode) @@ -243,8 +241,6 @@ public: xub_StrLen SearchAndReplace( const UniString& rStr, const UniString& rRepStr, xub_StrLen nIndex = 0 ); - void SetToken( xub_StrLen nToken, sal_Unicode cTok, const UniString& rStr, - xub_StrLen nIndex = 0 ); UniString GetToken( xub_StrLen nToken, sal_Unicode cTok, sal_Int32& rIndex ) const; UniString GetToken( xub_StrLen nToken, sal_Unicode cTok = ';' ) const; diff --git a/sw/source/core/fields/authfld.cxx b/sw/source/core/fields/authfld.cxx index 7312a22..9a86d3d 100644 --- a/sw/source/core/fields/authfld.cxx +++ b/sw/source/core/fields/authfld.cxx @@ -668,7 +668,7 @@ bool SwAuthorityField::PutValue( const Any& rAny, sal_uInt16 /*nWhichId*/ ) OUStringBuffer sBuf; comphelper::string::padToLength(sBuf, AUTH_FIELD_ISBN, TOX_STYLE_DELIMITER); - String sToSet(sBuf.makeStringAndClear()); + OUString sToSet(sBuf.makeStringAndClear()); const PropertyValue* pParam = aParam.getConstArray(); for(sal_Int32 i = 0; i < aParam.getLength(); i++) { @@ -684,7 +684,7 @@ bool SwAuthorityField::PutValue( const Any& rAny, sal_uInt16 /*nWhichId*/ ) } else pParam[i].Value >>= sContent; - sToSet.SetToken(nFound, TOX_STYLE_DELIMITER, sContent); + sToSet = comphelper::string::setToken(sToSet, nFound, TOX_STYLE_DELIMITER, sContent); } } diff --git a/sw/source/core/unocore/unosect.cxx b/sw/source/core/unocore/unosect.cxx index 644ba32..5f7be3d 100644 --- a/sw/source/core/unocore/unosect.cxx +++ b/sw/source/core/unocore/unosect.cxx @@ -614,9 +614,8 @@ throw (beans::UnknownPropertyException, beans::PropertyVetoException, case WID_SECT_DDE_FILE: case WID_SECT_DDE_ELEMENT: { - OUString uTmp; - pValues[nProperty] >>= uTmp; - String sTmp(uTmp); + OUString sTmp; + pValues[nProperty] >>= sTmp; if (m_bIsDescriptor) { if (!m_pProps->m_bDDE) @@ -627,9 +626,9 @@ throw (beans::UnknownPropertyException, beans::PropertyVetoException, m_pProps->m_sLinkFileName = buf.makeStringAndClear(); m_pProps->m_bDDE = true; } - String sLinkFileName(m_pProps->m_sLinkFileName); - sLinkFileName.SetToken(pEntry->nWID - WID_SECT_DDE_TYPE, - sfx2::cTokenSeparator, sTmp); + OUString sLinkFileName(m_pProps->m_sLinkFileName); + sLinkFileName = comphelper::string::setToken(sLinkFileName, + pEntry->nWID - WID_SECT_DDE_TYPE, sfx2::cTokenSeparator, sTmp); m_pProps->m_sLinkFileName = sLinkFileName; } else @@ -641,7 +640,8 @@ throw (beans::UnknownPropertyException, beans::PropertyVetoException, sLinkFileName += sfx2::cTokenSeparator; pSectionData->SetType(DDE_LINK_SECTION); } - sLinkFileName.SetToken(pEntry->nWID - WID_SECT_DDE_TYPE, + sLinkFileName = comphelper::string::setToken(sLinkFileName, + pEntry->nWID - WID_SECT_DDE_TYPE, sfx2::cTokenSeparator, sTmp); pSectionData->SetLinkFileName(sLinkFileName); } @@ -725,12 +725,12 @@ throw (beans::UnknownPropertyException, beans::PropertyVetoException, { pSectionData->SetType(FILE_LINK_SECTION); } - String sSectLink(pSectionData->GetLinkFileName()); + OUString sSectLink(pSectionData->GetLinkFileName()); while (3 < comphelper::string::getTokenCount(sSectLink, sfx2::cTokenSeparator)) { sSectLink += sfx2::cTokenSeparator; } - sSectLink.SetToken(2, sfx2::cTokenSeparator, sLink); + sSectLink = comphelper::string::setToken(sSectLink, 2, sfx2::cTokenSeparator, sLink); pSectionData->SetLinkFileName(sSectLink); if (sSectLink.Len() < 3) { diff --git a/sw/source/ui/app/applab.cxx b/sw/source/ui/app/applab.cxx index 064af8e..bfe3481 100644 --- a/sw/source/ui/app/applab.cxx +++ b/sw/source/ui/app/applab.cxx @@ -142,7 +142,7 @@ static const SwFrmFmt *lcl_InsertLabText( SwWrtShell& rSh, const SwLabItem& rIte String sDBName; if( (!rItem.bSynchron || !(nCol|nRow)) && (sDBName = InsertLabEnvText( rSh, rFldMgr, rItem.aWriting )).Len() && !bLast ) { - sDBName.SetToken( 3, DB_DELIM, OUString("True")); + sDBName = comphelper::string::setToken(sDBName, 3, DB_DELIM, "True"); SwInsertFld_Data aData(TYP_DBNEXTSETFLD, 0, sDBName, aEmptyStr, 0, &rSh ); rFldMgr.InsertFld( aData ); } diff --git a/sw/source/ui/dbui/mmoutputpage.cxx b/sw/source/ui/dbui/mmoutputpage.cxx index da72f2d..395f3ee 100644 --- a/sw/source/ui/dbui/mmoutputpage.cxx +++ b/sw/source/ui/dbui/mmoutputpage.cxx @@ -896,17 +896,17 @@ IMPL_LINK(SwMailMergeOutputPage, SendTypeHdl_Impl, ListBox*, pBox) if(bEnable) { //add the correct extension - String sAttach(m_aAttachmentED.GetText()); + OUString sAttach(m_aAttachmentED.GetText()); //do nothing if the user has removed the name - the warning will come early enough - if(sAttach.Len()) + if (!sAttach.isEmpty()) { - xub_StrLen nTokenCount = comphelper::string::getTokenCount(sAttach, '.'); + sal_Int32 nTokenCount = comphelper::string::getTokenCount(sAttach, '.'); if( 2 > nTokenCount) { sAttach += '.'; ++nTokenCount; } - sAttach.SetToken( nTokenCount - 1, '.', lcl_GetExtensionForDocType( nDocType )); + sAttach = comphelper::string::setToken(sAttach, nTokenCount - 1, '.', lcl_GetExtensionForDocType( nDocType )); m_aAttachmentED.SetText(sAttach); } } @@ -1054,14 +1054,14 @@ IMPL_LINK(SwMailMergeOutputPage, SendDocumentsHdl_Impl, PushButton*, pButton) aQuery.SetIsEmptyTextAllowed(false); if(RET_OK == aQuery.Execute()) { - String sAttach(aQuery.GetValue()); - xub_StrLen nTokenCount = comphelper::string::getTokenCount(sAttach, '.'); - if( 2 > nTokenCount) + OUString sAttach(aQuery.GetValue()); + sal_Int32 nTokenCount = comphelper::string::getTokenCount(sAttach, '.'); + if (2 > nTokenCount) { sAttach += '.'; ++nTokenCount; } - sAttach.SetToken( nTokenCount - 1, '.', lcl_GetExtensionForDocType( + sAttach = comphelper::string::setToken(sAttach, nTokenCount - 1, '.', lcl_GetExtensionForDocType( (sal_uLong)m_aSendAsLB.GetEntryData(m_aSendAsLB.GetSelectEntryPos()))); m_aAttachmentED.SetText(sAttach); } @@ -1194,12 +1194,12 @@ IMPL_LINK(SwMailMergeOutputPage, SendDocumentsHdl_Impl, PushButton*, pButton) { sBody = m_sBody; aDesc.sAttachmentURL = aName.GetValue(); - String sAttachment(m_aAttachmentED.GetText()); - xub_StrLen nTokenCount = comphelper::string::getTokenCount(sAttachment, '.'); - if( 2 > nTokenCount) + OUString sAttachment(m_aAttachmentED.GetText()); + sal_Int32 nTokenCount = comphelper::string::getTokenCount(sAttachment, '.'); + if (2 > nTokenCount) { sAttachment += '.'; - sAttachment.SetToken( nTokenCount, '.', sExtension); + sAttachment = comphelper::string::setToken(sAttachment, nTokenCount, '.', sExtension); } else if(sAttachment.GetToken( nTokenCount - 1, '.') != sExtension) sAttachment += sExtension; diff --git a/sw/source/ui/dialog/regionsw.cxx b/sw/source/ui/dialog/regionsw.cxx index 26b9264..cf376fe 100644 --- a/sw/source/ui/dialog/regionsw.cxx +++ b/sw/source/ui/dialog/regionsw.cxx @@ -158,14 +158,16 @@ void SwBaseShell::InsertRegionDialog(SfxRequest& rReq) if(aFile.Len() || aSub.Len()) { - String sLinkFileName = OUString(sfx2::cTokenSeparator); + OUString sLinkFileName = OUString(sfx2::cTokenSeparator); sLinkFileName += sfx2::cTokenSeparator; - sLinkFileName.SetToken(0, sfx2::cTokenSeparator,aFile); + sLinkFileName = comphelper::string::setToken(sLinkFileName, 0, sfx2::cTokenSeparator, aFile); if(SFX_ITEM_SET == pSet->GetItemState(FN_PARAM_2, sal_True, &pItem)) - sLinkFileName.SetToken(1, sfx2::cTokenSeparator, + { + sLinkFileName = comphelper::string::setToken(sLinkFileName, 1, sfx2::cTokenSeparator, ((const SfxStringItem *)pItem)->GetValue()); + } sLinkFileName += aSub; aSection.SetType( FILE_LINK_SECTION ); diff --git a/sw/source/ui/envelp/envlop1.cxx b/sw/source/ui/envelp/envlop1.cxx index a85fe41..0586e8c 100644 --- a/sw/source/ui/envelp/envlop1.cxx +++ b/sw/source/ui/envelp/envlop1.cxx @@ -246,7 +246,9 @@ IMPL_LINK( SwEnvPage, DatabaseHdl, ListBox *, pListBox ) sActDBName += DB_DELIM; } else - sActDBName.SetToken(1, DB_DELIM, m_pTableLB->GetSelectEntry()); + { + sActDBName = comphelper::string::setToken(sActDBName, 1, DB_DELIM, m_pTableLB->GetSelectEntry()); + } pSh->GetNewDBMgr()->GetColumnNames(m_pDBFieldLB, m_pDatabaseLB->GetSelectEntry(), m_pTableLB->GetSelectEntry()); return 0; diff --git a/tools/source/string/strascii.cxx b/tools/source/string/strascii.cxx index 5ae3967..83cf85a 100644 --- a/tools/source/string/strascii.cxx +++ b/tools/source/string/strascii.cxx @@ -63,21 +63,6 @@ static sal_Int32 ImplStringCompareAscii( const sal_Unicode* pStr1, const sal_Cha return nRet; } -static sal_Int32 ImplStringCompareWithoutZeroAscii( const sal_Unicode* pStr1, const sal_Char* pStr2, - xub_StrLen nCount ) -{ - sal_Int32 nRet = 0; - while ( nCount && - ((nRet = ((sal_Int32)*pStr1)-((sal_Int32)((unsigned char)*pStr2))) == 0) ) - { - ++pStr1, - ++pStr2, - --nCount; - } - - return nRet; -} - UniString& UniString::AppendAscii( const sal_Char* pAsciiStr ) { DBG_CHKTHIS( UniString, DbgCheckUniString ); @@ -168,47 +153,4 @@ StringCompare UniString::CompareToAscii( const sal_Char* pAsciiStr, return COMPARE_GREATER; } -xub_StrLen UniString::SearchAscii( const sal_Char* pAsciiStr, xub_StrLen nIndex ) const -{ - DBG_CHKTHIS( UniString, DbgCheckUniString ); - DBG_ASSERT( ImplDbgCheckAsciiStr( pAsciiStr, STRING_LEN ), - "UniString::SearchAscii() - pAsciiStr include characters > 127" ); - - sal_Int32 nLen = mpData->mnLen; - xub_StrLen nStrLen = ImplStringLen( pAsciiStr ); - - // If length of pAsciiStr is 0 or index exceeds length, it was not found - if ( !nStrLen || (nIndex >= nLen) ) - return STRING_NOTFOUND; - - const sal_Unicode* pStr = mpData->maStr; - pStr += nIndex; - - if ( nStrLen == 1 ) - { - sal_Unicode cSearch = (unsigned char)*pAsciiStr; - while ( nIndex < nLen ) - { - if ( *pStr == cSearch ) - return nIndex; - ++pStr, - ++nIndex; - } - } - else - { - // Only search within string - while ( nLen - nIndex >= nStrLen ) - { - // Check if string matches - if ( ImplStringCompareWithoutZeroAscii( pStr, pAsciiStr, nStrLen ) == 0 ) - return nIndex; - ++pStr, - ++nIndex; - } - } - - return STRING_NOTFOUND; -} - /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/tools/source/string/tustring.cxx b/tools/source/string/tustring.cxx index 9b10bde..c339941 100644 --- a/tools/source/string/tustring.cxx +++ b/tools/source/string/tustring.cxx @@ -235,44 +235,6 @@ xub_StrLen STRING::Match( const STRING& rStr ) const return STRING_MATCH; } -void STRING::SetToken( xub_StrLen nToken, STRCODE cTok, const STRING& rStr, - xub_StrLen nIndex ) -{ - DBG_CHKTHIS( STRING, DBGCHECKSTRING ); - DBG_CHKOBJ( &rStr, STRING, DBGCHECKSTRING ); - - const STRCODE* pStr = mpData->maStr; - xub_StrLen nLen = (xub_StrLen)mpData->mnLen; - xub_StrLen nTok = 0; - xub_StrLen nFirstChar = nIndex; - xub_StrLen i = nFirstChar; - - // Determine token position and length - pStr += i; - while ( i < nLen ) - { - // Increase token count if match - if ( *pStr == cTok ) - { - ++nTok; - - if ( nTok == nToken ) - nFirstChar = i+1; - else - { - if ( nTok > nToken ) - break; - } - } - - ++pStr, - ++i; - } - - if ( nTok >= nToken ) - Replace( nFirstChar, i-nFirstChar, rStr ); -} - STRING STRING::GetToken( xub_StrLen nToken, STRCODE cTok, sal_Int32& rIndex ) const { DBG_CHKTHIS( STRING, DBGCHECKSTRING ); diff --git a/unusedcode.easy b/unusedcode.easy index d4daf9c..a8f893f 100644 --- a/unusedcode.easy +++ b/unusedcode.easy @@ -66,7 +66,6 @@ String::Append(unsigned short const*) String::Append(unsigned short const*, unsigned short) String::Assign(unsigned short const*) String::Insert(String const&, unsigned short, unsigned short, unsigned short) -String::SearchAscii(char const*, unsigned short) const String::String(char) SvdProgressInfo::ReportError() SvpSalInstance::PostEvent(SalFrame const*, void*, unsigned short)
_______________________________________________ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits