Skip to content

Commit 49e17a2

Browse files
author
Lars H. Rohweder
committed
cleanups suggested by clang-tidy
1 parent aa58196 commit 49e17a2

File tree

9 files changed

+58
-144
lines changed

9 files changed

+58
-144
lines changed

platform/unix/syspovfilesystem.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -121,7 +121,7 @@ std::size_t LargeFile::Read(void* data, std::size_t maxSize)
121121
{
122122
if (mpData->handle == -1)
123123
return false;
124-
return read(mpData->handle, data, int(maxSize));
124+
return read(mpData->handle, data, maxSize);
125125
}
126126

127127
bool LargeFile::Write(const void* data, std::size_t size)

source/backend/bounding/boundingtask.cpp

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -93,10 +93,7 @@ class SceneObjects final : public BSPTree::Objects
9393
}
9494
}
9595

96-
virtual ~SceneObjects() override
97-
{
98-
// nothing to do
99-
}
96+
~SceneObjects() override = default;
10097

10198
virtual unsigned int size() const override
10299
{
@@ -156,10 +153,6 @@ BoundingTask::BoundingTask(std::shared_ptr<BackendSceneData> sd, unsigned int bt
156153
{
157154
}
158155

159-
BoundingTask::~BoundingTask()
160-
{
161-
}
162-
163156
void BoundingTask::AppendObject(ObjectPtr p)
164157
{
165158
sceneData->objects.push_back(p);

source/backend/bounding/boundingtask.h

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@
3737
#define POVRAY_BACKEND_BOUNDINGTASK_H
3838

3939
// Module config header file must be the first file included within POV-Ray unit header files
40-
#include "backend/configbackend.h"
40+
//#include "backend/configbackend.h"
4141

4242
// C++ variants of C standard header files
4343
// (none at the moment)
@@ -62,11 +62,11 @@ class BoundingTask final : public SceneTask
6262
{
6363
public:
6464
BoundingTask(std::shared_ptr<BackendSceneData> sd, unsigned int bt, size_t seed);
65-
virtual ~BoundingTask() override;
65+
~BoundingTask() override = default;
6666

67-
virtual void Run() override;
68-
virtual void Stopped() override;
69-
virtual void Finish() override;
67+
void Run() override;
68+
void Stopped() override;
69+
void Finish() override;
7070

7171
void AppendObject(ObjectPtr p);
7272

source/backend/scene/view.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -120,7 +120,7 @@ class ViewData final
120120
class BlockInfo
121121
{
122122
public:
123-
virtual ~BlockInfo() {}
123+
virtual ~BlockInfo() =default;
124124
};
125125

126126
/**
@@ -253,7 +253,7 @@ class ViewData final
253253
* Get the highest trace level found when last rendering this view.
254254
* @return Highest trace level found so far.
255255
*/
256-
unsigned int GetHighestTraceLevel();
256+
//unsigned int GetHighestTraceLevel();
257257

258258
/**
259259
* Set the highest trace level found while rendering this view.

source/base/colour.h

Lines changed: 33 additions & 80 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,7 @@
4141
#include "base/configbase.h"
4242

4343
// C++ variants of C standard header files
44+
#include <array>
4445
#include <cmath>
4546

4647
// C++ standard header files
@@ -133,57 +134,39 @@ class GenericRGBColour final
133134

134135
friend GenericRGBColour ToRGBColour(const GenericColour<T>& col);
135136

136-
/// Default constructor.
137-
inline GenericRGBColour()
138-
{
139-
mColour[RED] = 0.0;
140-
mColour[GREEN] = 0.0;
141-
mColour[BLUE] = 0.0;
142-
}
137+
GenericRGBColour()
138+
: mColour{ T(), T(), T() }
139+
{}
143140

144141
/// Copy constructor.
145-
inline GenericRGBColour(const GenericRGBColour& col)
146-
{
147-
mColour[RED] = col.mColour[RED];
148-
mColour[GREEN] = col.mColour[GREEN];
149-
mColour[BLUE] = col.mColour[BLUE];
150-
}
142+
GenericRGBColour(const GenericRGBColour& col) = default;
151143

152144
template<typename T2>
153145
inline explicit GenericRGBColour(const GenericRGBColour<T2>& col)
154-
{
155-
mColour[RED] = col.mColour[RED];
156-
mColour[GREEN] = col.mColour[GREEN];
157-
mColour[BLUE] = col.mColour[BLUE];
158-
}
146+
: mColour{ T(col.mColour[RED]), T(col.mColour[GREEN]), T(col.mColour[BLUE])}
147+
{}
159148

160-
inline explicit GenericRGBColour(T grey)
161-
{
162-
mColour[RED] = grey;
163-
mColour[GREEN] = grey;
164-
mColour[BLUE] = grey;
165-
}
149+
explicit GenericRGBColour(T grey)
150+
: mColour{grey, grey, grey}
151+
{}
166152

167-
inline explicit GenericRGBColour(T red, T green, T blue)
168-
{
169-
mColour[RED] = red;
170-
mColour[GREEN] = green;
171-
mColour[BLUE] = blue;
172-
}
153+
explicit GenericRGBColour(T red, T green, T blue)
154+
: mColour{ red, green, blue }
155+
{}
173156

174-
inline explicit GenericRGBColour(const GenericRGBFTColour<T>& col)
157+
explicit GenericRGBColour(const GenericRGBFTColour<T>& col)
175158
{
176159
mColour[RED] = col.red();
177160
mColour[GREEN] = col.green();
178161
mColour[BLUE] = col.blue();
179162
}
180163

181164
template<int BIAS, bool QUANTIZE_TO_NEAREST, typename T2>
182-
inline explicit GenericRGBColour(const GenericRGBEColour<BIAS,QUANTIZE_TO_NEAREST,T2>& col)
165+
explicit GenericRGBColour(const GenericRGBEColour<BIAS,QUANTIZE_TO_NEAREST,T2>& col)
183166
{
184167
if (col.mData[GenericRGBEColour<BIAS,QUANTIZE_TO_NEAREST,T2>::EXP] > std::numeric_limits<T2>::min())
185168
{
186-
double expFactor = ldexp(1.0,(int)col.mData[GenericRGBEColour<BIAS,QUANTIZE_TO_NEAREST,T2>::EXP]-(int)(BIAS+8));
169+
double expFactor = ldexp(1.0,(int)col.mData[GenericRGBEColour<BIAS,QUANTIZE_TO_NEAREST,T2>::EXP]-(BIAS+8));
187170
double quantizationFix = (QUANTIZE_TO_NEAREST? 0.0 : 0.5);
188171
mColour[RED] = (col.mData[GenericRGBEColour<BIAS,QUANTIZE_TO_NEAREST,T2>::RED] + quantizationFix) * expFactor;
189172
mColour[GREEN] = (col.mData[GenericRGBEColour<BIAS,QUANTIZE_TO_NEAREST,T2>::GREEN] + quantizationFix) * expFactor;
@@ -204,13 +187,7 @@ class GenericRGBColour final
204187
mColour[BLUE] = col.Blue();
205188
}
206189
*/
207-
inline GenericRGBColour& operator=(const GenericRGBColour& col)
208-
{
209-
mColour[RED] = col.mColour[RED];
210-
mColour[GREEN] = col.mColour[GREEN];
211-
mColour[BLUE] = col.mColour[BLUE];
212-
return *this;
213-
}
190+
GenericRGBColour& operator=(const GenericRGBColour& col) = default;
214191

215192
inline T operator[](int idx) const { return mColour[idx]; }
216193
inline T& operator[](int idx) { return mColour[idx]; }
@@ -576,15 +553,12 @@ class GenericRGBColour final
576553
BLUE = 2
577554
};
578555

579-
T mColour[3];
556+
std::array<T,3> mColour;
580557

581558
#if (NUM_COLOUR_CHANNELS == 3)
582559
inline explicit GenericRGBColour(const GenericColour<T>& col)
583-
{
584-
mColour[RED] = col.mColour[0];
585-
mColour[GREEN] = col.mColour[1];
586-
mColour[BLUE] = col.mColour[2];
587-
}
560+
: mColour(col.mColour)
561+
{}
588562
#else
589563
#error "TODO!"
590564
#endif
@@ -690,11 +664,7 @@ class GenericRGBFTColour final
690664
{}
691665

692666
/// Copy constructor.
693-
inline GenericRGBFTColour(const GenericRGBFTColour& col) :
694-
mColour(col.mColour),
695-
mFilter(col.mFilter),
696-
mTransm(col.mTransm)
697-
{}
667+
inline GenericRGBFTColour(const GenericRGBFTColour& col) = default;
698668

699669
template<typename T2>
700670
inline explicit GenericRGBFTColour(const GenericRGBFTColour<T2>& col) :
@@ -733,13 +703,7 @@ class GenericRGBFTColour final
733703
mTransm(expr[4])
734704
{}
735705

736-
inline GenericRGBFTColour& operator=(const GenericRGBFTColour& col)
737-
{
738-
mColour = col.mColour;
739-
mFilter = col.mFilter;
740-
mTransm = col.mTransm;
741-
return *this;
742-
}
706+
inline GenericRGBFTColour& operator=(const GenericRGBFTColour& col) = default;
743707

744708
inline GenericRGBColour<T> rgb() const { return mColour; }
745709
inline GenericRGBColour<T>& rgb() { return mColour; }
@@ -1008,10 +972,7 @@ class GenericRGBTColour final
1008972
{}
1009973

1010974
/// Copy constructor.
1011-
inline GenericRGBTColour(const GenericRGBTColour& col) :
1012-
mColour(col.mColour),
1013-
mTransm(col.mTransm)
1014-
{}
975+
inline GenericRGBTColour(const GenericRGBTColour& col) = default;
1015976

1016977
template<typename T2>
1017978
inline explicit GenericRGBTColour(const GenericRGBTColour<T2>& col) :
@@ -1035,13 +996,7 @@ class GenericRGBTColour final
1035996
mTransm(col.transm())
1036997
{}
1037998
*/
1038-
1039-
inline GenericRGBTColour& operator=(const GenericRGBTColour& col)
1040-
{
1041-
mColour = col.mColour;
1042-
mTransm = col.mTransm;
1043-
return *this;
1044-
}
999+
inline GenericRGBTColour& operator=(const GenericRGBTColour& col) = default;
10451000

10461001
inline GenericRGBColour<T> rgb() const { return mColour; }
10471002
inline GenericRGBColour<T>& rgb() { return mColour; }
@@ -1261,18 +1216,16 @@ class GenericColour final
12611216

12621217
/// Default constructor.
12631218
inline GenericColour()
1264-
{
1265-
for (int i = 0; i < channels; i ++)
1266-
mColour[i] = 0.0;
1267-
}
1219+
: mColour{}
1220+
{}
12681221

12691222
/// Copy constructor.
1270-
inline GenericColour(const GenericColour& col)
1271-
{
1223+
inline GenericColour(const GenericColour& col) = default;
1224+
/* {
12721225
for (int i = 0; i < channels; i ++)
12731226
mColour[i] = col.mColour[i];
12741227
}
1275-
1228+
*/
12761229
template<typename T2>
12771230
inline explicit GenericColour(const GenericColour<T2>& col)
12781231
{
@@ -1301,13 +1254,13 @@ class GenericColour final
13011254
mColour[i] = (col.mData[i] + 0.5) * exponent;
13021255
}
13031256
*/
1304-
inline GenericColour& operator=(const GenericColour& col)
1305-
{
1257+
inline GenericColour& operator=(const GenericColour& col) = default;
1258+
/* {
13061259
for (int i = 0; i < channels; i ++)
13071260
mColour[i] = col.mColour[i];
13081261
return *this;
13091262
}
1310-
1263+
*/
13111264
inline T operator[](int idx) const { return mColour[idx]; }
13121265
inline T& operator[](int idx) { return mColour[idx]; }
13131266

@@ -1740,7 +1693,7 @@ class GenericColour final
17401693

17411694
#endif
17421695

1743-
T mColour[channels];
1696+
std::array<T,channels> mColour;
17441697

17451698
#if (NUM_COLOUR_CHANNELS == 3)
17461699
inline explicit GenericColour(const GenericRGBColour<T>& col)

unix/disp.h

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -54,11 +54,11 @@ namespace pov_frontend
5454
public:
5555
UnixDisplay(unsigned int w, unsigned int h, vfeSession *session, bool visible) :
5656
vfeDisplay(w, h, session, visible) {};
57-
virtual ~UnixDisplay() override {} ;
58-
virtual void Initialise() override = 0;
59-
virtual void Close() override = 0;
60-
virtual void Show() override = 0;
61-
virtual void Hide() override = 0;
57+
~UnixDisplay() override =default ;
58+
void Initialise() override = 0;
59+
void Close() override = 0;
60+
void Show() override = 0;
61+
void Hide() override = 0;
6262

6363
virtual bool TakeOver(UnixDisplay *display) = 0;
6464

vfe/vfe.cpp

Lines changed: 1 addition & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -178,10 +178,6 @@ vfeConsole::vfeConsole(vfeSession *session, int width) : Console(width == -1 ? s
178178
Initialise();
179179
}
180180

181-
vfeConsole::~vfeConsole()
182-
{
183-
}
184-
185181
void vfeConsole::Initialise()
186182
{
187183
rawBuffer [0] = '\0' ;
@@ -243,10 +239,6 @@ vfePlatformBase::vfePlatformBase(vfeSession& session) : m_Session(&session), Pla
243239
{
244240
}
245241

246-
vfePlatformBase::~vfePlatformBase()
247-
{
248-
}
249-
250242
UCS2String vfePlatformBase::GetTemporaryPath(void)
251243
{
252244
return m_Session->GetTemporaryPath();
@@ -291,9 +283,6 @@ vfeParserMessageHandler::vfeParserMessageHandler() : ParserMessageHandler()
291283
m_Session = vfeSession::GetSessionFromThreadID();
292284
}
293285

294-
vfeParserMessageHandler::~vfeParserMessageHandler()
295-
{
296-
}
297286

298287
void vfeParserMessageHandler::Options(Console *Con, POVMS_Object& Obj, bool conout)
299288
{
@@ -426,11 +415,7 @@ void vfeParserMessageHandler::DebugInfo(Console *Con, POVMS_Object& Obj, bool co
426415
////////////////////////////////////////////////////////////////////////////////////////
427416

428417
vfeRenderMessageHandler::vfeRenderMessageHandler() : RenderMessageHandler()
429-
{
430-
m_Session = vfeSession::GetSessionFromThreadID();
431-
}
432-
433-
vfeRenderMessageHandler::~vfeRenderMessageHandler()
418+
, m_Session {vfeSession::GetSessionFromThreadID()}
434419
{
435420
}
436421

@@ -518,10 +503,6 @@ vfeProcessRenderOptions::vfeProcessRenderOptions(vfeSession *Session) : ProcessR
518503
{
519504
}
520505

521-
vfeProcessRenderOptions::~vfeProcessRenderOptions()
522-
{
523-
}
524-
525506
int vfeProcessRenderOptions::ReadSpecialOptionHandler(INI_Parser_Table *Table, char *Param, POVMSObjectPtr Obj)
526507
{
527508
return ProcessRenderOptions::ReadSpecialOptionHandler (Table, Param, Obj);

0 commit comments

Comments
 (0)