Kaydet (Commit) 05db125c authored tarafından Noel Grandin's avatar Noel Grandin

loplugin:staticconstfield improvements

Change-Id: Ia0a19736dfd4500bb17b04c072710f8ee8744031
Reviewed-on: https://gerrit.libreoffice.org/60526
Tested-by: Jenkins
Reviewed-by: 's avatarNoel Grandin <noel.grandin@collabora.co.uk>
üst be9b8344
......@@ -33,22 +33,66 @@ bool StaticConstField::TraverseConstructorInitializer(CXXCtorInitializer* init)
return true;
if (!init->getMember())
return true;
auto tc = loplugin::TypeCheck(init->getMember()->getType());
if (!tc.Const().Class("OUString").Namespace("rtl").GlobalNamespace()
&& !tc.Const().Class("OString").Namespace("rtl").GlobalNamespace())
auto type = init->getMember()->getType();
auto tc = loplugin::TypeCheck(type);
bool found = false;
if (!tc.Const())
return true;
if (auto constructExpr = dyn_cast<CXXConstructExpr>(init->getInit()))
if (tc.Const().Class("OUString").Namespace("rtl").GlobalNamespace()
|| tc.Const().Class("OString").Namespace("rtl").GlobalNamespace())
{
if (constructExpr->getNumArgs() >= 1 && isa<clang::StringLiteral>(constructExpr->getArg(0)))
if (auto constructExpr = dyn_cast<CXXConstructExpr>(init->getInit()))
{
report(DiagnosticsEngine::Warning, "string field can be static const",
init->getSourceLocation())
<< init->getSourceRange();
report(DiagnosticsEngine::Note, "field here", init->getMember()->getLocation())
<< init->getMember()->getSourceRange();
if (constructExpr->getNumArgs() >= 1
&& isa<clang::StringLiteral>(constructExpr->getArg(0)))
found = true;
}
}
return RecursiveASTVisitor::TraverseConstructorInitializer(init);
else if (type->isIntegerType())
{
if (isa<IntegerLiteral>(init->getInit()->IgnoreParenImpCasts()))
found = true;
// isIntegerType includes bool
else if (isa<CXXBoolLiteralExpr>(init->getInit()->IgnoreParenImpCasts()))
found = true;
}
else if (type->isFloatingType())
{
if (isa<FloatingLiteral>(init->getInit()->IgnoreParenImpCasts()))
found = true;
}
else if (type->isEnumeralType())
{
if (auto declRefExpr = dyn_cast<DeclRefExpr>(init->getInit()->IgnoreParenImpCasts()))
{
if (isa<EnumConstantDecl>(declRefExpr->getDecl()))
found = true;
}
}
// If we find more than one non-copy-move constructor, we can't say for sure if a member can be static
// because it could be initialised differently in each constructor.
if (auto cxxRecordDecl = dyn_cast<CXXRecordDecl>(init->getMember()->getParent()))
{
int cnt = 0;
for (auto it = cxxRecordDecl->ctor_begin(); it != cxxRecordDecl->ctor_end(); ++it)
{
if (!it->isCopyOrMoveConstructor())
cnt++;
}
if (cnt > 1)
return true;
}
if (found)
{
report(DiagnosticsEngine::Warning, "field can be static const", init->getSourceLocation())
<< init->getSourceRange();
report(DiagnosticsEngine::Note, "field here", init->getMember()->getLocation())
<< init->getMember()->getSourceRange();
}
return true;
}
loplugin::Plugin::Registration<StaticConstField> X("staticconstfield", true);
......
......@@ -15,7 +15,7 @@ class Class1
OUString const m_field1; // expected-note {{field here [loplugin:staticconstfield]}}
Class1()
: m_field1("xxxx")
// expected-error@-1 {{string field can be static const [loplugin:staticconstfield]}}
// expected-error@-1 {{field can be static const [loplugin:staticconstfield]}}
{
(void)m_field1;
}
......@@ -26,7 +26,7 @@ class Class2
OString const m_field1; // expected-note {{field here [loplugin:staticconstfield]}}
Class2()
: m_field1("xxxx")
// expected-error@-1 {{string field can be static const [loplugin:staticconstfield]}}
// expected-error@-1 {{field can be static const [loplugin:staticconstfield]}}
{
(void)m_field1;
}
......@@ -43,4 +43,71 @@ class Class4
}
};
class Class5
{
enum class Enum
{
ONE
};
float const m_field1; // expected-note {{field here [loplugin:staticconstfield]}}
int const m_field2; // expected-note {{field here [loplugin:staticconstfield]}}
bool const m_field3; // expected-note {{field here [loplugin:staticconstfield]}}
Enum const m_field4; // expected-note {{field here [loplugin:staticconstfield]}}
Class5()
: m_field1(1.0)
// expected-error@-1 {{field can be static const [loplugin:staticconstfield]}}
, m_field2(1)
// expected-error@-1 {{field can be static const [loplugin:staticconstfield]}}
, m_field3(true)
// expected-error@-1 {{field can be static const [loplugin:staticconstfield]}}
, m_field4(Enum::ONE)
// expected-error@-1 {{field can be static const [loplugin:staticconstfield]}}
{
(void)m_field1;
(void)m_field2;
(void)m_field3;
(void)m_field4;
}
};
// no warning expected
class Class6
{
enum class Enum
{
ONE
};
float m_field1;
int m_field2;
bool m_field3;
Enum m_field4;
Class6()
: m_field1(1.0)
, m_field2(1)
, m_field3(true)
, m_field4(Enum::ONE)
{
(void)m_field1;
(void)m_field2;
(void)m_field3;
(void)m_field4;
}
};
// no warning expected, checking for assigning to const field from multiple constructors
class Class7
{
bool const m_field1;
Class7()
: m_field1(true)
{
(void)m_field1;
}
Class7(bool b)
: m_field1(b)
{
(void)m_field1;
}
};
/* vim:set shiftwidth=4 softtabstop=4 expandtab cinoptions=b1,g0,N-s cinkeys+=0=break: */
......@@ -120,7 +120,6 @@ namespace cppcanvas
// mxBufferBitmap content
CanvasSharedPtr mpCanvas;
rendering::RenderState maState;
const double mnAlpha;
};
......@@ -151,8 +150,7 @@ namespace cppcanvas
mxBufferBitmap(),
maLastTransformation(),
mpCanvas( rCanvas ),
maState(),
mnAlpha( 1.0 )
maState()
{
tools::initRenderState(maState,rState);
implSetupTransform( maState, rDstPoint );
......@@ -400,27 +398,10 @@ namespace cppcanvas
aLocalState.DeviceColor = maState.DeviceColor;
#endif
if( ::rtl::math::approxEqual(mnAlpha, 1.0) )
{
// no further alpha changes necessary -> draw directly
mpCanvas->getUNOCanvas()->drawBitmap( mxBufferBitmap,
mpCanvas->getViewState(),
aLocalState );
}
else
{
// add alpha modulation value to DeviceColor
uno::Sequence<rendering::ARGBColor> aCols(1);
aCols[0] = rendering::ARGBColor( mnAlpha, 1.0, 1.0, 1.0);
aLocalState.DeviceColor =
mpCanvas->getUNOCanvas()->getDevice()->getDeviceColorSpace()->convertFromARGB(
aCols);
mpCanvas->getUNOCanvas()->drawBitmapModulated( mxBufferBitmap,
mpCanvas->getViewState(),
aLocalState );
}
// no further alpha changes necessary -> draw directly
mpCanvas->getUNOCanvas()->drawBitmap( mxBufferBitmap,
mpCanvas->getViewState(),
aLocalState );
return true;
}
......
......@@ -99,7 +99,7 @@ private:
long _barheight, _barspace, _textBaseline;
double _fXPos, _fYPos;
double _fWidth, _fHeight;
const long _xoffset, _yoffset;
static constexpr long _xoffset = 12, _yoffset = 18;
public:
SplashScreen();
......@@ -172,8 +172,6 @@ SplashScreen::SplashScreen()
, _fYPos(-1.0)
, _fWidth(-1.0)
, _fHeight(-1.0)
, _xoffset(12)
, _yoffset(18)
{
loadConfig();
}
......
......@@ -168,7 +168,6 @@ protected:
bool mbInitialized;
int mnRefCount;
bool mbRequestLegacyContext;
bool const mbUseDoubleBufferedRendering;
bool mbVCLOnly;
int mnFramebufferCount;
......
......@@ -275,7 +275,7 @@ void ScTpSubTotalGroup::FillListBoxes()
i++;
}
// subsequent initialization of the constant:
const_cast<sal_uInt16&>(nFieldCount) = i;
nFieldCount = i;
}
}
......
......@@ -60,7 +60,7 @@ protected:
const sal_uInt16 nWhichSubTotals;
const ScSubTotalParam& rSubTotalData;
SCCOL nFieldArr[SC_MAXFIELDS];
const sal_uInt16 nFieldCount;
sal_uInt16 nFieldCount;
private:
void Init ();
......
......@@ -22,11 +22,12 @@
namespace sd { namespace sidebar {
static const int gnBorderWidth(3);
static const int gnBorderHeight(3);
PreviewValueSet::PreviewValueSet (vcl::Window* pParent)
: ValueSet (pParent, WB_TABSTOP),
maPreviewSize(10,10),
mnBorderWidth(3),
mnBorderHeight(3),
mnMaxColumnCount(-1)
{
SetStyle (
......@@ -88,7 +89,7 @@ sal_uInt16 PreviewValueSet::CalculateColumnCount (int nWidth) const
int nColumnCount = 0;
if (nWidth > 0)
{
nColumnCount = nWidth / (maPreviewSize.Width() + 2*mnBorderWidth);
nColumnCount = nWidth / (maPreviewSize.Width() + 2*gnBorderWidth);
if (nColumnCount < 1)
nColumnCount = 1;
else if (mnMaxColumnCount>0 && nColumnCount>mnMaxColumnCount)
......@@ -116,7 +117,7 @@ sal_Int32 PreviewValueSet::GetPreferredHeight (sal_Int32 nWidth)
int nRowCount (CalculateRowCount(CalculateColumnCount(nWidth)));
int nItemHeight (maPreviewSize.Height());
return nRowCount * (nItemHeight + 2*mnBorderHeight);
return nRowCount * (nItemHeight + 2*gnBorderHeight);
}
} } // end of namespace sd::sidebar
......
......@@ -51,8 +51,6 @@ protected:
private:
Link<const MouseEvent&,void> maRightMouseClickHandler;
Size maPreviewSize;
const int mnBorderWidth;
const int mnBorderHeight;
const int mnMaxColumnCount;
sal_uInt16 CalculateColumnCount (int nWidth) const;
......
......@@ -387,7 +387,6 @@ class SwOrderIter
{
const SwPageFrame *m_pPage;
const SdrObject *m_pCurrent;
const bool m_bFlysOnly;
public:
SwOrderIter( const SwPageFrame *pPage );
......
......@@ -2242,8 +2242,7 @@ SwBorderAttrs *SwBorderAttrAccess::Get()
SwOrderIter::SwOrderIter( const SwPageFrame *pPg ) :
m_pPage( pPg ),
m_pCurrent( nullptr ),
m_bFlysOnly( true )
m_pCurrent( nullptr )
{
}
......@@ -2260,7 +2259,7 @@ void SwOrderIter::Top()
for (SwAnchoredObject* i : *pObjs)
{
const SdrObject* pObj = i->GetDrawObj();
if ( m_bFlysOnly && dynamic_cast<const SwVirtFlyDrawObj*>( pObj) == nullptr )
if ( dynamic_cast<const SwVirtFlyDrawObj*>( pObj) == nullptr )
continue;
sal_uInt32 nTmp = pObj->GetOrdNumDirect();
if ( nTmp >= nTopOrd )
......@@ -2286,7 +2285,7 @@ const SdrObject *SwOrderIter::Bottom()
for (SwAnchoredObject* i : *pObjs)
{
const SdrObject* pObj = i->GetDrawObj();
if ( m_bFlysOnly && dynamic_cast<const SwVirtFlyDrawObj*>( pObj) == nullptr )
if ( dynamic_cast<const SwVirtFlyDrawObj*>( pObj) == nullptr )
continue;
sal_uInt32 nTmp = pObj->GetOrdNumDirect();
if ( nTmp < nBotOrd )
......@@ -2314,7 +2313,7 @@ const SdrObject *SwOrderIter::Next()
for (SwAnchoredObject* i : *pObjs)
{
const SdrObject* pObj = i->GetDrawObj();
if ( m_bFlysOnly && dynamic_cast<const SwVirtFlyDrawObj*>( pObj) == nullptr )
if ( dynamic_cast<const SwVirtFlyDrawObj*>( pObj) == nullptr )
continue;
sal_uInt32 nTmp = pObj->GetOrdNumDirect();
if ( nTmp > nCurOrd && nTmp < nOrd )
......@@ -2342,7 +2341,7 @@ void SwOrderIter::Prev()
for (SwAnchoredObject* i : *pObjs)
{
const SdrObject* pObj = i->GetDrawObj();
if ( m_bFlysOnly && dynamic_cast<const SwVirtFlyDrawObj*>( pObj) == nullptr )
if ( dynamic_cast<const SwVirtFlyDrawObj*>( pObj) == nullptr )
continue;
sal_uInt32 nTmp = pObj->GetOrdNumDirect();
if ( nTmp < nCurOrd && nTmp >= nOrd )
......
......@@ -69,7 +69,6 @@ MacroWarning::MacroWarning(weld::Window* pParent, bool _bWithSignatures)
, mxEnableBtn(m_xBuilder->weld_button("ok"))
, mxDisableBtn(m_xBuilder->weld_button("cancel"))
, mpInfos ( nullptr )
, mbSignedMode ( true )
, mbShowSignatures ( _bWithSignatures )
, mnActSecLevel ( 0 )
{
......@@ -105,7 +104,7 @@ IMPL_LINK_NOARG(MacroWarning, ViewSignsBtnHdl, weld::Button&, void)
IMPL_LINK_NOARG(MacroWarning, EnableBtnHdl, weld::Button&, void)
{
if (mbSignedMode && mxAlwaysTrustCB->get_active())
if (mxAlwaysTrustCB->get_active())
{ // insert path into trusted path list
uno::Reference< security::XDocumentDigitalSignatures > xD(
security::DocumentDigitalSignatures::createWithVersion(comphelper::getProcessComponentContext(), maODFVersion));
......
......@@ -46,7 +46,6 @@ private:
OUString maODFVersion;
const css::uno::Sequence< css::security::DocumentSignatureInformation >* mpInfos;
const bool mbSignedMode; // mode of dialog (signed / unsigned macros)
const bool mbShowSignatures;
sal_Int32 mnActSecLevel;
......
......@@ -105,7 +105,7 @@ class VisualBackendTestWindow : public WorkWindow
private:
Timer maUpdateTimer;
std::vector<std::chrono::high_resolution_clock::time_point> mTimePoints;
unsigned char const mnNumberOfTests;
static constexpr unsigned char gnNumberOfTests = 6;
unsigned char mnTest;
bool mbAnimate;
ScopedVclPtr<VirtualDevice> mpVDev;
......@@ -113,9 +113,8 @@ private:
public:
VisualBackendTestWindow()
: WorkWindow(nullptr, WB_APP | WB_STDWORK)
, mnNumberOfTests(6)
, mnTest(10 * mnNumberOfTests)
, mbAnimate(mnTest % mnNumberOfTests == mnNumberOfTests - 1)
, mnTest(10 * gnNumberOfTests)
, mbAnimate(mnTest % gnNumberOfTests == gnNumberOfTests - 1)
, mpVDev(VclPtr<VirtualDevice>::Create())
{
maUpdateTimer.SetInvokeHandler(LINK(this, VisualBackendTestWindow, updateHdl));
......@@ -145,7 +144,7 @@ public:
if (nCode == KEY_BACKSPACE || nCode == KEY_SPACE)
{
if (mnTest % mnNumberOfTests == mnNumberOfTests - 1)
if (mnTest % gnNumberOfTests == gnNumberOfTests - 1)
{
mbAnimate = true;
maUpdateTimer.Start();
......@@ -377,7 +376,7 @@ public:
virtual void Paint(vcl::RenderContext& rRenderContext, const tools::Rectangle& /*rRect*/) override
{
if (mnTest % mnNumberOfTests == mnNumberOfTests - 1)
if (mnTest % gnNumberOfTests == gnNumberOfTests - 1)
{
rRenderContext.SetBackground(Wallpaper(COL_GREEN));
......@@ -449,23 +448,23 @@ public:
tools::Rectangle aRectangle;
size_t index = 0;
if (mnTest % mnNumberOfTests == 0)
if (mnTest % gnNumberOfTests == 0)
{
testRectangles(rRenderContext, nWidth, nHeight);
}
else if (mnTest % mnNumberOfTests == 1)
else if (mnTest % gnNumberOfTests == 1)
{
testFilledRectangles(rRenderContext, nWidth, nHeight);
}
else if (mnTest % mnNumberOfTests == 2)
else if (mnTest % gnNumberOfTests == 2)
{
testLines(rRenderContext, nWidth, nHeight);
}
else if (mnTest % mnNumberOfTests == 3)
else if (mnTest % gnNumberOfTests == 3)
{
testBitmaps(rRenderContext, nWidth, nHeight);
}
else if (mnTest % mnNumberOfTests == 4)
else if (mnTest % gnNumberOfTests == 4)
{
std::vector<tools::Rectangle> aRegions = setupRegions(3, 2, nWidth, nHeight);
......
......@@ -88,7 +88,7 @@ private:
typedef std::unordered_map<rtl::Reference<LogicalFontInstance>,std::unique_ptr<FreetypeFont>,IFSD_Hash,IFSD_Equal > FontList;
FontList maFontList;
sal_uLong const mnMaxSize; // max overall cache size in bytes
static constexpr sal_uLong gnMaxSize = 1500000; // max overall cache size in bytes
mutable sal_uLong mnBytesUsed;
mutable long mnLruIndex;
mutable int mnGlyphCount;
......
......@@ -529,9 +529,7 @@ bool WinOpenGLContext::ImplInit()
0, 0, 0 // Layer Masks Ignored
};
if (mbUseDoubleBufferedRendering)
PixelFormatFront.dwFlags |= PFD_DOUBLEBUFFER;
PixelFormatFront.dwFlags |= PFD_DOUBLEBUFFER;
PixelFormatFront.dwFlags |= PFD_DRAW_TO_WINDOW;
// we must check whether can set the MSAA
......@@ -539,7 +537,7 @@ bool WinOpenGLContext::ImplInit()
bool bMultiSampleSupport = false;
if (!mbVCLOnly)
bMultiSampleSupport = InitMultisample(PixelFormatFront, WindowPix, mbUseDoubleBufferedRendering, false);
bMultiSampleSupport = InitMultisample(PixelFormatFront, WindowPix, /*bUseDoubleBufferedRendering*/true, false);
else
VCL_GL_INFO("Skipping multisample detection for VCL.");
......
......@@ -302,7 +302,7 @@ bool X11OpenGLContext::ImplInit()
if (hasCreateContextAttribsARB && !mbRequestLegacyContext)
{
int best_fbc = -1;
GLXFBConfig* pFBC = getFBConfig(m_aGLWin.dpy, m_aGLWin.win, best_fbc, mbUseDoubleBufferedRendering);
GLXFBConfig* pFBC = getFBConfig(m_aGLWin.dpy, m_aGLWin.win, best_fbc, /*bUseDoubleBufferedRendering*/true);
if (pFBC && best_fbc != -1)
{
......
......@@ -1690,8 +1690,6 @@ void PDFWriterImpl::PDFPage::appendWaveLine( sal_Int32 nWidth, sal_Int32 nY, sal
m_nCurrentStructElement( 0 ),
m_bEmitStructure( true ),
m_nNextFID( 1 ),
m_nInheritedPageWidth( 595 ), // default A4
m_nInheritedPageHeight( 842 ), // default A4
m_nCurrentPage( -1 ),
m_nCatalogObject(0),
m_nSignatureObject( -1 ),
......@@ -4992,8 +4990,8 @@ bool PDFWriterImpl::emitCatalog()
sal_Int32 nMediaBoxHeight = 0;
if( m_aPages.empty() ) // sanity check, this should not happen
{
nMediaBoxWidth = m_nInheritedPageWidth;
nMediaBoxHeight = m_nInheritedPageHeight;
nMediaBoxWidth = g_nInheritedPageWidth;
nMediaBoxHeight = g_nInheritedPageHeight;
}
else
{
......@@ -5109,14 +5107,14 @@ bool PDFWriterImpl::emitCatalog()
aLine.append( "/OpenAction[" );
aLine.append( aInitPageRef.makeStringAndClear() );
aLine.append( " /FitH " );
aLine.append( m_nInheritedPageHeight );//Open fit width
aLine.append( g_nInheritedPageHeight );//Open fit width
aLine.append( "]\n" );
break;
case PDFWriter::FitVisible :
aLine.append( "/OpenAction[" );
aLine.append( aInitPageRef.makeStringAndClear() );
aLine.append( " /FitBH " );
aLine.append( m_nInheritedPageHeight );//Open fit visible
aLine.append( g_nInheritedPageHeight );//Open fit visible
aLine.append( "]\n" );
break;
case PDFWriter::ActionZoom :
......
......@@ -188,7 +188,7 @@ public:
// appends a horizontal waveline with vertical offset (helper for drawWaveLine)
void appendWaveLine( sal_Int32 nLength, sal_Int32 nYOffset, sal_Int32 nDelta, OStringBuffer& rBuffer ) const;
double getHeight() const { return m_nPageHeight ? m_nPageHeight : m_pWriter->m_nInheritedPageHeight; }
double getHeight() const { return m_nPageHeight ? m_nPageHeight : PDFWriterImpl::g_nInheritedPageHeight; }
};
friend struct PDFPage;
......@@ -693,8 +693,8 @@ private:
sal_Int32 m_nNextFID;
PDFFontCache m_aFontCache;
sal_Int32 const m_nInheritedPageWidth; // in inch/72
sal_Int32 const m_nInheritedPageHeight; // in inch/72
static constexpr sal_Int32 g_nInheritedPageWidth = 595; // default A4 in inch/72
static constexpr sal_Int32 g_nInheritedPageHeight = 842; // default A4 in inch/72
sal_Int32 m_nCurrentPage;
sal_Int32 m_nCatalogObject;
......
......@@ -55,7 +55,6 @@ OpenGLContext::OpenGLContext():
mbInitialized(false),
mnRefCount(0),
mbRequestLegacyContext(false),
mbUseDoubleBufferedRendering(true),
mbVCLOnly(false),
mnFramebufferCount(0),
mpCurrentFramebuffer(nullptr),
......
......@@ -33,8 +33,7 @@
static GlyphCache* pInstance = nullptr;
GlyphCache::GlyphCache()
: mnMaxSize( 1500000 ),
mnBytesUsed(sizeof(GlyphCache)),
: mnBytesUsed(sizeof(GlyphCache)),
mnLruIndex(0),
mnGlyphCount(0),
mpCurrentGCFont(nullptr)
......@@ -226,7 +225,7 @@ FreetypeFont* GlyphCache::CacheFont(LogicalFontInstance* pFontInstance)
void GlyphCache::UncacheFont( FreetypeFont& rFreetypeFont )
{
if( (rFreetypeFont.Release() <= 0) && (mnMaxSize <= mnBytesUsed) )
if( (rFreetypeFont.Release() <= 0) && (gnMaxSize <= mnBytesUsed) )
{
mpCurrentGCFont = &rFreetypeFont;
GarbageCollect();
......@@ -290,7 +289,7 @@ inline void GlyphCache::AddedGlyph( GlyphData& rGlyphData )
++mnGlyphCount;
mnBytesUsed += sizeof( rGlyphData );
UsingGlyph( rGlyphData );
if( mnBytesUsed > mnMaxSize )
if( mnBytesUsed > gnMaxSize )
GarbageCollect();
}
......
......@@ -277,7 +277,7 @@ private:
std::array<LZWCTreeNode, 4096>
mpTable; // LZW compression data
LZWCTreeNode* mpPrefix; // the compression is as same as the TIFF compression
sal_uInt16 const mnDataSize;
static constexpr sal_uInt16 gnDataSize = 8;
sal_uInt16 const mnClearCode;
sal_uInt16 const mnEOICode;
sal_uInt16 mnTableSize;
......@@ -298,11 +298,10 @@ public:
LZWEncoder::LZWEncoder(osl::File* pOutputFile) :
Ascii85Encoder (pOutputFile),
mpPrefix(nullptr),
mnDataSize(8),
mnClearCode(1 << mnDataSize),
mnClearCode(1 << gnDataSize),
mnEOICode(mnClearCode + 1),
mnTableSize(mnEOICode + 1),
mnCodeSize(mnDataSize + 1),
mnCodeSize(gnDataSize + 1),
mnOffset(32), // free bits in dwShift
mdwShift(0)
{
......@@ -375,7 +374,7 @@ LZWEncoder::EncodeByte (sal_uInt8 nByte )
for (i = 0; i < mnClearCode; i++)
mpTable[i].mpFirstChild = nullptr;
mnCodeSize = mnDataSize + 1;
mnCodeSize = gnDataSize + 1;
mnTableSize = mnEOICode + 1;
}
else
......
......@@ -90,9 +90,7 @@ SalGtkFilePicker::SalGtkFilePicker( const uno::Reference< uno::XComponentContext
mbPreviewState( false ),
mHID_Preview( 0 ),
m_pPreview( nullptr ),
m_pPseudoFilter( nullptr ),
m_PreviewImageWidth( 256 ),
m_PreviewImageHeight( 256 )
m_pPseudoFilter( nullptr )
{
int i;
......@@ -1414,7 +1412,7 @@ sal_Int32 SAL_CALL SalGtkFilePicker::getAvailableWidth()
OSL_ASSERT( m_pDialog != nullptr );
return m_PreviewImageWidth;
return g_PreviewImageWidth;
}
sal_Int32 SAL_CALL SalGtkFilePicker::getAvailableHeight()
......@@ -1423,7 +1421,7 @@ sal_Int32 SAL_CALL SalGtkFilePicker::getAvailableHeight()
OSL_ASSERT( m_pDialog != nullptr );
return m_PreviewImageHeight;
return g_PreviewImageHeight;
}
void SAL_CALL SalGtkFilePicker::setImage( sal_Int16 /*aImageFormat*/, const uno::Any& /*aImage*/ )
......@@ -1509,8 +1507,8 @@ void SalGtkFilePicker::update_preview_cb( GtkFileChooser *file_chooser, SalGtkFi
{
pixbuf = gdk_pixbuf_new_from_file_at_size(
filename,
pobjFP->m_PreviewImageWidth,
pobjFP->m_PreviewImageHeight, nullptr );
g_PreviewImageWidth,
g_PreviewImageHeight, nullptr );
have_preview = ( pixbuf != nullptr );
......
......@@ -202,8 +202,8 @@ class SalGtkFilePicker : public SalGtkPicker, public SalGtkFilePicker_Base
gulong mHID_Preview;
GtkWidget* m_pPreview;
GtkFileFilter* m_pPseudoFilter;
sal_Int32 const m_PreviewImageWidth;
sal_Int32 const m_PreviewImageHeight;
static constexpr sal_Int32 g_PreviewImageWidth = 256;
static constexpr sal_Int32 g_PreviewImageHeight = 256;
GtkWidget *getWidget( sal_Int16 nControlId, GType *pType = nullptr);
......
......@@ -200,7 +200,7 @@ public:
sal_Int32 nBrightness;
double const fGamma;
sal_Int32 const nFillColor;
static constexpr sal_Int32 nFillColor = 0xffffffff;
drawing::ColorMode eColorMode;
......@@ -260,7 +260,6 @@ public:
,nContrast(0)
,nBrightness(0)
,fGamma( -1.0 )
,nFillColor( 0xffffffff )
,eColorMode( drawing::ColorMode_STANDARD )
,nCurrentBorderLine(BORDER_TOP)
,bIsGraphic(false)
......@@ -388,6 +387,10 @@ public:
}
};
#if !HAVE_CPP_INLINE_VARIABLES
constexpr sal_Int32 GraphicImport_Impl::nFillColor;
#endif
GraphicImport::GraphicImport(uno::Reference<uno::XComponentContext> const& xComponentContext,
uno::Reference<lang::XMultiServiceFactory> const& xTextFactory,
DomainMapper& rDMapper,
......@@ -1276,7 +1279,7 @@ uno::Reference<text::XTextContent> GraphicImport::createGraphicObject(uno::Refer
uno::makeAny(m_pImpl->fGamma