Bug 106475

Summary: xorg-server-1.20.0/miext/rootless/rootlessGC.c:1238: confused chain of if statements
Product: xorg Reporter: dcb314
Component: Server/GeneralAssignee: Xorg Project Team <xorg-team>
Status: RESOLVED MOVED QA Contact: Xorg Project Team <xorg-team>
Severity: normal    
Priority: medium    
Version: unspecified   
Hardware: Other   
OS: All   
Whiteboard:
i915 platform: i915 features:

Description dcb314 2018-05-11 09:08:30 UTC
xorg-server-1.20.0/miext/rootless/rootlessGC.c:1238] -> [xorg-server-1.20.0/miext/rootless/rootlessGC.c:1246]: (warning) Identical inner 'if' condition is always true.

Source code is

    if (width > 0) {
        BoxRec box;

        /* ugh */
        box.x1 = dst->x + x + FONTMINBOUNDS(pGC->font, leftSideBearing);
        box.x2 = dst->x + x + FONTMAXBOUNDS(pGC->font, rightSideBearing);

        if (count > 1) {
            if (width > 0)
                box.x2 += width;
            else
                box.x1 += width;

box.x1 can never be incremented.
Comment 1 dcb314 2018-05-11 09:10:27 UTC
Same thing in function polytext16 in same file:

xorg-server-1.20.0/miext/rootless/rootlessGC.c:1329] -> [xorg-server-1.20.0/miext/rootless/rootlessGC.c:1337]: (warning) Identical inner 'if' condition is always true.
Comment 2 GitLab Migration User 2018-12-13 22:39:33 UTC
-- GitLab Migration Automatic Message --

This bug has been migrated to freedesktop.org's GitLab instance and has been closed from further activity.

You can subscribe and participate further through the new bug through this link to our GitLab instance: https://gitlab.freedesktop.org/xorg/xserver/issues/537.

Use of freedesktop.org services, including Bugzilla, is subject to our Code of Conduct. How we collect and use information is described in our Privacy Policy.