diff options
author | Noel Grandin <noel.grandin@collabora.co.uk> | 2017-07-30 12:16:31 +0200 |
---|---|---|
committer | Noel Grandin <noel.grandin@collabora.co.uk> | 2017-07-31 08:25:07 +0200 |
commit | c9253818ec8252169c20450b41878be459568d95 (patch) | |
tree | 1f271151725042f33c3c8aa3988343bcd7f89e12 /vcl | |
parent | 242a796a71e29a1d8cdc4dd71d2465b898db32ab (diff) |
loplugin:oncevar
extend oncevar to any POD type
Change-Id: Ia98ee0a67f183e40fb0c38477760124b2c411dc0
Reviewed-on: https://gerrit.libreoffice.org/40564
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'vcl')
-rw-r--r-- | vcl/opengl/gdiimpl.cxx | 4 | ||||
-rw-r--r-- | vcl/opengl/x11/gdiimpl.cxx | 2 | ||||
-rw-r--r-- | vcl/qa/cppunit/svm/svmtest.cxx | 2 | ||||
-rw-r--r-- | vcl/source/filter/ixpm/xpmread.cxx | 2 | ||||
-rw-r--r-- | vcl/source/font/fontcache.cxx | 3 | ||||
-rw-r--r-- | vcl/source/fontsubset/sft.cxx | 2 | ||||
-rw-r--r-- | vcl/source/gdi/CommonSalLayout.cxx | 4 | ||||
-rw-r--r-- | vcl/source/window/debugevent.cxx | 2 | ||||
-rw-r--r-- | vcl/unx/generic/dtrans/X11_selection.cxx | 5 | ||||
-rw-r--r-- | vcl/workben/vcldemo.cxx | 14 |
10 files changed, 19 insertions, 21 deletions
diff --git a/vcl/opengl/gdiimpl.cxx b/vcl/opengl/gdiimpl.cxx index 60df24d784ab..54bb066ddd30 100644 --- a/vcl/opengl/gdiimpl.cxx +++ b/vcl/opengl/gdiimpl.cxx @@ -566,9 +566,9 @@ bool OpenGLSalGraphicsImpl::CheckOffscreenTexture() { glDrawBuffer( GL_COLOR_ATTACHMENT0 ); #if OSL_DEBUG_LEVEL > 0 // lets have some red debugging background. - GLfloat clearColor[4] = { 1.0, 0, 0, 0 }; + GLfloat const clearColor[4] = { 1.0, 0, 0, 0 }; #else - GLfloat clearColor[4] = { 1.0, 1.0, 1.0, 0 }; + GLfloat const clearColor[4] = { 1.0, 1.0, 1.0, 0 }; #endif glClearBufferfv( GL_COLOR, 0, clearColor ); // FIXME: use glClearTexImage if we have it ? diff --git a/vcl/opengl/x11/gdiimpl.cxx b/vcl/opengl/x11/gdiimpl.cxx index 07a0b6d80fe8..74e9d9454f7a 100644 --- a/vcl/opengl/x11/gdiimpl.cxx +++ b/vcl/opengl/x11/gdiimpl.cxx @@ -303,7 +303,7 @@ bool X11OpenGLContext::ImplInit() if (pFBC && best_fbc != -1) { - int pContextAttribs[] = + int const pContextAttribs[] = { #if 0 // defined(DBG_UTIL) GLX_CONTEXT_MAJOR_VERSION_ARB, 3, diff --git a/vcl/qa/cppunit/svm/svmtest.cxx b/vcl/qa/cppunit/svm/svmtest.cxx index 619fa07e684d..a1b89d87a5a8 100644 --- a/vcl/qa/cppunit/svm/svmtest.cxx +++ b/vcl/qa/cppunit/svm/svmtest.cxx @@ -686,7 +686,7 @@ void SvmTest::testTextArray() GDIMetaFile aGDIMetaFile; ScopedVclPtrInstance<VirtualDevice> pVirtualDev; setupBaseVirtualDevice(*pVirtualDev.get(), aGDIMetaFile); - long aDX[] = { 10, 15, 20, 25, 30, 35 }; + long const aDX[] = { 10, 15, 20, 25, 30, 35 }; pVirtualDev->DrawTextArray(Point(4,6), "123456", aDX, 1, 4); checkTextArray(writeAndRead(aGDIMetaFile, "textarray.svm")); diff --git a/vcl/source/filter/ixpm/xpmread.cxx b/vcl/source/filter/ixpm/xpmread.cxx index 7608c8252e48..6c4838af8e68 100644 --- a/vcl/source/filter/ixpm/xpmread.cxx +++ b/vcl/source/filter/ixpm/xpmread.cxx @@ -564,7 +564,7 @@ bool XPMReader::ImplGetPara ( sal_uLong nNumb ) bool XPMReader::ImplGetString() { - sal_uInt8 sID[] = "/* XPM */"; + sal_uInt8 const sID[] = "/* XPM */"; sal_uInt8* pString = mpStringBuf; mnStringSize = 0; diff --git a/vcl/source/font/fontcache.cxx b/vcl/source/font/fontcache.cxx index 8b26edacb5fa..6b576999507b 100644 --- a/vcl/source/font/fontcache.cxx +++ b/vcl/source/font/fontcache.cxx @@ -116,8 +116,7 @@ LogicalFontInstance* ImplFontCache::GetFontInstance( PhysicalFontCollection cons // the most recently used font usually has a hit rate of >50% LogicalFontInstance *pFontInstance = nullptr; PhysicalFontFamily* pFontFamily = nullptr; - IFSD_Equal aIFSD_Equal; - if( mpFirstEntry && aIFSD_Equal( aFontSelData, mpFirstEntry->maFontSelData ) ) + if( mpFirstEntry && IFSD_Equal()( aFontSelData, mpFirstEntry->maFontSelData ) ) pFontInstance = mpFirstEntry; else { diff --git a/vcl/source/fontsubset/sft.cxx b/vcl/source/fontsubset/sft.cxx index 3cffc299c073..027e0c4238bd 100644 --- a/vcl/source/fontsubset/sft.cxx +++ b/vcl/source/fontsubset/sft.cxx @@ -2105,7 +2105,7 @@ static void DumpSfnts(FILE *outf, sal_uInt8 *sfntP, sal_uInt32 sfntLen) HexFmt *h = HexFmtNew(outf); sal_uInt16 i, numTables = GetUInt16(sfntP, 4); GlyphOffsets *go = GlyphOffsetsNew(sfntP, sfntLen); - sal_uInt8 pad[] = {0,0,0,0}; /* zeroes */ + sal_uInt8 const pad[] = {0,0,0,0}; /* zeroes */ if (numTables > nMaxPossibleTables) { diff --git a/vcl/source/gdi/CommonSalLayout.cxx b/vcl/source/gdi/CommonSalLayout.cxx index e826d38be1fe..c169030f8f2a 100644 --- a/vcl/source/gdi/CommonSalLayout.cxx +++ b/vcl/source/gdi/CommonSalLayout.cxx @@ -407,7 +407,7 @@ bool CommonSalLayout::HasVerticalAlternate(sal_UCS4 aChar, sal_UCS4 aVariationSe // Find all GSUB lookups for “vert” feature. hb_set_t* pLookups = hb_set_create(); - hb_tag_t pFeatures[] = { HB_TAG('v','e','r','t'), HB_TAG_NONE }; + hb_tag_t const pFeatures[] = { HB_TAG('v','e','r','t'), HB_TAG_NONE }; hb_ot_layout_collect_lookups(pHbFace, HB_OT_TAG_GSUB, nullptr, nullptr, pFeatures, pLookups); if (!hb_set_is_empty(pLookups)) { @@ -592,7 +592,7 @@ bool CommonSalLayout::LayoutText(ImplLayoutArgs& rArgs) // preference. The coretext_aat shaper is available only on macOS, // but there is no harm in always including it, HarfBuzz will // ignore unavailable shapers. - const char* pHbShapers[] = { "graphite2", "coretext_aat", "ot", "fallback", nullptr }; + const char*const pHbShapers[] = { "graphite2", "coretext_aat", "ot", "fallback", nullptr }; hb_segment_properties_t aHbProps; hb_buffer_get_segment_properties(pHbBuffer, &aHbProps); hb_shape_plan_t* pHbPlan = hb_shape_plan_create_cached(pHbFace, &aHbProps, maFeatures.data(), maFeatures.size(), pHbShapers); diff --git a/vcl/source/window/debugevent.cxx b/vcl/source/window/debugevent.cxx index 2b83f4f92f03..b47532891c24 100644 --- a/vcl/source/window/debugevent.cxx +++ b/vcl/source/window/debugevent.cxx @@ -192,7 +192,7 @@ void DebugEventInjector::InjectKeyNavEdit() struct { double mnProb; sal_uInt16 mnKey; - } nWeights[] = { + } const nWeights[] = { // edit / escape etc. - 50% { 0.20, KEY_SPACE }, { 0.10, KEY_TAB }, diff --git a/vcl/unx/generic/dtrans/X11_selection.cxx b/vcl/unx/generic/dtrans/X11_selection.cxx index 5738e2140238..7c89186505e0 100644 --- a/vcl/unx/generic/dtrans/X11_selection.cxx +++ b/vcl/unx/generic/dtrans/X11_selection.cxx @@ -1077,8 +1077,7 @@ bool SelectionManager::getPasteData( Atom selection, const OUString& rType, Sequ // prepare property for MULTIPLE request Sequence< sal_Int8 > aData; - Atom pTypes[4] = { XA_PIXMAP, XA_PIXMAP, - XA_COLORMAP, XA_COLORMAP }; + Atom const pTypes[4] = { XA_PIXMAP, XA_PIXMAP, XA_COLORMAP, XA_COLORMAP }; { osl::MutexGuard aGuard(m_aMutex); @@ -1088,7 +1087,7 @@ bool SelectionManager::getPasteData( Atom selection, const OUString& rType, Sequ XA_ATOM, 32, PropModeReplace, - reinterpret_cast<unsigned char*>(pTypes), + reinterpret_cast<unsigned char const *>(pTypes), 4 ); } diff --git a/vcl/workben/vcldemo.cxx b/vcl/workben/vcldemo.cxx index def90351b09b..3033860d79dd 100644 --- a/vcl/workben/vcldemo.cxx +++ b/vcl/workben/vcldemo.cxx @@ -262,19 +262,19 @@ public: 0.1, 0.1, 0.1, 0.1 }; #endif - drawing::LineCap eLineCaps[] = { + drawing::LineCap const eLineCaps[] = { drawing::LineCap_BUTT, drawing::LineCap_ROUND, drawing::LineCap_SQUARE, drawing::LineCap_BUTT, drawing::LineCap_BUTT, drawing::LineCap_ROUND, drawing::LineCap_SQUARE, drawing::LineCap_BUTT, drawing::LineCap_BUTT, drawing::LineCap_ROUND, drawing::LineCap_SQUARE, drawing::LineCap_BUTT, drawing::LineCap_BUTT, drawing::LineCap_ROUND, drawing::LineCap_SQUARE, drawing::LineCap_BUTT }; - basegfx::B2DLineJoin eJoins[] = { + basegfx::B2DLineJoin const eJoins[] = { basegfx::B2DLineJoin::NONE, basegfx::B2DLineJoin::Bevel, basegfx::B2DLineJoin::Miter, basegfx::B2DLineJoin::Round, basegfx::B2DLineJoin::NONE, basegfx::B2DLineJoin::Bevel, basegfx::B2DLineJoin::Miter, basegfx::B2DLineJoin::Round, basegfx::B2DLineJoin::NONE, basegfx::B2DLineJoin::Bevel, basegfx::B2DLineJoin::Miter, basegfx::B2DLineJoin::Round, basegfx::B2DLineJoin::NONE, basegfx::B2DLineJoin::Bevel, basegfx::B2DLineJoin::Miter, basegfx::B2DLineJoin::Round }; - double aLineWidths[] = { + double const aLineWidths[] = { 10.0, 15.0, 20.0, 10.0, 10.0, 15.0, 20.0, 10.0, 10.0, 15.0, 20.0, 10.0, @@ -408,7 +408,7 @@ public: std::vector<OUString> aFontNames; - sal_uInt32 nCols[] = { + sal_uInt32 const nCols[] = { COL_BLACK, COL_BLUE, COL_GREEN, COL_CYAN, COL_RED, COL_MAGENTA, COL_BROWN, COL_GRAY, COL_LIGHTGRAY, COL_LIGHTBLUE, COL_LIGHTGREEN, COL_LIGHTCYAN, COL_LIGHTRED, COL_LIGHTMAGENTA, COL_YELLOW, COL_WHITE @@ -562,7 +562,7 @@ public: FontWeight aWeights[] = { WEIGHT_NORMAL, WEIGHT_BOLD, WEIGHT_NORMAL }; - FontItalic aItalics[] = { ITALIC_NONE, + FontItalic const aItalics[] = { ITALIC_NONE, ITALIC_NONE, ITALIC_NORMAL }; vcl::Font aFont(OUString::createFromAscii( @@ -1127,8 +1127,8 @@ public: std::vector<tools::Rectangle> aRegions(DemoRenderer::partition(rCtx,2, 2)); DemoRenderer::clearRects(rDev, aRegions); - RenderType eRenderTypes[] = { RENDER_AS_BITMAP, RENDER_AS_OUTDEV, - RENDER_AS_BITMAPEX, RENDER_AS_ALPHA_OUTDEV }; + RenderType const eRenderTypes[] { RENDER_AS_BITMAP, RENDER_AS_OUTDEV, + RENDER_AS_BITMAPEX, RENDER_AS_ALPHA_OUTDEV }; for (size_t i = 0; i < aRegions.size(); i++) SizeAndRender(rDev, aRegions[i], eRenderTypes[i], rCtx); } |