Diff for /embedaddon/libxml2/xmlschemastypes.c between versions 1.1.1.2 and 1.1.1.3

version 1.1.1.2, 2013/07/22 01:22:21 version 1.1.1.3, 2014/06/15 19:53:28
Line 40  extern double xmlXPathPINF; Line 40  extern double xmlXPathPINF;
 extern double xmlXPathNINF;  extern double xmlXPathNINF;
 #endif  #endif
   
#define TODO                                                            \#define TODO                                                            \
     xmlGenericError(xmlGenericErrorContext,                             \      xmlGenericError(xmlGenericErrorContext,                             \
             "Unimplemented block at %s:%d\n",                           \              "Unimplemented block at %s:%d\n",                           \
             __FILE__, __LINE__);              __FILE__, __LINE__);
Line 75  typedef struct _xmlSchemaValDuration xmlSchemaValDurat Line 75  typedef struct _xmlSchemaValDuration xmlSchemaValDurat
 typedef xmlSchemaValDuration *xmlSchemaValDurationPtr;  typedef xmlSchemaValDuration *xmlSchemaValDurationPtr;
 struct _xmlSchemaValDuration {  struct _xmlSchemaValDuration {
     long                mon;            /* mon stores years also */      long                mon;            /* mon stores years also */
    long                day;    long        day;
     double              sec;            /* sec stores min and hour also */      double              sec;            /* sec stores min and hour also */
 };  };
   
Line 189  static xmlSchemaTypePtr xmlSchemaTypeNmtokensDef = NUL Line 189  static xmlSchemaTypePtr xmlSchemaTypeNmtokensDef = NUL
   
 /************************************************************************  /************************************************************************
  *                                                                      *   *                                                                      *
 *                      Datatype error handlers                         * *                        Datatype error handlers                         *
  *                                                                      *   *                                                                      *
  ************************************************************************/   ************************************************************************/
 /**  /**
Line 206  xmlSchemaTypeErrMemory(xmlNodePtr node, const char *ex Line 206  xmlSchemaTypeErrMemory(xmlNodePtr node, const char *ex
   
 /************************************************************************  /************************************************************************
  *                                                                      *   *                                                                      *
 *                      Base types support                              * *                        Base types support                              *
  *                                                                      *   *                                                                      *
  ************************************************************************/   ************************************************************************/
   
Line 254  xmlSchemaNewMinLengthFacet(int value) Line 254  xmlSchemaNewMinLengthFacet(int value)
  * Initialize one primitive built-in type   * Initialize one primitive built-in type
  */   */
 static xmlSchemaTypePtr  static xmlSchemaTypePtr
