Pull requests

#10 Declined
Repository
bblanchon
Branch
default
Repository
zserge
Branch
default

Fixed compilation in Arduino IDE

Author
  1. Benoit Blanchon
Reviewers
Description

I had several compilation errors with Arduino IDE 1.0.5, which uses GCC 4.3.2. Most of the errors were implicit cast of int to jsmnerr_t.

  • Learn about pull requests

Comments (4)

  1. Johnny Hoffman

    I'm brand new to this website so I'm not going to make a pull request or anything for this, but I wanted to make a minor correction. I too wanted to compile this on arduino and luckily found this which you seem to have posted very recently! Your fix worked for me but I noticed it made compilation with "make" fail, giving the error

    jsmn.c: In function 'jsmn_parse_string':
    jsmn.c:158:17: error: 'for' loop initial declarations are only allowed in C99 mode
    jsmn.c:158:17: note: use option -std=c99 or -std=gnu99 to compile your code
    

    For me, changing

    for(int i = 0; i < 4 && js[parser->pos] != '\0'; i++) {
    

    to

    int i; for(i = 0; i < 4 && js[parser->pos] != '\0'; i++) {
    

    worked for both the make command and compilation from the Arduino IDE.

    Best, -Johnny

  2. Serge Zaitsev repo owner

    Since that unicode pull request was initially included using C89 loop form and the warning has been fixed there - I'm closing this pull request. Thanks!