diff options
author | Julien Nabet <serval2412@yahoo.fr> | 2020-11-18 21:13:04 +0100 |
---|---|---|
committer | Julien Nabet <serval2412@yahoo.fr> | 2020-11-19 12:17:06 +0100 |
commit | ef7abc0dc87e9820f80245ab0e8781bac358505f (patch) | |
tree | 920d8c39f59d166a01089d4ea29d83b7c3b87e0b | |
parent | 6ec95f00083df7e48c5e95879a778e4d0d3c62d5 (diff) |
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@collabora.co.uk>
Reviewed-by: Julien Nabet <serval2412@yahoo.fr>
Tested-by: Jenkins
-rw-r--r-- | xmloff/source/forms/elementimport.cxx | 4 |
1 files changed, 2 insertions, 2 deletions
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, |