Skip to content

Commit bd32caa

Browse files
authored
Merge pull request #4440 from neheb/bool
misc clang-tidy fixes
2 parents c176ab5 + 9febb8a commit bd32caa

File tree

12 files changed

+36
-31
lines changed

12 files changed

+36
-31
lines changed

hardware/MySensorsMQTT.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@ MySensorsMQTT::MySensorsMQTT(
6868
// And remove it from the CAfilename string.
6969
m_CAFilename.erase(nextPiece, m_CAFilename.length());
7070

71-
} while (0);
71+
} while (false);
7272

7373
switch (PublishScheme) {
7474
case 2:

hardware/PanasonicTV.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -451,7 +451,7 @@ int CPanasonicNode::handleMessage(std::string pMessage)
451451
iPosBegin = 0;
452452
iPosEnd = 0;
453453

454-
while (1)
454+
while (true)
455455
{
456456
iPosBegin = pMessage.find(begin, iPosBegin);
457457
if (iPosBegin == std::string::npos)

hardware/PhilipsHue/PhilipsHueHelper.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -100,7 +100,7 @@ static point get_closest_point_to_line(point A, point B, point P)
100100
else if (t > 1.0)
101101
t = 1.0;
102102

103-
return point(A.x + AB.x * t, A.y + AB.y * t);
103+
return { A.x + AB.x * t, A.y + AB.y * t };
104104
}
105105

106106
static double get_distance_between_two_points(point p1, point p2)
@@ -145,7 +145,7 @@ static point get_closest_point_to_point(point xy_point, const std::string &model
145145
double cx = closest_point.x;
146146
double cy = closest_point.y;
147147

148-
return point(cx, cy);
148+
return { cx, cy };
149149
}
150150

151151
void CPhilipsHue::RgbFromXY(const double x, const double y, const double bri, const std::string &modelid, uint8_t &r8, uint8_t &g8, uint8_t &b8)

hardware/SatelIntegra.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1284,5 +1284,5 @@ std::pair<unsigned char*, unsigned int> SatelIntegra::getFullFrame(const unsigne
12841284
pResult[index] = *it;
12851285
}
12861286

1287-
return std::pair<unsigned char*, unsigned int>(pResult, resultSize);
1287+
return { pResult, resultSize };
12881288
}

hardware/TE923.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -184,7 +184,7 @@ void CTE923::GetSensorDetails()
184184
tsen.WIND.packetlength=sizeof(tsen.WIND)-1;
185185
tsen.WIND.packettype=pTypeWIND;
186186
tsen.WIND.subtype=sTypeWINDNoTemp;
187-
dev.batteryWind = 1;
187+
dev.batteryWind = true;
188188
if (dev.batteryWind)
189189
tsen.WIND.battery_level=9;
190190
else

hardware/serial/serial.cpp

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -42,11 +42,11 @@ class Serial::ScopedReadLock {
4242
~ScopedReadLock() {
4343
this->pimpl_->readUnlock();
4444
}
45-
private:
4645
// Disable copy constructors
47-
ScopedReadLock(const ScopedReadLock&);
48-
const ScopedReadLock& operator=(ScopedReadLock);
46+
ScopedReadLock(const ScopedReadLock &) = delete;
47+
const ScopedReadLock &operator=(ScopedReadLock) = delete;
4948

49+
private:
5050
SerialImpl *pimpl_;
5151
};
5252

@@ -58,10 +58,11 @@ class Serial::ScopedWriteLock {
5858
~ScopedWriteLock() {
5959
this->pimpl_->writeUnlock();
6060
}
61-
private:
6261
// Disable copy constructors
63-
ScopedWriteLock(const ScopedWriteLock&);
64-
const ScopedWriteLock& operator=(ScopedWriteLock);
62+
ScopedWriteLock(const ScopedWriteLock &) = delete;
63+
const ScopedWriteLock &operator=(ScopedWriteLock) = delete;
64+
65+
private:
6566
SerialImpl *pimpl_;
6667
};
6768

hardware/serial/serial.h

Lines changed: 12 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -644,11 +644,11 @@ class Serial {
644644
bool
645645
getCD ();
646646

647-
private:
648647
// Disable copy constructors
649-
Serial(const Serial&);
650-
Serial& operator=(const Serial&);
648+
Serial(const Serial &) = delete;
649+
Serial &operator=(const Serial &) = delete;
651650

651+
private:
652652
// Pimpl idiom, d_pointer
653653
class SerialImpl;
654654
SerialImpl *pimpl_;
@@ -668,10 +668,11 @@ class Serial {
668668

669669
class SerialException : public std::exception
670670
{
671-
// Disable copy constructors
672-
SerialException& operator=(const SerialException&);
673671
std::string e_what_;
674672
public:
673+
// Disable copy constructors
674+
SerialException &operator=(const SerialException &) = delete;
675+
675676
explicit SerialException (const char *description) {
676677
std::stringstream ss;
677678
ss << "SerialException " << description << " failed.";
@@ -686,13 +687,14 @@ class SerialException : public std::exception
686687

687688
class IOException : public std::exception
688689
{
689-
// Disable copy constructors
690-
IOException& operator=(const IOException&);
691690
std::string file_;
692691
int line_;
693692
std::string e_what_;
694693
int errno_;
695694
public:
695+
// Disable copy constructors
696+
IOException &operator=(const IOException &) = delete;
697+
696698
explicit IOException (std::string file, int line, int errnum)
697699
: file_(file), line_(line), errno_(errnum) {
698700
std::stringstream ss;
@@ -725,10 +727,11 @@ class IOException : public std::exception
725727

726728
class PortNotOpenedException : public std::exception
727729
{
728-
// Disable copy constructors
729-
const PortNotOpenedException& operator=(PortNotOpenedException);
730730
std::string e_what_;
731731
public:
732+
// Disable copy constructors
733+
const PortNotOpenedException &operator=(PortNotOpenedException) = delete;
734+
732735
explicit PortNotOpenedException (const char * description) {
733736
std::stringstream ss;
734737
ss << "PortNotOpenedException " << description << " failed.";

main/EventSystem.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2124,7 +2124,7 @@ std::string CEventSystem::ParseBlocklyString(const std::string &oString)
21242124
{
21252125
std::string retString = oString;
21262126

2127-
while (1)
2127+
while (true)
21282128
{
21292129
size_t pos1, pos2;
21302130
pos1 = retString.find("{{");

main/HTMLSanitizer.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,7 @@ std::string HTMLSanitizer::Sanitize(const std::string& szText)
8181
}
8282
if (!bHaveForbiddenTag)
8383
ret += org_tag;
84-
} while (1);
84+
} while (true);
8585
//will never be reached
8686
return ret;
8787
}
@@ -132,7 +132,7 @@ std::wstring HTMLSanitizer::Sanitize(const std::wstring& szText)
132132
}
133133
if (!bHaveForbiddenTag)
134134
ret += org_tag;
135-
} while (1);
135+
} while (true);
136136
//will never be reached
137137
return ret;
138138
}

main/RFXNames.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1576,7 +1576,7 @@ void GetLightStatus(
15761576
case fs20_sDimlevel_14:
15771577
case fs20_sDimlevel_15:
15781578
lstatus = "Set Level";
1579-
bHaveDimmer = 1;
1579+
bHaveDimmer = true;
15801580
llevel = nValue - fs20_sDimlevel_1 + 1;
15811581
llevel = (int)float((100.0f / float(maxDimLevel)) * llevel);
15821582
break;

0 commit comments

Comments
 (0)