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

loplugin:oncevar

extend oncevar to any POD type

Change-Id: Ia98ee0a67f183e40fb0c38477760124b2c411dc0
Reviewed-on: https://gerrit.libreoffice.org/40564Tested-by: 's avatarJenkins <ci@libreoffice.org>
Reviewed-by: 's avatarNoel Grandin <noel.grandin@collabora.co.uk>
üst 242a796a
......@@ -133,7 +133,7 @@ namespace basctl
const sal_Char* pEventName;
void (DocumentEventListener::*listenerMethod)( const ScriptDocument& _rDocument );
};
EventEntry aEvents[] = {
EventEntry const aEvents[] = {
{ "OnNew", &DocumentEventListener::onDocumentCreated },
{ "OnLoad", &DocumentEventListener::onDocumentOpened },
{ "OnSave", &DocumentEventListener::onDocumentSave },
......@@ -145,7 +145,7 @@ namespace basctl
{ "OnModeChanged", &DocumentEventListener::onDocumentModeChanged }
};
for (EventEntry & aEvent : aEvents)
for (EventEntry const & aEvent : aEvents)
{
if ( !_rEvent.EventName.equalsAscii( aEvent.pEventName ) )
continue;
......
......@@ -149,8 +149,8 @@ CheckBox::CheckBox(vcl::Window* pParent, WinBits nStyle)
, eMode(ObjectMode::Module)
, m_aDocument(ScriptDocument::getApplicationScriptDocument())
{
long aTabs_[] = { 1, 12 }; // TabPos needs at least one...
// 12 because of the CheckBox
long const aTabs_[] = { 1, 12 }; // TabPos needs at least one...
// 12 because of the CheckBox
SetTabs( aTabs_ );
Init();
}
......@@ -499,7 +499,7 @@ LibPage::LibPage(vcl::Window * pParent)
m_pLibBox->EnableInplaceEditing(true);
m_pLibBox->SetStyle( WB_HSCROLL | WB_BORDER | WB_TABSTOP );
long aTabs[] = { 2, 30, 120 };
long const aTabs[] = { 2, 30, 120 };
m_pLibBox->SetTabs( aTabs, MapUnit::MapPixel );
FillListBox();
......
......@@ -1098,11 +1098,6 @@ void SfxLibraryContainer::init_Impl( const OUString& rInitialDocumentURL,
mxSFI->move( aFolderUserBasic, aPrevFolder );
mxSFI->move( aFolderTmp, aFolderUserBasic );
OUString aUserSearchStr("vnd.sun.star.expand:$UNO_USER_PACKAGES_CACHE");
OUString aSharedSearchStr("vnd.sun.star.expand:$UNO_SHARED_PACKAGES_CACHE");
OUString const aBundledSearchStr("vnd.sun.star.expand:$BUNDLED_EXTENSIONS");
OUString const aInstSearchStr("$(INST)");
Sequence< OUString > aNames = pPrevCont->getElementNames();
const OUString* pNames = aNames.getConstArray();
sal_Int32 nNameCount = aNames.getLength();
......@@ -1129,10 +1124,10 @@ void SfxLibraryContainer::init_Impl( const OUString& rInitialDocumentURL,
{
OUString aStorageURL = pImplLib->maUnexpandedStorageURL;
bool bCreateLink = true;
if( aStorageURL.indexOf( aUserSearchStr ) != -1 ||
aStorageURL.indexOf( aSharedSearchStr ) != -1 ||
aStorageURL.indexOf( aBundledSearchStr ) != -1 ||
aStorageURL.indexOf( aInstSearchStr ) != -1 )
if( aStorageURL.indexOf( "vnd.sun.star.expand:$UNO_USER_PACKAGES_CACHE" ) != -1 ||
aStorageURL.indexOf( "vnd.sun.star.expand:$UNO_SHARED_PACKAGES_CACHE" ) != -1 ||
aStorageURL.indexOf( "vnd.sun.star.expand:$BUNDLED_EXTENSIONS" ) != -1 ||
aStorageURL.indexOf( "$(INST)" ) != -1 )
{
bCreateLink = false;
}
......@@ -2207,14 +2202,12 @@ Reference< XNameAccess > SAL_CALL SfxLibraryContainer::createLibraryLink
maNameContainer->insertByName( Name, aElement );
maModifiable.setModified( true );
OUString aUserSearchStr("vnd.sun.star.expand:$UNO_USER_PACKAGES_CACHE");
OUString aSharedSearchStr("vnd.sun.star.expand:$UNO_SHARED_PACKAGES_CACHE");
OUString const aBundledSearchStr("vnd.sun.star.expand:$BUNDLED_EXTENSIONS");
if( StorageURL.indexOf( aUserSearchStr ) != -1 )
if( StorageURL.indexOf( "vnd.sun.star.expand:$UNO_USER_PACKAGES_CACHE" ) != -1 )
{
pNewLib->mbExtension = true;
}
else if( StorageURL.indexOf( aSharedSearchStr ) != -1 || StorageURL.indexOf( aBundledSearchStr ) != -1 )
else if( StorageURL.indexOf( "vnd.sun.star.expand:$UNO_SHARED_PACKAGES_CACHE" ) != -1
|| StorageURL.indexOf( "vnd.sun.star.expand:$BUNDLED_EXTENSIONS" ) != -1 )
{
pNewLib->mbExtension = true;
pNewLib->mbReadOnly = true;
......
......@@ -596,7 +596,7 @@ void Chart2ExportTest::testEmbeddingsGrabBag()
xTextDocumentPropertySet->getPropertyValue("InteropGrabBag") >>= aGrabBag;
CPPUNIT_ASSERT(aGrabBag.hasElements()); // Grab Bag not empty
bool bEmbeddings = false;
const char* testEmbeddedFileNames[3] = {"word/embeddings/Microsoft_Excel_Worksheet3.xlsx",
const char* const testEmbeddedFileNames[] {"word/embeddings/Microsoft_Excel_Worksheet3.xlsx",
"word/embeddings/Microsoft_Excel_Worksheet2.xlsx",
"word/embeddings/Microsoft_Excel_Worksheet1.xlsx"};
for(int i = 0; i < aGrabBag.getLength(); ++i)
......@@ -1121,7 +1121,7 @@ void Chart2ExportTest::testEmbeddingsOleObjectGrabBag()
xTextDocumentPropertySet->getPropertyValue("InteropGrabBag") >>= aGrabBag;
CPPUNIT_ASSERT(aGrabBag.hasElements()); // Grab Bag not empty
bool bEmbeddings = false;
const char* testEmbeddedFileNames[1] = {"word/embeddings/oleObject1.bin"};
const char* const testEmbeddedFileNames[] = {"word/embeddings/oleObject1.bin"};
for(int i = 0; i < aGrabBag.getLength(); ++i)
{
if (aGrabBag[i].Name == "OOXEmbeddings")
......
......@@ -268,7 +268,7 @@ void Chart2ImportTest::testErrorBarFormatting()
void Chart2ImportTest::testSteppedLines()
{
const sal_Int32 MAXSHEET = 14;
chart2::CurveStyle curveStyle[] = {
chart2::CurveStyle const curveStyle[] = {
chart2::CurveStyle_LINES,
chart2::CurveStyle_CUBIC_SPLINES,
chart2::CurveStyle_B_SPLINES,
......
......@@ -840,9 +840,9 @@ void OpenGL3DRenderer::RenderLine3D(const Polygon3DInfo& polygon)
{
CHECK_GL_ERROR();
glUseProgram(maResources.m_CommonProID);
PosVecf3 trans = {0.0f, 0, 0.0};
PosVecf3 angle = {0.0f, 0.0f, 0.0f};
PosVecf3 scale = {1.0f, 1.0f, 1.0f};
PosVecf3 const trans = {0.0f, 0, 0.0};
PosVecf3 const angle = {0.0f, 0.0f, 0.0f};
PosVecf3 const scale = {1.0f, 1.0f, 1.0f};
MoveModelf(trans, angle, scale);
m_Model = m_GlobalScaleMatrix * m_Model;
m_3DMVP = m_3DProjection * m_3DView * m_Model;
......@@ -959,9 +959,9 @@ void OpenGL3DRenderer::RenderPolygon3D(const Polygon3DInfo& polygon)
//move the circle to the pos, and scale using the xScale and Y scale
Vertices3D *pointList = polygon.verticesList[i];
Normals3D *normalList = polygon.normalsList[i];
PosVecf3 trans = {0.0f, 0.0f, 0.0};
PosVecf3 angle = {0.0f, 0.0f, 0.0f};
PosVecf3 scale = {1.0f, 1.0f, 1.0f};
PosVecf3 const trans = {0.0f, 0.0f, 0.0};
PosVecf3 const angle = {0.0f, 0.0f, 0.0f};
PosVecf3 const scale = {1.0f, 1.0f, 1.0f};
MoveModelf(trans, angle, scale);
m_Model = m_GlobalScaleMatrix * m_Model;
glm::mat3 normalMatrix(m_Model);
......@@ -2059,9 +2059,9 @@ void OpenGL3DRenderer::RenderTextShape()
CHECK_GL_ERROR();
for (TextInfo & textInfo : m_TextInfoList)
{
PosVecf3 trans = {0, 0, 0};
PosVecf3 angle = {0.0f, 0.0f, 0.0f};
PosVecf3 scale = {1.0, 1.0, 1.0f};
PosVecf3 const trans = {0, 0, 0};
PosVecf3 const angle = {0.0f, 0.0f, 0.0f};
PosVecf3 const scale = {1.0, 1.0, 1.0f};
MoveModelf(trans, angle, scale);
m_Model = m_GlobalScaleMatrix * m_Model;
glm::mat4 aMVP = m_3DProjection * m_3DView * m_Model;
......
......@@ -159,8 +159,8 @@ int OpenGLRender::InitOpenGL()
glBindBuffer(GL_ARRAY_BUFFER, 0);
glEnable(GL_LIGHTING);
GLfloat light_direction[] = { 0.0 , 0.0 , 1.0 };
GLfloat materialDiffuse[] = { 1.0 , 1.0 , 1.0 , 1.0};
GLfloat const light_direction[] = { 0.0 , 0.0 , 1.0 };
GLfloat const materialDiffuse[] = { 1.0 , 1.0 , 1.0 , 1.0};
glLightfv(GL_LIGHT0, GL_SPOT_DIRECTION, light_direction);
glMaterialfv(GL_FRONT,GL_DIFFUSE,materialDiffuse);
glEnable(GL_LIGHT0);
......@@ -192,9 +192,9 @@ int OpenGLRender::RenderLine2FBO()
CHECK_GL_ERROR();
glLineWidth(m_fLineWidth);
size_t listNum = m_Line2DShapePointList.size();
PosVecf3 trans = {0.0f, 0.0f, 0.0f};
PosVecf3 angle = {0.0f, 0.0f, 0.0f};
PosVecf3 scale = {1.0f, 1.0f, 1.0f};
PosVecf3 const trans = {0.0f, 0.0f, 0.0f};
PosVecf3 const angle = {0.0f, 0.0f, 0.0f};
PosVecf3 const scale = {1.0f, 1.0f, 1.0f};
MoveModelf(trans, angle, scale);
m_MVP = m_Projection * m_View * m_Model;
for (size_t i = 0; i < listNum; i++)
......@@ -421,9 +421,9 @@ int OpenGLRender::RenderBubble2FBO()
{
//move the circle to the pos, and scale using the xScale and Y scale
Bubble2DPointList &pointList = m_Bubble2DShapePointList.front();
PosVecf3 trans = {pointList.x, pointList.y, m_fZStep};
PosVecf3 angle = {0.0f, 0.0f, 0.0f};
PosVecf3 scale = {pointList.xScale / 2, pointList.yScale / 2 , 1.0f};
PosVecf3 const trans = {pointList.x, pointList.y, m_fZStep};
PosVecf3 const angle = {0.0f, 0.0f, 0.0f};
PosVecf3 const scale = {pointList.xScale / 2, pointList.yScale / 2 , 1.0f};
MoveModelf(trans, angle, scale);
m_MVP = m_Projection * m_View * m_Model;
//render to fbo
......@@ -520,9 +520,9 @@ int OpenGLRender::RenderRectangleShape(bool bBorder, bool bFill)
//move the circle to the pos, and scale using the xScale and Y scale
RectanglePointList &pointList = m_RectangleShapePointList.front();
{
PosVecf3 trans = {0, 0, 0};
PosVecf3 angle = {0.0f, 0.0f, 0.0f};
PosVecf3 scale = {1, 1, 1.0f};
PosVecf3 const trans = {0, 0, 0};
PosVecf3 const angle = {0.0f, 0.0f, 0.0f};
PosVecf3 const scale = {1, 1, 1.0f};
MoveModelf(trans, angle, scale);
m_MVP = m_Projection * m_View * m_Model;
}
......@@ -570,9 +570,9 @@ int OpenGLRender::RenderRectangleShape(bool bBorder, bool bFill)
{
if(bFill)
{
PosVecf3 trans = {0.0, 0.0, Z_STEP };
PosVecf3 angle = {0.0f, 0.0f, 0.0f};
PosVecf3 scale = {1, 1, 1.0f};
PosVecf3 const trans = {0.0, 0.0, Z_STEP };
PosVecf3 const angle = {0.0f, 0.0f, 0.0f};
PosVecf3 const scale = {1, 1, 1.0f};
MoveModelf(trans, angle, scale);
m_MVP = m_Projection * m_View * m_Model;
......@@ -704,9 +704,9 @@ int OpenGLRender::RenderTextShape()
for (size_t i = 0; i < listNum; i++)
{
TextInfo &textInfo = m_TextInfoList.front();
PosVecf3 trans = { textInfo.nDx, textInfo.nDy, 0};
PosVecf3 angle = {0.0f, 0.0f, float(textInfo.rotation)};
PosVecf3 scale = {1.0, 1.0, 1.0f};
PosVecf3 const trans = { textInfo.nDx, textInfo.nDy, 0};
PosVecf3 const angle = {0.0f, 0.0f, float(textInfo.rotation)};
PosVecf3 const scale = {1.0, 1.0, 1.0f};
MoveModelf(trans, angle, scale);
m_MVP = m_Projection * m_View * m_Model;
glBindBuffer(GL_ARRAY_BUFFER, m_VertexBuffer);
......@@ -813,9 +813,9 @@ int OpenGLRender::RenderArea2DShape()
glDisable(GL_MULTISAMPLE);
size_t listNum = m_Area2DShapePointList.size();
PosVecf3 trans = {0.0f, 0.0f, 0.0f};
PosVecf3 angle = {0.0f, 0.0f, 0.0f};
PosVecf3 scale = {1.0f, 1.0f, 1.0f};
PosVecf3 const trans = {0.0f, 0.0f, 0.0f};
PosVecf3 const angle = {0.0f, 0.0f, 0.0f};
PosVecf3 const scale = {1.0f, 1.0f, 1.0f};
MoveModelf(trans, angle, scale);
m_MVP = m_Projection * m_View * m_Model;
for (size_t i = 0; i < listNum; ++i)
......@@ -945,9 +945,9 @@ void OpenGLRender::GeneratePieSegment2D(double fInnerRadius, double fOutterRadiu
int OpenGLRender::RenderPieSegment2DShape(float fSize, float fPosX, float fPosY)
{
int listNum = m_PieSegment2DShapePointList.size();
PosVecf3 trans = {fPosX, fPosY, 0.0f};
PosVecf3 angle = {0.0f, 0.0f, 0.0f};
PosVecf3 scale = {fSize, fSize, 1.0f};
PosVecf3 const trans = {fPosX, fPosY, 0.0f};
PosVecf3 const angle = {0.0f, 0.0f, 0.0f};
PosVecf3 const scale = {fSize, fSize, 1.0f};
MoveModelf(trans, angle, scale);
m_MVP = m_Projection * m_View * m_Model;
......@@ -994,9 +994,9 @@ int OpenGLRender::RenderSymbol2DShape(float x, float y, sal_Int32 nSymbol)
glPointSize(20.f);
CHECK_GL_ERROR();
PosVecf3 trans = {0.0, 0.0, 0.0};
PosVecf3 angle = {0.0f, 0.0f, 0.0f};
PosVecf3 scale = {1.0, 1.0, 1.0f};
PosVecf3 const trans = {0.0, 0.0, 0.0};
PosVecf3 const angle = {0.0f, 0.0f, 0.0f};
PosVecf3 const scale = {1.0, 1.0, 1.0f};
MoveModelf(trans, angle, scale);
m_MVP = m_Projection * m_View * m_Model;
......
......@@ -149,8 +149,7 @@ bool CppuOptions::initOptions(int ac, char* av[], bool bCmdFile)
if (isValid("-C") || isValid("-CS"))
{
OString tmp("'-L' could not be combined with '-C' or '-CS' option");
throw IllegalArgument(tmp);
throw IllegalArgument("'-L' could not be combined with '-C' or '-CS' option");
}
m_options["-L"] = OString();
break;
......@@ -170,8 +169,7 @@ bool CppuOptions::initOptions(int ac, char* av[], bool bCmdFile)
if (isValid("-L") || isValid("-C"))
{
OString tmp("'-CS' could not be combined with '-L' or '-C' option");
throw IllegalArgument(tmp);
throw IllegalArgument("'-CS' could not be combined with '-L' or '-C' option");
}
m_options["-CS"] = OString();
break;
......@@ -189,8 +187,7 @@ bool CppuOptions::initOptions(int ac, char* av[], bool bCmdFile)
if (isValid("-L") || isValid("-CS"))
{
OString tmp("'-C' could not be combined with '-L' or '-CS' option");
throw IllegalArgument(tmp);
throw IllegalArgument("'-C' could not be combined with '-L' or '-CS' option");
}
m_options["-C"] = OString();
break;
......
......@@ -378,7 +378,7 @@ uno::Sequence< beans::NamedValue > OStorageHelper::CreatePackageEncryptionData(
aEncryptionData[nSha1Ind].Name = PACKAGE_ENCRYPTIONDATA_SHA1UTF8;
aEncryptionData[nSha1Ind + 1].Name = PACKAGE_ENCRYPTIONDATA_SHA1MS1252;
rtl_TextEncoding pEncoding[2] = { RTL_TEXTENCODING_UTF8, RTL_TEXTENCODING_MS_1252 };
rtl_TextEncoding const pEncoding[2] = { RTL_TEXTENCODING_UTF8, RTL_TEXTENCODING_MS_1252 };
for ( sal_Int32 nInd = 0; nInd < 2; nInd++ )
{
......
......@@ -114,6 +114,9 @@ public:
// macros managing to generate to a valid warning
if (fn == SRCDIR "/solenv/bin/concat-deps.c")
return;
// TODO bug in the plugin
if (fn == SRCDIR "/vcl/unx/generic/app/saldisp.cxx")
return;
TraverseDecl(compiler.getASTContext().getTranslationUnitDecl());
......@@ -220,6 +223,9 @@ public:
if (loplugin::TypeCheck(qt).LvalueReference().NonConst()) {
recordIgnore(expr->getArg(i));
}
if (loplugin::TypeCheck(qt).Pointer().NonConst()) {
recordIgnore(expr->getArg(i));
}
}
}
}
......@@ -235,6 +241,9 @@ public:
if (loplugin::TypeCheck(qt).LvalueReference().NonConst()) {
recordIgnore(expr->getArg(i));
}
if (loplugin::TypeCheck(qt).Pointer().NonConst()) {
recordIgnore(expr->getArg(i));
}
}
}
return true;
......@@ -321,9 +330,7 @@ bool OnceVar::VisitVarDecl( const VarDecl* varDecl )
return true;
}
auto const tc = loplugin::TypeCheck(varDecl->getType());
if (!varDecl->getType()->isScalarType()
&& !varDecl->getType()->isBooleanType()
&& !varDecl->getType()->isEnumeralType()
if (!varDecl->getType().isCXX11PODType(compiler.getASTContext())
&& !tc.Class("OString").Namespace("rtl").GlobalNamespace()
&& !tc.Class("OUString").Namespace("rtl").GlobalNamespace()
&& !tc.Class("OStringBuffer").Namespace("rtl").GlobalNamespace()
......@@ -346,22 +353,14 @@ bool OnceVar::VisitVarDecl( const VarDecl* varDecl )
if (auto e = dyn_cast<ExprWithCleanups>(initExpr)) {
initExpr = e->getSubExpr();
}
if (auto stringLit = dyn_cast<clang::StringLiteral>(initExpr)) {
if (isa<clang::StringLiteral>(initExpr)) {
foundStringLiteral = true;
// ignore long literals, helps to make the code more legible
if (stringLit->getLength() > 40) {
return true;
}
} else if (auto constructExpr = dyn_cast<CXXConstructExpr>(initExpr)) {
if (constructExpr->getNumArgs() == 0) {
foundStringLiteral = true; // i.e., empty string
} else {
auto stringLit2 = dyn_cast<clang::StringLiteral>(constructExpr->getArg(0));
foundStringLiteral = stringLit2 != nullptr;
// ignore long literals, helps to make the code more legible
if (stringLit2 && stringLit2->getLength() > 40) {
return true;
}
}
}
if (!foundStringLiteral) {
......
......@@ -24,6 +24,9 @@ template<typename T> void f() {
}
template void f<int>(); // needed for clang-cl
class Foo;
void method1(const Foo**);
int main() {
/* TODO
int i;
......@@ -55,6 +58,9 @@ int main() {
call_ref(s3);
OUString const s4("xxx");
call_value(s4);
const Foo* pInternalArgs[] = { nullptr };
method1(pInternalArgs);
}
/* vim:set shiftwidth=4 softtabstop=4 expandtab cinoptions=b1,g0,N-s cinkeys+=0=break: */
......@@ -218,7 +218,7 @@ namespace cppu_ifcontainer
void testOMultiTypeInterfaceContainerHelperInt32()
{
sal_Int32 pTypes[nTests] =
sal_Int32 const pTypes[nTests] =
{
0,
-1,
......@@ -239,7 +239,7 @@ namespace cppu_ifcontainer
typedef cppu::OMultiTypeInterfaceContainerHelperVar<
char const *, void, rtl::CStringEqual> StrContainer;
const char *pTypes[nTests] =
const char * const pTypes[nTests] =
{
"this_is", "such", "fun", "writing", "unit", "tests", "when", "it", "works", "anyway"
};
......
......@@ -488,7 +488,7 @@ IMPL_LINK( SpellDialog, CheckGrammarHdl, Button*, pBox, void )
void SpellDialog::StartSpellOptDlg_Impl()
{
sal_uInt16 aSpellInfos[] =
sal_uInt16 const aSpellInfos[] =
{
SID_ATTR_SPELL,SID_ATTR_SPELL,
SID_AUTOSPELL_CHECK, SID_AUTOSPELL_CHECK,
......
......@@ -238,7 +238,7 @@ void FmSearchDialog::Init(const OUString& strVisibleFields, const OUString& sIni
// fill the listboxes
// method of field comparison
const char* aResIds[] = {
const char* const aResIds[] = {
RID_STR_SEARCH_ANYWHERE,
RID_STR_SEARCH_BEGINNING,
RID_STR_SEARCH_END,
......
......@@ -57,11 +57,11 @@ CertPathDialog::CertPathDialog(vcl::Window* pParent)
try
{
mozilla::MozillaProductType productTypes[3] = {
mozilla::MozillaProductType const productTypes[3] = {
mozilla::MozillaProductType_Thunderbird,
mozilla::MozillaProductType_Firefox,
mozilla::MozillaProductType_Mozilla };
const char* productNames[3] = {
const char* const productNames[3] = {
"thunderbird",
"firefox",
"mozilla" };
......
......@@ -136,7 +136,7 @@ SvxJavaOptionsPage::SvxJavaOptionsPage( vcl::Window* pParent, const SfxItemSet&
pJavaListContainer->set_height_request(aControlSize.Height());
m_pJavaList = VclPtr<SvxJavaListBox>::Create(*pJavaListContainer, m_sAccessibilityText);
long aStaticTabs[]= { 4, 0, 0, 0, 0 };
long const aStaticTabs[]= { 4, 0, 0, 0, 0 };
m_pJavaList->SvSimpleTable::SetTabs( aStaticTabs );
......
......@@ -112,7 +112,7 @@ WebConnectionInfoDialog::WebConnectionInfoDialog(vcl::Window* pParent)
SvSimpleTableContainer *pPasswordsLBContainer = get<SvSimpleTableContainer>("logins");
m_pPasswordsLB = VclPtr<PasswordTable>::Create(*pPasswordsLBContainer, 0);
long aStaticTabs[]= { 2, 0, 0 };
long const aStaticTabs[]= { 2, 0, 0 };
m_pPasswordsLB->SetTabs( aStaticTabs );
m_pPasswordsLB->InsertHeaderItem( 1, get<FixedText>("website")->GetText(),
HeaderBarItemBits::LEFT | HeaderBarItemBits::VCENTER | HeaderBarItemBits::FIXEDPOS | HeaderBarItemBits::CLICKABLE | HeaderBarItemBits::UPARROW );
......
......@@ -1235,7 +1235,7 @@ void SvxBorderTabPage::UpdateRemoveAdjCellBorderCB( sal_uInt16 nPreset )
{ svx::FrameBorderType::Left,SvxBoxInfoItemValidFlags::LEFT },
{ svx::FrameBorderType::Right,SvxBoxInfoItemValidFlags::RIGHT },
};
SvxBoxItemLine eTypes2[] = {
SvxBoxItemLine const eTypes2[] = {
SvxBoxItemLine::TOP,
SvxBoxItemLine::BOTTOM,
SvxBoxItemLine::LEFT,
......
......@@ -1445,7 +1445,7 @@ void ODocumentDefinition::separateOpenCommandArguments( const Sequence< Property
{
::comphelper::NamedValueCollection aOpenCommandArguments( i_rOpenCommandArguments );
const char* pObjectDescriptorArgs[] =
const char* const pObjectDescriptorArgs[] =
{
"RecoveryStorage"
};
......
......@@ -782,7 +782,7 @@ void DesktopLOKTest::testWriterComments()
// Insert a comment at the beginning of the document and wait till the main
// loop grabs the focus, so characters end up in the annotation window.
TimeValue aTimeValue = {2 , 0}; // 2 seconds max
TimeValue const aTimeValue = {2 , 0}; // 2 seconds max
m_aCommandResultCondition.reset();
pDocument->pClass->postUnoCommand(pDocument, ".uno:InsertAnnotation", nullptr, true);
Scheduler::ProcessEventsToIdle();
......@@ -1064,7 +1064,7 @@ void DesktopLOKTest::testContextMenuCalc()
1, 4, 0);
Scheduler::ProcessEventsToIdle();
TimeValue aTimeValue = {2 , 0}; // 2 seconds max
TimeValue const aTimeValue = {2 , 0}; // 2 seconds max
m_aContextMenuCondition.wait(aTimeValue);
CPPUNIT_ASSERT( !m_aContextMenuResult.empty() );
......@@ -1174,7 +1174,7 @@ void DesktopLOKTest::testContextMenuWriter()
1, 4, 0);
Scheduler::ProcessEventsToIdle();
TimeValue aTimeValue = {2 , 0}; // 2 seconds max
TimeValue const aTimeValue = {2 , 0}; // 2 seconds max
m_aContextMenuCondition.wait(aTimeValue);
CPPUNIT_ASSERT( !m_aContextMenuResult.empty() );
......@@ -1230,7 +1230,7 @@ void DesktopLOKTest::testContextMenuImpress()
1, 4, 0);
Scheduler::ProcessEventsToIdle();
TimeValue aTimeValue = {2 , 0}; // 2 seconds max
TimeValue const aTimeValue = {2 , 0}; // 2 seconds max
m_aContextMenuCondition.wait(aTimeValue);
CPPUNIT_ASSERT( !m_aContextMenuResult.empty() );
......
......@@ -318,7 +318,7 @@ void EditRTFParser::SetAttrInDoc( SvxRTFItemStackType &rSet )
const MapUnit eSrcUnit = aRTFMapMode.GetMapUnit();
if (eDestUnit != eSrcUnit)
{
sal_uInt16 aFntHeightIems[3] = { EE_CHAR_FONTHEIGHT, EE_CHAR_FONTHEIGHT_CJK, EE_CHAR_FONTHEIGHT_CTL };
sal_uInt16 const aFntHeightIems[3] = { EE_CHAR_FONTHEIGHT, EE_CHAR_FONTHEIGHT_CJK, EE_CHAR_FONTHEIGHT_CTL };
for (unsigned short aFntHeightIem : aFntHeightIems)
{
if (SfxItemState::SET == rSet.GetAttrSet().GetItemState( aFntHeightIem, false, &pItem ))
......
......@@ -1877,7 +1877,7 @@ bool SvxBoxItem::PutValue( const uno::Any& rVal, sal_uInt8 nMemberId )
}
// WTH are the borders and the distances saved in different order?
SvxBoxItemLine nLines[4] = { SvxBoxItemLine::TOP, SvxBoxItemLine::BOTTOM, SvxBoxItemLine::LEFT, SvxBoxItemLine::RIGHT };
SvxBoxItemLine const nLines[4] = { SvxBoxItemLine::TOP, SvxBoxItemLine::BOTTOM, SvxBoxItemLine::LEFT, SvxBoxItemLine::RIGHT };
for ( sal_Int32 n = 4; n < 9; n++ )
{
sal_Int32 nDist = 0;
......@@ -4028,7 +4028,7 @@ sal_uInt16 SvxFrameDirectionItem::GetVersion( sal_uInt16 nFVer ) const
const char* getFrmDirResId(size_t nIndex)
{
const char* RID_SVXITEMS_FRMDIR[] =
const char* const RID_SVXITEMS_FRMDIR[] =
{
RID_SVXITEMS_FRMDIR_HORI_LEFT_TOP,
RID_SVXITEMS_FRMDIR_HORI_RIGHT_TOP,
......
......@@ -412,9 +412,9 @@ void OwnView_Impl::CreateNative()
if ( xNameAccess->hasByName( aSubStreamName ) )
{
sal_uInt8 aClassID[] =
sal_uInt8 const aClassID[] =
{ 0x00, 0x03, 0x00, 0x0C, 0x00, 0x00, 0x00, 0x00, 0xC0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x46 };
uno::Sequence< sal_Int8 > aPackageClassID( reinterpret_cast<sal_Int8*>(aClassID), 16 );
uno::Sequence< sal_Int8 > aPackageClassID( reinterpret_cast<sal_Int8 const *>(aClassID), 16 );
uno::Reference< io::XStream > xSubStream;
xNameAccess->getByName( aSubStreamName ) >>= xSubStream;
......
......@@ -1206,8 +1206,7 @@ Reference< awt::XControlModel > BibDataManager::createGridModel(const OUString&
xPropSet->setPropertyValue( "Name", makeAny( rName ) );
// set the name of the to-be-created control
OUString aControlName("com.sun.star.form.control.InteractionGridControl");
Any aAny; aAny <<= aControlName;
Any aAny(OUString("com.sun.star.form.control.InteractionGridControl"));
xPropSet->setPropertyValue( "DefaultControl",aAny );
// the helpURL
......
......@@ -123,14 +123,14 @@ namespace pcr
OSL_VERIFY( m_xControlModel->getPropertyValue( PROPERTY_CLASSID ) >>= nControlType );
// some lists
sal_Int16 nNumericCompatibleTypes[] = { DataTypeClass::DECIMAL, DataTypeClass::FLOAT, DataTypeClass::DOUBLE, 0 };
sal_Int16 nDateCompatibleTypes[] = { DataTypeClass::DATE, 0 };
sal_Int16 nTimeCompatibleTypes[] = { DataTypeClass::TIME, 0 };
sal_Int16 nCheckboxCompatibleTypes[] = { DataTypeClass::BOOLEAN, DataTypeClass::STRING, DataTypeClass::anyURI, 0 };
sal_Int16 nRadiobuttonCompatibleTypes[] = { DataTypeClass::STRING, DataTypeClass::anyURI, 0 };
sal_Int16 nFormattedCompatibleTypes[] = { DataTypeClass::DECIMAL, DataTypeClass::FLOAT, DataTypeClass::DOUBLE, DataTypeClass::DATETIME, DataTypeClass::DATE, DataTypeClass::TIME, 0 };
sal_Int16* pCompatibleTypes = nullptr;
sal_Int16 const nNumericCompatibleTypes[] = { DataTypeClass::DECIMAL, DataTypeClass::FLOAT, DataTypeClass::DOUBLE, 0 };
sal_Int16 const nDateCompatibleTypes[] = { DataTypeClass::DATE, 0 };
sal_Int16 const nTimeCompatibleTypes[] = { DataTypeClass::TIME, 0 };
sal_Int16 const nCheckboxCompatibleTypes[] = { DataTypeClass::BOOLEAN, DataTypeClass::STRING, DataTypeClass::anyURI, 0 };
sal_Int16 const nRadiobuttonCompatibleTypes[] = { DataTypeClass::STRING, DataTypeClass::anyURI, 0 };
sal_Int16 const nFormattedCompatibleTypes[] = { DataTypeClass::DECIMAL, DataTypeClass::FLOAT, DataTypeClass::DOUBLE, DataTypeClass::DATETIME, DataTypeClass::DATE, DataTypeClass::TIME, 0 };
sal_Int16 const * pCompatibleTypes = nullptr;
switch ( nControlType )
{
case FormComponentType::SPINBUTTON:
......
......@@ -619,7 +619,7 @@ bool Sane::Start( BitmapTransporter& rBitmap )
break;
}
#if (OSL_DEBUG_LEVEL > 0) || defined DBG_UTIL
const char* ppFormats[] = { "SANE_FRAME_GRAY", "SANE_FRAME_RGB",
const char* const ppFormats[] = { "SANE_FRAME_GRAY", "SANE_FRAME_RGB",
"SANE_FRAME_RED", "SANE_FRAME_GREEN",
"SANE_FRAME_BLUE", "Unknown !!!" };
fprintf( stderr, "Parameters for frame %d:\n", nStream );
......
......@@ -325,8 +325,7 @@ namespace frm
if (!bFoundIt)
{ // somebody gave us a format which we can't translate
OUString sMessage ("This control supports only a very limited number of formats.");
throw IllegalArgumentException(sMessage, nullptr, 2);
throw IllegalArgumentException("This control supports only a very limited number of formats.", nullptr, 2);
}
return bModified;
......
......@@ -60,8 +60,7 @@ void XMLNamespaces::addNamespace( const OUString& aName, const OUString& aValue
else
{
// a xml namespace without name is not allowed (e.g. "xmlns:" )
OUString aErrorMessage( "A xml namespace without name is not allowed!" );
throw SAXException( aErrorMessage, Reference< XInterface >(), Any() );
throw SAXException( "A xml namespace without name is not allowed!", Reference< XInterface >(), Any() );
}
}
......@@ -69,8 +68,7 @@ void XMLNamespaces::addNamespace( const OUString& aName, const OUString& aValue
{
// namespace should be reseted - as xml draft states this is only allowed
// for the default namespace - check and throw exception if check fails
OUString aErrorMessage( "Clearing xml namespace only allowed for default namespace!" );
throw SAXException( aErrorMessage, Reference< XInterface >(), Any() );
throw SAXException( "Clearing xml namespace only allowed for default namespace!", Reference< XInterface >(), Any() );
}
else
{
......@@ -108,8 +106,7 @@ OUString XMLNamespaces::applyNSToAttributeName( const OUString& aName ) const
else
{
// attribute with namespace but without name "namespace:" is not allowed!!
OUString aErrorMessage( "Attribute has no name only preceding namespace!" );