diff options
author | Friedemann Kleint <[email protected]> | 2023-09-25 16:15:25 +0200 |
---|---|---|
committer | Friedemann Kleint <[email protected]> | 2023-09-27 11:13:31 +0200 |
commit | d88eba7e8f8f9951e48709a1503931025a592d6a (patch) | |
tree | b3466d2f03e44b19cc7e1d2748ed1fb791235dfb /sources/shiboken6/tests/libsample | |
parent | f6d11df9409da11e084f57633025c2806735e8b7 (diff) |
Fix some static analysis warnings in the shiboken tests
- else after return
- Do not repeat return types
- Use range-based for for std::map
- Use constructor member initialization
- Initialize variables
- Use override instead of repeating virtual
- Use noexcept for move special functions
- Upper case integer literals
- Various other small fixes
Pick-to: 6.6 6.5
Change-Id: I06924c60fcd0d8bfcad9cc2cd6e79e72621cb766
Reviewed-by: Shyamnath Premnadh <[email protected]>
Diffstat (limited to 'sources/shiboken6/tests/libsample')
29 files changed, 83 insertions, 99 deletions
diff --git a/sources/shiboken6/tests/libsample/blackbox.cpp b/sources/shiboken6/tests/libsample/blackbox.cpp index b6fc28fe3..2ac435d3d 100644 --- a/sources/shiboken6/tests/libsample/blackbox.cpp +++ b/sources/shiboken6/tests/libsample/blackbox.cpp @@ -6,10 +6,10 @@ BlackBox::~BlackBox() { // Free all maps. - for (auto it = m_objects.begin(), end = m_objects.end(); it != end; ++it) - delete it->second; - for (auto it = m_points.begin(), end = m_points.end(); it != end; ++it) - delete it->second; + for (const auto &p :m_objects) + delete p.second; + for (const auto &p : m_points) + delete p.second; } int BlackBox::keepObjectType(ObjectType *object) @@ -64,8 +64,8 @@ std::list<ObjectType*> BlackBox::objects() { std::list<ObjectType*> l; - for (auto it = m_objects.begin(), end = m_objects.end(); it != end; ++it) - l.push_back((*it).second); + for (const auto &p : m_objects) + l.push_back(p.second); return l; } @@ -74,8 +74,8 @@ std::list<Point*> BlackBox::points() { std::list<Point*> l; - for (auto it = m_points.begin(), end = m_points.end(); it != end; ++it) - l.push_back((*it).second); + for (const auto &p : m_points) + l.push_back(p.second); return l; } diff --git a/sources/shiboken6/tests/libsample/bucket.cpp b/sources/shiboken6/tests/libsample/bucket.cpp index 277809b15..cafd382a9 100644 --- a/sources/shiboken6/tests/libsample/bucket.cpp +++ b/sources/shiboken6/tests/libsample/bucket.cpp @@ -25,7 +25,7 @@ int Bucket::pop(void) { int x = 0; - if (m_data.size() > 0) { + if (!m_data.empty()) { x = m_data.front(); m_data.pop_front(); } diff --git a/sources/shiboken6/tests/libsample/bytearray.cpp b/sources/shiboken6/tests/libsample/bytearray.cpp index 1fe4b6fc2..78d5162b0 100644 --- a/sources/shiboken6/tests/libsample/bytearray.cpp +++ b/sources/shiboken6/tests/libsample/bytearray.cpp @@ -161,6 +161,6 @@ unsigned int ByteArray::hash(const ByteArray &byteArray) { unsigned int result = 0; for (char c : byteArray.m_data) - result = 5u * result + unsigned(c); + result = 5U * result + unsigned(c); return result; } diff --git a/sources/shiboken6/tests/libsample/cvlist.h b/sources/shiboken6/tests/libsample/cvlist.h index e0c6dfeb5..e09c7d943 100644 --- a/sources/shiboken6/tests/libsample/cvlist.h +++ b/sources/shiboken6/tests/libsample/cvlist.h @@ -21,7 +21,7 @@ using const_ptr_value_list = std::list<const CVValueType*>; class CVListUser { public: - static const_ptr_value_list produce() { return const_ptr_value_list(); } + static const_ptr_value_list produce() { return {}; } static void consume(const const_ptr_value_list &l) { (void)l; } }; diff --git a/sources/shiboken6/tests/libsample/derived.cpp b/sources/shiboken6/tests/libsample/derived.cpp index 310ae5e75..e7a30f311 100644 --- a/sources/shiboken6/tests/libsample/derived.cpp +++ b/sources/shiboken6/tests/libsample/derived.cpp @@ -67,7 +67,7 @@ struct SecretClass : public Abstract { PrintFormat returnAnEnum() override { return Short; } void hideFunction(HideType*) override {}; private: - virtual void pureVirtualPrivate() override {} + void pureVirtualPrivate() override {} }; Abstract *Derived::triggerImpossibleTypeDiscovery() diff --git a/sources/shiboken6/tests/libsample/expression.cpp b/sources/shiboken6/tests/libsample/expression.cpp index 5a6b4f4bb..6462d509c 100644 --- a/sources/shiboken6/tests/libsample/expression.cpp +++ b/sources/shiboken6/tests/libsample/expression.cpp @@ -12,12 +12,12 @@ Expression::Expression(int number) : m_value(number) { } -Expression::Expression(const Expression &other) +Expression::Expression(const Expression &other) : + m_value(other.m_value), + m_operation(other.m_operation), + m_operand1(other.m_operand1 ? new Expression(*other.m_operand1) : nullptr), + m_operand2(other.m_operand2 ? new Expression(*other.m_operand2) : nullptr) { - m_operand1 = other.m_operand1 ? new Expression(*other.m_operand1) : nullptr; - m_operand2 = other.m_operand2 ? new Expression(*other.m_operand2) : nullptr; - m_value = other.m_value; - m_operation = other.m_operation; } Expression &Expression::operator=(const Expression &other) @@ -86,7 +86,7 @@ std::string Expression::toString() const std::string result; result += '('; result += m_operand1->toString(); - char op; + char op = '?'; switch (m_operation) { case Add: op = '+'; @@ -100,9 +100,7 @@ std::string Expression::toString() const case GreaterThan: op = '<'; break; - case None: // just to avoid the compiler warning default: - op = '?'; break; } result += op; diff --git a/sources/shiboken6/tests/libsample/functions.cpp b/sources/shiboken6/tests/libsample/functions.cpp index 6141af8df..ad2f4dd5a 100644 --- a/sources/shiboken6/tests/libsample/functions.cpp +++ b/sources/shiboken6/tests/libsample/functions.cpp @@ -49,14 +49,12 @@ double multiplyPair(std::pair<double, double> pair) int countCharacters(const char *text) { - if (!text) - return -1; - return std::strlen(text); + return text != nullptr ? int(std::strlen(text)) : -1; } char *makeCString() { - char *string = new char[strlen(__FUNCTION__) + 1]; + char *string = new char[std::strlen(__FUNCTION__) + 1]; std::strcpy(string, __FUNCTION__); return string; } @@ -181,9 +179,7 @@ double sumDoubleMatrix(double m[2][3]) return result; } -ArrayModifyTest::ArrayModifyTest() -{ -} +ArrayModifyTest::ArrayModifyTest() = default; int ArrayModifyTest::sumIntArray(int n, int *array) { diff --git a/sources/shiboken6/tests/libsample/handle.h b/sources/shiboken6/tests/libsample/handle.h index 7af0b3107..07fc89d15 100644 --- a/sources/shiboken6/tests/libsample/handle.h +++ b/sources/shiboken6/tests/libsample/handle.h @@ -25,16 +25,16 @@ public: void set(SAMPLE_HANDLE ptr); inline void set(const Foo::SAMPLE_HANDLE &val) { m_handle2 = val; } - inline SAMPLE_HANDLE handle() { return m_handle; } - inline Foo::SAMPLE_HANDLE handle2() { return m_handle2; } + inline SAMPLE_HANDLE handle() const { return m_handle; } + inline Foo::SAMPLE_HANDLE handle2() const { return m_handle2; } static SAMPLE_HANDLE createHandle(); bool compare(HandleHolder *other); bool compare2(HandleHolder *other); private: - SAMPLE_HANDLE m_handle; - Foo::SAMPLE_HANDLE m_handle2; + SAMPLE_HANDLE m_handle = nullptr; + Foo::SAMPLE_HANDLE m_handle2 = 0; }; inline void HandleHolder::set(SAMPLE_HANDLE) diff --git a/sources/shiboken6/tests/libsample/listuser.cpp b/sources/shiboken6/tests/libsample/listuser.cpp index fd393b881..9bb7f7798 100644 --- a/sources/shiboken6/tests/libsample/listuser.cpp +++ b/sources/shiboken6/tests/libsample/listuser.cpp @@ -13,9 +13,9 @@ std::list<int> ListUser::callCreateList() ListUser::ListUser() = default; ListUser::ListUser(const ListUser &other) = default; -ListUser::ListUser(ListUser &&other) = default; +ListUser::ListUser(ListUser &&other) noexcept = default; ListUser &ListUser::operator=(const ListUser &other) = default; -ListUser &ListUser::operator=(ListUser &&other) = default; +ListUser &ListUser::operator=(ListUser &&other) noexcept = default; ListUser::~ListUser() = default; std::list<int> ListUser::createList() diff --git a/sources/shiboken6/tests/libsample/listuser.h b/sources/shiboken6/tests/libsample/listuser.h index 280cfbabd..96781ed16 100644 --- a/sources/shiboken6/tests/libsample/listuser.h +++ b/sources/shiboken6/tests/libsample/listuser.h @@ -24,9 +24,9 @@ public: ListUser(); ListUser(const ListUser &other); - ListUser(ListUser &&other); + ListUser(ListUser &&other) noexcept; ListUser &operator=(const ListUser &other); - ListUser &operator=(ListUser &&other); + ListUser &operator=(ListUser &&other) noexcept; virtual ~ListUser(); virtual std::list<int> createList(); diff --git a/sources/shiboken6/tests/libsample/mapuser.cpp b/sources/shiboken6/tests/libsample/mapuser.cpp index c793235df..40059bbcd 100644 --- a/sources/shiboken6/tests/libsample/mapuser.cpp +++ b/sources/shiboken6/tests/libsample/mapuser.cpp @@ -29,8 +29,8 @@ std::map<std::string, std::pair<Complex, int> > MapUser::createMap() void MapUser::showMap(std::map<std::string, int> mapping) { std::cout << __FUNCTION__ << std::endl; - for (auto it = mapping.begin(), end = mapping.end(); it != end; ++it) - std::cout << (*it).first << " => " << (*it).second << std::endl; + for (const auto &p : mapping) + std::cout << p.first << " => " << p.second << std::endl; } void MapUser::pointerToMap(std::map<std::string, std::string> *) diff --git a/sources/shiboken6/tests/libsample/modifications.cpp b/sources/shiboken6/tests/libsample/modifications.cpp index 2e413946e..6d627c4c1 100644 --- a/sources/shiboken6/tests/libsample/modifications.cpp +++ b/sources/shiboken6/tests/libsample/modifications.cpp @@ -7,8 +7,8 @@ #include <iostream> Modifications::Modifications() + : m_object(new ObjectType()) { - m_object = new ObjectType(); m_object->setObjectName("MyObject"); } diff --git a/sources/shiboken6/tests/libsample/modifications.h b/sources/shiboken6/tests/libsample/modifications.h index 0dea163b6..4ade7c444 100644 --- a/sources/shiboken6/tests/libsample/modifications.h +++ b/sources/shiboken6/tests/libsample/modifications.h @@ -130,7 +130,7 @@ class LIBSAMPLE_API AbstractModifications : public Modifications { public: AbstractModifications() {} - virtual ~AbstractModifications() {} + ~AbstractModifications() override {} inline bool invert(bool value) { return !value; } diff --git a/sources/shiboken6/tests/libsample/objecttype.cpp b/sources/shiboken6/tests/libsample/objecttype.cpp index a52d2a52a..7df7b46f2 100644 --- a/sources/shiboken6/tests/libsample/objecttype.cpp +++ b/sources/shiboken6/tests/libsample/objecttype.cpp @@ -14,8 +14,8 @@ ObjectType::ObjectType(ObjectType *parent) setParent(parent); } -ObjectType::ObjectType(ObjectType &&) = default; -ObjectType &ObjectType::operator=(ObjectType &&) = default; +ObjectType::ObjectType(ObjectType &&) noexcept = default; +ObjectType &ObjectType::operator=(ObjectType &&) noexcept = default; ObjectType::~ObjectType() { @@ -170,10 +170,9 @@ void ObjectType::setLayout(ObjectTypeLayout *l) << "' on ObjectType '" << objectName().cstring() << "', when the ObjectTypeLayout already has a parent layout.\n"; return; - } else { - // Steal the layout from an ObjectType parent. - oldParent->takeLayout(); } + // Steal the layout from an ObjectType parent. + oldParent->takeLayout(); } m_layout = l; @@ -243,7 +242,7 @@ int ObjectType::callId() const void ObjectType::callVirtualCreateChild() { - ObjectType *fake_parent = new ObjectType(); + auto *fake_parent = new ObjectType(); ObjectType *fake_child = createChild(fake_parent); assert(fake_child->isPython()); (void)fake_child; diff --git a/sources/shiboken6/tests/libsample/objecttype.h b/sources/shiboken6/tests/libsample/objecttype.h index d7f606012..08128be49 100644 --- a/sources/shiboken6/tests/libsample/objecttype.h +++ b/sources/shiboken6/tests/libsample/objecttype.h @@ -50,8 +50,8 @@ public: virtual ~ObjectType(); ObjectType(const ObjectType &) = delete; ObjectType &operator=(const ObjectType &) = delete; - ObjectType(ObjectType &&); - ObjectType &operator=(ObjectType &&); + ObjectType(ObjectType &&) noexcept; + ObjectType &operator=(ObjectType &&) noexcept; // factory method inline static ObjectType *create() { return new ObjectType(); } diff --git a/sources/shiboken6/tests/libsample/objecttypebyvalue.h b/sources/shiboken6/tests/libsample/objecttypebyvalue.h index c6d9aef87..7b12ff945 100644 --- a/sources/shiboken6/tests/libsample/objecttypebyvalue.h +++ b/sources/shiboken6/tests/libsample/objecttypebyvalue.h @@ -11,7 +11,7 @@ class ObjectTypeByValue { public: - ObjectTypeByValue returnSomeKindOfMe() { return ObjectTypeByValue(); } + ObjectTypeByValue returnSomeKindOfMe() { return {}; } void acceptKindOfMeAsValue(ObjectTypeByValue kindOfMe); void acceptListOfObjectTypeByValue(std::list<ObjectTypeByValue> listOfMe); diff --git a/sources/shiboken6/tests/libsample/objecttypeholder.cpp b/sources/shiboken6/tests/libsample/objecttypeholder.cpp index dfd7c4020..344f54dbd 100644 --- a/sources/shiboken6/tests/libsample/objecttypeholder.cpp +++ b/sources/shiboken6/tests/libsample/objecttypeholder.cpp @@ -5,7 +5,7 @@ ObjectTypeHolder::ObjectTypeHolder(const char *objectName) { - auto object = new ObjectType(); + auto *object = new ObjectType(); object->setObjectName(objectName); m_objectType = object; } diff --git a/sources/shiboken6/tests/libsample/objectview.cpp b/sources/shiboken6/tests/libsample/objectview.cpp index d12464142..1b727f88c 100644 --- a/sources/shiboken6/tests/libsample/objectview.cpp +++ b/sources/shiboken6/tests/libsample/objectview.cpp @@ -8,7 +8,7 @@ Str ObjectView::displayModelData() { if (!m_model) - return Str("(NULL)"); + return {"(NULL)"}; return Str("Name: %VAR").arg(m_model->objectName()); } diff --git a/sources/shiboken6/tests/libsample/pen.cpp b/sources/shiboken6/tests/libsample/pen.cpp index 2d58fa54c..76473a264 100644 --- a/sources/shiboken6/tests/libsample/pen.cpp +++ b/sources/shiboken6/tests/libsample/pen.cpp @@ -59,9 +59,9 @@ Pen::Pen(const Pen &) : m_ctor(CopyCtor) { } -Pen::Pen(Pen &&) = default; +Pen::Pen(Pen &&) noexcept = default; Pen &Pen::operator=(const Pen &pen) = default; -Pen &Pen::operator=(Pen &&) = default; +Pen &Pen::operator=(Pen &&) noexcept = default; int Pen::ctorType() { diff --git a/sources/shiboken6/tests/libsample/pen.h b/sources/shiboken6/tests/libsample/pen.h index c99dd8add..90a8aa584 100644 --- a/sources/shiboken6/tests/libsample/pen.h +++ b/sources/shiboken6/tests/libsample/pen.h @@ -51,9 +51,9 @@ public: Pen(SampleNamespace::Option option); Pen(const Color &color); Pen(const Pen &pen); - Pen(Pen &&); + Pen(Pen &&) noexcept; Pen &operator=(const Pen &pen); - Pen &operator=(Pen &&); + Pen &operator=(Pen &&) noexcept; // PYSIDE-1325, default initializer void drawLine(int x1, int y1, int x2, int y2, RenderHints renderHints = {}); diff --git a/sources/shiboken6/tests/libsample/point.cpp b/sources/shiboken6/tests/libsample/point.cpp index f85e4650c..d0fa83295 100644 --- a/sources/shiboken6/tests/libsample/point.cpp +++ b/sources/shiboken6/tests/libsample/point.cpp @@ -41,12 +41,12 @@ bool Point::operator==(const Point &other) Point Point::operator+(const Point &other) { - return Point(m_x + other.m_x, m_y + other.m_y); + return {m_x + other.m_x, m_y + other.m_y}; } Point Point::operator-(const Point &other) { - return Point(m_x - other.m_x, m_y - other.m_y); + return {m_x - other.m_x, m_y - other.m_y}; } Point &Point::operator+=(Point &other) @@ -70,22 +70,22 @@ Point operator*(const Point &pt, double mult) Point operator*(const Point &pt, int mult) { - return Point(int(pt.m_x) * mult, int(pt.m_y) * mult); + return {int(pt.m_x) * mult, int(pt.m_y) * mult}; } Point operator*(double mult, const Point &pt) { - return Point(pt.m_x * mult, pt.m_y * mult); + return {pt.m_x * mult, pt.m_y * mult}; } Point operator*(int mult, const Point &pt) { - return Point(int(pt.m_x) * mult, int(pt.m_y) * mult); + return {int(pt.m_x) * mult, int(pt.m_y) * mult}; } Point operator-(const Point &pt) { - return Point(-pt.m_x, -pt.m_y); + return {-pt.m_x, -pt.m_y}; } bool operator!(const Point &pt) @@ -95,7 +95,7 @@ bool operator!(const Point &pt) Point Point::operator/(int operand) { - return Point(m_x/operand, m_y/operand); + return {m_x/operand, m_y/operand}; } Complex transmutePointIntoComplex(const Point &point) diff --git a/sources/shiboken6/tests/libsample/pointf.cpp b/sources/shiboken6/tests/libsample/pointf.cpp index e51173c6d..244a10736 100644 --- a/sources/shiboken6/tests/libsample/pointf.cpp +++ b/sources/shiboken6/tests/libsample/pointf.cpp @@ -33,12 +33,12 @@ bool PointF::operator==(const PointF &other) PointF PointF::operator+(const PointF &other) { - return PointF(m_x + other.m_x, m_y + other.m_y); + return {m_x + other.m_x, m_y + other.m_y}; } PointF PointF::operator-(const PointF &other) { - return PointF(m_x - other.m_x, m_y - other.m_y); + return {m_x - other.m_x, m_y - other.m_y}; } PointF &PointF::operator+=(PointF &other) @@ -57,7 +57,7 @@ PointF &PointF::operator-=(PointF &other) PointF operator*(const PointF &pt, double mult) { - return PointF(pt.m_x * mult, pt.m_y * mult); + return {pt.m_x * mult, pt.m_y * mult}; } PointF operator*(const PointF &pt, int mult) @@ -67,7 +67,7 @@ PointF operator*(const PointF &pt, int mult) PointF operator*(double mult, const PointF &pt) { - return PointF(pt.m_x * mult, pt.m_y * mult); + return {pt.m_x * mult, pt.m_y * mult}; } PointF operator*(int mult, const PointF &pt) @@ -77,7 +77,7 @@ PointF operator*(int mult, const PointF &pt) PointF operator-(const PointF &pt) { - return PointF(-pt.m_x, -pt.m_y); + return {-pt.m_x, -pt.m_y}; } bool operator!(const PointF &pt) diff --git a/sources/shiboken6/tests/libsample/polygon.cpp b/sources/shiboken6/tests/libsample/polygon.cpp index 789b94ac1..6af597192 100644 --- a/sources/shiboken6/tests/libsample/polygon.cpp +++ b/sources/shiboken6/tests/libsample/polygon.cpp @@ -3,19 +3,16 @@ #include "polygon.h" -Polygon::Polygon(double x, double y) +Polygon::Polygon(double x, double y) : m_points({Point(x, y)}) { - m_points.push_back(Point(x, y)); } -Polygon::Polygon(Point point) +Polygon::Polygon(Point point) : m_points({point}) { - m_points.push_back(point); } -Polygon::Polygon(PointList points) +Polygon::Polygon(PointList points) : m_points(points) { - m_points = points; } void Polygon::addPoint(Point point) diff --git a/sources/shiboken6/tests/libsample/rect.h b/sources/shiboken6/tests/libsample/rect.h index 3218b78a2..4fd40c1bb 100644 --- a/sources/shiboken6/tests/libsample/rect.h +++ b/sources/shiboken6/tests/libsample/rect.h @@ -31,13 +31,8 @@ public: RectF() = default; explicit RectF(int left, int top, int right, int bottom) : m_left(left), m_top(top), m_right(right), m_bottom(bottom) { } - RectF(const Rect &other) - { - m_left = other.left(); - m_top = other.top(); - m_right = other.right(); - m_bottom = other.bottom(); - } + RectF(const Rect &other) : m_left(other.left()), m_top(other.top()), + m_right(other.right()), m_bottom(other.bottom()) {} ~RectF() = default; inline double left() const { return m_left; } diff --git a/sources/shiboken6/tests/libsample/samplenamespace.cpp b/sources/shiboken6/tests/libsample/samplenamespace.cpp index 6a0805c7e..eae5af2d2 100644 --- a/sources/shiboken6/tests/libsample/samplenamespace.cpp +++ b/sources/shiboken6/tests/libsample/samplenamespace.cpp @@ -19,7 +19,7 @@ SomeClass::PublicScopedEnum SomeClass::protectedMethodReturningPublicScopedEnum( OutValue enumInEnumOut(InValue in) { - OutValue retval; + auto retval = OutValue(-1); switch(in) { case ZeroIn: retval = ZeroOut; @@ -31,7 +31,6 @@ OutValue enumInEnumOut(InValue in) retval = TwoOut; break; default: - retval = OutValue(-1); break; } return retval; diff --git a/sources/shiboken6/tests/libsample/size.h b/sources/shiboken6/tests/libsample/size.h index 011999d72..163e22927 100644 --- a/sources/shiboken6/tests/libsample/size.h +++ b/sources/shiboken6/tests/libsample/size.h @@ -90,11 +90,11 @@ public: // External operators friend inline bool operator==(const Size&, const Size&); friend inline bool operator!=(const Size&, const Size&); - friend inline const Size operator+(const Size&, const Size&); - friend inline const Size operator-(const Size&, const Size&); - friend inline const Size operator*(const Size&, double); - friend inline const Size operator*(double, const Size&); - friend inline const Size operator/(const Size&, double); + friend inline Size operator+(const Size&, const Size&); + friend inline Size operator-(const Size&, const Size&); + friend inline Size operator*(const Size&, double); + friend inline Size operator*(double, const Size&); + friend inline Size operator/(const Size&, double); friend inline bool operator<(double, const Size&); friend inline bool operator>(double, const Size&); @@ -140,27 +140,27 @@ inline bool operator>=(double area, const Size &s) } // Arithmetic Operators -inline const Size operator+(const Size &s1, const Size &s2) +inline Size operator+(const Size &s1, const Size &s2) { return Size(s1.m_width + s2.m_width, s1.m_height + s2.m_height); } -inline const Size operator-(const Size &s1, const Size &s2) +inline Size operator-(const Size &s1, const Size &s2) { return Size(s1.m_width - s2.m_width, s1.m_height - s2.m_height); } -inline const Size operator*(const Size &s, double mult) +inline Size operator*(const Size &s, double mult) { return Size(s.m_width * mult, s.m_height * mult); } -inline const Size operator*(double mult, const Size &s) +inline Size operator*(double mult, const Size &s) { return Size(s.m_width * mult, s.m_height * mult); } -inline const Size operator/(const Size &s, double div) +inline Size operator/(const Size &s, double div) { return Size(s.m_width / div, s.m_height / div); } diff --git a/sources/shiboken6/tests/libsample/str.cpp b/sources/shiboken6/tests/libsample/str.cpp index 96fbba74a..742c0bb01 100644 --- a/sources/shiboken6/tests/libsample/str.cpp +++ b/sources/shiboken6/tests/libsample/str.cpp @@ -68,7 +68,7 @@ int Str::toInt(bool *ok, int base) const conv >> std::hex >> result; break; } - const bool my_ok = std::istringstream::eofbit &conv.rdstate(); + const bool my_ok = std::istringstream::eofbit & conv.rdstate(); if (!my_ok) result = 0; if (ok) @@ -120,7 +120,7 @@ unsigned int strHash(const Str &str) { unsigned int result = 0; for (char c : str.m_str) - result = 5u * result + unsigned(c); + result = 5U * result + unsigned(c); return result; } diff --git a/sources/shiboken6/tests/libsample/str.h b/sources/shiboken6/tests/libsample/str.h index e75e33085..6b3386cef 100644 --- a/sources/shiboken6/tests/libsample/str.h +++ b/sources/shiboken6/tests/libsample/str.h @@ -27,7 +27,7 @@ public: void show() const; - inline int size() const { return m_str.size(); } + inline int size() const { return int(m_str.size()); } // nonsense operator just to test reverse operators Str operator+(int number) const; diff --git a/sources/shiboken6/tests/libsample/transform.cpp b/sources/shiboken6/tests/libsample/transform.cpp index ebcab630a..5ccf5d1ed 100644 --- a/sources/shiboken6/tests/libsample/transform.cpp +++ b/sources/shiboken6/tests/libsample/transform.cpp @@ -19,10 +19,10 @@ Point applyHomogeneousTransform(const Point &in, if (std::isfinite(w) && fabs(w) > 1e-10) { if (okay) *okay = true; - return Point(x / w, y / w); - } else { - if (okay) - *okay = false; - return Point(); + return {x / w, y / w}; } + + if (okay) + *okay = false; + return {}; } |