[Libreoffice-commits] core.git: 4 commits - bin/lint-ui.py extensions/source sal/osl sal/qa sal/rtl uui/uiconfig writerfilter/source writerperfect/uiconfig
Noel (via logerrit)
logerrit at kemper.freedesktop.org
Mon Oct 5 12:47:09 UTC 2020
bin/lint-ui.py | 12 +++++++++++-
extensions/source/propctrlr/defaultforminspection.cxx | 2 +-
extensions/source/propctrlr/formcomponenthandler.cxx | 5 ++---
extensions/source/propctrlr/objectinspectormodel.cxx | 2 +-
extensions/source/update/check/updatecheck.cxx | 2 +-
sal/osl/unx/profile.cxx | 6 +++---
sal/qa/osl/pipe/osl_Pipe.cxx | 3 +--
sal/rtl/byteseq.cxx | 7 ++++---
sal/rtl/ustring.cxx | 4 +---
uui/uiconfig/ui/simplenameclash.ui | 1 +
writerfilter/source/dmapper/NumberingManager.cxx | 8 ++++----
writerfilter/source/rtftok/rtfsdrimport.cxx | 2 +-
writerperfect/uiconfig/ui/wpftencodingdialog.ui | 1 +
13 files changed, 32 insertions(+), 23 deletions(-)
New commits:
commit 68961653f9af29b332039e50459e29d33c623013
Author: Noel <noelgrandin at gmail.com>
AuthorDate: Fri Oct 2 13:22:04 2020 +0200
Commit: Noel Grandin <noel.grandin at collabora.co.uk>
CommitDate: Mon Oct 5 14:43:18 2020 +0200
lint-ui: validate has_default and can_default
check that if a widget has has_default=='True', then it also
has can_default=='True'
Change-Id: Ie51d9d8fff6d7cc0cc42a09331f59e7ef6d559be
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/103834
Reviewed-by: Caolán McNamara <caolanm at redhat.com>
Reviewed-by: Noel Grandin <noel.grandin at collabora.co.uk>
Tested-by: Jenkins
diff --git a/bin/lint-ui.py b/bin/lint-ui.py
index 4f13320a23f3..a4631e760b4c 100755
--- a/bin/lint-ui.py
+++ b/bin/lint-ui.py
@@ -76,6 +76,17 @@ def check_top_level_widget(element):
lint_assert(border_width.text == BORDER_WIDTH,
"Top level 'border_width' property should be " + BORDER_WIDTH, border_width)
+ # check that any widget which has 'has-default' also has 'can-default'
+ for widget in element.findall('.//object'):
+ if not widget.attrib['class']:
+ continue
+ widget_type = widget.attrib['class']
+ has_defaults = widget.findall("./property[@name='has_default']")
+ if len(has_defaults) > 0 and has_defaults[0].text == "True":
+ can_defaults = widget.findall("./property[@name='can_default']")
+ lint_assert(len(can_defaults)>0 and can_defaults[0].text == "True",
+ "has_default without can_default in " + widget_type + " with id = '" + widget.attrib['id'] + "'", widget)
+
def check_button_box_spacing(element):
spacing = element.findall("property[@name='spacing']")
lint_assert(len(spacing) > 0 and spacing[0].text == BUTTON_BOX_SPACING,
@@ -121,7 +132,6 @@ def check_check_buttons(root):
if len(radio_underlines) < 1:
lint_assert(False, "No use_underline in GtkCheckButton with id = '" + radio.attrib['id'] + "'", radio)
-
def check_frames(root):
frames = [element for element in root.findall('.//object') if element.attrib['class'] == 'GtkFrame']
for frame in frames:
diff --git a/uui/uiconfig/ui/simplenameclash.ui b/uui/uiconfig/ui/simplenameclash.ui
index 9c5f39213e0c..04d0bb16ef8f 100644
--- a/uui/uiconfig/ui/simplenameclash.ui
+++ b/uui/uiconfig/ui/simplenameclash.ui
@@ -56,6 +56,7 @@
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="has_default">True</property>
+ <property name="can_default">True</property>
<property name="receives_default">True</property>
</object>
<packing>
diff --git a/writerperfect/uiconfig/ui/wpftencodingdialog.ui b/writerperfect/uiconfig/ui/wpftencodingdialog.ui
index 067cfb72bad3..d0aff9435ac2 100644
--- a/writerperfect/uiconfig/ui/wpftencodingdialog.ui
+++ b/writerperfect/uiconfig/ui/wpftencodingdialog.ui
@@ -28,6 +28,7 @@
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="has_default">True</property>
+ <property name="can_default">True</property>
<property name="receives_default">True</property>
<property name="use_stock">True</property>
<property name="yalign">0.62000000476837158</property>
commit 9742c9e40fc2e104eaa806b8f02014055d37ed68
Author: Noel <noelgrandin at gmail.com>
AuthorDate: Mon Oct 5 09:28:25 2020 +0200
Commit: Noel Grandin <noel.grandin at collabora.co.uk>
CommitDate: Mon Oct 5 14:42:36 2020 +0200
loplugin:reducevarscope in extensions
Change-Id: I6ba76a8e50d564cd72edc5a3438faef5f3c71bc6
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/103948
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin at collabora.co.uk>
diff --git a/extensions/source/propctrlr/defaultforminspection.cxx b/extensions/source/propctrlr/defaultforminspection.cxx
index b4f491051f5b..809279330ae8 100644
--- a/extensions/source/propctrlr/defaultforminspection.cxx
+++ b/extensions/source/propctrlr/defaultforminspection.cxx
@@ -180,9 +180,9 @@ namespace pcr
return;
}
- sal_Int32 nMinHelpTextLines( 0 ), nMaxHelpTextLines( 0 );
if ( arguments.size() == 2 )
{ // constructor: "createWithHelpSection( long, long )"
+ sal_Int32 nMinHelpTextLines( 0 ), nMaxHelpTextLines( 0 );
if ( !( arguments[0] >>= nMinHelpTextLines ) || !( arguments[1] >>= nMaxHelpTextLines ) )
throw IllegalArgumentException( OUString(), *this, 0 );
createWithHelpSection( nMinHelpTextLines, nMaxHelpTextLines );
diff --git a/extensions/source/propctrlr/formcomponenthandler.cxx b/extensions/source/propctrlr/formcomponenthandler.cxx
index fd71ce028da8..669aa0cacd6a 100644
--- a/extensions/source/propctrlr/formcomponenthandler.cxx
+++ b/extensions/source/propctrlr/formcomponenthandler.cxx
@@ -395,11 +395,10 @@ namespace pcr
sal_Int32 nOldIdCount = aOldIdStrings.getLength();
for ( i = 0; i < nNewCount; ++i )
{
- OUString aOldIdStr;
OUString aOldPureIdStr;
if( i < nOldIdCount )
{
- aOldIdStr = pOldIdStrings[i];
+ OUString aOldIdStr = pOldIdStrings[i];
aOldPureIdStr = aOldIdStr.copy( 1 );
}
OUString aNewPureIdStr = pNewPureIds[i];
@@ -1681,7 +1680,6 @@ namespace pcr
{
bool bAccuracy = (PROPERTY_ID_DECIMAL_ACCURACY == nActuatingPropId);
sal_uInt16 nNewDigits = 0;
- bool bUseSep = false;
if ( bAccuracy )
{
if( ! (_rNewValue >>= nNewDigits) )
@@ -1689,6 +1687,7 @@ namespace pcr
}
else
{
+ bool bUseSep = false;
if( ! (_rNewValue >>= bUseSep) )
SAL_WARN("extensions.propctrlr", "actuatingPropertyChanged: unable to get property " << PROPERTY_ID_SHOWTHOUSANDSEP);
}
diff --git a/extensions/source/propctrlr/objectinspectormodel.cxx b/extensions/source/propctrlr/objectinspectormodel.cxx
index 99447d5c8a3f..6ed1db687aa0 100644
--- a/extensions/source/propctrlr/objectinspectormodel.cxx
+++ b/extensions/source/propctrlr/objectinspectormodel.cxx
@@ -127,9 +127,9 @@ namespace pcr
return;
}
- sal_Int32 nMinHelpTextLines( 0 ), nMaxHelpTextLines( 0 );
if ( arguments.size() == 3 )
{ // constructor: "createWithHandlerFactoriesAndHelpSection( any[], long, long )"
+ sal_Int32 nMinHelpTextLines( 0 ), nMaxHelpTextLines( 0 );
impl_verifyArgument_throw( arguments[1] >>= nMinHelpTextLines, 2 );
impl_verifyArgument_throw( arguments[2] >>= nMaxHelpTextLines, 3 );
createWithHandlerFactoriesAndHelpSection( factories, nMinHelpTextLines, nMaxHelpTextLines );
diff --git a/extensions/source/update/check/updatecheck.cxx b/extensions/source/update/check/updatecheck.cxx
index 485b4e140947..997dc7eccd60 100644
--- a/extensions/source/update/check/updatecheck.cxx
+++ b/extensions/source/update/check/updatecheck.cxx
@@ -1058,10 +1058,10 @@ UpdateCheck::enableDownload(bool enable, bool paused)
{
OSL_ASSERT(nullptr == m_pThread);
- State eState = DISABLED;
if( enable )
{
m_pThread = new DownloadThread(m_aCondition, m_xContext, this, m_aUpdateInfo.Sources[0].URL );
+ State eState = DISABLED;
if( !paused )
{
eState = DOWNLOADING;
commit 8e34b8ce575bab7e71de20db10cc49ae956d7ff1
Author: Noel <noelgrandin at gmail.com>
AuthorDate: Mon Oct 5 09:27:56 2020 +0200
Commit: Noel Grandin <noel.grandin at collabora.co.uk>
CommitDate: Mon Oct 5 14:42:12 2020 +0200
loplugin:reducevarscope in writerfilter
Change-Id: I19f12959a04be07cdd2083a6aa519943d069fae6
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/103947
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin at collabora.co.uk>
diff --git a/writerfilter/source/dmapper/NumberingManager.cxx b/writerfilter/source/dmapper/NumberingManager.cxx
index 4e66b5aff0ea..a0ff5002e1ee 100644
--- a/writerfilter/source/dmapper/NumberingManager.cxx
+++ b/writerfilter/source/dmapper/NumberingManager.cxx
@@ -874,12 +874,12 @@ void ListsManager::lcl_sprm( Sprm& rSprm )
// Respect only the aspect ratio of the picture, not its size.
awt::Size aPrefSize = xShape->getSize();
- // See SwDefBulletConfig::InitFont(), default height is 14.
- const int nFontHeight = 14;
- // Point -> mm100.
- const int nHeight = nFontHeight * 35;
if ( aPrefSize.Height * aPrefSize.Width != 0 )
{
+ // See SwDefBulletConfig::InitFont(), default height is 14.
+ const int nFontHeight = 14;
+ // Point -> mm100.
+ const int nHeight = nFontHeight * 35;
int nWidth = (nHeight * aPrefSize.Width) / aPrefSize.Height;
awt::Size aSize( convertMm100ToTwip(nWidth), convertMm100ToTwip(nHeight) );
diff --git a/writerfilter/source/rtftok/rtfsdrimport.cxx b/writerfilter/source/rtftok/rtfsdrimport.cxx
index 473e42395444..64177ee88f91 100644
--- a/writerfilter/source/rtftok/rtfsdrimport.cxx
+++ b/writerfilter/source/rtftok/rtfsdrimport.cxx
@@ -778,9 +778,9 @@ void RTFSdrImport::resolve(RTFShape& rShape, bool bClose, ShapeOrPict const shap
oRelativeWidth = 100;
}
nRelativeWidthRelation = text::RelOrientation::FRAME;
- sal_Int16 const nVertOrient = text::VertOrientation::CENTER;
if (xPropertySet.is())
{
+ sal_Int16 const nVertOrient = text::VertOrientation::CENTER;
xPropertySet->setPropertyValue("VertOrient", uno::makeAny(nVertOrient));
}
}
commit 8ec183056dd7a954d9af7b26432d7680a31e9896
Author: Noel <noelgrandin at gmail.com>
AuthorDate: Mon Oct 5 09:28:37 2020 +0200
Commit: Noel Grandin <noel.grandin at collabora.co.uk>
CommitDate: Mon Oct 5 14:41:59 2020 +0200
loplugin:reducevarscope in sal
Change-Id: I2ce95de07b8e0952a1e778e65940b30597396aa6
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/103949
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin at collabora.co.uk>
diff --git a/sal/osl/unx/profile.cxx b/sal/osl/unx/profile.cxx
index 31cfc8575f73..354fe626f390 100644
--- a/sal/osl/unx/profile.cxx
+++ b/sal/osl/unx/profile.cxx
@@ -488,12 +488,10 @@ sal_Bool SAL_CALL osl_writeProfileString(oslProfile Profile,
const char* pszEntry,
const char* pszString)
{
- sal_uInt32 i;
bool bRet = false;
sal_uInt32 NoEntry;
char* pStr;
char* Line = nullptr;
- osl_TProfileSection* pSec;
osl_TProfileImpl* pProfile = nullptr;
osl_TProfileImpl* pTmpProfile = static_cast<osl_TProfileImpl*>(Profile);
@@ -525,6 +523,7 @@ sal_Bool SAL_CALL osl_writeProfileString(oslProfile Profile,
if (! (pProfile->m_Flags & osl_Profile_SYSTEM))
{
+ osl_TProfileSection* pSec;
if ((pSec = findEntry(pProfile, pszSection, pszEntry, &NoEntry)) == nullptr)
{
Line[0] = '\0';
@@ -559,6 +558,7 @@ sal_Bool SAL_CALL osl_writeProfileString(oslProfile Profile,
if (NoEntry >= pSec->m_NoEntries)
{
+ sal_uInt32 i;
if (pSec->m_NoEntries > 0)
i = pSec->m_Entries[pSec->m_NoEntries - 1].m_Line + 1;
else
@@ -581,7 +581,7 @@ sal_Bool SAL_CALL osl_writeProfileString(oslProfile Profile,
}
else
{
- i = pSec->m_Entries[NoEntry].m_Line;
+ sal_uInt32 i = pSec->m_Entries[NoEntry].m_Line;
free(pProfile->m_Lines[i]);
pProfile->m_Lines[i] = strdup(Line);
setEntry(pProfile, pSec, NoEntry, i, pProfile->m_Lines[i], strlen(pszEntry));
diff --git a/sal/qa/osl/pipe/osl_Pipe.cxx b/sal/qa/osl/pipe/osl_Pipe.cxx
index f9e2bb16174e..eef77e998380 100644
--- a/sal/qa/osl/pipe/osl_Pipe.cxx
+++ b/sal/qa/osl/pipe/osl_Pipe.cxx
@@ -802,7 +802,6 @@ namespace osl_StreamPipe
void SAL_CALL run( ) override
{
//create pipe.
- sal_Int32 nChars;
printf("listen\n");
if ( !aListenPipe.is() )
{
@@ -819,7 +818,7 @@ namespace osl_StreamPipe
}
printf("write\n");
// write to pipe
- nChars = aConnectionPipe.write( m_pTestString1.getStr(), m_pTestString1.getLength() + 1 );
+ sal_Int32 nChars = aConnectionPipe.write( m_pTestString1.getStr(), m_pTestString1.getLength() + 1 );
if ( nChars < 0)
{
printf("server write failed! \n");
diff --git a/sal/rtl/byteseq.cxx b/sal/rtl/byteseq.cxx
index c78a1e22f43a..3c4967d5456d 100644
--- a/sal/rtl/byteseq.cxx
+++ b/sal/rtl/byteseq.cxx
@@ -39,13 +39,14 @@ static sal_Sequence aEmpty_rtl_ByteSeq =
void SAL_CALL rtl_byte_sequence_reference2One(
sal_Sequence ** ppSequence ) SAL_THROW_EXTERN_C()
{
- sal_Sequence * pSequence, * pNew;
+ sal_Sequence * pSequence;
OSL_ENSURE( ppSequence, "### null ptr!" );
pSequence = *ppSequence;
if (pSequence->nRefCount > 1)
{
+ sal_Sequence *pNew;
sal_Int32 nElements = pSequence->nElements;
if (nElements)
{
@@ -75,7 +76,7 @@ void SAL_CALL rtl_byte_sequence_reference2One(
void SAL_CALL rtl_byte_sequence_realloc(
sal_Sequence ** ppSequence, sal_Int32 nSize ) SAL_THROW_EXTERN_C()
{
- sal_Sequence * pSequence, * pNew;
+ sal_Sequence * pSequence;
sal_Int32 nElements;
assert(ppSequence && "### null ptr!");
@@ -87,7 +88,7 @@ void SAL_CALL rtl_byte_sequence_realloc(
if (pSequence->nRefCount > 1) // split
{
- pNew = static_cast<sal_Sequence *>(malloc( SAL_SEQUENCE_HEADER_SIZE + nSize ));
+ sal_Sequence *pNew = static_cast<sal_Sequence *>(malloc( SAL_SEQUENCE_HEADER_SIZE + nSize ));
if ( pNew != nullptr )
{
diff --git a/sal/rtl/ustring.cxx b/sal/rtl/ustring.cxx
index cbadddc6a98e..7b6687f74bd5 100644
--- a/sal/rtl/ustring.cxx
+++ b/sal/rtl/ustring.cxx
@@ -1054,14 +1054,12 @@ void SAL_CALL rtl_uString_internConvert( rtl_uString ** newStr,
static void
internRelease (rtl_uString *pThis)
{
- oslMutex pPoolMutex;
-
rtl_uString *pFree = nullptr;
if ( SAL_STRING_REFCOUNT(
osl_atomic_decrement( &(pThis->refCount) ) ) == 0)
{
RTL_LOG_STRING_INTERN_DELETE(pThis);
- pPoolMutex = getInternMutex();
+ oslMutex pPoolMutex = getInternMutex();
osl_acquireMutex( pPoolMutex );
rtl_str_hash_remove (pThis);
More information about the Libreoffice-commits
mailing list