[Libreoffice-commits] core.git: 23 commits - connectivity/source cpputools/source editeng/source oox/source sal/rtl sc/source svtools/source svx/source sw/source tools/source ucb/source unotools/source vcl/qa vcl/source writerfilter/source
Caolán McNamara
caolanm at redhat.com
Tue Oct 28 08:07:12 PDT 2014
connectivity/source/manager/mdrivermanager.cxx | 26 +++++-
cpputools/source/unoexe/unoexe.cxx | 1
editeng/source/misc/svxacorr.cxx | 10 +-
oox/source/ole/axcontrol.cxx | 4 -
sal/rtl/alloc_cache.cxx | 2
sc/source/filter/html/htmlpars.cxx | 2
sc/source/filter/oox/workbookfragment.cxx | 1
sc/source/ui/unoobj/datauno.cxx | 2
svtools/source/control/ruler.cxx | 2
svx/source/fmcomp/dbaexchange.cxx | 2
svx/source/fmcomp/gridcell.cxx | 2
sw/source/core/unocore/unoobj.cxx | 2
sw/source/filter/ww8/ww8par2.cxx | 20 ++++-
sw/source/filter/ww8/ww8scan.cxx | 14 +++
sw/source/uibase/dialog/SwSpellDialogChildWindow.cxx | 2
sw/source/uibase/dochdl/swdtflvr.cxx | 12 ++-
sw/source/uibase/lingu/olmenu.cxx | 60 +++++++--------
sw/source/uibase/utlui/navipi.cxx | 4 -
tools/source/generic/poly.cxx | 6 +
ucb/source/ucp/ftp/ftpcontent.cxx | 2
unotools/source/config/configitem.cxx | 2
vcl/qa/cppunit/timer.cxx | 5 +
vcl/source/fontsubset/ttcr.cxx | 29 +++----
vcl/source/gdi/animate.cxx | 2
writerfilter/source/dmapper/DomainMapperTableManager.cxx | 17 +++-
25 files changed, 149 insertions(+), 82 deletions(-)
New commits:
commit 7acb634f58e86375f4a3cd4926a560679a45896f
Author: Caolán McNamara <caolanm at redhat.com>
Date: Tue Oct 28 13:39:08 2014 +0000
Resolves: fdo#85081 terminate if can't load kde addressbook
Change-Id: I3b1b78127d7d4080a23c0ac9f7d37706197de62c
diff --git a/connectivity/source/manager/mdrivermanager.cxx b/connectivity/source/manager/mdrivermanager.cxx
index 494a304..6e90f65 100644
--- a/connectivity/source/manager/mdrivermanager.cxx
+++ b/connectivity/source/manager/mdrivermanager.cxx
@@ -119,12 +119,26 @@ Any SAL_CALL ODriverEnumeration::nextElement( ) throw(NoSuchElementException, W
const DriverAccess& operator()( const DriverAccess& _rDescriptor ) const
{
- if ( !_rDescriptor.xDriver.is() )
- // we did not load this driver, yet
- if ( _rDescriptor.xComponentFactory.is() )
- // we have a factory for it
- const_cast< DriverAccess& >( _rDescriptor ).xDriver.set(
- _rDescriptor.xComponentFactory->createInstanceWithContext( mxContext ), css::uno::UNO_QUERY);
+ // we did not load this driver, yet
+ if (!_rDescriptor.xDriver.is())
+ {
+ // we have a factory for it
+ if (_rDescriptor.xComponentFactory.is())
+ {
+ DriverAccess& rDesc = const_cast<DriverAccess&>(_rDescriptor);
+ try
+ {
+ //load driver
+ rDesc.xDriver.set(
+ rDesc.xComponentFactory->createInstanceWithContext(mxContext), css::uno::UNO_QUERY);
+ }
+ catch (const Exception&)
+ {
+ //failure, abandon driver
+ rDesc.xComponentFactory.clear();
+ }
+ }
+ }
return _rDescriptor;
}
commit aa0499cefda1f808e6361e400d02a04cd4a0ef65
Author: Caolán McNamara <caolanm at redhat.com>
Date: Tue Oct 28 14:12:32 2014 +0000
coverity#982593 experiment with silencing Infinite loop
etc.
Change-Id: I1548d60280ab4f74fe023d026435a05f7865b516
diff --git a/cpputools/source/unoexe/unoexe.cxx b/cpputools/source/unoexe/unoexe.cxx
index f06b2dc..91d75b4 100644
--- a/cpputools/source/unoexe/unoexe.cxx
+++ b/cpputools/source/unoexe/unoexe.cxx
@@ -493,6 +493,7 @@ SAL_IMPLEMENT_MAIN()
nIndex = 0;
OUString aUnoUrlToken( aUnoUrl.getToken( 1, ';', nIndex ) );
+ // coverity[infinite_loop]
for (;;)
{
// accepting
diff --git a/sal/rtl/alloc_cache.cxx b/sal/rtl/alloc_cache.cxx
index 19591a8..be6cd4da 100644
--- a/sal/rtl/alloc_cache.cxx
+++ b/sal/rtl/alloc_cache.cxx
@@ -919,12 +919,14 @@ rtl_cache_deactivate (
/* cleanup cpu layer */
if ((mag = cache->m_cpu_curr) != 0)
{
+ // coverity[missing_lock]
cache->m_cpu_curr = 0;
rtl_cache_magazine_clear (cache, mag);
rtl_cache_free (mag_cache, mag);
}
if ((mag = cache->m_cpu_prev) != 0)
{
+ // coverity[missing_lock]
cache->m_cpu_prev = 0;
rtl_cache_magazine_clear (cache, mag);
rtl_cache_free (mag_cache, mag);
diff --git a/sc/source/filter/oox/workbookfragment.cxx b/sc/source/filter/oox/workbookfragment.cxx
index bacbc65..26bf3b4 100644
--- a/sc/source/filter/oox/workbookfragment.cxx
+++ b/sc/source/filter/oox/workbookfragment.cxx
@@ -328,6 +328,7 @@ void importSheetFragments( WorkbookFragment& rWorkbookHandler, SheetFragmentVect
nSheetsLeft++;
}
+ // coverity[infinite_loop]
while( nSheetsLeft > 0)
{
// This is a much more controlled re-enterancy hazard than
diff --git a/vcl/qa/cppunit/timer.cxx b/vcl/qa/cppunit/timer.cxx
index d432f8a..0732baa 100644
--- a/vcl/qa/cppunit/timer.cxx
+++ b/vcl/qa/cppunit/timer.cxx
@@ -104,6 +104,7 @@ void TimerTest::testDurations()
{
bool bDone = false;
TimerBool aTimer( aDurations[i], bDone );
+ // coverity[infinite_loop]
while( !bDone )
{
Application::Yield();
@@ -134,6 +135,7 @@ void TimerTest::testAutoTimer()
{
sal_Int32 nCount = 0;
AutoTimerCount aCount(1, nCount);
+ // coverity[infinite_loop]
while (nCount < 100) {
Application::Yield();
}
@@ -161,6 +163,7 @@ void TimerTest::testRecursiveTimer()
sal_Int32 nCount = 0;
YieldTimer aCount(5);
AutoTimerCount aCountUp( 3, nCount );
+ // coverity[infinite_loop]
while (nCount < 20)
Application::Yield();
}
@@ -194,8 +197,10 @@ void TimerTest::testSlowTimerCallback()
sal_Int32 nCount = 0;
AutoTimerCount aHighFreq(1, nCount);
SlowCallbackTimer aSlow(250, bBeenSlow);
+ // coverity[infinite_loop]
while (!bBeenSlow)
Application::Yield();
+ // coverity[infinite_loop]
while (nCount < 200)
Application::Yield();
}
commit 9e67149741bf753fd802737701117a095bea846f
Author: Caolán McNamara <caolanm at redhat.com>
Date: Tue Oct 28 13:41:07 2014 +0000
coverity#735332 Unchecked return value
the !isAfterLast should be sufficient
Change-Id: Iab45b70c24ae1f90c38178d261e467d9b1e3fa6c
diff --git a/svx/source/fmcomp/gridcell.cxx b/svx/source/fmcomp/gridcell.cxx
index 5dff48f..c8a9dcf 100644
--- a/svx/source/fmcomp/gridcell.cxx
+++ b/svx/source/fmcomp/gridcell.cxx
@@ -3102,7 +3102,7 @@ void DbFilterField::Update()
{
aStr = getFormattedValue(xDataField, xFormatter, aNullDate, nFormatKey, nKeyType);
aStringList.push_back(aStr);
- xListCursor->next();
+ (void)xListCursor->next();
}
// filling the entries for the combobox
commit 5651dd471ef66f8c510b6abe00304b48264b6148
Author: Caolán McNamara <caolanm at redhat.com>
Date: Tue Oct 28 12:56:38 2014 +0000
coverity#1157745 Unchecked return value
Change-Id: I06e8e946063dc54335f3b672105d5cd0b3ff71a4
diff --git a/svtools/source/control/ruler.cxx b/svtools/source/control/ruler.cxx
index d657542..1e1f36c 100644
--- a/svtools/source/control/ruler.cxx
+++ b/svtools/source/control/ruler.cxx
@@ -2376,7 +2376,7 @@ RulerType Ruler::GetType( const Point& rPos, sal_uInt16* pAryPos )
mnUpdateFlags &= ~RULER_UPDATE_DRAW;
}
- ImplHitTest( rPos, &aHitTest );
+ (void)ImplHitTest(rPos, &aHitTest);
// return values
if ( pAryPos )
commit 664d05f8a5c4c7bd98caa7d9757e7340b6c64705
Author: Caolán McNamara <caolanm at redhat.com>
Date: Tue Oct 28 12:53:26 2014 +0000
coverity#1078486 Unchecked return value
Change-Id: I762796b848aa8d8dd35b401e03bf40af18fb8e72
diff --git a/svx/source/fmcomp/dbaexchange.cxx b/svx/source/fmcomp/dbaexchange.cxx
index 489e441..92a70e4 100644
--- a/svx/source/fmcomp/dbaexchange.cxx
+++ b/svx/source/fmcomp/dbaexchange.cxx
@@ -343,7 +343,7 @@ namespace svx
return false;
OUString sFieldDescription;
- const_cast<TransferableDataHelper&>(_rData).GetString(nRecognizedFormat, sFieldDescription);
+ (void)const_cast<TransferableDataHelper&>(_rData).GetString(nRecognizedFormat, sFieldDescription);
const sal_Unicode cSeparator = sal_Unicode(11);
_rDatasource = sFieldDescription.getToken(0, cSeparator);
commit 85d0d3d0c2627c3f208ddc215d43ae0f93db5eba
Author: Caolán McNamara <caolanm at redhat.com>
Date: Tue Oct 28 12:52:45 2014 +0000
coverity#1078448 Unchecked return value
Change-Id: Icbdd0b6b19a91a3339c8635c112729b46232069e
diff --git a/sw/source/uibase/utlui/navipi.cxx b/sw/source/uibase/utlui/navipi.cxx
index a2c9038..0df9924 100644
--- a/sw/source/uibase/utlui/navipi.cxx
+++ b/sw/source/uibase/utlui/navipi.cxx
@@ -1153,7 +1153,9 @@ OUString SwNavigationPI::CreateDropFileName( TransferableDataHelper& rData )
else if( rData.HasFormat( nFmt = FORMAT_STRING ) ||
rData.HasFormat( nFmt = FORMAT_FILE ) ||
rData.HasFormat( nFmt = SOT_FORMATSTR_ID_FILENAME ))
- rData.GetString( nFmt, sFileName );
+ {
+ (void)rData.GetString(nFmt, sFileName);
+ }
else if( rData.HasFormat( nFmt = SOT_FORMATSTR_ID_SOLK ) ||
rData.HasFormat( nFmt = SOT_FORMATSTR_ID_NETSCAPE_BOOKMARK )||
rData.HasFormat( nFmt = SOT_FORMATSTR_ID_FILECONTENT ) ||
commit 2eab2dac4ec1855356c79a42a0e9de737f51905f
Author: Caolán McNamara <caolanm at redhat.com>
Date: Tue Oct 28 12:45:57 2014 +0000
coverity#735309 Unchecked return value
Change-Id: I15cbfb15054962998a058da1381a84bb667944ef
diff --git a/oox/source/ole/axcontrol.cxx b/oox/source/ole/axcontrol.cxx
index d4426c0..cb9e7d2 100644
--- a/oox/source/ole/axcontrol.cxx
+++ b/oox/source/ole/axcontrol.cxx
@@ -1057,13 +1057,13 @@ void AxCommandButtonModel::convertProperties( PropertyMap& rPropMap, const Contr
void AxCommandButtonModel::convertFromProperties( PropertySet& rPropSet, const ControlConverter& rConv )
{
- rPropSet.getProperty( maCaption, PROP_Label );
+ (void)rPropSet.getProperty(maCaption, PROP_Label);
bool bRes = false;
if ( rPropSet.getProperty( bRes, PROP_Enabled ) )
setFlag( mnFlags, AX_FLAGS_ENABLED, bRes );
if ( rPropSet.getProperty( bRes, PROP_MultiLine ) )
setFlag( mnFlags, AX_FLAGS_WORDWRAP, bRes );
- rPropSet.getProperty( mbFocusOnClick, PROP_FocusOnClick );
+ (void)rPropSet.getProperty(mbFocusOnClick, PROP_FocusOnClick);
rConv.convertToMSColor( rPropSet, PROP_TextColor, mnTextColor );
rConv.convertToMSColor( rPropSet, PROP_BackgroundColor, mnBackColor );
commit f338acb77c2823d5c1eb0499aa2b150a7b453ed6
Author: Caolán McNamara <caolanm at redhat.com>
Date: Tue Oct 28 12:43:40 2014 +0000
coverity#735305 Unchecked return value
Change-Id: I0f03b67a5df3427e78f70f2b86aba26024ea575f
diff --git a/editeng/source/misc/svxacorr.cxx b/editeng/source/misc/svxacorr.cxx
index 79d5c39..fc173d5 100644
--- a/editeng/source/misc/svxacorr.cxx
+++ b/editeng/source/misc/svxacorr.cxx
@@ -1422,8 +1422,8 @@ SvxAutoCorrectLanguageLists& SvxAutoCorrect::_GetLanguageList(
LanguageType eLang )
{
LanguageTag aLanguageTag( eLang);
- if(pLangTable->find(aLanguageTag) == pLangTable->end())
- CreateLanguageFile(aLanguageTag, true);
+ if (pLangTable->find(aLanguageTag) == pLangTable->end())
+ (void)CreateLanguageFile(aLanguageTag, true);
return *(pLangTable->find(aLanguageTag)->second);
}
@@ -1453,7 +1453,7 @@ void SvxAutoCorrect::SaveWrdSttExceptList(LanguageType eLang)
#endif
}
- // Adds a single word. The list will immediately be written to the file!
+// Adds a single word. The list will immediately be written to the file!
bool SvxAutoCorrect::AddCplSttException( const OUString& rNew,
LanguageType eLang )
{
@@ -1472,7 +1472,7 @@ bool SvxAutoCorrect::AddCplSttException( const OUString& rNew,
pLists = pLangTable->find(aLangTagUndetermined)->second;
}
OSL_ENSURE(pLists, "No auto correction data");
- return pLists->AddToCplSttExceptList(rNew);
+ return pLists ? pLists->AddToCplSttExceptList(rNew) : false;
}
// Adds a single word. The list will immediately be written to the file!
@@ -1494,7 +1494,7 @@ bool SvxAutoCorrect::AddWrtSttException( const OUString& rNew,
pLists = pLangTable->find(aLangTagUndetermined)->second;
}
OSL_ENSURE(pLists, "No auto correction file!");
- return pLists->AddToWrdSttExceptList(rNew);
+ return pLists ? pLists->AddToWrdSttExceptList(rNew) : false;
}
bool SvxAutoCorrect::GetPrevAutoCorrWord( SvxAutoCorrDoc& rDoc,
commit 459e080067370f1ddda55cdf43e13d9e1cf551fe
Author: Caolán McNamara <caolanm at redhat.com>
Date: Tue Oct 28 12:29:44 2014 +0000
coverity#704090 Unchecked return value
going to assume that this is correct
Change-Id: I47072dc668f200eacf0f6a6d7ccdad0c9d6bfa68
diff --git a/vcl/source/gdi/animate.cxx b/vcl/source/gdi/animate.cxx
index 308f1fe..7288847 100644
--- a/vcl/source/gdi/animate.cxx
+++ b/vcl/source/gdi/animate.cxx
@@ -684,7 +684,7 @@ bool Animation::Filter( BmpFilter eFilter, const BmpFilterParam* pFilterParam, c
for( size_t i = 0, n = maList.size(); ( i < n ) && bRet; ++i )
bRet = maList[ i ]->aBmpEx.Filter( eFilter, pFilterParam, pProgress );
- maBitmapEx.Filter( eFilter, pFilterParam, pProgress );
+ (void)maBitmapEx.Filter(eFilter, pFilterParam, pProgress);
}
else
bRet = false;
commit 313e304b67b519c7208d11a511c3b14a3369d297
Author: Caolán McNamara <caolanm at redhat.com>
Date: Tue Oct 28 12:22:40 2014 +0000
coverity#704089 Unchecked return value
rework code a little to help coverity out
Change-Id: I4aa253a579153ad389d4667a9676fff04aa00a34
diff --git a/vcl/source/fontsubset/ttcr.cxx b/vcl/source/fontsubset/ttcr.cxx
index fdc7d15..272ad1c 100644
--- a/vcl/source/fontsubset/ttcr.cxx
+++ b/vcl/source/fontsubset/ttcr.cxx
@@ -242,30 +242,29 @@ static void ProcessTables(TrueTypeCreator *);
int StreamToMemory(TrueTypeCreator *_this, sal_uInt8 **ptr, sal_uInt32 *length)
{
- sal_uInt16 numTables, searchRange=1, entrySelector=0, rangeShift;
+ sal_uInt16 searchRange=1, entrySelector=0, rangeShift;
sal_uInt32 s, offset, checkSumAdjustment = 0;
sal_uInt32 *p;
- int i=0, n;
sal_uInt8 *head = NULL; /* saved pointer to the head table data for checkSumAdjustment calculation */
- if ((n = listCount(_this->tables)) == 0) return SF_TTFORMAT;
+ if (listIsEmpty(_this->tables)) return SF_TTFORMAT;
ProcessTables(_this);
/* ProcessTables() adds 'loca' and 'hmtx' */
- n = listCount(_this->tables);
- numTables = (sal_uInt16) n;
+ sal_uInt16 numTables = listCount(_this->tables);
- TableEntry* te = (TableEntry*)scalloc(n, sizeof(TableEntry));
+ TableEntry* te = (TableEntry*)scalloc(numTables, sizeof(TableEntry));
+ TableEntry* e = te;
listToFirst(_this->tables);
- for (i = 0; i < n; i++) {
- GetRawData((TrueTypeTable *) listCurrent(_this->tables), &te[i].data, &te[i].length, &te[i].tag);
- listNext(_this->tables);
- }
+ do {
+ GetRawData((TrueTypeTable *)listCurrent(_this->tables), &e->data, &e->length, &e->tag);
+ ++e;
+ } while (listNext(_this->tables));
- qsort(te, n, sizeof(TableEntry), TableEntryCompareF);
+ qsort(te, numTables, sizeof(TableEntry), TableEntryCompareF);
do {
searchRange *= 2;
@@ -276,9 +275,9 @@ int StreamToMemory(TrueTypeCreator *_this, sal_uInt8 **ptr, sal_uInt32 *length)
entrySelector--;
rangeShift = numTables * 16 - searchRange;
- s = offset = 12 + 16 * n;
+ s = offset = 12 + 16 * numTables;
- for (i = 0; i < n; i++) {
+ for (int i = 0; i < numTables; ++i) {
s += (te[i].length + 3) & (sal_uInt32) ~3;
/* if ((te[i].length & 3) != 0) s += (4 - (te[i].length & 3)) & 3; */
}
@@ -293,7 +292,7 @@ int StreamToMemory(TrueTypeCreator *_this, sal_uInt8 **ptr, sal_uInt32 *length)
PutUInt16(rangeShift, ttf, 10, 1);
/* Table Directory */
- for (i = 0; i < n; i++) {
+ for (int i = 0; i < numTables; ++i) {
PutUInt32(te[i].tag, ttf + 12, 16 * i, 1);
PutUInt32(CheckSum((sal_uInt32 *) te[i].data, te[i].length), ttf + 12, 16 * i + 4, 1);
PutUInt32(offset, ttf + 12, 16 * i + 8, 1);
@@ -311,7 +310,7 @@ int StreamToMemory(TrueTypeCreator *_this, sal_uInt8 **ptr, sal_uInt32 *length)
free(te);
p = (sal_uInt32 *) ttf;
- for (i = 0; i < (int)s / 4; i++) checkSumAdjustment += p[i];
+ for (int i = 0; i < (int)s / 4; ++i) checkSumAdjustment += p[i];
PutUInt32(0xB1B0AFBA - checkSumAdjustment, head, 8, 1);
*ptr = ttf;
commit 7694719ce21718975099bbeff3335b279fb3ec49
Author: Caolán McNamara <caolanm at redhat.com>
Date: Tue Oct 28 12:11:06 2014 +0000
coverity#704086 Unchecked return value
following check is sufficient
Change-Id: Ibcf53293c8e862ab823ed422d1a7a59dcc0977cf
diff --git a/unotools/source/config/configitem.cxx b/unotools/source/config/configitem.cxx
index 854ad9f..3b6aa88 100644
--- a/unotools/source/config/configitem.cxx
+++ b/unotools/source/config/configitem.cxx
@@ -361,7 +361,7 @@ Sequence< sal_Bool > ConfigItem::GetReadOnlyStates(const com::sun::star::uno::Se
OUString sPath;
OUString sProperty;
- ::utl::splitLastFromConfigurationPath(sName,sPath,sProperty);
+ (void)::utl::splitLastFromConfigurationPath(sName,sPath,sProperty);
if (sPath.isEmpty() && sProperty.isEmpty())
{
OSL_FAIL("ConfigItem::IsReadonly()\nsplitt failed\n");
commit 5d78c65851d8da14b6370a40393b3fb8367d7e1a
Author: Caolán McNamara <caolanm at redhat.com>
Date: Tue Oct 28 12:09:10 2014 +0000
coverity#704085 Unchecked return value
other patterns aren't really the same as this one
Change-Id: Ie26fd5c01d156004f755017a859679e904a29520
diff --git a/ucb/source/ucp/ftp/ftpcontent.cxx b/ucb/source/ucp/ftp/ftpcontent.cxx
index d58ea9e..d903516 100644
--- a/ucb/source/ucp/ftp/ftpcontent.cxx
+++ b/ucb/source/ucp/ftp/ftpcontent.cxx
@@ -941,7 +941,7 @@ Sequence<Any> FTPContent::setPropertyValues(
if(evt.getLength()) {
// title has changed
notifyPropertiesChange(evt);
- exchange(new FTPContentIdentifier(m_aFTPURL.ident(false,false)));
+ (void)exchange(new FTPContentIdentifier(m_aFTPURL.ident(false,false)));
}
return ret;
commit d1f00da63c3b63bf02b7cf2380b2809a3010ec12
Author: Caolán McNamara <caolanm at redhat.com>
Date: Tue Oct 28 12:07:57 2014 +0000
coverity#704072 Unchecked return value
Change-Id: I3bd198fc21bb414a0b80e8234e22782e24e0477e
diff --git a/sw/source/uibase/lingu/olmenu.cxx b/sw/source/uibase/lingu/olmenu.cxx
index ce08077..2c1b0bb 100644
--- a/sw/source/uibase/lingu/olmenu.cxx
+++ b/sw/source/uibase/lingu/olmenu.cxx
@@ -748,44 +748,46 @@ void SwSpellPopup::Execute( sal_uInt16 nId )
{
}
} else {
- linguistic::AddEntryToDic( xDictionary,
- m_xSpellAlt->getWord(), false, OUString(), LANGUAGE_NONE );
+ OUString sWord(m_xSpellAlt->getWord());
+ sal_Int16 nAddRes = linguistic::AddEntryToDic( xDictionary,
+ sWord, false, OUString(), LANGUAGE_NONE );
+ if (DIC_ERR_NONE != nAddRes && !xDictionary->getEntry(sWord).is())
+ {
+ SvxDicError(&m_pSh->GetView().GetViewFrame()->GetWindow(), nAddRes);
+ }
}
}
else if ((MN_DICTIONARIES_START <= nId && nId <= MN_DICTIONARIES_END) || nId == MN_ADD_TO_DIC_SINGLE)
{
- OUString aWord( m_xSpellAlt->getWord() );
- OUString aDicName;
+ OUString sWord( m_xSpellAlt->getWord() );
+ OUString aDicName;
- if (MN_DICTIONARIES_START <= nId && nId <= MN_DICTIONARIES_END)
- {
- PopupMenu *pMenu = GetPopupMenu(MN_ADD_TO_DIC);
- aDicName = pMenu->GetItemText(nId);
- }
- else
- aDicName = m_aDicNameSingle;
+ if (MN_DICTIONARIES_START <= nId && nId <= MN_DICTIONARIES_END)
+ {
+ PopupMenu *pMenu = GetPopupMenu(MN_ADD_TO_DIC);
+ aDicName = pMenu->GetItemText(nId);
+ }
+ else
+ aDicName = m_aDicNameSingle;
- uno::Reference< linguistic2::XDictionary > xDic;
- uno::Reference< linguistic2::XSearchableDictionaryList > xDicList( SvxGetDictionaryList() );
- if (xDicList.is())
- xDic = xDicList->getDictionaryByName( aDicName );
+ uno::Reference< linguistic2::XDictionary > xDic;
+ uno::Reference< linguistic2::XSearchableDictionaryList > xDicList( SvxGetDictionaryList() );
+ if (xDicList.is())
+ xDic = xDicList->getDictionaryByName( aDicName );
- if (xDic.is())
+ if (xDic.is())
+ {
+ sal_Int16 nAddRes = linguistic::AddEntryToDic(xDic, sWord, false, OUString(), LANGUAGE_NONE);
+ // save modified user-dictionary if it is persistent
+ uno::Reference< frame::XStorable > xSavDic( xDic, uno::UNO_QUERY );
+ if (xSavDic.is())
+ xSavDic->store();
+
+ if (DIC_ERR_NONE != nAddRes && !xDic->getEntry(sWord).is())
{
- sal_Int16 nAddRes = linguistic::AddEntryToDic( xDic, aWord, false, OUString(), LANGUAGE_NONE );
- // save modified user-dictionary if it is persistent
- uno::Reference< frame::XStorable > xSavDic( xDic, uno::UNO_QUERY );
- if (xSavDic.is())
- xSavDic->store();
-
- if (DIC_ERR_NONE != nAddRes
- && !xDic->getEntry( aWord ).is())
- {
- SvxDicError(
- &m_pSh->GetView().GetViewFrame()->GetWindow(),
- nAddRes );
- }
+ SvxDicError(&m_pSh->GetView().GetViewFrame()->GetWindow(), nAddRes);
}
+ }
}
else if ( nId == MN_EXPLANATION_LINK && !m_sExplanationLink.isEmpty() )
{
commit 98b83c6a292c184f69b55e114c30212591884d0a
Author: Caolán McNamara <caolanm at redhat.com>
Date: Tue Oct 28 12:03:22 2014 +0000
coverity#704067 Unchecked return value
and
coverity#704068 Unchecked return value
those are ok I think
Change-Id: I7869c3f4200792d4bafafdff49735e8563d2e822
diff --git a/sw/source/uibase/dochdl/swdtflvr.cxx b/sw/source/uibase/dochdl/swdtflvr.cxx
index 14ce7d6..bf50042 100644
--- a/sw/source/uibase/dochdl/swdtflvr.cxx
+++ b/sw/source/uibase/dochdl/swdtflvr.cxx
@@ -2925,8 +2925,10 @@ bool SwTransferable::PasteSpecial( SwWrtShell& rSh, TransferableDataHelper& rDat
else
{
if( rData.HasFormat( SOT_FORMATSTR_ID_OBJECTDESCRIPTOR ) )
- rData.GetTransferableObjectDescriptor(
+ {
+ (void)rData.GetTransferableObjectDescriptor(
SOT_FORMATSTR_ID_OBJECTDESCRIPTOR, aDesc );
+ }
if( SwTransferable::_TestAllowedFormat( rData, SOT_FORMATSTR_ID_EMBED_SOURCE, nDest ))
pDlg->Insert( SOT_FORMATSTR_ID_EMBED_SOURCE, aEmptyOUStr );
@@ -2978,9 +2980,11 @@ void SwTransferable::FillClipFmtItem( const SwWrtShell& rSh,
else
{
TransferableObjectDescriptor aDesc;
- if( rData.HasFormat( SOT_FORMATSTR_ID_OBJECTDESCRIPTOR ) )
- ((TransferableDataHelper&)rData).GetTransferableObjectDescriptor(
- SOT_FORMATSTR_ID_OBJECTDESCRIPTOR, aDesc );
+ if (rData.HasFormat(SOT_FORMATSTR_ID_OBJECTDESCRIPTOR))
+ {
+ (void)const_cast<TransferableDataHelper&>(rData).GetTransferableObjectDescriptor(
+ SOT_FORMATSTR_ID_OBJECTDESCRIPTOR, aDesc);
+ }
if( SwTransferable::_TestAllowedFormat( rData, SOT_FORMATSTR_ID_EMBED_SOURCE, nDest ))
rToFill.AddClipbrdFormat( SOT_FORMATSTR_ID_EMBED_SOURCE,
commit bdec3d22b6b9cb7fb3fcf36377ab4a393ccb18b3
Author: Caolán McNamara <caolanm at redhat.com>
Date: Tue Oct 28 12:01:52 2014 +0000
coverity#704066 Unchecked return value
that's ok I think
Change-Id: Ie8dd3b938a058d771791471833fde4ef4ceef252
diff --git a/sw/source/uibase/dialog/SwSpellDialogChildWindow.cxx b/sw/source/uibase/dialog/SwSpellDialogChildWindow.cxx
index 8d9a320..01b1772 100644
--- a/sw/source/uibase/dialog/SwSpellDialogChildWindow.cxx
+++ b/sw/source/uibase/dialog/SwSpellDialogChildWindow.cxx
@@ -332,7 +332,7 @@ The code below would only be part of the solution.
delete m_pSpellState->pOtherCursor;
m_pSpellState->pOtherCursor = 0;
pWrtShell->SpellStart(DOCPOS_OTHERSTART, DOCPOS_CURR, DOCPOS_OTHERSTART );
- pWrtShell->SpellSentence(aRet, m_bIsGrammarCheckingOn);
+ (void)pWrtShell->SpellSentence(aRet, m_bIsGrammarCheckingOn);
}
if(!aRet.size())
{
commit 576aff2aa87ecce61b5ba579a175181790592f03
Author: Caolán McNamara <caolanm at redhat.com>
Date: Tue Oct 28 11:59:22 2014 +0000
coverity#704052 Unchecked return value
that's ok I think
Change-Id: I8ad2f3eab55d5a5907c431532768c9080fccfcf5
diff --git a/sw/source/core/unocore/unoobj.cxx b/sw/source/core/unocore/unoobj.cxx
index beaf599..6a7b2f2 100644
--- a/sw/source/core/unocore/unoobj.cxx
+++ b/sw/source/core/unocore/unoobj.cxx
@@ -1973,7 +1973,7 @@ throw (beans::UnknownPropertyException, uno::RuntimeException)
if ( pEntry->nWID >= FN_UNO_RANGE_BEGIN &&
pEntry->nWID <= FN_UNO_RANGE_END )
{
- SwUnoCursorHelper::getCrsrPropertyValue(
+ (void)SwUnoCursorHelper::getCrsrPropertyValue(
*pEntry, rPaM, 0, pStates[i] );
}
else
commit ea7a0b359cc8eb0455f80b530e64281f677eeaa6
Author: Caolán McNamara <caolanm at redhat.com>
Date: Tue Oct 28 11:56:22 2014 +0000
coverity#704001 silence Unchecked return value
that's definitely ok, it returns if its an
advanced query, and we don't care as we're going
to force it to be anyway
Change-Id: I5c5fec3f0978bc7f66db0b746dd69b60dc4c9026
diff --git a/sc/source/ui/unoobj/datauno.cxx b/sc/source/ui/unoobj/datauno.cxx
index 1f10bc6..f79d786 100644
--- a/sc/source/ui/unoobj/datauno.cxx
+++ b/sc/source/ui/unoobj/datauno.cxx
@@ -2061,7 +2061,7 @@ void SAL_CALL ScDatabaseRangeObj::setPropertyValue(
{
// only here to set bIsAdvanced in ScDBData
ScRange aRange;
- aNewData.GetAdvancedQuerySource(aRange);
+ (void)aNewData.GetAdvancedQuerySource(aRange);
aNewData.SetAdvancedQuerySource(&aRange);
}
else
commit 8e3e99bbad348dbb9a54698c2297d170ff1890f3
Author: Caolán McNamara <caolanm at redhat.com>
Date: Tue Oct 28 11:53:31 2014 +0000
coverity#703988 silence Unchecked return value
its not really like the other checked patterns
Change-Id: Ied788b5bad93581bf687d7b3d230971095959bb1
diff --git a/sc/source/filter/html/htmlpars.cxx b/sc/source/filter/html/htmlpars.cxx
index 139ac8f..ae6ca2c 100644
--- a/sc/source/filter/html/htmlpars.cxx
+++ b/sc/source/filter/html/htmlpars.cxx
@@ -597,7 +597,7 @@ void ScHTMLLayoutParser::Adjust()
}
}
// Real column
- SeekOffset( pColOffset, pE->nOffset, &pE->nCol, nOffsetTolerance );
+ (void)SeekOffset( pColOffset, pE->nOffset, &pE->nCol, nOffsetTolerance );
SCCOL nColBeforeSkip = pE->nCol;
SkipLocked( pE, false );
if ( pE->nCol != nColBeforeSkip )
commit 04343704ae9e5b2be4a47f7ba8ef35174db7076d
Author: Caolán McNamara <caolanm at redhat.com>
Date: Tue Oct 28 11:35:18 2014 +0000
coverity#1000600 Division or modulo by zero
Change-Id: I38fb8a7072eb7905f5dccc8697b3176d8b34c6c2
diff --git a/writerfilter/source/dmapper/DomainMapperTableManager.cxx b/writerfilter/source/dmapper/DomainMapperTableManager.cxx
index c5b1946..cbb32a8 100644
--- a/writerfilter/source/dmapper/DomainMapperTableManager.cxx
+++ b/writerfilter/source/dmapper/DomainMapperTableManager.cxx
@@ -787,12 +787,19 @@ void DomainMapperTableManager::endOfRowAction()
for (sal_uInt32 i = 0; i < pCellWidths->size(); ++i)
nFullWidthRelative += (*pCellWidths.get())[i];
- for (sal_uInt32 i = 0; i < pCellWidths->size() - 1; ++i)
+ size_t nWidthsBound = pCellWidths->size() - 1;
+ if (nWidthsBound)
{
- nSum += (*pCellWidths.get())[i];
- pSeparators[nPos].Position = (nSum * 10000) / nFullWidthRelative; // Relative position
- pSeparators[nPos].IsVisible = sal_True;
- nPos++;
+ if (nFullWidthRelative == 0)
+ throw std::range_error("divide by zero");
+
+ for (sal_uInt32 i = 0; i < nWidthsBound; ++i)
+ {
+ nSum += (*pCellWidths.get())[i];
+ pSeparators[nPos].Position = (nSum * 10000) / nFullWidthRelative; // Relative position
+ pSeparators[nPos].IsVisible = sal_True;
+ nPos++;
+ }
}
TablePropertyMapPtr pPropMap( new TablePropertyMap );
commit 1f6aefcf2dc50a678561c9b3884d973481788821
Author: Caolán McNamara <caolanm at redhat.com>
Date: Tue Oct 28 10:51:38 2014 +0000
coverity#1242531 Untrusted loop bound
Change-Id: I94308a517028a62ecf7018f6d7a4e9d37c0f56a6
diff --git a/tools/source/generic/poly.cxx b/tools/source/generic/poly.cxx
index 56b224b..dc3f70e 100644
--- a/tools/source/generic/poly.cxx
+++ b/tools/source/generic/poly.cxx
@@ -1551,6 +1551,12 @@ SvStream& ReadPolygon( SvStream& rIStream, Polygon& rPoly )
{
// Determine whether we need to write through operators
+ const size_t nMaxRecordsPossible = rIStream.remainingSize() / (2 * sizeof(sal_Int32));
+ if (nPoints > nMaxRecordsPossible)
+ {
+ SAL_WARN("tools", "Polygon claims " << nPoints << " records, but only " << nMaxRecordsPossible << " possible");
+ nPoints = nMaxRecordsPossible;
+ }
#if (SAL_TYPES_SIZEOFLONG) == 4
#ifdef OSL_BIGENDIAN
if ( rIStream.GetNumberFormatInt() == NUMBERFORMAT_INT_BIGENDIAN )
commit 95e93e9a16e19fe25737ac7eda7328ba927834ea
Author: Caolán McNamara <caolanm at redhat.com>
Date: Tue Oct 28 10:47:12 2014 +0000
coverity#1242653 Untrusted loop bound
Change-Id: I911685ea84e0b2dbee1f18aaba425f5d18677687
diff --git a/sw/source/filter/ww8/ww8scan.cxx b/sw/source/filter/ww8/ww8scan.cxx
index f0f15d8..8a375bf 100644
--- a/sw/source/filter/ww8/ww8scan.cxx
+++ b/sw/source/filter/ww8/ww8scan.cxx
@@ -3837,8 +3837,6 @@ bool WW8PLCFx_FLD::GetPara(long nIdx, WW8FieldDesc& rF)
}
// WW8PLCF_Book
-
-/* to be optimized like this: */
void WW8ReadSTTBF(bool bVer8, SvStream& rStrm, sal_uInt32 nStart, sal_Int32 nLen,
sal_uInt16 nExtraLen, rtl_TextEncoding eCS, std::vector<OUString> &rArray,
std::vector<ww::bytes>* pExtraArray, ::std::vector<OUString>* pValueArray)
@@ -3864,6 +3862,18 @@ void WW8ReadSTTBF(bool bVer8, SvStream& rStrm, sal_uInt32 nStart, sal_Int32 nLen
rStrm.ReadUInt16( nExtraLen );
+ size_t nMinRecordSize = nExtraLen;
+ if (bUnicode)
+ nMinRecordSize += sizeof(sal_uInt16);
+ else
+ nMinRecordSize += sizeof(sal_uInt8);
+ const size_t nMaxPossibleStrings = rStrm.remainingSize() / nMinRecordSize;
+ if (nStrings > nMaxPossibleStrings)
+ {
+ SAL_WARN("sw.ww8", "STTBF claims " << nStrings << " entries, but only " << nMaxPossibleStrings << "are possible");
+ nStrings = nMaxPossibleStrings;
+ }
+
for (sal_uInt16 i=0; i < nStrings; ++i)
{
if (bUnicode)
commit 4aa33cac14ab4954239a8b36959de05e046852d9
Author: Caolán McNamara <caolanm at redhat.com>
Date: Tue Oct 28 10:39:10 2014 +0000
coverity#1242656 Untrusted loop bound
Change-Id: I229701ad12d33f2fe73b2db5fce217abbb6ea155
diff --git a/sw/source/filter/ww8/ww8par2.cxx b/sw/source/filter/ww8/ww8par2.cxx
index 8ef7a81..13190bf 100644
--- a/sw/source/filter/ww8/ww8par2.cxx
+++ b/sw/source/filter/ww8/ww8par2.cxx
@@ -4177,8 +4177,15 @@ void WW8RStyle::ImportOldFormatStyles()
sal_uInt16 cstcStd(0);
rSt.ReadUInt16( cstcStd );
+ size_t nMaxByteCount = rSt.remainingSize();
sal_uInt16 cbName(0);
- rSt.ReadUInt16( cbName );
+ rSt.ReadUInt16(cbName);
+ if (cbName > nMaxByteCount)
+ {
+ SAL_WARN("sw.ww8", "WW8RStyle::ImportOldFormatStyles: truncating out of range "
+ << cbName << " to " << nMaxByteCount);
+ cbName = nMaxByteCount;
+ }
sal_uInt16 nByteCount = 2;
sal_uInt16 stcp=0;
while (nByteCount < cbName)
@@ -4227,16 +4234,15 @@ void WW8RStyle::ImportOldFormatStyles()
sal_uInt16 nStyles=stcp;
std::vector<pxoffset> aCHPXOffsets(stcp);
- size_t nMaxByteCount = rSt.remainingSize();
+ nMaxByteCount = rSt.remainingSize();
sal_uInt16 cbChpx(0);
rSt.ReadUInt16(cbChpx);
- if (cbPapx > nMaxByteCount)
+ if (cbChpx > nMaxByteCount)
{
SAL_WARN("sw.ww8", "WW8RStyle::ImportOldFormatStyles: truncating out of range "
- << cbPapx << " to " << nMaxByteCount);
- cbPapx = nMaxByteCount;
+ << cbChpx << " to " << nMaxByteCount);
+ cbChpx = nMaxByteCount;
}
-
nByteCount = 2;
stcp=0;
std::vector< std::vector<sal_uInt8> > aConvertedChpx;
@@ -4273,7 +4279,7 @@ void WW8RStyle::ImportOldFormatStyles()
}
std::vector<pxoffset> aPAPXOffsets(stcp);
- size_t nMaxByteCount = rSt.remainingSize();
+ nMaxByteCount = rSt.remainingSize();
sal_uInt16 cbPapx(0);
rSt.ReadUInt16(cbPapx);
if (cbPapx > nMaxByteCount)
commit 4673bbef97f7352d6e83520c098d4d8b3c6bad54
Author: Caolán McNamara <caolanm at redhat.com>
Date: Tue Oct 28 10:35:42 2014 +0000
coverity#1242656 Untrusted loop bound
Change-Id: I1b06497065fa52b928f99c2955391af68f4ff1b7
diff --git a/sw/source/filter/ww8/ww8par2.cxx b/sw/source/filter/ww8/ww8par2.cxx
index 542afa9..8ef7a81 100644
--- a/sw/source/filter/ww8/ww8par2.cxx
+++ b/sw/source/filter/ww8/ww8par2.cxx
@@ -4227,8 +4227,16 @@ void WW8RStyle::ImportOldFormatStyles()
sal_uInt16 nStyles=stcp;
std::vector<pxoffset> aCHPXOffsets(stcp);
+ size_t nMaxByteCount = rSt.remainingSize();
sal_uInt16 cbChpx(0);
- rSt.ReadUInt16( cbChpx );
+ rSt.ReadUInt16(cbChpx);
+ if (cbPapx > nMaxByteCount)
+ {
+ SAL_WARN("sw.ww8", "WW8RStyle::ImportOldFormatStyles: truncating out of range "
+ << cbPapx << " to " << nMaxByteCount);
+ cbPapx = nMaxByteCount;
+ }
+
nByteCount = 2;
stcp=0;
std::vector< std::vector<sal_uInt8> > aConvertedChpx;
More information about the Libreoffice-commits
mailing list