xmlSchemaInitBasicType(const char *name, xmlSchemaValType type, xmlSchemaInitBasicType(const char *name, xmlSchemaValType type,
                        xmlSchemaTypePtr baseType) {                         xmlSchemaTypePtr baseType) {
     xmlSchemaTypePtr ret;      xmlSchemaTypePtr ret;
   
Line 267  xmlSchemaInitBasicType(const char *name, xmlSchemaValT Line 267  xmlSchemaInitBasicType(const char *name, xmlSchemaValT
     ret->name = (const xmlChar *)name;      ret->name = (const xmlChar *)name;
     ret->targetNamespace = XML_SCHEMAS_NAMESPACE_NAME;      ret->targetNamespace = XML_SCHEMAS_NAMESPACE_NAME;
     ret->type = XML_SCHEMA_TYPE_BASIC;      ret->type = XML_SCHEMA_TYPE_BASIC;
    ret->baseType = baseType;       ret->baseType = baseType;
     ret->contentType = XML_SCHEMA_CONTENT_BASIC;      ret->contentType = XML_SCHEMA_CONTENT_BASIC;
     /*      /*
     * Primitive types.      * Primitive types.
     */      */
    switch (type) {                 switch (type) {
        case XML_SCHEMAS_STRING:                    case XML_SCHEMAS_STRING:
        case XML_SCHEMAS_DECIMAL:            case XML_SCHEMAS_DECIMAL:
        case XML_SCHEMAS_DATE:            case XML_SCHEMAS_DATE:
        case XML_SCHEMAS_DATETIME:            case XML_SCHEMAS_DATETIME:
        case XML_SCHEMAS_TIME:            case XML_SCHEMAS_TIME:
        case XML_SCHEMAS_GYEAR:            case XML_SCHEMAS_GYEAR:
        case XML_SCHEMAS_GYEARMONTH:            case XML_SCHEMAS_GYEARMONTH:
        case XML_SCHEMAS_GMONTH:            case XML_SCHEMAS_GMONTH:
        case XML_SCHEMAS_GMONTHDAY:            case XML_SCHEMAS_GMONTHDAY:
        case XML_SCHEMAS_GDAY:            case XML_SCHEMAS_GDAY:
        case XML_SCHEMAS_DURATION:            case XML_SCHEMAS_DURATION:
        case XML_SCHEMAS_FLOAT:            case XML_SCHEMAS_FLOAT:
        case XML_SCHEMAS_DOUBLE:            case XML_SCHEMAS_DOUBLE:
        case XML_SCHEMAS_BOOLEAN:            case XML_SCHEMAS_BOOLEAN:
        case XML_SCHEMAS_ANYURI:            case XML_SCHEMAS_ANYURI:
        case XML_SCHEMAS_HEXBINARY:            case XML_SCHEMAS_HEXBINARY:
        case XML_SCHEMAS_BASE64BINARY:          case XML_SCHEMAS_BASE64BINARY:
        case XML_SCHEMAS_QNAME:         case XML_SCHEMAS_QNAME:
        case XML_SCHEMAS_NOTATION:              case XML_SCHEMAS_NOTATION:
             ret->flags |= XML_SCHEMAS_TYPE_BUILTIN_PRIMITIVE;              ret->flags |= XML_SCHEMAS_TYPE_BUILTIN_PRIMITIVE;
             break;              break;
         default:          default:
Line 309  xmlSchemaInitBasicType(const char *name, xmlSchemaValT Line 309  xmlSchemaInitBasicType(const char *name, xmlSchemaValT
         case XML_SCHEMAS_ENTITIES:          case XML_SCHEMAS_ENTITIES:
             ret->flags |= XML_SCHEMAS_TYPE_VARIETY_LIST;              ret->flags |= XML_SCHEMAS_TYPE_VARIETY_LIST;
             ret->facets = xmlSchemaNewMinLengthFacet(1);              ret->facets = xmlSchemaNewMinLengthFacet(1);
            ret->flags |= XML_SCHEMAS_TYPE_HAS_FACETS;                  ret->flags |= XML_SCHEMAS_TYPE_HAS_FACETS;
             break;              break;
         default:          default:
             ret->flags |= XML_SCHEMAS_TYPE_VARIETY_ATOMIC;              ret->flags |= XML_SCHEMAS_TYPE_VARIETY_ATOMIC;
Line 390  xmlSchemaInitTypes(void) Line 390  xmlSchemaInitTypes(void)
         return;          return;
     xmlSchemaTypesBank = xmlHashCreate(40);      xmlSchemaTypesBank = xmlHashCreate(40);
   
    
     /*      /*
     * 3.4.7 Built-in Complex Type Definition      * 3.4.7 Built-in Complex Type Definition
     */      */
     xmlSchemaTypeAnyTypeDef = xmlSchemaInitBasicType("anyType",      xmlSchemaTypeAnyTypeDef = xmlSchemaInitBasicType("anyType",
                                                     XML_SCHEMAS_ANYTYPE,                                                      XML_SCHEMAS_ANYTYPE,
                                                      NULL);                                                       NULL);
     xmlSchemaTypeAnyTypeDef->baseType = xmlSchemaTypeAnyTypeDef;      xmlSchemaTypeAnyTypeDef->baseType = xmlSchemaTypeAnyTypeDef;
     xmlSchemaTypeAnyTypeDef->contentType = XML_SCHEMA_CONTENT_MIXED;      xmlSchemaTypeAnyTypeDef->contentType = XML_SCHEMA_CONTENT_MIXED;
     /*      /*
     * Init the content type.      * Init the content type.
     */      */
    xmlSchemaTypeAnyTypeDef->contentType = XML_SCHEMA_CONTENT_MIXED;        xmlSchemaTypeAnyTypeDef->contentType = XML_SCHEMA_CONTENT_MIXED;
     {      {
         xmlSchemaParticlePtr particle;          xmlSchemaParticlePtr particle;
         xmlSchemaModelGroupPtr sequence;          xmlSchemaModelGroupPtr sequence;
Line 420  xmlSchemaInitTypes(void) Line 420  xmlSchemaInitTypes(void)
             return;              return;
         }          }
         memset(sequence, 0, sizeof(xmlSchemaModelGroup));          memset(sequence, 0, sizeof(xmlSchemaModelGroup));
        sequence->type = XML_SCHEMA_TYPE_SEQUENCE;              sequence->type = XML_SCHEMA_TYPE_SEQUENCE;
         particle->children = (xmlSchemaTreeItemPtr) sequence;          particle->children = (xmlSchemaTreeItemPtr) sequence;
         /* Second particle. */          /* Second particle. */
         particle = xmlSchemaAddParticle();          particle = xmlSchemaAddParticle();
Line 437  xmlSchemaInitTypes(void) Line 437  xmlSchemaInitTypes(void)
         }          }
         memset(wild, 0, sizeof(xmlSchemaWildcard));          memset(wild, 0, sizeof(xmlSchemaWildcard));
         wild->type = XML_SCHEMA_TYPE_ANY;          wild->type = XML_SCHEMA_TYPE_ANY;
        wild->any = 1;          wild->any = 1;
        wild->processContents = XML_SCHEMAS_ANY_LAX;            wild->processContents = XML_SCHEMAS_ANY_LAX;
        particle->children = (xmlSchemaTreeItemPtr) wild;            particle->children = (xmlSchemaTreeItemPtr) wild;
         /*          /*
         * Create the attribute wildcard.          * Create the attribute wildcard.
         */          */
Line 451  xmlSchemaInitTypes(void) Line 451  xmlSchemaInitTypes(void)
         }          }
         memset(wild, 0, sizeof(xmlSchemaWildcard));          memset(wild, 0, sizeof(xmlSchemaWildcard));
         wild->any = 1;          wild->any = 1;
        wild->processContents = XML_SCHEMAS_ANY_LAX;            wild->processContents = XML_SCHEMAS_ANY_LAX;
         xmlSchemaTypeAnyTypeDef->attributeWildcard = wild;          xmlSchemaTypeAnyTypeDef->attributeWildcard = wild;
     }      }
    xmlSchemaTypeAnySimpleTypeDef = xmlSchemaInitBasicType("anySimpleType",     xmlSchemaTypeAnySimpleTypeDef = xmlSchemaInitBasicType("anySimpleType",
                                                            XML_SCHEMAS_ANYSIMPLETYPE,                                                             XML_SCHEMAS_ANYSIMPLETYPE,
                                                            xmlSchemaTypeAnyTypeDef);                                                             xmlSchemaTypeAnyTypeDef);
     /*      /*
Line 513  xmlSchemaInitTypes(void) Line 513  xmlSchemaInitTypes(void)
         xmlSchemaTypeAnySimpleTypeDef);          xmlSchemaTypeAnySimpleTypeDef);
     xmlSchemaTypeNotationDef = xmlSchemaInitBasicType("NOTATION",      xmlSchemaTypeNotationDef = xmlSchemaInitBasicType("NOTATION",
                                                     XML_SCHEMAS_NOTATION,                                                      XML_SCHEMAS_NOTATION,
                                                    xmlSchemaTypeAnySimpleTypeDef);                                                        xmlSchemaTypeAnySimpleTypeDef);
     xmlSchemaTypeQNameDef = xmlSchemaInitBasicType("QName",      xmlSchemaTypeQNameDef = xmlSchemaInitBasicType("QName",
                                                    XML_SCHEMAS_QNAME,                                                     XML_SCHEMAS_QNAME,
                                                    xmlSchemaTypeAnySimpleTypeDef);                                                     xmlSchemaTypeAnySimpleTypeDef);
Line 583  xmlSchemaInitTypes(void) Line 583  xmlSchemaInitTypes(void)
                                                     xmlSchemaTypeNCNameDef);                                                      xmlSchemaTypeNCNameDef);
     xmlSchemaTypeIdrefDef = xmlSchemaInitBasicType("IDREF",      xmlSchemaTypeIdrefDef = xmlSchemaInitBasicType("IDREF",
                                                    XML_SCHEMAS_IDREF,                                                     XML_SCHEMAS_IDREF,
                                                   xmlSchemaTypeNCNameDef);                                                           xmlSchemaTypeNCNameDef);
     xmlSchemaTypeEntityDef = xmlSchemaInitBasicType("ENTITY",      xmlSchemaTypeEntityDef = xmlSchemaInitBasicType("ENTITY",
                                                     XML_SCHEMAS_ENTITY,                                                      XML_SCHEMAS_ENTITY,
                                                     xmlSchemaTypeNCNameDef);                                                      xmlSchemaTypeNCNameDef);
Line 615  xmlSchemaInitTypes(void) Line 615  xmlSchemaInitTypes(void)
  *   *
  * Cleanup the default XML Schemas type library   * Cleanup the default XML Schemas type library
  */   */
void    void
 xmlSchemaCleanupTypes(void) {  xmlSchemaCleanupTypes(void) {
     if (xmlSchemaTypesInitialized == 0)      if (xmlSchemaTypesInitialized == 0)
         return;          return;
Line 629  xmlSchemaCleanupTypes(void) { Line 629  xmlSchemaCleanupTypes(void) {
         /* Content type. */          /* Content type. */
         particle = (xmlSchemaParticlePtr) xmlSchemaTypeAnyTypeDef->subtypes;          particle = (xmlSchemaParticlePtr) xmlSchemaTypeAnyTypeDef->subtypes;
         /* Wildcard. */          /* Wildcard. */
        xmlSchemaFreeWildcard((xmlSchemaWildcardPtr)         xmlSchemaFreeWildcard((xmlSchemaWildcardPtr)
             particle->children->children->children);              particle->children->children->children);
         xmlFree((xmlSchemaParticlePtr) particle->children->children);          xmlFree((xmlSchemaParticlePtr) particle->children->children);
         /* Sequence model group. */          /* Sequence model group. */
         xmlFree((xmlSchemaModelGroupPtr) particle->children);          xmlFree((xmlSchemaModelGroupPtr) particle->children);
         xmlFree((xmlSchemaParticlePtr) particle);          xmlFree((xmlSchemaParticlePtr) particle);
        xmlSchemaTypeAnyTypeDef->subtypes = NULL;               xmlSchemaTypeAnyTypeDef->subtypes = NULL;
     }      }
     xmlHashFree(xmlSchemaTypesBank, (xmlHashDeallocator) xmlSchemaFreeType);      xmlHashFree(xmlSchemaTypesBank, (xmlHashDeallocator) xmlSchemaFreeType);
     xmlSchemaTypesInitialized = 0;      xmlSchemaTypesInitialized = 0;
Line 665  xmlSchemaIsBuiltInTypeFacet(xmlSchemaTypePtr type, int Line 665  xmlSchemaIsBuiltInTypeFacet(xmlSchemaTypePtr type, int
                 (facetType == XML_SCHEMA_FACET_WHITESPACE))                  (facetType == XML_SCHEMA_FACET_WHITESPACE))
                 return (1);                  return (1);
             else              else
                return (0);                     return (0);
         case XML_SCHEMAS_STRING:          case XML_SCHEMAS_STRING:
         case XML_SCHEMAS_NOTATION:          case XML_SCHEMAS_NOTATION:
         case XML_SCHEMAS_QNAME:          case XML_SCHEMAS_QNAME:
        case XML_SCHEMAS_ANYURI:                    case XML_SCHEMAS_ANYURI:
        case XML_SCHEMAS_BASE64BINARY:            case XML_SCHEMAS_BASE64BINARY:
         case XML_SCHEMAS_HEXBINARY:          case XML_SCHEMAS_HEXBINARY:
             if ((facetType == XML_SCHEMA_FACET_LENGTH) ||              if ((facetType == XML_SCHEMA_FACET_LENGTH) ||
                 (facetType == XML_SCHEMA_FACET_MINLENGTH) ||                  (facetType == XML_SCHEMA_FACET_MINLENGTH) ||
Line 693  xmlSchemaIsBuiltInTypeFacet(xmlSchemaTypePtr type, int Line 693  xmlSchemaIsBuiltInTypeFacet(xmlSchemaTypePtr type, int
                 (facetType == XML_SCHEMA_FACET_MINEXCLUSIVE))                  (facetType == XML_SCHEMA_FACET_MINEXCLUSIVE))
                 return (1);                  return (1);
             else              else
                return (0);                 return (0);
         case XML_SCHEMAS_TIME:          case XML_SCHEMAS_TIME:
        case XML_SCHEMAS_GDAY:         case XML_SCHEMAS_GDAY:
         case XML_SCHEMAS_GMONTH:          case XML_SCHEMAS_GMONTH:
        case XML_SCHEMAS_GMONTHDAY:         case XML_SCHEMAS_GMONTHDAY:
        case XML_SCHEMAS_GYEAR:         case XML_SCHEMAS_GYEAR:
         case XML_SCHEMAS_GYEARMONTH:          case XML_SCHEMAS_GYEARMONTH:
         case XML_SCHEMAS_DATE:          case XML_SCHEMAS_DATE:
         case XML_SCHEMAS_DATETIME:          case XML_SCHEMAS_DATETIME:
Line 714  xmlSchemaIsBuiltInTypeFacet(xmlSchemaTypePtr type, int Line 714  xmlSchemaIsBuiltInTypeFacet(xmlSchemaTypePtr type, int
                 (facetType == XML_SCHEMA_FACET_MINEXCLUSIVE))                  (facetType == XML_SCHEMA_FACET_MINEXCLUSIVE))
                 return (1);                  return (1);
             else              else
                return (0);                                                      return (0);
         default:          default:
             break;              break;
     }      }
Line 736  xmlSchemaGetBuiltInType(xmlSchemaValType type) Line 736  xmlSchemaGetBuiltInType(xmlSchemaValType type)
     if (xmlSchemaTypesInitialized == 0)      if (xmlSchemaTypesInitialized == 0)
         xmlSchemaInitTypes();          xmlSchemaInitTypes();
     switch (type) {      switch (type) {
        
         case XML_SCHEMAS_ANYSIMPLETYPE:          case XML_SCHEMAS_ANYSIMPLETYPE:
             return (xmlSchemaTypeAnySimpleTypeDef);              return (xmlSchemaTypeAnySimpleTypeDef);
         case XML_SCHEMAS_STRING:          case XML_SCHEMAS_STRING:
Line 752  xmlSchemaGetBuiltInType(xmlSchemaValType type) Line 752  xmlSchemaGetBuiltInType(xmlSchemaValType type)
         case XML_SCHEMAS_GMONTH:          case XML_SCHEMAS_GMONTH:
             return (xmlSchemaTypeGMonthDef);              return (xmlSchemaTypeGMonthDef);
         case XML_SCHEMAS_GMONTHDAY:          case XML_SCHEMAS_GMONTHDAY:
            return (xmlSchemaTypeGMonthDayDef);            return (xmlSchemaTypeGMonthDayDef);
         case XML_SCHEMAS_GYEAR:          case XML_SCHEMAS_GYEAR:
             return (xmlSchemaTypeGYearDef);              return (xmlSchemaTypeGYearDef);
         case XML_SCHEMAS_GYEARMONTH:          case XML_SCHEMAS_GYEARMONTH:
Line 828  xmlSchemaGetBuiltInType(xmlSchemaValType type) Line 828  xmlSchemaGetBuiltInType(xmlSchemaValType type)
         case XML_SCHEMAS_BASE64BINARY:          case XML_SCHEMAS_BASE64BINARY:
             return (xmlSchemaTypeBase64BinaryDef);              return (xmlSchemaTypeBase64BinaryDef);
         case XML_SCHEMAS_ANYTYPE:          case XML_SCHEMAS_ANYTYPE:
            return (xmlSchemaTypeAnyTypeDef);                   return (xmlSchemaTypeAnyTypeDef);
         default:          default:
             return (NULL);              return (NULL);
     }      }
Line 880  xmlSchemaValueGetNext(xmlSchemaValPtr cur) { Line 880  xmlSchemaValueGetNext(xmlSchemaValPtr cur) {
  */   */
 const xmlChar *  const xmlChar *
 xmlSchemaValueGetAsString(xmlSchemaValPtr val)  xmlSchemaValueGetAsString(xmlSchemaValPtr val)
{    {
     if (val == NULL)      if (val == NULL)
         return (NULL);          return (NULL);
     switch (val->type) {      switch (val->type) {
Line 913  xmlSchemaValueGetAsString(xmlSchemaValPtr val) Line 913  xmlSchemaValueGetAsString(xmlSchemaValPtr val)
  */   */
 int  int
 xmlSchemaValueGetAsBoolean(xmlSchemaValPtr val)  xmlSchemaValueGetAsBoolean(xmlSchemaValPtr val)
{    {
     if ((val == NULL) || (val->type != XML_SCHEMAS_BOOLEAN))      if ((val == NULL) || (val->type != XML_SCHEMAS_BOOLEAN))
         return (0);          return (0);
     return (val->value.b);      return (val->value.b);
Line 924  xmlSchemaValueGetAsBoolean(xmlSchemaValPtr val) Line 924  xmlSchemaValueGetAsBoolean(xmlSchemaValPtr val)
  * @type:  the value type   * @type:  the value type
  * @value:  the value   * @value:  the value
  *   *
 * Allocate a new simple type value. The type can be  * Allocate a new simple type value. The type can be
 * of XML_SCHEMAS_STRING.  * of XML_SCHEMAS_STRING.
  * WARNING: This one is intended to be expanded for other   * WARNING: This one is intended to be expanded for other
  * string based types. We need this for anySimpleType as well.   * string based types. We need this for anySimpleType as well.
  * The given value is consumed and freed with the struct.   * The given value is consumed and freed with the struct.
Line 1007  xmlSchemaNewQNameValue(const xmlChar *namespaceName, Line 1007  xmlSchemaNewQNameValue(const xmlChar *namespaceName,
  *   *
  * Cleanup the default XML Schemas type library   * Cleanup the default XML Schemas type library
  */   */
void    void
 xmlSchemaFreeValue(xmlSchemaValPtr value) {  xmlSchemaFreeValue(xmlSchemaValPtr value) {
     xmlSchemaValPtr prev;      xmlSchemaValPtr prev;
   
    while (value != NULL) {         while (value != NULL) {
         switch (value->type) {          switch (value->type) {
             case XML_SCHEMAS_STRING:              case XML_SCHEMAS_STRING:
             case XML_SCHEMAS_NORMSTRING:              case XML_SCHEMAS_NORMSTRING:
Line 1025  xmlSchemaFreeValue(xmlSchemaValPtr value) { Line 1025  xmlSchemaFreeValue(xmlSchemaValPtr value) {
             case XML_SCHEMAS_IDREF:              case XML_SCHEMAS_IDREF:
             case XML_SCHEMAS_IDREFS:              case XML_SCHEMAS_IDREFS:
             case XML_SCHEMAS_ENTITY:              case XML_SCHEMAS_ENTITY:
            case XML_SCHEMAS_ENTITIES:                    case XML_SCHEMAS_ENTITIES:
             case XML_SCHEMAS_ANYURI:              case XML_SCHEMAS_ANYURI:
             case XML_SCHEMAS_ANYSIMPLETYPE:              case XML_SCHEMAS_ANYSIMPLETYPE:
                 if (value->value.str != NULL)                  if (value->value.str != NULL)
Line 1052  xmlSchemaFreeValue(xmlSchemaValPtr value) { Line 1052  xmlSchemaFreeValue(xmlSchemaValPtr value) {
         prev = value;          prev = value;
         value = value->next;          value = value->next;
         xmlFree(prev);          xmlFree(prev);
    }        }
 }  }
   
 /**  /**
Line 1088  xmlSchemaGetBuiltInListSimpleTypeItemType(xmlSchemaTyp Line 1088  xmlSchemaGetBuiltInListSimpleTypeItemType(xmlSchemaTyp
     if ((type == NULL) || (type->type != XML_SCHEMA_TYPE_BASIC))      if ((type == NULL) || (type->type != XML_SCHEMA_TYPE_BASIC))
         return (NULL);          return (NULL);
     switch (type->builtInType) {      switch (type->builtInType) {
        case XML_SCHEMAS_NMTOKENS:         case XML_SCHEMAS_NMTOKENS:
             return (xmlSchemaTypeNmtokenDef );              return (xmlSchemaTypeNmtokenDef );
        case XML_SCHEMAS_IDREFS:         case XML_SCHEMAS_IDREFS:
             return (xmlSchemaTypeIdrefDef);              return (xmlSchemaTypeIdrefDef);
         case XML_SCHEMAS_ENTITIES:          case XML_SCHEMAS_ENTITIES:
             return (xmlSchemaTypeEntityDef);              return (xmlSchemaTypeEntityDef);
Line 1342  _xmlSchemaParseGDay (xmlSchemaValDatePtr dt, const xml Line 1342  _xmlSchemaParseGDay (xmlSchemaValDatePtr dt, const xml
  */   */
 static int  static int
 _xmlSchemaParseTime (xmlSchemaValDatePtr dt, const xmlChar **str) {  _xmlSchemaParseTime (xmlSchemaValDatePtr dt, const xmlChar **str) {
    const xmlChar *cur = *str;        const xmlChar *cur = *str;
     int ret = 0;      int ret = 0;
     int value = 0;      int value = 0;
   
     PARSE_2_DIGITS(value, cur, ret);      PARSE_2_DIGITS(value, cur, ret);
     if (ret != 0)      if (ret != 0)
        return ret;            return ret;
     if (*cur != ':')      if (*cur != ':')
         return 1;          return 1;
     if (!VALID_HOUR(value))      if (!VALID_HOUR(value))
Line 1614  xmlSchemaValidateDates (xmlSchemaValType type, Line 1614  xmlSchemaValidateDates (xmlSchemaValType type,
             const xmlChar *rewnd = cur;              const xmlChar *rewnd = cur;
             cur++;              cur++;
   
            ret = _xmlSchemaParseGDay(&(dt->value.date), &cur);            ret = _xmlSchemaParseGDay(&(dt->value.date), &cur);
             if ((ret == 0) && ((*cur == 0) || (*cur != ':'))) {              if ((ret == 0) && ((*cur == 0) || (*cur != ':'))) {
   
                 /*                  /*
Line 1852  xmlSchemaValidateDuration (xmlSchemaTypePtr type ATTRI Line 1852  xmlSchemaValidateDuration (xmlSchemaTypePtr type ATTRI
         }          }
         cur++;          cur++;
         if (collapse)          if (collapse)
            while IS_WSP_BLANK_CH(*cur) cur++;                    while IS_WSP_BLANK_CH(*cur) cur++;
     }      }
   
     if (isneg) {      if (isneg) {
Line 1908  xmlSchemaStrip(const xmlChar *value) { Line 1908  xmlSchemaStrip(const xmlChar *value) {
  */   */
 xmlChar *  xmlChar *
 xmlSchemaWhiteSpaceReplace(const xmlChar *value) {  xmlSchemaWhiteSpaceReplace(const xmlChar *value) {
    const xmlChar *cur = value;        const xmlChar *cur = value;
    xmlChar *ret = NULL, *mcur;     xmlChar *ret = NULL, *mcur;
   
    if (value == NULL)     if (value == NULL)
         return(NULL);          return(NULL);
    
    while ((*cur != 0) &&     while ((*cur != 0) &&
         (((*cur) != 0xd) && ((*cur) != 0x9) && ((*cur) != 0xa))) {          (((*cur) != 0xd) && ((*cur) != 0x9) && ((*cur) != 0xa))) {
         cur++;          cur++;
     }      }
Line 1927  xmlSchemaWhiteSpaceReplace(const xmlChar *value) { Line 1927  xmlSchemaWhiteSpaceReplace(const xmlChar *value) {
         if ( ((*mcur) == 0xd) || ((*mcur) == 0x9) || ((*mcur) == 0xa) )          if ( ((*mcur) == 0xd) || ((*mcur) == 0x9) || ((*mcur) == 0xa) )
             *mcur = ' ';              *mcur = ' ';
         mcur++;          mcur++;
    } while (*mcur != 0);               } while (*mcur != 0);
     return(ret);      return(ret);
 }  }
   
Line 2072  xmlSchemaParseUInt(const xmlChar **str, unsigned long  Line 2072  xmlSchemaParseUInt(const xmlChar **str, unsigned long 
     const xmlChar *tmp, *cur = *str;      const xmlChar *tmp, *cur = *str;
     int ret = 0, i = 0;      int ret = 0, i = 0;
   
    if (!((*cur >= '0') && (*cur <= '9')))     if (!((*cur >= '0') && (*cur <= '9')))
         return(-2);          return(-2);
   
     while (*cur == '0') {        /* ignore leading zeroes */      while (*cur == '0') {        /* ignore leading zeroes */
Line 2148  xmlSchemaValAtomicType(xmlSchemaTypePtr type, const xm Line 2148  xmlSchemaValAtomicType(xmlSchemaTypePtr type, const xm
     if ((flags == 0) && (value != NULL)) {      if ((flags == 0) && (value != NULL)) {
   
         if ((type->builtInType != XML_SCHEMAS_STRING) &&          if ((type->builtInType != XML_SCHEMAS_STRING) &&
          (type->builtInType != XML_SCHEMAS_ANYTYPE) &&           (type->builtInType != XML_SCHEMAS_ANYTYPE) &&
           (type->builtInType != XML_SCHEMAS_ANYSIMPLETYPE)) {            (type->builtInType != XML_SCHEMAS_ANYSIMPLETYPE)) {
             if (type->builtInType == XML_SCHEMAS_NORMSTRING)              if (type->builtInType == XML_SCHEMAS_NORMSTRING)
                 norm = xmlSchemaWhiteSpaceReplace(value);                  norm = xmlSchemaWhiteSpaceReplace(value);
Line 2160  xmlSchemaValAtomicType(xmlSchemaTypePtr type, const xm Line 2160  xmlSchemaValAtomicType(xmlSchemaTypePtr type, const xm
     }      }
   
     switch (type->builtInType) {      switch (type->builtInType) {
        case XML_SCHEMAS_UNKNOWN:                    case XML_SCHEMAS_UNKNOWN:
             goto error;              goto error;
         case XML_SCHEMAS_ANYTYPE:          case XML_SCHEMAS_ANYTYPE:
         case XML_SCHEMAS_ANYSIMPLETYPE:          case XML_SCHEMAS_ANYSIMPLETYPE:
Line 2171  xmlSchemaValAtomicType(xmlSchemaTypePtr type, const xm Line 2171  xmlSchemaValAtomicType(xmlSchemaTypePtr type, const xm
                     *val = v;                      *val = v;
                 } else {                  } else {
                     goto error;                      goto error;
                }                               }
             }              }
             goto return0;              goto return0;
        case XML_SCHEMAS_STRING:                        case XML_SCHEMAS_STRING:
             if (! normOnTheFly) {              if (! normOnTheFly) {
                 const xmlChar *cur = value;                  const xmlChar *cur = value;
   
Line 2253  xmlSchemaValAtomicType(xmlSchemaTypePtr type, const xm Line 2253  xmlSchemaValAtomicType(xmlSchemaTypePtr type, const xm
                 const xmlChar *cur = value;                  const xmlChar *cur = value;
                 unsigned int len, neg, integ, hasLeadingZeroes;                  unsigned int len, neg, integ, hasLeadingZeroes;
                 xmlChar cval[25];                  xmlChar cval[25];
                xmlChar *cptr = cval;                           xmlChar *cptr = cval;
   
                 if ((cur == NULL) || (*cur == 0))                  if ((cur == NULL) || (*cur == 0))
                     goto return1;                      goto return1;
Line 2327  xmlSchemaValAtomicType(xmlSchemaTypePtr type, const xm Line 2327  xmlSchemaValAtomicType(xmlSchemaTypePtr type, const xm
                     v = xmlSchemaNewValue(XML_SCHEMAS_DECIMAL);                      v = xmlSchemaNewValue(XML_SCHEMAS_DECIMAL);
                     if (v != NULL) {                      if (v != NULL) {
                         /*                          /*
                        * Now evaluate the significant digits of the number                        * Now evaluate the significant digits of the number
                        */                        */
                         if (len != 0) {                          if (len != 0) {
                            
                             if (integ != ~0u) {                              if (integ != ~0u) {
                                 /*                                  /*
                                 * Get rid of trailing zeroes in the                                  * Get rid of trailing zeroes in the
Line 2604  xmlSchemaValAtomicType(xmlSchemaTypePtr type, const xm Line 2604  xmlSchemaValAtomicType(xmlSchemaTypePtr type, const xm
                         } else {                          } else {
                             cur++;                              cur++;
                         }                          }
                    }                                   }
                }                                }
                 if (val != NULL) {                  if (val != NULL) {
                     v = xmlSchemaNewValue(XML_SCHEMAS_TOKEN);                      v = xmlSchemaNewValue(XML_SCHEMAS_TOKEN);
                     if (v != NULL) {                      if (v != NULL) {
Line 2618  xmlSchemaValAtomicType(xmlSchemaTypePtr type, const xm Line 2618  xmlSchemaValAtomicType(xmlSchemaTypePtr type, const xm
                 goto return0;                  goto return0;
             }              }
         case XML_SCHEMAS_LANGUAGE:          case XML_SCHEMAS_LANGUAGE:
            if (normOnTheFly) {                         if (normOnTheFly) {
                 norm = xmlSchemaCollapseString(value);                  norm = xmlSchemaCollapseString(value);
                 if (norm != NULL)                  if (norm != NULL)
                     value = norm;                      value = norm;
Line 2903  xmlSchemaValAtomicType(xmlSchemaTypePtr type, const xm Line 2903  xmlSchemaValAtomicType(xmlSchemaTypePtr type, const xm
                 }                  }
                 goto done;                  goto done;
             }              }
        case XML_SCHEMAS_ANYURI:{                       case XML_SCHEMAS_ANYURI:{
                 if (*value != 0) {                  if (*value != 0) {
                     xmlURIPtr uri;                      xmlURIPtr uri;
                     xmlChar *tmpval, *cur;                      xmlChar *tmpval, *cur;
                    if (normOnTheFly) {                                 if (normOnTheFly) {
                         norm = xmlSchemaCollapseString(value);                          norm = xmlSchemaCollapseString(value);
                         if (norm != NULL)                          if (norm != NULL)
                             value = norm;                              value = norm;
Line 2996  xmlSchemaValAtomicType(xmlSchemaTypePtr type, const xm Line 2996  xmlSchemaValAtomicType(xmlSchemaTypePtr type, const xm
             }              }
         case XML_SCHEMAS_BASE64BINARY:{          case XML_SCHEMAS_BASE64BINARY:{
                 /* ISSUE:                  /* ISSUE:
                 *                  *
                  * Ignore all stray characters? (yes, currently)                   * Ignore all stray characters? (yes, currently)
                  * Worry about long lines? (no, currently)                   * Worry about long lines? (no, currently)
                 *                  *
                  * rfc2045.txt:                   * rfc2045.txt:
                 *                  *
                  * "The encoded output stream must be represented in lines of                   * "The encoded output stream must be represented in lines of
                  * no more than 76 characters each.  All line breaks or other                   * no more than 76 characters each.  All line breaks or other
                  * characters not found in Table 1 must be ignored by decoding                   * characters not found in Table 1 must be ignored by decoding
Line 3412  xmlSchemaCompareDecimals(xmlSchemaValPtr x, xmlSchemaV Line 3412  xmlSchemaCompareDecimals(xmlSchemaValPtr x, xmlSchemaV
     /*      /*
      * First test: If x is -ve and not zero       * First test: If x is -ve and not zero
      */       */
    if ((x->value.decimal.sign) &&     if ((x->value.decimal.sign) &&
         ((x->value.decimal.lo != 0) ||          ((x->value.decimal.lo != 0) ||
          (x->value.decimal.mi != 0) ||           (x->value.decimal.mi != 0) ||
          (x->value.decimal.hi != 0))) {           (x->value.decimal.hi != 0))) {
Line 3653  xmlSchemaDupVal (xmlSchemaValPtr v) Line 3653  xmlSchemaDupVal (xmlSchemaValPtr v)
     xmlSchemaValPtr ret = xmlSchemaNewValue(v->type);      xmlSchemaValPtr ret = xmlSchemaNewValue(v->type);
     if (ret == NULL)      if (ret == NULL)
         return NULL;          return NULL;
    
     memcpy(ret, v, sizeof(xmlSchemaVal));      memcpy(ret, v, sizeof(xmlSchemaVal));
     ret->next = NULL;      ret->next = NULL;
     return ret;      return ret;
Line 3699  xmlSchemaCopyValue(xmlSchemaValPtr val) Line 3699  xmlSchemaCopyValue(xmlSchemaValPtr val)
                 if (val->value.str != NULL)                  if (val->value.str != NULL)
                     cur->value.str = xmlStrdup(BAD_CAST val->value.str);                      cur->value.str = xmlStrdup(BAD_CAST val->value.str);
                 break;                  break;
            case XML_SCHEMAS_QNAME:                    case XML_SCHEMAS_QNAME:
             case XML_SCHEMAS_NOTATION:              case XML_SCHEMAS_NOTATION:
                 cur = xmlSchemaDupVal(val);                  cur = xmlSchemaDupVal(val);
                 if (val->value.qname.name != NULL)                  if (val->value.qname.name != NULL)
Line 3841  _xmlSchemaDateAdd (xmlSchemaValPtr dt, xmlSchemaValPtr Line 3841  _xmlSchemaDateAdd (xmlSchemaValPtr dt, xmlSchemaValPtr
             if (tyr == 0)              if (tyr == 0)
                 tyr--;                  tyr--;
             /*              /*
             * Coverity detected an overrun in daysInMonth              * Coverity detected an overrun in daysInMonth
              * of size 12 at position 12 with index variable "((r)->mon - 1)"               * of size 12 at position 12 with index variable "((r)->mon - 1)"
              */               */
             if (tmon < 0)              if (tmon < 0)
Line 3866  _xmlSchemaDateAdd (xmlSchemaValPtr dt, xmlSchemaValPtr Line 3866  _xmlSchemaDateAdd (xmlSchemaValPtr dt, xmlSchemaValPtr
                 r->year++;                  r->year++;
         }          }
     }      }
    
     r->day = tempdays;      r->day = tempdays;
   
     /*      /*
Line 3931  xmlSchemaDateNormalize (xmlSchemaValPtr dt, double off Line 3931  xmlSchemaDateNormalize (xmlSchemaValPtr dt, double off
  * _xmlSchemaDateCastYMToDays:   * _xmlSchemaDateCastYMToDays:
  * @dt: an #xmlSchemaValPtr   * @dt: an #xmlSchemaValPtr
  *   *
 * Convert mon and year of @dt to total number of days. Take the  * Convert mon and year of @dt to total number of days. Take the
  * number of years since (or before) 1 AD and add the number of leap   * number of years since (or before) 1 AD and add the number of leap
  * years. This is a function  because negative   * years. This is a function  because negative
  * years must be handled a little differently and there is no zero year.   * years must be handled a little differently and there is no zero year.
Line 4111  xmlSchemaCompareDates (xmlSchemaValPtr x, xmlSchemaVal Line 4111  xmlSchemaCompareDates (xmlSchemaValPtr x, xmlSchemaVal
                 ret = -1;                  ret = -1;
             else if (sec > 0.0)              else if (sec > 0.0)
                 ret = 1;                  ret = 1;
            
         }          }
         xmlSchemaFreeValue(p1);          xmlSchemaFreeValue(p1);
         xmlSchemaFreeValue(q1);          xmlSchemaFreeValue(q1);
Line 4252  xmlSchemaComparePreserveReplaceStrings(const xmlChar * Line 4252  xmlSchemaComparePreserveReplaceStrings(const xmlChar *
                                        int invert)                                         int invert)
 {  {
     int tmp;      int tmp;
    
     while ((*x != 0) && (*y != 0)) {      while ((*x != 0) && (*y != 0)) {
         if (IS_WSP_REPLACE_CH(*y)) {          if (IS_WSP_REPLACE_CH(*y)) {
             if (! IS_WSP_SPACE_CH(*x)) {              if (! IS_WSP_SPACE_CH(*x)) {
Line 4267  xmlSchemaComparePreserveReplaceStrings(const xmlChar * Line 4267  xmlSchemaComparePreserveReplaceStrings(const xmlChar *
                     else                      else
                         return(1);                          return(1);
                 }                  }
            }                   }
         } else {          } else {
             tmp = *x - *y;              tmp = *x - *y;
             if (tmp < 0) {              if (tmp < 0) {
Line 4321  xmlSchemaComparePreserveCollapseStrings(const xmlChar  Line 4321  xmlSchemaComparePreserveCollapseStrings(const xmlChar 
 {  {
     int tmp;      int tmp;
   
    /*     /*
     * Skip leading blank chars of the collapsed string.      * Skip leading blank chars of the collapsed string.
     */      */
     while IS_WSP_BLANK_CH(*y)      while IS_WSP_BLANK_CH(*y)
Line 4410  xmlSchemaCompareReplaceCollapseStrings(const xmlChar * Line 4410  xmlSchemaCompareReplaceCollapseStrings(const xmlChar *
 {  {
     int tmp;      int tmp;
   
    /*     /*
     * Skip leading blank chars of the collapsed string.      * Skip leading blank chars of the collapsed string.
     */      */
     while IS_WSP_BLANK_CH(*y)      while IS_WSP_BLANK_CH(*y)
         y++;          y++;
    
     while ((*x != 0) && (*y != 0)) {      while ((*x != 0) && (*y != 0)) {
         if IS_WSP_BLANK_CH(*y) {          if IS_WSP_BLANK_CH(*y) {
             if (! IS_WSP_BLANK_CH(*x)) {              if (! IS_WSP_BLANK_CH(*x)) {
Line 4435  xmlSchemaCompareReplaceCollapseStrings(const xmlChar * Line 4435  xmlSchemaCompareReplaceCollapseStrings(const xmlChar *
                 }                  }
             }              }
             x++;              x++;
            y++;                        y++;
            /*             /*
             * Skip contiguous blank chars of the collapsed string.              * Skip contiguous blank chars of the collapsed string.
             */              */
             while IS_WSP_BLANK_CH(*y)              while IS_WSP_BLANK_CH(*y)
Line 4470  xmlSchemaCompareReplaceCollapseStrings(const xmlChar * Line 4470  xmlSchemaCompareReplaceCollapseStrings(const xmlChar *
              return(-1);               return(-1);
          else           else
              return(1);               return(1);
    }       }
     if (*y != 0) {      if (*y != 0) {
         /*          /*
         * Skip trailing blank chars of the collapsed string.          * Skip trailing blank chars of the collapsed string.
Line 4503  xmlSchemaCompareReplacedStrings(const xmlChar *x, Line 4503  xmlSchemaCompareReplacedStrings(const xmlChar *x,
                                 const xmlChar *y)                                  const xmlChar *y)
 {  {
     int tmp;      int tmp;
   
     while ((*x != 0) && (*y != 0)) {      while ((*x != 0) && (*y != 0)) {
         if IS_WSP_BLANK_CH(*y) {          if IS_WSP_BLANK_CH(*y) {
             if (! IS_WSP_BLANK_CH(*x)) {              if (! IS_WSP_BLANK_CH(*x)) {
                 if ((*x - 0x20) < 0)                  if ((*x - 0x20) < 0)
                    return(-1);                    return(-1);
                 else                  else
                     return(1);                      return(1);
            }                   }
         } else {          } else {
             if IS_WSP_BLANK_CH(*x) {              if IS_WSP_BLANK_CH(*x) {
                 if ((0x20 - *y) < 0)                  if ((0x20 - *y) < 0)
                    return(-1);                    return(-1);
                 else                  else
                     return(1);                      return(1);
             }              }
             tmp = *x - *y;              tmp = *x - *y;
             if (tmp < 0)              if (tmp < 0)
                return(-1);                return(-1);
             if (tmp > 0)              if (tmp > 0)
                return(1);                return(1);
         }          }
         x++;          x++;
         y++;          y++;
Line 4549  static int Line 4549  static int
 xmlSchemaCompareNormStrings(const xmlChar *x,  xmlSchemaCompareNormStrings(const xmlChar *x,
                             const xmlChar *y) {                              const xmlChar *y) {
     int tmp;      int tmp;
    
     while (IS_BLANK_CH(*x)) x++;      while (IS_BLANK_CH(*x)) x++;
     while (IS_BLANK_CH(*y)) y++;      while (IS_BLANK_CH(*y)) y++;
     while ((*x != 0) && (*y != 0)) {      while ((*x != 0) && (*y != 0)) {
Line 4742  xmlSchemaCompareValuesInternal(xmlSchemaValType xtype, Line 4742  xmlSchemaCompareValuesInternal(xmlSchemaValType xtype,
                 (ytype == XML_SCHEMAS_GYEARMONTH))                  (ytype == XML_SCHEMAS_GYEARMONTH))
                 return (xmlSchemaCompareDates(x, y));                  return (xmlSchemaCompareDates(x, y));
             return (-2);              return (-2);
        /*         /*
         * Note that we will support comparison of string types against          * Note that we will support comparison of string types against
         * anySimpleType as well.          * anySimpleType as well.
         */          */
         case XML_SCHEMAS_ANYSIMPLETYPE:          case XML_SCHEMAS_ANYSIMPLETYPE:
         case XML_SCHEMAS_STRING:          case XML_SCHEMAS_STRING:
        case XML_SCHEMAS_NORMSTRING:                    case XML_SCHEMAS_NORMSTRING:
         case XML_SCHEMAS_TOKEN:          case XML_SCHEMAS_TOKEN:
         case XML_SCHEMAS_LANGUAGE:          case XML_SCHEMAS_LANGUAGE:
         case XML_SCHEMAS_NMTOKEN:          case XML_SCHEMAS_NMTOKEN:
Line 4772  xmlSchemaCompareValuesInternal(xmlSchemaValType xtype, Line 4772  xmlSchemaCompareValuesInternal(xmlSchemaValType xtype,
             /*              /*
             * TODO: Compare those against QName.              * TODO: Compare those against QName.
             */              */
            if (ytype == XML_SCHEMAS_QNAME) {                       if (ytype == XML_SCHEMAS_QNAME) {
                 TODO                  TODO
                 if (y == NULL)                  if (y == NULL)
                    return(-2);                        return(-2);
                 return (-2);                  return (-2);
             }              }
             if ((ytype == XML_SCHEMAS_ANYSIMPLETYPE) ||              if ((ytype == XML_SCHEMAS_ANYSIMPLETYPE) ||
Line 4797  xmlSchemaCompareValuesInternal(xmlSchemaValType xtype, Line 4797  xmlSchemaCompareValuesInternal(xmlSchemaValType xtype,
                         /* TODO: What about x < y or x > y. */                          /* TODO: What about x < y or x > y. */
                         if (xmlStrEqual(xv, yv))                          if (xmlStrEqual(xv, yv))
                             return (0);                              return (0);
                        else                         else
                             return (2);                              return (2);
                     } else if (yws == XML_SCHEMA_WHITESPACE_REPLACE)                      } else if (yws == XML_SCHEMA_WHITESPACE_REPLACE)
                         return (xmlSchemaComparePreserveReplaceStrings(xv, yv, 0));                          return (xmlSchemaComparePreserveReplaceStrings(xv, yv, 0));
Line 4823  xmlSchemaCompareValuesInternal(xmlSchemaValType xtype, Line 4823  xmlSchemaCompareValuesInternal(xmlSchemaValType xtype,
                         return (xmlSchemaCompareNormStrings(xv, yv));                          return (xmlSchemaCompareNormStrings(xv, yv));
                 } else                  } else
                     return (-2);                      return (-2);
                
             }              }
             return (-2);              return (-2);
         }          }
Line 4894  xmlSchemaCompareValuesInternal(xmlSchemaValType xtype, Line 4894  xmlSchemaCompareValuesInternal(xmlSchemaValType xtype,
                 else                  else
                     return(-1);                      return(-1);
             }              }
            return (-2);                return (-2);
         case XML_SCHEMAS_IDREFS:          case XML_SCHEMAS_IDREFS:
         case XML_SCHEMAS_ENTITIES:          case XML_SCHEMAS_ENTITIES:
         case XML_SCHEMAS_NMTOKENS:          case XML_SCHEMAS_NMTOKENS:
Line 5082  xmlSchemaValidateListSimpleTypeFacet(xmlSchemaFacetPtr Line 5082  xmlSchemaValidateListSimpleTypeFacet(xmlSchemaFacetPtr
             if (expectedLen != NULL)              if (expectedLen != NULL)
                 *expectedLen = facet->val->value.decimal.lo;                  *expectedLen = facet->val->value.decimal.lo;
             return (XML_SCHEMAV_CVC_LENGTH_VALID);              return (XML_SCHEMAV_CVC_LENGTH_VALID);
        }               }
     } else if (facet->type == XML_SCHEMA_FACET_MINLENGTH) {      } else if (facet->type == XML_SCHEMA_FACET_MINLENGTH) {
         if (actualLen < facet->val->value.decimal.lo) {          if (actualLen < facet->val->value.decimal.lo) {
             if (expectedLen != NULL)              if (expectedLen != NULL)
Line 5096  xmlSchemaValidateListSimpleTypeFacet(xmlSchemaFacetPtr Line 5096  xmlSchemaValidateListSimpleTypeFacet(xmlSchemaFacetPtr
             return (XML_SCHEMAV_CVC_MAXLENGTH_VALID);              return (XML_SCHEMAV_CVC_MAXLENGTH_VALID);
         }          }
     } else      } else
        /*         /*
        * NOTE: That we can pass NULL as xmlSchemaValPtr to         * NOTE: That we can pass NULL as xmlSchemaValPtr to
         * xmlSchemaValidateFacet, since the remaining facet types          * xmlSchemaValidateFacet, since the remaining facet types
        * are: XML_SCHEMA_FACET_PATTERN, XML_SCHEMA_FACET_ENUMERATION.         * are: XML_SCHEMA_FACET_PATTERN, XML_SCHEMA_FACET_ENUMERATION.
         */          */
        return(xmlSchemaValidateFacet(NULL, facet, value, NULL));           return(xmlSchemaValidateFacet(NULL, facet, value, NULL));
     return (0);      return (0);
 }  }
   
Line 5114  xmlSchemaValidateListSimpleTypeFacet(xmlSchemaFacetPtr Line 5114  xmlSchemaValidateListSimpleTypeFacet(xmlSchemaFacetPtr
  * @ws: the whitespace type of the value   * @ws: the whitespace type of the value
  * @length: the actual length of the value   * @length: the actual length of the value
  *   *
 * Checka a value against a "length", "minLength" and "maxLength"  * Checka a value against a "length", "minLength" and "maxLength"
  * facet; sets @length to the computed length of @value.   * facet; sets @length to the computed length of @value.
  *   *
  * Returns 0 if the value is valid, a positive error code   * Returns 0 if the value is valid, a positive error code
Line 5126  xmlSchemaValidateLengthFacetInternal(xmlSchemaFacetPtr Line 5126  xmlSchemaValidateLengthFacetInternal(xmlSchemaFacetPtr
                                      const xmlChar *value,                                       const xmlChar *value,
                                      xmlSchemaValPtr val,                                       xmlSchemaValPtr val,
                                      unsigned long *length,                                       unsigned long *length,
                                     xmlSchemaWhitespaceValueType ws)                                       xmlSchemaWhitespaceValueType ws)
 {  {
     unsigned int len = 0;      unsigned int len = 0;
   
Line 5137  xmlSchemaValidateLengthFacetInternal(xmlSchemaFacetPtr Line 5137  xmlSchemaValidateLengthFacetInternal(xmlSchemaFacetPtr
         (facet->type != XML_SCHEMA_FACET_MAXLENGTH) &&          (facet->type != XML_SCHEMA_FACET_MAXLENGTH) &&
         (facet->type != XML_SCHEMA_FACET_MINLENGTH))          (facet->type != XML_SCHEMA_FACET_MINLENGTH))
         return (-1);          return (-1);
        
     /*      /*
     * TODO: length, maxLength and minLength must be of type      * TODO: length, maxLength and minLength must be of type
     * nonNegativeInteger only. Check if decimal is used somehow.      * nonNegativeInteger only. Check if decimal is used somehow.
Line 5171  xmlSchemaValidateLengthFacetInternal(xmlSchemaFacetPtr Line 5171  xmlSchemaValidateLengthFacetInternal(xmlSchemaFacetPtr
                     if (ws == XML_SCHEMA_WHITESPACE_COLLAPSE)                      if (ws == XML_SCHEMA_WHITESPACE_COLLAPSE)
                         len = xmlSchemaNormLen(value);                          len = xmlSchemaNormLen(value);
                     else                      else
                    /*                     /*
                     * Should be OK for "preserve" as well.                      * Should be OK for "preserve" as well.
                     */                      */
                     len = xmlUTF8Strlen(value);                      len = xmlUTF8Strlen(value);
Line 5183  xmlSchemaValidateLengthFacetInternal(xmlSchemaFacetPtr Line 5183  xmlSchemaValidateLengthFacetInternal(xmlSchemaFacetPtr
             case XML_SCHEMAS_NMTOKEN:              case XML_SCHEMAS_NMTOKEN:
             case XML_SCHEMAS_NAME:              case XML_SCHEMAS_NAME:
             case XML_SCHEMAS_NCNAME:              case XML_SCHEMAS_NCNAME:
            case XML_SCHEMAS_ID:                            case XML_SCHEMAS_ID:
                 /*                  /*
                 * FIXME: What exactly to do with anyURI?                  * FIXME: What exactly to do with anyURI?
                 */                  */
Line 5192  xmlSchemaValidateLengthFacetInternal(xmlSchemaFacetPtr Line 5192  xmlSchemaValidateLengthFacetInternal(xmlSchemaFacetPtr
                     len = xmlSchemaNormLen(value);                      len = xmlSchemaNormLen(value);
                 break;                  break;
             case XML_SCHEMAS_QNAME:              case XML_SCHEMAS_QNAME:
            case XML_SCHEMAS_NOTATION:            case XML_SCHEMAS_NOTATION:
                /*                /*
                 * For QName and NOTATION, those facets are                  * For QName and NOTATION, those facets are
                 * deprecated and should be ignored.                  * deprecated and should be ignored.
                */                */
                 return (0);                  return (0);
             default:              default:
                 TODO                  TODO
Line 5216  xmlSchemaValidateLengthFacetInternal(xmlSchemaFacetPtr Line 5216  xmlSchemaValidateLengthFacetInternal(xmlSchemaFacetPtr
         if (len > facet->val->value.decimal.lo)          if (len > facet->val->value.decimal.lo)
             return(XML_SCHEMAV_CVC_MAXLENGTH_VALID);              return(XML_SCHEMAV_CVC_MAXLENGTH_VALID);
     }      }
    
     return (0);      return (0);
 }  }
   
Line 5228  xmlSchemaValidateLengthFacetInternal(xmlSchemaFacetPtr Line 5228  xmlSchemaValidateLengthFacetInternal(xmlSchemaFacetPtr
  * @val:  the precomputed value   * @val:  the precomputed value
  * @length: the actual length of the value   * @length: the actual length of the value
  *   *
 * Checka a value against a "length", "minLength" and "maxLength"  * Checka a value against a "length", "minLength" and "maxLength"
  * facet; sets @length to the computed length of @value.   * facet; sets @length to the computed length of @value.
  *   *
  * Returns 0 if the value is valid, a positive error code   * Returns 0 if the value is valid, a positive error code
  * otherwise and -1 in case of an internal or API error.   * otherwise and -1 in case of an internal or API error.
  */   */
 int  int
xmlSchemaValidateLengthFacet(xmlSchemaTypePtr type, xmlSchemaValidateLengthFacet(xmlSchemaTypePtr type,
                              xmlSchemaFacetPtr facet,                               xmlSchemaFacetPtr facet,
                              const xmlChar *value,                               const xmlChar *value,
                              xmlSchemaValPtr val,                               xmlSchemaValPtr val,
                             unsigned long *length)                               unsigned long *length)
 {  {
     if (type == NULL)      if (type == NULL)
         return(-1);          return(-1);
Line 5249  xmlSchemaValidateLengthFacet(xmlSchemaTypePtr type,  Line 5249  xmlSchemaValidateLengthFacet(xmlSchemaTypePtr type, 
 }  }
   
 /**  /**
 * xmlSchemaValidateLengthFacetWhtsp:  * xmlSchemaValidateLengthFacetWhtsp:
  * @facet:  the facet to check   * @facet:  the facet to check
  * @valType:  the built-in type   * @valType:  the built-in type
  * @value:  the lexical repr. of the value to be validated   * @value:  the lexical repr. of the value to be validated
Line 5257  xmlSchemaValidateLengthFacet(xmlSchemaTypePtr type,  Line 5257  xmlSchemaValidateLengthFacet(xmlSchemaTypePtr type, 
  * @ws: the whitespace type of the value   * @ws: the whitespace type of the value
  * @length: the actual length of the value   * @length: the actual length of the value
  *   *
 * Checka a value against a "length", "minLength" and "maxLength"  * Checka a value against a "length", "minLength" and "maxLength"
  * facet; sets @length to the computed length of @value.   * facet; sets @length to the computed length of @value.
  *   *
  * Returns 0 if the value is valid, a positive error code   * Returns 0 if the value is valid, a positive error code
Line 5292  xmlSchemaValidateLengthFacetWhtsp(xmlSchemaFacetPtr fa Line 5292  xmlSchemaValidateLengthFacetWhtsp(xmlSchemaFacetPtr fa
 static int  static int
 xmlSchemaValidateFacetInternal(xmlSchemaFacetPtr facet,  xmlSchemaValidateFacetInternal(xmlSchemaFacetPtr facet,
                                xmlSchemaWhitespaceValueType fws,                                 xmlSchemaWhitespaceValueType fws,
                               xmlSchemaValType valType,                                                              xmlSchemaValType valType,
                                const xmlChar *value,                                 const xmlChar *value,
                                xmlSchemaValPtr val,                                 xmlSchemaValPtr val,
                                xmlSchemaWhitespaceValueType ws)                                 xmlSchemaWhitespaceValueType ws)
Line 5304  xmlSchemaValidateFacetInternal(xmlSchemaFacetPtr facet Line 5304  xmlSchemaValidateFacetInternal(xmlSchemaFacetPtr facet
   
     switch (facet->type) {      switch (facet->type) {
         case XML_SCHEMA_FACET_PATTERN:          case XML_SCHEMA_FACET_PATTERN:
            /*             /*
             * NOTE that for patterns, the @value needs to be the normalized              * NOTE that for patterns, the @value needs to be the normalized
             * value, *not* the lexical initial value or the canonical value.              * value, *not* the lexical initial value or the canonical value.
             */              */
Line 5405  xmlSchemaValidateFacetInternal(xmlSchemaFacetPtr facet Line 5405  xmlSchemaValidateFacetInternal(xmlSchemaFacetPtr facet
             else {              else {
                 switch (valType) {                  switch (valType) {
                     case XML_SCHEMAS_STRING:                      case XML_SCHEMAS_STRING:
                    case XML_SCHEMAS_NORMSTRING:                                            case XML_SCHEMAS_NORMSTRING:
                         if (ws == XML_SCHEMA_WHITESPACE_UNKNOWN) {                          if (ws == XML_SCHEMA_WHITESPACE_UNKNOWN) {
                             /*                              /*
                             * This is to ensure API compatibility with the old                              * This is to ensure API compatibility with the old
Line 5421  xmlSchemaValidateFacetInternal(xmlSchemaFacetPtr facet Line 5421  xmlSchemaValidateFacetInternal(xmlSchemaFacetPtr facet
                             if (ws == XML_SCHEMA_WHITESPACE_COLLAPSE)                              if (ws == XML_SCHEMA_WHITESPACE_COLLAPSE)
                                 len = xmlSchemaNormLen(value);                                  len = xmlSchemaNormLen(value);
                             else                              else
                                /*                                 /*
                                 * Should be OK for "preserve" as well.                                  * Should be OK for "preserve" as well.
                                 */                                  */
                                 len = xmlUTF8Strlen(value);                                  len = xmlUTF8Strlen(value);
                         }                          }
                         break;                          break;
                    case XML_SCHEMAS_IDREF:                                     case XML_SCHEMAS_IDREF:
                     case XML_SCHEMAS_TOKEN:                      case XML_SCHEMAS_TOKEN:
                     case XML_SCHEMAS_LANGUAGE:                      case XML_SCHEMAS_LANGUAGE:
                     case XML_SCHEMAS_NMTOKEN:                      case XML_SCHEMAS_NMTOKEN:
Line 5436  xmlSchemaValidateFacetInternal(xmlSchemaFacetPtr facet Line 5436  xmlSchemaValidateFacetInternal(xmlSchemaFacetPtr facet
                     case XML_SCHEMAS_ID:                      case XML_SCHEMAS_ID:
                     case XML_SCHEMAS_ANYURI:                      case XML_SCHEMAS_ANYURI:
                         if (value != NULL)                          if (value != NULL)
                            len = xmlSchemaNormLen(value);                            len = xmlSchemaNormLen(value);
                        break;                                     break;
                     default:                      default:
                         TODO                          TODO
                }                }
             }              }
             if (facet->type == XML_SCHEMA_FACET_LENGTH) {              if (facet->type == XML_SCHEMA_FACET_LENGTH) {
                 if (len != facet->val->value.decimal.lo)                  if (len != facet->val->value.decimal.lo)
Line 5550  xmlSchemaValidateFacet(xmlSchemaTypePtr base, Line 5550  xmlSchemaValidateFacet(xmlSchemaTypePtr base,
 int  int
 xmlSchemaValidateFacetWhtsp(xmlSchemaFacetPtr facet,  xmlSchemaValidateFacetWhtsp(xmlSchemaFacetPtr facet,
                             xmlSchemaWhitespaceValueType fws,                              xmlSchemaWhitespaceValueType fws,
                            xmlSchemaValType valType,                                                   xmlSchemaValType valType,
                             const xmlChar *value,                              const xmlChar *value,
                             xmlSchemaValPtr val,                              xmlSchemaValPtr val,
                             xmlSchemaWhitespaceValueType ws)                              xmlSchemaWhitespaceValueType ws)
Line 5611  xmlSchemaFormatFloat(double number, char buffer[], int Line 5611  xmlSchemaFormatFloat(double number, char buffer[], int
             /*              /*
              * Result is in work, and after_fraction points               * Result is in work, and after_fraction points
              * just past the fractional part.               * just past the fractional part.
             * Use scientific notation              * Use scientific notation
             */              */
             integer_place = DBL_DIG + EXPONENT_DIGITS + 1;              integer_place = DBL_DIG + EXPONENT_DIGITS + 1;
             fraction_place = DBL_DIG - 1;              fraction_place = DBL_DIG - 1;
             snprintf(work, sizeof(work),"%*.*e",              snprintf(work, sizeof(work),"%*.*e",
                 integer_place, fraction_place, number);                  integer_place, fraction_place, number);
            after_fraction = strchr(work + DBL_DIG, 'e');                       after_fraction = strchr(work + DBL_DIG, 'e');
             /* Remove fractional trailing zeroes */              /* Remove fractional trailing zeroes */
             ptr = after_fraction;              ptr = after_fraction;
             while (*(--ptr) == '0')              while (*(--ptr) == '0')
Line 5649  xmlSchemaFormatFloat(double number, char buffer[], int Line 5649  xmlSchemaFormatFloat(double number, char buffer[], int
  *   *
  * WARNING: Some value types are not supported yet, resulting   * WARNING: Some value types are not supported yet, resulting
  * in a @retValue of "???".   * in a @retValue of "???".
 *  *
  * TODO: XML Schema 1.0 does not define canonical representations   * TODO: XML Schema 1.0 does not define canonical representations
  * for: duration, gYearMonth, gYear, gMonthDay, gMonth, gDay,   * for: duration, gYearMonth, gYear, gMonthDay, gMonth, gDay,
  * anyURI, QName, NOTATION. This will be fixed in XML Schema 1.1.   * anyURI, QName, NOTATION. This will be fixed in XML Schema 1.1.
Line 5669  xmlSchemaGetCanonValue(xmlSchemaValPtr val, const xmlC Line 5669  xmlSchemaGetCanonValue(xmlSchemaValPtr val, const xmlC
             if (val->value.str == NULL)              if (val->value.str == NULL)
                 *retValue = BAD_CAST xmlStrdup(BAD_CAST "");                  *retValue = BAD_CAST xmlStrdup(BAD_CAST "");
             else              else
                *retValue =                 *retValue =
                     BAD_CAST xmlStrdup((const xmlChar *) val->value.str);                      BAD_CAST xmlStrdup((const xmlChar *) val->value.str);
             break;              break;
         case XML_SCHEMAS_NORMSTRING:          case XML_SCHEMAS_NORMSTRING:
Line 5686  xmlSchemaGetCanonValue(xmlSchemaValPtr val, const xmlC Line 5686  xmlSchemaGetCanonValue(xmlSchemaValPtr val, const xmlC
         case XML_SCHEMAS_TOKEN:          case XML_SCHEMAS_TOKEN:
         case XML_SCHEMAS_LANGUAGE:          case XML_SCHEMAS_LANGUAGE:
         case XML_SCHEMAS_NMTOKEN:          case XML_SCHEMAS_NMTOKEN:
        case XML_SCHEMAS_NAME:          case XML_SCHEMAS_NAME:
         case XML_SCHEMAS_NCNAME:          case XML_SCHEMAS_NCNAME:
         case XML_SCHEMAS_ID:          case XML_SCHEMAS_ID:
         case XML_SCHEMAS_IDREF:          case XML_SCHEMAS_IDREF:
Line 5695  xmlSchemaGetCanonValue(xmlSchemaValPtr val, const xmlC Line 5695  xmlSchemaGetCanonValue(xmlSchemaValPtr val, const xmlC
         case XML_SCHEMAS_ANYURI:   /* Unclear */          case XML_SCHEMAS_ANYURI:   /* Unclear */
             if (val->value.str == NULL)              if (val->value.str == NULL)
                 return (-1);                  return (-1);
            *retValue =             *retValue =
                 BAD_CAST xmlSchemaCollapseString(BAD_CAST val->value.str);                  BAD_CAST xmlSchemaCollapseString(BAD_CAST val->value.str);
             if (*retValue == NULL)              if (*retValue == NULL)
                *retValue =                 *retValue =
                     BAD_CAST xmlStrdup((const xmlChar *) val->value.str);                      BAD_CAST xmlStrdup((const xmlChar *) val->value.str);
             break;              break;
         case XML_SCHEMAS_QNAME:          case XML_SCHEMAS_QNAME:
Line 5720  xmlSchemaGetCanonValue(xmlSchemaValPtr val, const xmlC Line 5720  xmlSchemaGetCanonValue(xmlSchemaValPtr val, const xmlC
             /*              /*
             * TODO: Lookout for a more simple implementation.              * TODO: Lookout for a more simple implementation.
             */              */
            if ((val->value.decimal.total == 1) &&             if ((val->value.decimal.total == 1) &&
                 (val->value.decimal.lo == 0)) {                  (val->value.decimal.lo == 0)) {
                 *retValue = xmlStrdup(BAD_CAST "0.0");                  *retValue = xmlStrdup(BAD_CAST "0.0");
             } else {              } else {
Line 5754  xmlSchemaGetCanonValue(xmlSchemaValPtr val, const xmlC Line 5754  xmlSchemaGetCanonValue(xmlSchemaValPtr val, const xmlC
                 else                  else
                     snprintf(offs, bufsize - (offs - buf),                      snprintf(offs, bufsize - (offs - buf),
                         "%lu", dec.lo);                          "%lu", dec.lo);
                        
                 if (dec.frac != 0) {                  if (dec.frac != 0) {
                     if (dec.frac != dec.total) {                      if (dec.frac != dec.total) {
                         int diff = dec.total - dec.frac;                          int diff = dec.total - dec.frac;
Line 5767  xmlSchemaGetCanonValue(xmlSchemaValPtr val, const xmlC Line 5767  xmlSchemaGetCanonValue(xmlSchemaValPtr val, const xmlC
                         unsigned int i = 0;                          unsigned int i = 0;
                         /*                          /*
                         * Insert missing zeroes behind the decimal point.                          * Insert missing zeroes behind the decimal point.
                        */                                              */
                         while (*(offs + i) != 0)                          while (*(offs + i) != 0)
                             i++;                              i++;
                         if (i < dec.total) {                          if (i < dec.total) {
Line 5904  xmlSchemaGetCanonValue(xmlSchemaValPtr val, const xmlC Line 5904  xmlSchemaGetCanonValue(xmlSchemaValPtr val, const xmlC
                 snprintf((char *) *retValue, 6, "---%02u",                  snprintf((char *) *retValue, 6, "---%02u",
                     val->value.date.day);                      val->value.date.day);
             }              }
            break;                    break;
         case XML_SCHEMAS_GMONTHDAY: {          case XML_SCHEMAS_GMONTHDAY: {
                 /* TODO: Unclear in XML Schema 1.0 */                  /* TODO: Unclear in XML Schema 1.0 */
                 /* TODO: What to do with the timezone? */                  /* TODO: What to do with the timezone? */
Line 5921  xmlSchemaGetCanonValue(xmlSchemaValPtr val, const xmlC Line 5921  xmlSchemaGetCanonValue(xmlSchemaValPtr val, const xmlC
                 /* TODO: What to do with the timezone? */                  /* TODO: What to do with the timezone? */
                 if (val->value.date.year < 0)                  if (val->value.date.year < 0)
                     snprintf(buf, 35, "-%04ld-%02u",                      snprintf(buf, 35, "-%04ld-%02u",
                        labs(val->value.date.year),                         labs(val->value.date.year),
                         val->value.date.mon);                          val->value.date.mon);
                 else                  else
                     snprintf(buf, 35, "%04ld-%02u",                      snprintf(buf, 35, "%04ld-%02u",
                         val->value.date.year, val->value.date.mon);                          val->value.date.year, val->value.date.mon);
                 *retValue = BAD_CAST xmlStrdup(BAD_CAST buf);                  *retValue = BAD_CAST xmlStrdup(BAD_CAST buf);
             }              }
            break;                          break;
         case XML_SCHEMAS_TIME:          case XML_SCHEMAS_TIME:
             {              {
                 char buf[30];                  char buf[30];
Line 5939  xmlSchemaGetCanonValue(xmlSchemaValPtr val, const xmlC Line 5939  xmlSchemaGetCanonValue(xmlSchemaValPtr val, const xmlC
                     norm = xmlSchemaDateNormalize(val, 0);                      norm = xmlSchemaDateNormalize(val, 0);
                     if (norm == NULL)                      if (norm == NULL)
                         return (-1);                          return (-1);
                    /*                     /*
                    * TODO: Check if "%.14g" is portable.                                       * TODO: Check if "%.14g" is portable.
                     */                      */
                     snprintf(buf, 30,                      snprintf(buf, 30,
                         "%02u:%02u:%02.14gZ",                          "%02u:%02u:%02.14gZ",
Line 5956  xmlSchemaGetCanonValue(xmlSchemaValPtr val, const xmlC Line 5956  xmlSchemaGetCanonValue(xmlSchemaValPtr val, const xmlC
                         val->value.date.sec);                          val->value.date.sec);
                 }                  }
                 *retValue = BAD_CAST xmlStrdup(BAD_CAST buf);                  *retValue = BAD_CAST xmlStrdup(BAD_CAST buf);
            }                   }
             break;              break;
         case XML_SCHEMAS_DATE:          case XML_SCHEMAS_DATE:
             {              {
Line 5984  xmlSchemaGetCanonValue(xmlSchemaValPtr val, const xmlC Line 5984  xmlSchemaGetCanonValue(xmlSchemaValPtr val, const xmlC
                         val->value.date.day);                          val->value.date.day);
                 }                  }
                 *retValue = BAD_CAST xmlStrdup(BAD_CAST buf);                  *retValue = BAD_CAST xmlStrdup(BAD_CAST buf);
            }                   }
             break;              break;
         case XML_SCHEMAS_DATETIME:          case XML_SCHEMAS_DATETIME:
             {              {
Line 6028  xmlSchemaGetCanonValue(xmlSchemaValPtr val, const xmlC Line 6028  xmlSchemaGetCanonValue(xmlSchemaValPtr val, const xmlC
             *retValue = BAD_CAST xmlStrdup(BAD_CAST val->value.base64.str);              *retValue = BAD_CAST xmlStrdup(BAD_CAST val->value.base64.str);
             break;              break;
         case XML_SCHEMAS_FLOAT: {          case XML_SCHEMAS_FLOAT: {
                char buf[30];                           char buf[30];
                /*                 /*
                 * |m| < 16777216, -149 <= e <= 104.                  * |m| < 16777216, -149 <= e <= 104.
                 * TODO: Handle, NaN, INF, -INF. The format is not                  * TODO: Handle, NaN, INF, -INF. The format is not
                 * yet conformant. The c type float does not cover                  * yet conformant. The c type float does not cover
Line 6050  xmlSchemaGetCanonValue(xmlSchemaValPtr val, const xmlC Line 6050  xmlSchemaGetCanonValue(xmlSchemaValPtr val, const xmlC
                 snprintf(buf, 40, "%01.14e", val->value.d);                  snprintf(buf, 40, "%01.14e", val->value.d);
                 *retValue = BAD_CAST xmlStrdup(BAD_CAST buf);                  *retValue = BAD_CAST xmlStrdup(BAD_CAST buf);
             }              }
            break;                  break;
         default:          default:
             *retValue = BAD_CAST xmlStrdup(BAD_CAST "???");              *retValue = BAD_CAST xmlStrdup(BAD_CAST "???");
             return (1);              return (1);
Line 6109  xmlSchemaGetCanonValueWhtsp(xmlSchemaValPtr val, Line 6109  xmlSchemaGetCanonValueWhtsp(xmlSchemaValPtr val,
             break;              break;
         default:          default:
             return (xmlSchemaGetCanonValue(val, retValue));              return (xmlSchemaGetCanonValue(val, retValue));
    }        }
     return (0);      return (0);
 }  }
   

Removed from v.1.1.1.2  
changed lines
  Added in v.1.1.1.3


FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>