VirtualBox

Changeset 73981 in vbox for trunk/src/VBox


Ignore:
Timestamp:
Aug 30, 2018 10:42:53 PM (6 years ago)
Author:
vboxsync
Message:

Runtime/json.cpp: Fix handling negative numbers

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Runtime/common/misc/json.cpp

    r73979 r73981  
    499499
    500500    char ch = rtJsonTokenizerGetCh(pTokenizer);
     501    if (ch == '-')
     502    {
     503        szTmp[cchNum++] = '-';
     504        rtJsonTokenizerSkipCh(pTokenizer);
     505        ch = rtJsonTokenizerGetCh(pTokenizer);
     506    }
     507
    501508    while (   RT_C_IS_DIGIT(ch)
    502509           && cchNum < sizeof(szTmp) - 1)
     
    669676    if (RT_C_IS_ALPHA(ch))
    670677        rc = rtJsonTokenizerGetLiteral(pTokenizer, pToken);
    671     else if (RT_C_IS_DIGIT(ch))
     678    else if (RT_C_IS_DIGIT(ch) || ch == '-')
    672679        rc = rtJsonTokenizerGetNumber(pTokenizer, pToken);
    673680    else if (ch == '\"')
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