[libxml2] relaxng.c: cast to allow compilation with sun studio 11



commit a7a6a4b2f39b6bc2973eed8b0fb7cf917a171487
Author: Ben Walton <bwalton artsci utoronto ca>
Date:   Mon Mar 15 10:06:36 2010 +0100

    relaxng.c: cast to allow compilation with sun studio 11
    
    Sun Studio 11 was failing to compile relaxng.c due to a type mismatch
    in a ternary operator used to provide an argument to xmlRngPErr.  It
    seems that sos11 cc is more pedantic about this part of the C99
    standard.  GCC issues a warning but doesn't fail by default.
    
    After casting the string literal "nothing" to (const xmlChar *) sos11
    cc is happy.  GCC no longer issues a warning either.
    
    Another warning was cleaned up with an identical cast.

 relaxng.c |    6 ++++--
 1 files changed, 4 insertions(+), 2 deletions(-)
---
diff --git a/relaxng.c b/relaxng.c
index 075fc4a..6dbc499 100644
--- a/relaxng.c
+++ b/relaxng.c
@@ -5369,7 +5369,8 @@ xmlRelaxNGParseNameClass(xmlRelaxNGParserCtxtPtr ctxt, xmlNodePtr node,
     } else {
         xmlRngPErr(ctxt, node, XML_RNGP_CHOICE_CONTENT,
                    "expecting name, anyName, nsName or choice : got %s\n",
-                   (node == NULL ? "nothing" : node->name), NULL);
+                   (node == NULL ? (const xmlChar *) "nothing" : node->name),
+		   NULL);
         return (NULL);
     }
     if (ret != def) {
@@ -9459,7 +9460,8 @@ xmlRelaxNGValidateInterleave(xmlRelaxNGValidCtxtPtr ctxt,
             ctxt->states = NULL;
             if (found == 0) {
                 if (cur == NULL) {
-                    VALID_ERR2(XML_RELAXNG_ERR_INTEREXTRA, "noname");
+		    VALID_ERR2(XML_RELAXNG_ERR_INTEREXTRA,
+			       (const xmlChar *) "noname");
                 } else {
                     VALID_ERR2(XML_RELAXNG_ERR_INTEREXTRA, cur->name);
                 }



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]