Date: prev next · Thread: first prev next last
2011 Archives by date, by thread · List index


Hi julien2412,

On Tuesday, 2011-09-13 13:03:41 -0700, julien2412 wrote:

Here's another "duplicateif" detected by cppcheck (thanks to Jesse's report
;-) )in vcl/source/gdi/outdev3.cxx (line 1999) :
        if( nMatchType & IMPL_FONT_ATTR_OTHERSTYLE )
        {
            if( !(nMatchType & IMPL_FONT_ATTR_OTHERSTYLE) )
                nTestMatch -= 10000;
        }
        else if( nMatchType & IMPL_FONT_ATTR_OTHERSTYLE )
            nTestMatch -= 10000;

I'd call that a triplicateif.. actually doing nothing.

I tried to find from when it's been there but after 5 minutes of searching
in gitk, I gave up.
(if someone knows a quick way to find at which commit a specific change has
been made... )

git log -G is your friend.

git log -G 'nMatchType.+IMPL_FONT_ATTR_OTHERSTYLE' vcl/source/gdi/outdev3.cxx

leads to
git show 4b2ab50308532bd070d9af4ef3d4893256cbe931

a CWS integration consisting of
git show c34627e6c9722436a2c2627f4f52b4b2ddf0d95a
and a following
git show ddb0bc2ec0f4e65168003549cd15000b4c0b8aea


Could someone explain the logic of all this ? First I thought about a typo
but even with 1 typo, it means nothing.

The original intent of that construct, even when seen with the removed
code in between, isn't really clear to me, but the negated condition
looks like a copy&paste error from the code that was removed in commit
ddb0bc2ec0f4e65168003549cd15000b4c0b8aea, with

// IMPL_FONT_ATTR_OTHERSTYLE    - OldStyle, ... so negativ points

I conclude that indeed a negative weight should be added, so

    if (nMatchType & IMPL_FONT_ATTR_OTHERSTYLE)
        nTestMatch -= 10000;

looks right to me.

  Eike

-- 
 PGP/OpenPGP/GnuPG encrypted mail preferred in all private communication.
 Key ID: 0x293C05FD - 997A 4C60 CE41 0149 0DB3  9E96 2F1A D073 293C 05FD

Attachment: signature.asc
Description: Digital signature


Context


Privacy Policy | Impressum (Legal Info) | Copyright information: Unless otherwise specified, all text and images on this website are licensed under the Creative Commons Attribution-Share Alike 3.0 License. This does not include the source code of LibreOffice, which is licensed under the Mozilla Public License (MPLv2). "LibreOffice" and "The Document Foundation" are registered trademarks of their corresponding registered owners or are in actual use as trademarks in one or more countries. Their respective logos and icons are also subject to international copyright laws. Use thereof is explained in our trademark policy.