]> sigrok.org Git - pulseview.git/commitdiff
tracegroup.cpp: Fix a potential unintended integer division.
authorUwe Hermann <redacted>
Mon, 21 May 2018 14:38:13 +0000 (16:38 +0200)
committerUwe Hermann <redacted>
Mon, 21 May 2018 15:20:54 +0000 (17:20 +0200)
Reported by Coverity (CID 279773):

  Result is not floating-point (UNINTENDED_INTEGER_DIVISION)
    integer_division: Dividing integer expressions -5 and 2, and then
    converting the integer quotient to type double. Any remainder, or
    fractional part of the quotient, is ignored.

pv/views/trace/tracegroup.cpp

index 3fbb864e8bca07111d359718274d6b5bd1e23d5e..6df8f6506b9ea3a552d40e4dc5dcdd86f6d71ba2 100644 (file)
@@ -85,8 +85,8 @@ pair<int, int> TraceGroup::v_extents() const
 void TraceGroup::paint_label(QPainter &p, const QRect &rect, bool hover)
 {
        const QRectF r = label_rect(rect).adjusted(
-               LineThickness / 2, LineThickness / 2,
-               -LineThickness / 2, -LineThickness / 2);
+               LineThickness / 2.0, LineThickness / 2.0,
+               -LineThickness / 2.0, -LineThickness / 2.0);
 
        // Paint the label
        const QPointF points[] = {