summaryrefslogtreecommitdiff
path: root/sw/source/ui
diff options
context:
space:
mode:
authorMichael Stahl <mst@openoffice.org>2012-07-27 17:30:57 +0200
committerMichael Stahl <mstahl@redhat.com>2012-07-27 17:50:22 +0200
commit4c3501cb61147304252e2ac281d3e466b6af93d9 (patch)
tree221666542d60078c84b4c978284794b94bc0f27f /sw/source/ui
parentf6f265313f055f3d767060509cbf05442c1bb548 (diff)
sw: fix some warnings
Diffstat (limited to 'sw/source/ui')
-rw-r--r--sw/source/ui/app/docsh.cxx11
-rw-r--r--sw/source/ui/dialog/ascfldlg.cxx2
-rw-r--r--sw/source/ui/misc/num.cxx5
-rw-r--r--sw/source/ui/table/tabledlg.cxx6
-rw-r--r--sw/source/ui/utlui/unotools.cxx6
5 files changed, 21 insertions, 9 deletions
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);