VirtualBox

Changeset 67642 in vbox


Ignore:
Timestamp:
Jun 27, 2017 3:38:21 PM (8 years ago)
Author:
vboxsync
svn:sync-xref-src-repo-rev:
116416
Message:

Main: Modified Utf8Str::parseKeyValue implementation to never return npos when returning the last pair. That simplifies using the method and seemingly reflects the original author's intentions.

Location:
trunk
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • trunk/include/VBox/com/string.h

    r67640 r67642  
    768768     *
    769769     * @returns offset of the @a a_rPairSeparator following the returned value.
    770      * @retval  npos is returned if there are no more key/value pairs, or if the
    771      *          final key/value pair isn't followed by a @a a_rPairSeparator.
     770     * @retval  npos is returned if there are no more key/value pairs.
    772771     *
    773772     * @param   a_rKey                  Reference to variable that should receive
  • trunk/src/VBox/Main/glue/string.cpp

    r67640 r67642  
    209209    if (offKeyValueSep < offEnd)
    210210    {
    211         a_rKey   = substr(a_offStart, offKeyValueSep - a_offStart);
     211        a_rKey = substr(a_offStart, offKeyValueSep - a_offStart);
     212        if (offEnd == npos)
     213            offEnd = m_cch; /* No confusing npos when returning strings. */
    212214        a_rValue = substr(offKeyValueSep + 1, offEnd - offKeyValueSep - 1);
    213215    }
  • trunk/src/VBox/Main/src-client/ConsoleImpl2.cpp

    r67639 r67642  
    12471247                size_t       uPos = 0;
    12481248                com::Utf8Str strDebugOptions = strParavirtDebug;
    1249                 do
    1250                 {
    1251                     com::Utf8Str strKey;
    1252                     com::Utf8Str strVal;
    1253                     uPos = strDebugOptions.parseKeyValue(strKey, strVal, uPos);
     1249                com::Utf8Str strKey;
     1250                com::Utf8Str strVal;
     1251                while ((uPos = strDebugOptions.parseKeyValue(strKey, strVal, uPos)) != com::Utf8Str::npos)
     1252                {
    12541253                    if (strKey == "enabled")
    12551254                    {
     
    12761275                    else if (strKey == "hypercallinterface")
    12771276                        fGimHvHypercallIf = RT_BOOL(strVal.toUInt32());
    1278                     else if (strKey.isNotEmpty() || strVal.isNotEmpty())
     1277                    else
    12791278                    {
    12801279                        AssertMsgFailed(("Unrecognized Hyper-V debug option '%s'\n", strKey.c_str()));
     
    12831282                                            strDebugOptions.c_str());
    12841283                    }
    1285                 } while (uPos != com::Utf8Str::npos);
     1284                }
    12861285
    12871286                /* Update HyperV CFGM node with active debug options. */
  • trunk/src/VBox/Main/src-client/VideoRec.cpp

    r67641 r67642  
    771771#endif
    772772
    773     /** @todo r=bird: This code will ignore the final value/pair iff the option
    774      *        string doesn't end with a comma. */
    775773    com::Utf8Str key, value;
    776774    while ((pos = options.parseKeyValue(key, value, pos)) != com::Utf8Str::npos)
  • trunk/src/VBox/Main/src-server/VirtualBoxImpl.cpp

    r66938 r67642  
    13331333    LogFlowThisFunc(("aName=\"%s\",aBaseFolder=\"%s\"\n", strName.c_str(), strBase.c_str()));
    13341334
    1335     Guid id;
     1335    com::Guid id;
    13361336    bool fDirectoryIncludesUUID = false;
    13371337    if (!aCreateFlags.isEmpty())
    13381338    {
    13391339        size_t uPos = 0;
    1340         do {
    1341 
    1342             com::Utf8Str strKey, strValue;
    1343             uPos = aCreateFlags.parseKeyValue(strKey, strValue, uPos);
    1344 
     1340        com::Utf8Str strKey;
     1341        com::Utf8Str strValue;
     1342        while ((uPos = aCreateFlags.parseKeyValue(strKey, strValue, uPos)) != com::Utf8Str::npos)
     1343        {
    13451344            if (strKey == "UUID")
    13461345                id = strValue.c_str();
    13471346            else if (strKey == "directoryIncludesUUID")
    13481347                fDirectoryIncludesUUID = (strValue == "1");
    1349 
    1350         } while (uPos != com::Utf8Str::npos);
     1348        }
    13511349    }
    13521350
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