cppu/qa/test_reference.cxx | 8 +++---- sal/cppunittester/cppunittester.cxx | 2 + sal/osl/unx/security.cxx | 39 ++++++++++++++++++----------------- svx/source/smarttags/SmartTagMgr.cxx | 18 +++++----------- vcl/source/fontsubset/cff.cxx | 19 ++--------------- vcl/unx/generic/app/i18n_status.cxx | 13 ----------- 6 files changed, 36 insertions(+), 63 deletions(-)
New commits: commit 46cb31f6fdc80d50cbca404a3bc88ecb72ce1b31 Author: Stephan Bergmann <sberg...@redhat.com> Date: Thu Apr 3 15:32:12 2014 +0200 Remove unused getText Change-Id: I13145c4dcdf95d7979dc1887ba08a243f8b5a224 diff --git a/vcl/unx/generic/app/i18n_status.cxx b/vcl/unx/generic/app/i18n_status.cxx index b5a286a..945d858 100644 --- a/vcl/unx/generic/app/i18n_status.cxx +++ b/vcl/unx/generic/app/i18n_status.cxx @@ -56,7 +56,6 @@ public: virtual void setPosition( SalFrame* ); virtual void setText( const OUString & ) = 0; - virtual OUString getText() const = 0; virtual void show( bool bShow, I18NStatus::ShowReason eReason ) = 0; virtual void toggle( bool bOn ) = 0; }; @@ -103,7 +102,6 @@ public: virtual void setPosition( SalFrame* ) SAL_OVERRIDE; virtual void setText( const OUString & ) SAL_OVERRIDE; - virtual OUString getText() const SAL_OVERRIDE; virtual void show( bool bShow, I18NStatus::ShowReason eReason ) SAL_OVERRIDE; virtual void toggle( bool bOn ) SAL_OVERRIDE; @@ -293,11 +291,6 @@ void XIMStatusWindow::setText( const OUString& rText ) m_aWindowSize.Width() = m_aStatusText.GetTextWidth( rText )+8; } -OUString XIMStatusWindow::getText() const -{ - return m_aStatusText.GetText(); -} - namespace vcl { class IIIMPStatusWindow : public StatusWindow @@ -317,7 +310,6 @@ public: virtual ~IIIMPStatusWindow(); virtual void setText( const OUString & ) SAL_OVERRIDE; - virtual OUString getText() const SAL_OVERRIDE; virtual void show( bool bShow, I18NStatus::ShowReason eReason ) SAL_OVERRIDE; virtual void toggle( bool bOn ) SAL_OVERRIDE; void layout(); @@ -398,11 +390,6 @@ void IIIMPStatusWindow::setText( const OUString& rText ) m_aStatusBtn.SetText( rText ); } -OUString IIIMPStatusWindow::getText() const -{ - return m_aStatusBtn.GetText(); -} - void IIIMPStatusWindow::show( bool bShow, I18NStatus::ShowReason eReason ) { // hide IIIMPStatusWindow only in presentations commit 3218dca3e98c0f785314fbd1aa3d29c24d641273 Author: Stephan Bergmann <sberg...@redhat.com> Date: Thu Apr 3 15:31:51 2014 +0200 Remove unnecessary SubsetterContext base class Change-Id: Ia000655f3fe49a4c9c1015b37f44c0ba44d7666e diff --git a/vcl/source/fontsubset/cff.cxx b/vcl/source/fontsubset/cff.cxx index 8880095..854784e 100644 --- a/vcl/source/fontsubset/cff.cxx +++ b/vcl/source/fontsubset/cff.cxx @@ -314,21 +314,8 @@ struct CffLocal bool mbForceBold; }; -class SubsetterContext -{ -public: - virtual ~SubsetterContext( void); - virtual bool emitAsType1( class Type1Emitter&, - const sal_GlyphId* pGlyphIds, const U8* pEncoding, - GlyphWidth* pGlyphWidths, int nGlyphCount, FontSubsetInfo& ) = 0; -}; - -SubsetterContext::~SubsetterContext( void) -{} - class CffSubsetterContext -: public SubsetterContext -, private CffGlobal +: private CffGlobal { public: static const int NMAXSTACK = 48; // see CFF.appendixB @@ -336,12 +323,12 @@ public: static const int NMAXTRANS = 32; // see CFF.appendixB public: explicit CffSubsetterContext( const U8* pBasePtr, int nBaseLen); - virtual ~CffSubsetterContext( void); + ~CffSubsetterContext( void); void initialCffRead( void); bool emitAsType1( class Type1Emitter&, const sal_GlyphId* pGlyphIds, const U8* pEncoding, - GlyphWidth* pGlyphWidths, int nGlyphCount, FontSubsetInfo& ) SAL_OVERRIDE; + GlyphWidth* pGlyphWidths, int nGlyphCount, FontSubsetInfo& ); // used by charstring converter void setCharStringType( int); commit 96fe761b7b55f6eaecae8113cca2fd8767ea4b11 Author: Stephan Bergmann <sberg...@redhat.com> Date: Thu Apr 3 15:31:11 2014 +0200 Redundant null checks Change-Id: I8b38d37de6cba2a29c9d785adf17d65835c8a05d diff --git a/svx/source/smarttags/SmartTagMgr.cxx b/svx/source/smarttags/SmartTagMgr.cxx index b812393..e0befd3 100644 --- a/svx/source/smarttags/SmartTagMgr.cxx +++ b/svx/source/smarttags/SmartTagMgr.cxx @@ -69,18 +69,14 @@ SmartTagMgr::~SmartTagMgr() void SmartTagMgr::Init( const OUString& rConfigurationGroupName ) { - // get component context to pass to components: - if ( mxContext.is() ) - { - PrepareConfiguration( rConfigurationGroupName ); - ReadConfiguration( true, true ); - RegisterListener(); - LoadLibraries(); - } + PrepareConfiguration( rConfigurationGroupName ); + ReadConfiguration( true, true ); + RegisterListener(); + LoadLibraries(); } void SmartTagMgr::CreateBreakIterator() const { - if ( !mxBreakIter.is() && mxContext.is() ) + if ( !mxBreakIter.is() ) { // get the break iterator mxBreakIter.set( BreakIterator::create(mxContext) ); @@ -345,9 +341,7 @@ void SmartTagMgr::changesOccurred( const util::ChangesEvent& rEvent ) throw( Run */ void SmartTagMgr::LoadLibraries() { - Reference< container::XContentEnumerationAccess > rContent( mxContext->getServiceManager(), UNO_QUERY ); - if ( !rContent.is() ) - return; + Reference< container::XContentEnumerationAccess > rContent( mxContext->getServiceManager(), UNO_QUERY_THROW ); // load recognizers: No recognizers -> nothing to do. Reference < container::XEnumeration > rEnum = rContent->createContentEnumeration( "com.sun.star.smarttags.SmartTagRecognizer"); commit bc067d1674546f956c65d97ef005897987f194ef Author: Stephan Bergmann <sberg...@redhat.com> Date: Thu Apr 3 15:30:16 2014 +0200 C++11-only stdint.h SIZE_MAX -> std::numeric_limits Change-Id: I6bf80d034490583afa9e51cf720703cdf60a924a diff --git a/sal/osl/unx/security.cxx b/sal/osl/unx/security.cxx index 4360965..2787bdb 100644 --- a/sal/osl/unx/security.cxx +++ b/sal/osl/unx/security.cxx @@ -17,8 +17,10 @@ * the License at http://www.apache.org/licenses/LICENSE-2.0 . */ -#include <stddef.h> -#include <stdint.h> +#include <sal/config.h> + +#include <cstddef> +#include <limits> #include "system.h" @@ -40,10 +42,6 @@ #define getpwuid_r(uid, pwd, buf, buflen, result) (*(result) = getpwuid(uid), (*(result) ? (memcpy (buf, *(result), sizeof (struct passwd)), 0) : errno)) #endif -#ifndef SIZE_MAX -#define SIZE_MAX ((size_t)-1) -#endif - static oslSecurityError SAL_CALL osl_psz_loginUser(const sal_Char* pszUserName, const sal_Char* pszPasswd, oslSecurity* pSecurity); @@ -52,7 +50,7 @@ static sal_Bool SAL_CALL osl_psz_getUserName(oslSecurity Security, sal_Char* psz static sal_Bool SAL_CALL osl_psz_getHomeDir(oslSecurity Security, sal_Char* pszDirectory, sal_uInt32 nMax); static sal_Bool SAL_CALL osl_psz_getConfigDir(oslSecurity Security, sal_Char* pszDirectory, sal_uInt32 nMax); -static sal_Bool sysconf_SC_GETPW_R_SIZE_MAX(size_t * value) { +static sal_Bool sysconf_SC_GETPW_R_SIZE_MAX(std::size_t * value) { #if defined _SC_GETPW_R_SIZE_MAX long m; errno = 0; @@ -63,8 +61,10 @@ static sal_Bool sysconf_SC_GETPW_R_SIZE_MAX(size_t * value) { way and always set EINVAL, so be resilient here: */ return sal_False; } else { - OSL_ASSERT(m >= 0 && (unsigned long) m < SIZE_MAX); - *value = (size_t) m; + OSL_ASSERT( + m >= 0 + && (unsigned long) m < std::numeric_limits<std::size_t>::max()); + *value = (std::size_t) m; return sal_True; } #else @@ -74,9 +74,9 @@ static sal_Bool sysconf_SC_GETPW_R_SIZE_MAX(size_t * value) { } static oslSecurityImpl * growSecurityImpl( - oslSecurityImpl * impl, size_t * bufSize) + oslSecurityImpl * impl, std::size_t * bufSize) { - size_t n = 0; + std::size_t n = 0; oslSecurityImpl * p = NULL; if (impl == NULL) { if (!sysconf_SC_GETPW_R_SIZE_MAX(&n)) { @@ -84,16 +84,19 @@ static oslSecurityImpl * growSecurityImpl( detect it if the allocated buffer is too small: */ n = 1024; } - } else if (*bufSize <= SIZE_MAX / 2) { + } else if (*bufSize <= std::numeric_limits<std::size_t>::max() / 2) { n = 2 * *bufSize; } if (n != 0) { - if (n <= SIZE_MAX - offsetof(oslSecurityImpl, m_buffer)) { + if (n <= std::numeric_limits<std::size_t>::max() + - offsetof(oslSecurityImpl, m_buffer)) + { *bufSize = n; n += offsetof(oslSecurityImpl, m_buffer); } else { - *bufSize = SIZE_MAX - offsetof(oslSecurityImpl, m_buffer); - n = SIZE_MAX; + *bufSize = std::numeric_limits<std::size_t>::max() + - offsetof(oslSecurityImpl, m_buffer); + n = std::numeric_limits<std::size_t>::max(); } p = static_cast<oslSecurityImpl *>(realloc(impl, n)); memset (p, 0, n); @@ -110,7 +113,7 @@ static void deleteSecurityImpl(oslSecurityImpl * impl) { oslSecurity SAL_CALL osl_getCurrentSecurity() { - size_t n = 0; + std::size_t n = 0; oslSecurityImpl * p = NULL; for (;;) { struct passwd * found; @@ -312,7 +315,7 @@ static sal_Bool SAL_CALL osl_psz_getHomeDir(oslSecurity Security, sal_Char* pszD sal_Int32 nCopy = (sal_Int32)(nMax-1) < pStrValue->length ? (sal_Int32)(nMax-1) : pStrValue->length ; strncpy (pszDirectory, pStrValue->buffer, nCopy); pszDirectory[nCopy] = '\0'; - bRet = (size_t)pStrValue->length < nMax; + bRet = (std::size_t)pStrValue->length < nMax; } rtl_string_release(pStrValue); } @@ -390,7 +393,7 @@ static sal_Bool SAL_CALL osl_psz_getConfigDir(oslSecurity Security, sal_Char* ps if (pStr == NULL || strlen(pStr) == 0 || access(pStr, 0) != 0) { - size_t n = 0; + std::size_t n = 0; // a default equal to $HOME/.config should be used. if (!osl_psz_getHomeDir(Security, pszDirectory, nMax)) commit 82861c562f70aaeb76e10319377998fce5c65c4e Author: Stephan Bergmann <sberg...@redhat.com> Date: Thu Apr 3 15:29:22 2014 +0200 Properly cover in #ifdef TIMETESTS Change-Id: Iff8f992e5260150b9ba108698b506f5a9ec7dea2 diff --git a/sal/cppunittester/cppunittester.cxx b/sal/cppunittester/cppunittester.cxx index c2bdb13..f4c2fc6 100644 --- a/sal/cppunittester/cppunittester.cxx +++ b/sal/cppunittester/cppunittester.cxx @@ -73,6 +73,7 @@ std::string convertLazy(rtl::OUString const & s16) { s8.getStr(), static_cast< std::string::size_type >(s8.getLength())); } +#if defined TIMETESTS //Output how long each test took class TimingListener : public CppUnit::TestListener @@ -94,6 +95,7 @@ public: private: sal_uInt32 m_nStartTime; }; +#endif #ifdef UNX #include <stdlib.h> commit 1fc26b811256290880fa6e86c9146b48c052bde5 Author: Stephan Bergmann <sberg...@redhat.com> Date: Thu Apr 3 15:28:50 2014 +0200 Cosmetics (to ease work related to finding unused functions) Change-Id: I88b7659fdfdcba43e69ef7489573b28952c8328c diff --git a/cppu/qa/test_reference.cxx b/cppu/qa/test_reference.cxx index f905826..fe3191f6 100644 --- a/cppu/qa/test_reference.cxx +++ b/cppu/qa/test_reference.cxx @@ -92,10 +92,10 @@ private: // Check that the up-casting Reference conversion constructor catches the // intended cases: -struct Base1: public css::uno::XInterface { virtual ~Base1() {} }; -struct Base2: public Base1 { virtual ~Base2() {} }; -struct Base3: public Base1 { virtual ~Base3() {} }; -struct Derived: public Base2, public Base3 { virtual ~Derived() {} }; +struct Base1: public css::uno::XInterface { virtual ~Base1() = 0; }; +struct Base2: public Base1 {}; +struct Base3: public Base1 {}; +struct Derived: public Base2, public Base3 {}; // The special case using the conversion operator instead: css::uno::Reference< css::uno::XInterface > testUpcast1( _______________________________________________ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits