diff options
author | Michael Stahl <mst@openoffice.org> | 2012-07-27 17:30:57 +0200 |
---|---|---|
committer | Michael Stahl <mstahl@redhat.com> | 2012-07-27 17:50:22 +0200 |
commit | 4c3501cb61147304252e2ac281d3e466b6af93d9 (patch) | |
tree | 221666542d60078c84b4c978284794b94bc0f27f | |
parent | some tweaks in RTF filter (diff) | |
download | core-4c3501cb61147304252e2ac281d3e466b6af93d9.tar.gz core-4c3501cb61147304252e2ac281d3e466b6af93d9.zip |
sw: fix some warnings
-rw-r--r-- | sw/source/core/doc/number.cxx | 4 | ||||
-rw-r--r-- | sw/source/filter/ww1/w1filter.cxx | 2 | ||||
-rw-r--r-- | sw/source/filter/ww8/ww8graf.cxx | 2 | ||||
-rw-r--r-- | sw/source/filter/ww8/ww8par5.cxx | 8 | ||||
-rw-r--r-- | sw/source/filter/ww8/ww8par6.cxx | 2 | ||||
-rw-r--r-- | sw/source/ui/app/docsh.cxx | 11 | ||||
-rw-r--r-- | sw/source/ui/dialog/ascfldlg.cxx | 2 | ||||
-rw-r--r-- | sw/source/ui/misc/num.cxx | 5 | ||||
-rw-r--r-- | sw/source/ui/table/tabledlg.cxx | 6 | ||||
-rw-r--r-- | sw/source/ui/utlui/unotools.cxx | 6 |
10 files changed, 33 insertions, 15 deletions
diff --git a/sw/source/core/doc/number.cxx b/sw/source/core/doc/number.cxx index c43cb61c2427..5a97789e931e 100644 --- a/sw/source/core/doc/number.cxx +++ b/sw/source/core/doc/number.cxx @@ -1126,9 +1126,9 @@ namespace numfunc } inline sal_Unicode GetChar( sal_uInt8 p_nListLevel ) const { - if ( p_nListLevel > MAXLEVEL ) + if (p_nListLevel >= MAXLEVEL) { - p_nListLevel = MAXLEVEL; + p_nListLevel = MAXLEVEL - 1; } return mnLevelChars[p_nListLevel]; diff --git a/sw/source/filter/ww1/w1filter.cxx b/sw/source/filter/ww1/w1filter.cxx index b62e7845e669..14e978ce04c0 100644 --- a/sw/source/filter/ww1/w1filter.cxx +++ b/sw/source/filter/ww1/w1filter.cxx @@ -1377,7 +1377,7 @@ SvxFontItem Ww1Fonts::GetFont(sal_uInt16 nFCode) FAMILY_DONTKNOW, FAMILY_ROMAN, FAMILY_SWISS, FAMILY_MODERN, FAMILY_SCRIPT, FAMILY_DECORATIVE }; - if (b < sizeof(eFamilyA)) + if (b < (sizeof(eFamilyA)/sizeof(eFamilyA[0]))) eFamily = eFamilyA[b]; } else diff --git a/sw/source/filter/ww8/ww8graf.cxx b/sw/source/filter/ww8/ww8graf.cxx index 7a87b29b1814..26b1483f387e 100644 --- a/sw/source/filter/ww8/ww8graf.cxx +++ b/sw/source/filter/ww8/ww8graf.cxx @@ -268,7 +268,7 @@ static void SetFill( SfxItemSet& rSet, WW8_DP_FILL& rFill ) else { rSet.Put(XFillStyleItem(XFILL_SOLID)); // necessary for textbox - if (nPat <= 1 || nPat > sizeof(nPatA)) + if (nPat <= 1 || ((sizeof(nPatA)/sizeof(nPatA[0])) <= nPat)) { // Solid Background or unknown rSet.Put(XFillColorItem(aEmptyStr, WW8TransCol(rFill.dlpcBg))); diff --git a/sw/source/filter/ww8/ww8par5.cxx b/sw/source/filter/ww8/ww8par5.cxx index 412fb1421a78..67345a93475c 100644 --- a/sw/source/filter/ww8/ww8par5.cxx +++ b/sw/source/filter/ww8/ww8par5.cxx @@ -1025,10 +1025,16 @@ long SwWW8ImplReader::Read_Field(WW8PLCFManResult* pRes) if (bNested) return 0; - sal_uInt16 n = ( aF.nId <= eMax ) ? aF.nId : static_cast< sal_uInt16 >(eMax); // alle > 91 werden 92 + sal_uInt16 n = (aF.nId <= eMax) ? aF.nId : static_cast<sal_uInt16>(eMax); sal_uInt16 nI = n / 32; // # des sal_uInt32 sal_uLong nMask = 1 << ( n % 32 ); // Maske fuer Bits + if ((sizeof(nFieldTagAlways)/sizeof(nFieldTagAlways[0])) <= nI) + { // if indexes larger than 95 are needed, then a new configuration + // item has to be added, and nFieldTagAlways/nFieldTagBad expanded! + return aF.nLen; + } + if( nFieldTagAlways[nI] & nMask ) // Flag: Tag it return Read_F_Tag( &aF ); // Resultat nicht als Text diff --git a/sw/source/filter/ww8/ww8par6.cxx b/sw/source/filter/ww8/ww8par6.cxx index c86300a18990..3b6503b75aa8 100644 --- a/sw/source/filter/ww8/ww8par6.cxx +++ b/sw/source/filter/ww8/ww8par6.cxx @@ -3469,7 +3469,7 @@ bool SwWW8ImplReader::GetFontParams( sal_uInt16 nFCode, FontFamily& reFamily, break; } } - if( b < sizeof( eFamilyA ) ) + if (b < (sizeof(eFamilyA)/sizeof(eFamilyA[0]))) reFamily = eFamilyA[b]; else reFamily = FAMILY_DONTKNOW; diff --git a/sw/source/ui/app/docsh.cxx b/sw/source/ui/app/docsh.cxx index ec2bcca0f613..9dd9aadc674f 100644 --- a/sw/source/ui/app/docsh.cxx +++ b/sw/source/ui/app/docsh.cxx @@ -1229,7 +1229,7 @@ uno::Reference< frame::XController > return aRet; } -static const char* pEventNames[] = +static const char* s_EventNames[] = { "OnPageCountChange", "OnMailMerge", @@ -1238,6 +1238,7 @@ static const char* pEventNames[] = "OnFieldMergeFinished", "OnLayoutFinished" }; +static sal_Int32 const s_nEvents(sizeof(s_EventNames)/sizeof(s_EventNames[0])); Sequence< OUString > SwDocShell::GetEventNames() { @@ -1255,12 +1256,12 @@ Sequence< OUString > SwDocShell::GetEventNames() return aRet; } -static sal_Int32 nEvents=13; - rtl::OUString SwDocShell::GetEventName( sal_Int32 nIndex ) { - if ( nIndex<nEvents ) - return ::rtl::OUString::createFromAscii(pEventNames[nIndex]); + if (nIndex < s_nEvents) + { + return ::rtl::OUString::createFromAscii(s_EventNames[nIndex]); + } return rtl::OUString(); } diff --git a/sw/source/ui/dialog/ascfldlg.cxx b/sw/source/ui/dialog/ascfldlg.cxx index 8c9fdcb9cbd6..595375af6bf7 100644 --- a/sw/source/ui/dialog/ascfldlg.cxx +++ b/sw/source/ui/dialog/ascfldlg.cxx @@ -115,8 +115,6 @@ SwAsciiFilterDlg::SwAsciiFilterDlg( Window* pParent, SwDocShell& rDocSh, { aBuffer[ nBytesRead ] = '0'; aBuffer[ nBytesRead+1 ] = '0'; - if( 0 != ( nBytesRead & 0x00000001 ) ) - aBuffer[ nBytesRead + 2 ] = '0'; } sal_Bool bCR = sal_False, bLF = sal_False, bNullChar = sal_False; diff --git a/sw/source/ui/misc/num.cxx b/sw/source/ui/misc/num.cxx index 2d205956e840..ada66a5bcf4c 100644 --- a/sw/source/ui/misc/num.cxx +++ b/sw/source/ui/misc/num.cxx @@ -248,6 +248,11 @@ void SwNumPositionTabPage::InitControls() nMask <<= 1; } + if (MAXLEVEL <= nLvl) + { + OSL_ENSURE(false, "cannot happen."); + return; + } if(bSameDistBorderNum) { long nDistBorderNum; diff --git a/sw/source/ui/table/tabledlg.cxx b/sw/source/ui/table/tabledlg.cxx index 411337c86e98..2ce75283f047 100644 --- a/sw/source/ui/table/tabledlg.cxx +++ b/sw/source/ui/table/tabledlg.cxx @@ -1009,6 +1009,12 @@ void SwTableColumnPage::ModifyHdl( PercentField* pEdit ) if(pEdit == pFieldArr[i]) break; + if (MET_FIELDS <= i) + { + OSL_ENSURE(false, "cannot happen."); + return; + } + SetVisibleWidth(aValueTbl[i], static_cast< SwTwips >(pEdit->DenormalizePercent(pEdit->GetValue( FUNIT_TWIP ))) ); nAktPos = aValueTbl[i]; diff --git a/sw/source/ui/utlui/unotools.cxx b/sw/source/ui/utlui/unotools.cxx index e3438e6ccfa4..c5dec257b0a3 100644 --- a/sw/source/ui/utlui/unotools.cxx +++ b/sw/source/ui/utlui/unotools.cxx @@ -408,7 +408,8 @@ void SwOneExampleFrame::CreatePopup(const Point& rPt) sal_Int16 nZoom = 0; aZoom >>= nZoom; - for(sal_uInt16 i = 0; i < 5; i++ ) + for (sal_uInt16 i = 0; + i < (sizeof(nZoomValues)/sizeof(nZoomValues[0])); ++i) { String sTemp; sTemp = String::CreateFromInt32(nZoomValues[i]); @@ -427,7 +428,8 @@ void SwOneExampleFrame::CreatePopup(const Point& rPt) IMPL_LINK(SwOneExampleFrame, PopupHdl, Menu*, pMenu ) { sal_uInt16 nId = pMenu->GetCurItemId(); - if( nId > ITEM_ZOOM && nId < ITEM_ZOOM + 100 ) + if ((nId > ITEM_ZOOM) && + (nId <= (ITEM_ZOOM + (sizeof(nZoomValues)/sizeof(nZoomValues[0]))))) { sal_Int16 nZoom = nZoomValues[nId - ITEM_ZOOM - 1]; uno::Reference< view::XViewSettingsSupplier > xSettings(_xController, uno::UNO_QUERY); |