Mike Giroux created XERCESC-2015:
------------------------------------

             Summary: Fix warnings under g++ 4.7.2 with -Wall
                 Key: XERCESC-2015
                 URL: https://issues.apache.org/jira/browse/XERCESC-2015
             Project: Xerces-C++
          Issue Type: Improvement
          Components: Validating Parser (XML Schema)
    Affects Versions: 2.8.0
            Reporter: Mike Giroux
            Priority: Minor
             Fix For: 2.8.0


SchemaAttDef.hpp and SchemaElementDecl.hpp both trigger warnings under -Wall 
with g++ 4.7.2.  In our environment, since we use -Werror for validation, these 
become a more serious issue.

There are 2 categories of fixes - a signed/unsigned comparison mismatch in 
SchemaElementDecl::isGlobalDecl, and some missing parens in if statements in 
SchemaAttDef::getMemberTypeAnonymous() and bool 
SchemaElementDecl::isTypeDefinitionUnion().

Here's a patch:

---
 src/xercesc/validators/schema/SchemaAttDef.hpp      | 4 ++--
 src/xercesc/validators/schema/SchemaElementDecl.hpp | 6 +++---
 2 files changed, 5 insertions(+), 5 deletions(-)

diff --git a/src/xercesc/validators/schema/SchemaAttDef.hpp 
b/src/xercesc/validators/schema/SchemaAttDef.hpp
index 7648de0..2c069b7 100644
--- a/src/xercesc/validators/schema/SchemaAttDef.hpp
+++ b/src/xercesc/validators/schema/SchemaAttDef.hpp
@@ -401,8 +401,8 @@ inline bool SchemaAttDef::getMemberTypeAnonymous() const {
 }

 inline bool SchemaAttDef::isTypeDefinitionUnion() const {
-   if(fAnyDatatypeValidator && fAnyDatatypeValidator->getType() == 
DatatypeValidator::Union ||
-      fDatatypeValidator && fDatatypeValidator->getType() == 
DatatypeValidator::Union)
+   if(   (fAnyDatatypeValidator && fAnyDatatypeValidator->getType() == 
DatatypeValidator::Union)
+      || (fDatatypeValidator && fDatatypeValidator->getType() == 
DatatypeValidator::Union))
        return true;
     return false;
 }
diff --git a/src/xercesc/validators/schema/SchemaElementDecl.hpp 
b/src/xercesc/validators/schema/SchemaElementDecl.hpp
index 9ffc2f2..5f9ad8f 100644
--- a/src/xercesc/validators/schema/SchemaElementDecl.hpp
+++ b/src/xercesc/validators/schema/SchemaElementDecl.hpp
@@ -506,7 +506,7 @@ inline SchemaAttDef* SchemaElementDecl::getAttWildCard() {

 inline bool SchemaElementDecl::isGlobalDecl() const {

-    return (fEnclosingScope == Grammar::TOP_LEVEL_SCOPE);
+    return (static_cast<unsigned int>(fEnclosingScope) == 
Grammar::TOP_LEVEL_SCOPE);
 }

 inline SchemaElementDecl*
@@ -591,8 +591,8 @@ inline bool SchemaElementDecl::getMemberTypeAnonymous() 
const {
 inline bool SchemaElementDecl::isTypeDefinitionUnion() const {
     // removing fXsi* references would break DOMTypeInfo implementation 
completely;
     // will have to wait for now
-   if(fXsiSimpleTypeInfo && fXsiSimpleTypeInfo->getType() == 
DatatypeValidator::Union ||
-      fDatatypeValidator && fDatatypeValidator->getType() == 
DatatypeValidator::Union)
+   if(   (fXsiSimpleTypeInfo && fXsiSimpleTypeInfo->getType() == 
DatatypeValidator::Union)
+      || (fDatatypeValidator && fDatatypeValidator->getType() == 
DatatypeValidator::Union))
        return true;
     return false;
 }
--


--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to