sw/source/core/doc/number.cxx | 4 ++-- sw/source/filter/ww1/w1filter.cxx | 2 +- sw/source/filter/ww8/ww8graf.cxx | 2 +- sw/source/filter/ww8/ww8par5.cxx | 8 +++++++- sw/source/filter/ww8/ww8par6.cxx | 2 +- sw/source/ui/app/docsh.cxx | 11 ++++++----- sw/source/ui/dialog/ascfldlg.cxx | 2 -- sw/source/ui/misc/num.cxx | 5 +++++ sw/source/ui/table/tabledlg.cxx | 6 ++++++ sw/source/ui/utlui/unotools.cxx | 6 ++++-- 10 files changed, 33 insertions(+), 15 deletions(-)
New commits: commit 746954f550d3d42393a817cd1172403e098d119f Author: Michael Stahl <m...@openoffice.org> Date: Tue Jul 31 14:37:03 2012 +0200 sw: fix some warnings Signed-off-by: Petr Mladek <pmla...@suse.cz> diff --git a/sw/source/core/doc/number.cxx b/sw/source/core/doc/number.cxx index c56c74b..bec3981 100644 --- a/sw/source/core/doc/number.cxx +++ b/sw/source/core/doc/number.cxx @@ -1108,9 +1108,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 0cd32f4..c17b1eb 100644 --- a/sw/source/filter/ww1/w1filter.cxx +++ b/sw/source/filter/ww1/w1filter.cxx @@ -1380,7 +1380,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 8182cff..f99ad5f 100644 --- a/sw/source/filter/ww8/ww8graf.cxx +++ b/sw/source/filter/ww8/ww8graf.cxx @@ -269,7 +269,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 949ddd9..c6cc594 100644 --- a/sw/source/filter/ww8/ww8par5.cxx +++ b/sw/source/filter/ww8/ww8par5.cxx @@ -1033,10 +1033,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 2f7a956..1677207 100644 --- a/sw/source/filter/ww8/ww8par6.cxx +++ b/sw/source/filter/ww8/ww8par6.cxx @@ -3479,7 +3479,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 6f5a902..17ff4c0 100644 --- a/sw/source/ui/app/docsh.cxx +++ b/sw/source/ui/app/docsh.cxx @@ -1221,7 +1221,7 @@ uno::Reference< frame::XController > return aRet; } -static const char* pEventNames[] = +static const char* s_EventNames[] = { "OnPageCountChange", "OnMailMerge", @@ -1230,6 +1230,7 @@ static const char* pEventNames[] = "OnFieldMergeFinished", "OnLayoutFinished" }; +static sal_Int32 const s_nEvents(sizeof(s_EventNames)/sizeof(s_EventNames[0])); Sequence< OUString > SwDocShell::GetEventNames() { @@ -1247,12 +1248,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 d6ca407..2f03056 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 832837c..8e8a5aa 100644 --- a/sw/source/ui/misc/num.cxx +++ b/sw/source/ui/misc/num.cxx @@ -263,6 +263,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 8e43fcd..92861ba 100644 --- a/sw/source/ui/table/tabledlg.cxx +++ b/sw/source/ui/table/tabledlg.cxx @@ -1010,6 +1010,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 d9089f7..bdcea67 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); _______________________________________________ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits