[Libreoffice-commits] core.git: 5 commits - basctl/source i18npool/source package/source
Caolán McNamara
caolanm at redhat.com
Sun Apr 12 13:18:26 PDT 2015
basctl/source/basicide/basidesh.cxx | 4 +--
i18npool/source/localedata/LocaleNode.hxx | 1
i18npool/source/localedata/filewriter.cxx | 6 +----
i18npool/source/localedata/saxparser.cxx | 10 ++++-----
i18npool/source/search/levdis.hxx | 33 ++++++++++++++++++++----------
package/source/xstor/xstorage.cxx | 7 ++----
6 files changed, 34 insertions(+), 27 deletions(-)
New commits:
commit fb150cb18b7a1975e66dd469f5e96c18047719b6
Author: Caolán McNamara <caolanm at redhat.com>
Date: Sun Apr 12 21:15:58 2015 +0100
cppcheck: cstyleCast
Change-Id: I9add864d76d08e76a3a4ac9645323ba49c3906ec
diff --git a/basctl/source/basicide/basidesh.cxx b/basctl/source/basicide/basidesh.cxx
index 665b78f..604a6a8 100644
--- a/basctl/source/basicide/basidesh.cxx
+++ b/basctl/source/basicide/basidesh.cxx
@@ -737,7 +737,7 @@ void Shell::UpdateWindows()
if ( !pNextActiveWindow && pLibInfoItem && pLibInfoItem->GetCurrentName() == aModName &&
pLibInfoItem->GetCurrentType() == TYPE_MODULE )
{
- pNextActiveWindow = (BaseWindow*)pWin;
+ pNextActiveWindow = static_cast<BaseWindow*>(pWin);
}
}
}
@@ -768,7 +768,7 @@ void Shell::UpdateWindows()
if ( !pNextActiveWindow && pLibInfoItem && pLibInfoItem->GetCurrentName() == aDlgName &&
pLibInfoItem->GetCurrentType() == TYPE_DIALOG )
{
- pNextActiveWindow = (BaseWindow*)pWin;
+ pNextActiveWindow = static_cast<BaseWindow*>(pWin);
}
}
}
commit a0f2bb7042b5cbadaade9077a7c673d5d6136cc6
Author: Caolán McNamara <caolanm at redhat.com>
Date: Sun Apr 12 21:09:25 2015 +0100
unnecessary cast
Change-Id: I7c040b2539b9f7f923620a02d0a27e8e000fee4a
diff --git a/package/source/xstor/xstorage.cxx b/package/source/xstor/xstorage.cxx
index 5eac916..c499e01 100644
--- a/package/source/xstor/xstorage.cxx
+++ b/package/source/xstor/xstorage.cxx
@@ -209,7 +209,7 @@ OStorage_Impl::OStorage_Impl( uno::Reference< io::XInputStream > xInputStream,
// all the checks done below by assertion statements must be done by factory
SAL_WARN_IF( !xInputStream.is(), "package.xstor", "No input stream is provided!" );
- m_pSwitchStream = (SwitchablePersistenceStream*) new SwitchablePersistenceStream( xContext, xInputStream );
+ m_pSwitchStream = new SwitchablePersistenceStream(xContext, xInputStream);
m_xInputStream = m_pSwitchStream->getInputStream();
if ( m_nStorageMode & embed::ElementModes::WRITE )
@@ -251,13 +251,12 @@ OStorage_Impl::OStorage_Impl( uno::Reference< io::XStream > xStream,
if ( m_nStorageMode & embed::ElementModes::WRITE )
{
- m_pSwitchStream = (SwitchablePersistenceStream*) new SwitchablePersistenceStream( xContext, xStream );
+ m_pSwitchStream = new SwitchablePersistenceStream(xContext, xStream);
m_xStream = static_cast< io::XStream* >( m_pSwitchStream );
}
else
{
- m_pSwitchStream = (SwitchablePersistenceStream*) new SwitchablePersistenceStream( xContext,
- xStream->getInputStream() );
+ m_pSwitchStream = new SwitchablePersistenceStream(xContext, xStream->getInputStream());
m_xInputStream = m_pSwitchStream->getInputStream();
}
}
commit 417b9403fe2390ec6f5c899bc0e3ee506abd179c
Author: Caolán McNamara <caolanm at redhat.com>
Date: Sun Apr 12 21:05:30 2015 +0100
cppcheck: noExplicitConstructor
Change-Id: I452a204616d98e1071b7bf43ad457c6a2376cf91
diff --git a/i18npool/source/localedata/saxparser.cxx b/i18npool/source/localedata/saxparser.cxx
index cafdb14..a6a5e80 100644
--- a/i18npool/source/localedata/saxparser.cxx
+++ b/i18npool/source/localedata/saxparser.cxx
@@ -62,10 +62,10 @@ using namespace ::com::sun::star::io;
class OInputStream : public WeakImplHelper1 < XInputStream >
{
public:
- OInputStream( const Sequence< sal_Int8 >&seq ) :
- nPos( 0 ),
- m_seq( seq )
- {}
+ explicit OInputStream( const Sequence< sal_Int8 >&seq )
+ : nPos(0)
+ , m_seq(seq)
+ {}
public:
virtual sal_Int32 SAL_CALL readBytes( Sequence< sal_Int8 >& aData, sal_Int32 nBytesToRead )
diff --git a/i18npool/source/search/levdis.hxx b/i18npool/source/search/levdis.hxx
index 9530ab9..d9cb836 100644
--- a/i18npool/source/search/levdis.hxx
+++ b/i18npool/source/search/levdis.hxx
@@ -98,12 +98,17 @@ class WLevDisPatternMem
sal_Unicode *cp;
bool *bp;
public:
- WLevDisPatternMem( sal_Int32 s ) { cp = new sal_Unicode[ s ];
- bp = new bool[ s ];
- }
- ~WLevDisPatternMem() { if (cp) delete [] cp;
- if (bp) delete [] bp;
- }
+ explicit WLevDisPatternMem( sal_Int32 s )
+ : cp(new sal_Unicode[s])
+ , bp(new bool[s])
+ {
+ }
+
+ ~WLevDisPatternMem()
+ {
+ delete [] cp;
+ delete [] bp;
+ }
sal_Unicode* GetcPtr() const { return cp; }
bool* GetbPtr() const { return bp; }
};
@@ -112,12 +117,18 @@ class WLevDisDistanceMem
{
int* p;
public:
- WLevDisDistanceMem( size_t s ) { p = 0; NewMem(s); }
- ~WLevDisDistanceMem() { if (p) delete [] p; }
+ explicit WLevDisDistanceMem( size_t s )
+ : p(0)
+ {
+ NewMem(s);
+ }
+ ~WLevDisDistanceMem() { delete [] p; }
int* GetPtr() const { return p; }
- int* NewMem( size_t s ) { if (p) delete [] p;
- return (p = new int[ s<3 ? 3 : s ]);
- }
+ int* NewMem( size_t s )
+ {
+ delete [] p;
+ return (p = new int[ s<3 ? 3 : s ]);
+ }
};
/** Weighted Levenshtein Distance (WLD)
commit db1aa2b78e222810a54d47cfc18a13934c41ee9d
Author: Caolán McNamara <caolanm at redhat.com>
Date: Sun Apr 12 21:04:42 2015 +0100
unnecessary cast
Change-Id: I57ad3b2492721115e0ea7ebd9f43480e93b0c8ab
diff --git a/i18npool/source/localedata/saxparser.cxx b/i18npool/source/localedata/saxparser.cxx
index a4a9cb1..cafdb14 100644
--- a/i18npool/source/localedata/saxparser.cxx
+++ b/i18npool/source/localedata/saxparser.cxx
@@ -238,7 +238,7 @@ public: // ExtendedDocumentHandler
LocaleNode * l = LocaleNode::createNode (aName, xAttribs);
if (!currentNode.empty() ) {
- LocaleNode * ln = (LocaleNode *) currentNode.top();
+ LocaleNode * ln = currentNode.top();
ln->addChild(l);
} else {
rootNode = l;
commit a167f6557fae2589e9305647bbb4ac12a68c3db3
Author: Caolán McNamara <caolanm at redhat.com>
Date: Sun Apr 12 21:03:51 2015 +0100
unnecessary strcpy
Change-Id: I98f12a01002a08d51f2232482cd015564cdb27b2
diff --git a/i18npool/source/localedata/LocaleNode.hxx b/i18npool/source/localedata/LocaleNode.hxx
index 4f40404..b4b7127 100644
--- a/i18npool/source/localedata/LocaleNode.hxx
+++ b/i18npool/source/localedata/LocaleNode.hxx
@@ -65,7 +65,6 @@ public:
/// Return the locale string, something like en_US or de_DE
const char * getLocale() const { return theLocale; }
private:
- char m_pcFile[1024];
char theLocale[50];
FILE *m_f;
};
diff --git a/i18npool/source/localedata/filewriter.cxx b/i18npool/source/localedata/filewriter.cxx
index 9c30144..7264b12 100644
--- a/i18npool/source/localedata/filewriter.cxx
+++ b/i18npool/source/localedata/filewriter.cxx
@@ -26,10 +26,8 @@
OFileWriter::OFileWriter(const char *pcFile, const char *locale ) {
- strncpy( m_pcFile , pcFile, sizeof(m_pcFile) );
- m_pcFile[sizeof(m_pcFile)-1] = 0;
- printf("file generated=%s\n", m_pcFile);
- m_f = fopen( m_pcFile , "w" );
+ printf("file generated=%s\n", pcFile);
+ m_f = fopen(pcFile, "w");
strncpy( theLocale, locale, sizeof(theLocale) );
theLocale[sizeof(theLocale)-1] = 0;
}
More information about the Libreoffice-commits
mailing list