VirtualBox

Ignore:
Timestamp:
Feb 20, 2008 10:30:22 AM (17 years ago)
Author:
vboxsync
Message:

Main/Settings: FromString <bool>: Recognize "0" and "1" and forget "on/off" and "yes/no" (to match XML Schema's definition of boolean).

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Main/xml/Settings.cpp

    r6310 r7027  
    3434
    3535
    36 /** 
     36/**
    3737 * Global module initialization structure.
    3838 *
     
    163163
    164164    if (strcmp (aValue, "true") == 0 ||
    165         strcmp (aValue, "yes") == 0 ||
    166         strcmp (aValue, "on") == 0)
     165        strcmp (aValue, "1") == 0)
     166        /* This contradicts the XML Schema's interpretation of boolean: */
     167        //strcmp (aValue, "yes") == 0 ||
     168        //strcmp (aValue, "on") == 0)
    167169        return true;
    168170    else if (strcmp (aValue, "false") == 0 ||
    169              strcmp (aValue, "no") == 0 ||
    170              strcmp (aValue, "off") == 0)
     171             strcmp (aValue, "0") == 0)
     172            /* This contradicts the XML Schema's interpretation of boolean: */
     173            //strcmp (aValue, "no") == 0 ||
     174            //strcmp (aValue, "off") == 0)
    171175        return false;
    172176
     
    284288                                                unsigned int aExtra /* = 0 */)
    285289{
     290    /* Convert to the canonical form according to XML Schema */
    286291    stdx::char_auto_ptr result (duplicate_chars (aValue ? "true" : "false"));
    287292    return result;
     
    765770    }
    766771
    767     /** 
     772    /**
    768773     * Composes a single message for the given error. The caller must free the
    769774     * returned string using RTStrFree() when no more necessary.
     
    928933
    929934            /* set our error handlers */
    930             xmlSchemaSetParserErrors (schemaCtxt, ValidityErrorCallback, 
     935            xmlSchemaSetParserErrors (schemaCtxt, ValidityErrorCallback,
    931936                                      ValidityWarningCallback, &errorStr);
    932937            xmlSchemaSetParserStructuredErrors (schemaCtxt,
     
    11171122#endif
    11181123
    1119         /* perform cleanup when necessary */ 
     1124        /* perform cleanup when necessary */
    11201125        if (ctxt->deleteStreamOnClose)
    11211126            delete ctxt->stream;
     
    12151220
    12161221/* static */
    1217 xmlParserInputPtr XmlTreeBackend::ExternalEntityLoader (const char *aURI, 
    1218                                                         const char *aID, 
     1222xmlParserInputPtr XmlTreeBackend::ExternalEntityLoader (const char *aURI,
     1223                                                        const char *aID,
    12191224                                                        xmlParserCtxtPtr aCtxt)
    12201225{
Note: See TracChangeset for help on using the changeset viewer.

© 2024 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette