[Libreoffice-commits] core.git: xmloff/source

Julien Nabet (via logerrit) logerrit at kemper.freedesktop.org
Thu Nov 19 11:17:44 UTC 2020


 xmloff/source/forms/elementimport.cxx |    4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

New commits:
commit ef7abc0dc87e9820f80245ab0e8781bac358505f
Author:     Julien Nabet <serval2412 at yahoo.fr>
AuthorDate: Wed Nov 18 21:13:04 2020 +0100
Commit:     Julien Nabet <serval2412 at yahoo.fr>
CommitDate: Thu Nov 19 12:17:06 2020 +0100

    Fix SAL_WARN_IF in elementimport (xmloff)
    
    Wrong from:
    2012-05-17 5e0b52c1893ffe04a68333026afa7a557c48d534
    -                    (0 == _rPropValue.Name.compareToAscii(PROPERTY_EFFECTIVE_VALUE))
    -                ||  (0 == _rPropValue.Name.compareToAscii(PROPERTY_EFFECTIVE_DEFAULT)),
    +                    (0 == _rPropValue.Name.equalsAsciiL(PROPERTY_EFFECTIVE_VALUE.ascii, PROPERTY_EFFECTIVE_VALUE.length))
    +                ||  (0 == _rPropValue.Name.equalsAsciiL(PROPERTY_EFFECTIVE_DEFAULT.ascii, PROPERTY_EFFECTIVE_DEFAULT.length)),
    since '"compareToAscii" returned 0 if both strings are equal'
    whereas "equalsAsciiL" returned sal_Bool (so sal_True if both strings equal)
    
    there have been different changes during some years.
    But c2d808a5ddf89ce40939d166e67dd0271852104f (2019-02-01) did also wrongly this:
    -            OSL_ENSURE(
    -                    _rPropValue.Name != PROPERTY_EFFECTIVE_VALUE
    -                &&  _rPropValue.Name != PROPERTY_EFFECTIVE_DEFAULT,
    -                "OControlImport::implTranslateValueProperty: invalid property type/name combination!");
    +            SAL_WARN_IF(
    +                    _rPropValue.Name == PROPERTY_EFFECTIVE_VALUE
    +                ||  _rPropValue.Name == PROPERTY_EFFECTIVE_DEFAULT, "xmloff",
    +                "OControlImport::implTranslateValueProperty: invalid property type/name combination, Any and " + _rPropValue.Name);
    
    Indeed the comment (which has never changed since 2001) above indicates:
    "we have exactly 2 properties where this type class is allowed"
    
    In brief, we want to warn if "_rPropValue.Name" different from "PROPERTY_EFFECTIVE_VALUE" and "PROPERTY_EFFECTIVE_DEFAULT"
    
    Change-Id: I576b2af2eaf96c53ae7950b352239ce1510ff03c
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/106080
    Reviewed-by: Noel Grandin <noel.grandin at collabora.co.uk>
    Reviewed-by: Julien Nabet <serval2412 at yahoo.fr>
    Tested-by: Jenkins

diff --git a/xmloff/source/forms/elementimport.cxx b/xmloff/source/forms/elementimport.cxx
index 42a151c9354b..0b14b3155956 100644
--- a/xmloff/source/forms/elementimport.cxx
+++ b/xmloff/source/forms/elementimport.cxx
@@ -877,8 +877,8 @@ namespace xmloff
         {
             // we have exactly 2 properties where this type class is allowed:
             SAL_WARN_IF(
-                    _rPropValue.Name == PROPERTY_EFFECTIVE_VALUE
-                ||  _rPropValue.Name == PROPERTY_EFFECTIVE_DEFAULT, "xmloff",
+                    _rPropValue.Name != PROPERTY_EFFECTIVE_VALUE
+                &&  _rPropValue.Name != PROPERTY_EFFECTIVE_DEFAULT, "xmloff",
                 "OControlImport::implTranslateValueProperty: invalid property type/name combination, Any and " << _rPropValue.Name);
 
             // Both properties are allowed to have a double or a string value,


More information about the Libreoffice-commits mailing list