Commit a6626420 authored by Michael Reeves's avatar Michael Reeves

Fix misc klazy/clang-tidy issues

parent b7b1f1c7
Pipeline #6221 passed with stage
in 8 minutes and 14 seconds
......@@ -24,9 +24,9 @@
*
*/
#ifndef __class_factory_h__
#define __class_factory_h__
#ifndef class_factory_h
#define class_factory_h
#include <shlobj.h>
#include <shlguid.h>
......@@ -43,9 +43,9 @@ class CLASS_FACTORY : public IClassFactory {
//ICLASS_FACTORY members
STDMETHODIMP CreateInstance(IUnknown*, REFIID, void**);
STDMETHODIMP LockServer(BOOL);
private:
ULONG _ref_count;
};
#endif //__class_factory_h__
#endif //class_factory_h
......@@ -26,11 +26,12 @@
#define _CRT_SECURE_NO_DEPRECATE
#include "diff_ext.h"
#include <assert.h>
#include <stdio.h>
#include <tchar.h>
#include "diff_ext.h"
#include <map>
#include <vector>
......
......@@ -25,8 +25,8 @@
*/
#ifndef __diff_ext_h__
#define __diff_ext_h__
#ifndef diff_ext_h
#define diff_ext_h
#include <windows.h>
#include <windowsx.h>
......
......@@ -25,8 +25,8 @@
*/
#ifndef __string_h__
#define __string_h__
#ifndef string_h
#define string_h
#include <windows.h>
#include <tchar.h>
......@@ -41,18 +41,18 @@ class STRING {
public:
static const int begin = 0;
static const int end = -1;
public:
STRING(const STRING& s) {
_str = new TCHAR[s.length()+1];
lstrcpy(_str, s);
}
STRING(const TCHAR* str = TEXT("")) {
_str = new TCHAR[lstrlen(str)+1];
lstrcpy(_str, str);
}
~STRING() {
delete[] _str;
}
......@@ -70,18 +70,18 @@ class STRING {
p[newLength]=0;
}
}
STRING& operator=(const STRING& s) {
delete[] _str;
_str = new TCHAR[s.length()+1];
lstrcpy(_str, s);
return *this;
}
operator TCHAR*() {
return _str;
}
operator const TCHAR*() const {
return _str;
}
......@@ -89,11 +89,11 @@ class STRING {
const TCHAR* c_str() const {
return _str;
}
size_t length() const {
return _tcslen(_str);
}
// Also returns the length. Behaviour like std::basic_string::size.
// See also sizeInBytes() below.
size_t size() const {
......@@ -109,21 +109,21 @@ class STRING {
{
return length()==0;
}
STRING substr(size_t from, size_t len=size_t(-1)) const {
STRING tmp;
size_t to = len==size_t(-1) ? length() : from + len;
if(from < to && (to <= length())) {
size_t new_len = to - from + 1;
TCHAR* new_str = new TCHAR[new_len+1];
lstrcpyn(new_str, &_str[from], int(new_len) );
new_str[new_len] = 0;
tmp = new_str;
delete[] new_str;
}
return tmp;
}
......@@ -132,7 +132,7 @@ class STRING {
*this = substr( 0, pos ) + s + substr( pos+num );
return *this;
}
bool operator ==(const STRING& s) const {
return (lstrcmp(_str, s) == 0);
}
......@@ -145,17 +145,17 @@ class STRING {
else
return size_t(-1);
}
STRING& operator +=(const STRING& s) {
TCHAR* str = new TCHAR[lstrlen(_str)+s.length()+1];
lstrcpy(str, _str);
lstrcat(str, s);
delete[] _str;
_str = str;
return *this;
}
......@@ -165,9 +165,9 @@ class STRING {
inline STRING operator+( const STRING& s1, const STRING& s2) {
STRING tmp(s1);
tmp+=s2;
return tmp;
}
......
This diff is collapsed.
......@@ -23,8 +23,8 @@
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
*/
#ifndef __server_h__
#define __server_h__
#ifndef server_h
#define server_h
#include <list> // std::list
//#include <log/file_sink.h>
#include <windows.h>
......@@ -53,34 +53,34 @@ class SERVER {
public:
static SERVER* instance();
void initLogging();
public:
virtual ~SERVER();
tstring getRegistryKeyString( const tstring& subKey, const tstring& value );
HINSTANCE handle() const;
HRESULT do_register();
HRESULT do_unregister();
void lock();
void release();
ULONG reference_count() const {
return _reference_count;
}
std::list< tstring >& recent_files();
void save_history() const;
static void logMessage( const char* function, const char* file, int line, const tstring& msg );
private:
SERVER();
SERVER(const SERVER&) {}
private:
LONG _reference_count;
std::list<tstring>* m_pRecentFiles;
......
......@@ -42,7 +42,10 @@ class LineRef
mLineNumber = -1;
}
inline operator LineType() const { return mLineNumber; }
inline void operator=(const LineType lineIn) { mLineNumber = lineIn; }
inline LineRef& operator=(const LineType lineIn) {
mLineNumber = lineIn;
return *this;
}
inline LineRef& operator+=(const LineType& inLine)
{
mLineNumber += inLine;
......@@ -55,7 +58,7 @@ class LineRef
return *this;
};
LineRef operator++(int)
const LineRef operator++(int)
{
LineRef line(*this);
++mLineNumber;
......@@ -68,7 +71,7 @@ class LineRef
return *this;
};
LineRef operator--(int)
const LineRef operator--(int)
{
LineRef line(*this);
--mLineNumber;
......
......@@ -9,10 +9,11 @@
* (at your option) any later version. *
* *
***************************************************************************/
#include "MergeFileInfos.h"
#include "directorymergewindow.h"
#include "DirectoryInfo.h"
#include "fileaccess.h"
#include "MergeFileInfos.h"
#include "progress.h"
#include <QString>
......
......@@ -513,7 +513,7 @@ QStringList SourceData::readAndPreprocess(QTextCodec* pEncoding, bool bAutoDetec
}
else
{
//exit early for non-existant files
//exit early for nonexistent files
return errors;
}
......@@ -530,7 +530,6 @@ QStringList SourceData::readAndPreprocess(QTextCodec* pEncoding, bool bAutoDetec
// Preprocessing command may result in smaller data buffer so adjust size
for(qint64 i = m_lmppData.m_vSize; i < m_normalData.m_vSize; ++i)
{ // Set all empty lines to point to the end of the buffer.
m_lmppData.m_v.push_back(LineData(m_lmppData.m_unicodeBuf, m_lmppData.m_unicodeBuf->length()));
}
......@@ -631,7 +630,7 @@ bool SourceData::FileData::preprocess(QTextCodec* pEncoding)
{
//workaround for lack of peak API in QTextStream.
qint64 j;
for(j = 0; j < 4 && lastOffset + j < m_size; j++)
for(j = 0; j < 4 && lastOffset + j < m_size; ++j)
{
if(m_pBuf[lastOffset + j] != '\0')
break;
......
......@@ -61,7 +61,7 @@ public:
void hideStatusBarWidget();
void delayedHideStatusBarWidget();
void timerEvent(QTimerEvent*) override;
void timerEvent(QTimerEvent* event) override;
public slots:
void recalc(bool bUpdate);
private:
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment