lopter / lightsd

A daemon with a JSON-RPC API to control your light bulbs
GNU General Public License v3.0
129 stars 15 forks source link

Numbers in E notation aren't supported by the JSON parser #8

Open lopter opened 8 years ago

lopter commented 8 years ago

lightsd parses floats manually so they can be stored in integers but fails to support numbers in E notation, which are part of the JSON standard.

The following functions should be fixed first:

Since I guess the E notation will mostly be triggered by client code doing float operations that tend towards 0.

But eventually everything number parsing above jsmn is affected in lightsd and should be fixed according to the JSON grammar:

number
    int
    int frac
    int exp
    int frac exp 
int
    digit
    digit1-9 digits
    - digit
    - digit1-9 digits 
frac
    . digits
exp
    e digits
digits
    digit
    digit digits
e
    e
    e+
    e-
    E
    E+
    E-