diff options
author | Armin Le Grand <alg@apache.org> | 2012-07-18 11:11:48 +0000 |
---|---|---|
committer | Armin Le Grand <alg@apache.org> | 2012-07-18 11:11:48 +0000 |
commit | 0132f35e8be61d34156ef907adb7eb98902509da (patch) | |
tree | adf85281f6cf25827e7d27493522555118a3bcfb | |
parent | ba86cf07673ed3dde1b4d54242005a4a903d86c9 (diff) |
basic, cui, extensions, filter, vcl: fix some warnings
Patch by: Michael Stahl
Notes
Notes:
prefer: 6a94d7b5c924e3a8ef3ff0f68f54061c035a3cb0
-rw-r--r-- | basic/source/runtime/runtime.cxx | 6 | ||||
-rw-r--r-- | cui/source/options/opthtml.cxx | 4 | ||||
-rw-r--r-- | cui/source/tabpages/numpages.cxx | 6 | ||||
-rw-r--r-- | extensions/source/scanner/sane.cxx | 2 | ||||
-rw-r--r-- | filter/source/graphicfilter/icgm/chart.cxx | 2 | ||||
-rw-r--r-- | vcl/source/gdi/metric.cxx | 2 | ||||
-rw-r--r-- | vcl/source/gdi/outmap.cxx | 11 | ||||
-rw-r--r-- | vcl/unx/gtk/a11y/atkwrapper.cxx | 2 | ||||
-rw-r--r-- | vcl/unx/gtk/app/gtkdata.cxx | 2 |
9 files changed, 23 insertions, 14 deletions
diff --git a/basic/source/runtime/runtime.cxx b/basic/source/runtime/runtime.cxx index f187ea54224b..f4ffc29d2830 100644 --- a/basic/source/runtime/runtime.cxx +++ b/basic/source/runtime/runtime.cxx @@ -731,17 +731,17 @@ sal_Bool SbiRuntime::Step() SbiOpcode eOp = (SbiOpcode ) ( *pCode++ ); sal_uInt32 nOp1, nOp2; - if( eOp <= SbOP0_END ) + if (eOp < SbOP0_END) { (this->*( aStep0[ eOp ] ) )(); } - else if( eOp >= SbOP1_START && eOp <= SbOP1_END ) + else if (eOp >= SbOP1_START && eOp < SbOP1_END) { nOp1 = *pCode++; nOp1 |= *pCode++ << 8; nOp1 |= *pCode++ << 16; nOp1 |= *pCode++ << 24; (this->*( aStep1[ eOp - SbOP1_START ] ) )( nOp1 ); } - else if( eOp >= SbOP2_START && eOp <= SbOP2_END ) + else if (eOp >= SbOP2_START && eOp < SbOP2_END) { nOp1 = *pCode++; nOp1 |= *pCode++ << 8; nOp1 |= *pCode++ << 16; nOp1 |= *pCode++ << 24; nOp2 = *pCode++; nOp2 |= *pCode++ << 8; nOp2 |= *pCode++ << 16; nOp2 |= *pCode++ << 24; diff --git a/cui/source/options/opthtml.cxx b/cui/source/options/opthtml.cxx index 1aefdc9e9699..29aa1bfe2ce1 100644 --- a/cui/source/options/opthtml.cxx +++ b/cui/source/options/opthtml.cxx @@ -198,7 +198,9 @@ void OfaHtmlTabPage::Reset( const SfxItemSet& ) aIgnoreFontNamesCB.Check(pHtmlOpt->IsIgnoreFontFamily()); sal_uInt16 nExport = pHtmlOpt->GetExportMode(); if( nExport >= ( sizeof( aExportToPosArr ) / sizeof( sal_uInt16 ) ) ) - nExport = 4; // default for bad config entry is NS 4.0 + { + nExport = 3; // default for bad config entry is NS 4.0 + } sal_uInt16 nPosArr = aExportToPosArr[ nExport ]; // if( nPosArr == DEPRECATED_ENTRY ) // nPosArr = aExportToPosArr[ 4 ]; // again: NS 4.0 is default diff --git a/cui/source/tabpages/numpages.cxx b/cui/source/tabpages/numpages.cxx index 3f0f8d4bbba3..9e9219c24acd 100644 --- a/cui/source/tabpages/numpages.cxx +++ b/cui/source/tabpages/numpages.cxx @@ -3247,6 +3247,12 @@ void SvxNumPositionTabPage::InitControls() nMask <<= 1; } + if (SVX_MAX_NUM <= nLvl) + { + OSL_ENSURE(false, "cannot happen."); + return; + } + if(bSameDistBorderNum) { long nDistBorderNum; diff --git a/extensions/source/scanner/sane.cxx b/extensions/source/scanner/sane.cxx index b7577fc41ce8..045ce56385fb 100644 --- a/extensions/source/scanner/sane.cxx +++ b/extensions/source/scanner/sane.cxx @@ -984,7 +984,7 @@ String Sane::GetOptionUnitName( int n ) String aText; SANE_Unit nUnit = mppOptions[n]->unit; size_t nUnitAsSize = (size_t)nUnit; - if( nUnitAsSize > sizeof( ppUnits )/sizeof( ppUnits[0] ) ) + if (nUnitAsSize >= sizeof(ppUnits)/sizeof(ppUnits[0])) aText = String::CreateFromAscii( "[unknown units]" ); else aText = String( ppUnits[ nUnit ], gsl_getSystemTextEncoding() ); diff --git a/filter/source/graphicfilter/icgm/chart.cxx b/filter/source/graphicfilter/icgm/chart.cxx index e28597e5c72d..fb9b5e093d39 100644 --- a/filter/source/graphicfilter/icgm/chart.cxx +++ b/filter/source/graphicfilter/icgm/chart.cxx @@ -67,8 +67,8 @@ void CGMChart::DeleteTextEntry( TextEntry* pTextEntry ) pTAttr = pTAttr->pNextAttribute; delete pTempTAttr; } - delete pTextEntry; maTextEntryList.Remove( pTextEntry ); + delete pTextEntry; } }; diff --git a/vcl/source/gdi/metric.cxx b/vcl/source/gdi/metric.cxx index 39b08f6ff460..c2df97cf8b05 100644 --- a/vcl/source/gdi/metric.cxx +++ b/vcl/source/gdi/metric.cxx @@ -748,7 +748,7 @@ bool ParseCMAP( const unsigned char* pCmap, int nLength, CmapResult& rResult ) while( cMin < cEnd ) { int j = 0; - for(; (cMin < cEnd) && (j < NINSIZE); ++cMin ) + for (; (cMin < cEnd) && (j < (NINSIZE-1)); ++cMin) { if( cMin >= 0x0100 ) cCharsInp[ j++ ] = static_cast<sal_Char>(cMin >> 8); diff --git a/vcl/source/gdi/outmap.cxx b/vcl/source/gdi/outmap.cxx index e702a0f6d6ce..f42f791d5a69 100644 --- a/vcl/source/gdi/outmap.cxx +++ b/vcl/source/gdi/outmap.cxx @@ -60,9 +60,10 @@ DBG_NAMEEX( Region ) // ======================================================================= -static long aImplNumeratorAry[MAP_PIXEL+1] = +static int const s_ImplArySize = MAP_PIXEL+1; +static long aImplNumeratorAry[s_ImplArySize] = { 1, 1, 5, 50, 1, 1, 1, 1, 1, 1, 1 }; -static long aImplDenominatorAry[MAP_PIXEL+1] = +static long aImplDenominatorAry[s_ImplArySize] = { 2540, 254, 127, 127, 1000, 100, 10, 1, 72, 1440, 1 }; // ----------------------------------------------------------------------- @@ -1952,9 +1953,9 @@ Region OutputDevice::PixelToLogic( const Region& rDeviceRegion, #define ENTER3( eUnitSource, eUnitDest ) \ long nNumerator = 1; \ long nDenominator = 1; \ - DBG_ASSERT( eUnitSource < MAP_LASTENUMDUMMY, "Invalid source map unit"); \ - DBG_ASSERT( eUnitDest < MAP_LASTENUMDUMMY, "Invalid destination map unit"); \ - if( (eUnitSource < MAP_LASTENUMDUMMY) && (eUnitDest < MAP_LASTENUMDUMMY) ) \ + DBG_ASSERT( eUnitSource < s_ImplArySize, "Invalid source map unit"); \ + DBG_ASSERT( eUnitDest < s_ImplArySize, "Invalid destination map unit"); \ + if( (eUnitSource < s_ImplArySize) && (eUnitDest < s_ImplArySize) ) \ { \ nNumerator = aImplNumeratorAry[eUnitSource] * \ aImplDenominatorAry[eUnitDest]; \ diff --git a/vcl/unx/gtk/a11y/atkwrapper.cxx b/vcl/unx/gtk/a11y/atkwrapper.cxx index 03e9f2a5e379..e44193c2bdbc 100644 --- a/vcl/unx/gtk/a11y/atkwrapper.cxx +++ b/vcl/unx/gtk/a11y/atkwrapper.cxx @@ -313,7 +313,7 @@ static AtkRole mapToAtkRole( sal_Int16 nRole ) initialized = true; } - static const sal_Int32 nMapSize = sizeof(roleMap)/sizeof(sal_Int16); + static const sal_Int32 nMapSize = sizeof(roleMap)/sizeof(roleMap[0]); if( 0 <= nRole && nMapSize > nRole ) role = roleMap[nRole]; diff --git a/vcl/unx/gtk/app/gtkdata.cxx b/vcl/unx/gtk/app/gtkdata.cxx index abbfc996bc76..8f17f1f8d10e 100644 --- a/vcl/unx/gtk/app/gtkdata.cxx +++ b/vcl/unx/gtk/app/gtkdata.cxx @@ -364,7 +364,7 @@ GdkCursor* GtkSalDisplay::getFromXPM( const char *pBitmap, GdkCursor *GtkSalDisplay::getCursor( PointerStyle ePointerStyle ) { - if( ePointerStyle > POINTER_COUNT ) + if (ePointerStyle >= POINTER_COUNT) return NULL; if ( !m_aCursors[ ePointerStyle ] ) |