Skip to content
GitLab
    • Explore Projects Groups Snippets
Projects Groups Snippets
  • /
  • Help
    • Help
    • Support
    • Community forum
    • Submit feedback
    • Contribute to GitLab
  • Sign in / Register
  • A ArduinoJson
  • Project information
    • Project information
    • Activity
    • Labels
    • Members
  • Repository
    • Repository
    • Files
    • Commits
    • Branches
    • Tags
    • Contributors
    • Graph
    • Compare
  • Issues 24
    • Issues 24
    • List
    • Boards
    • Service Desk
    • Milestones
  • Merge requests 0
    • Merge requests 0
  • CI/CD
    • CI/CD
    • Pipelines
    • Jobs
    • Schedules
  • Deployments
    • Deployments
    • Environments
    • Releases
  • Packages and registries
    • Packages and registries
    • Package Registry
    • Infrastructure Registry
  • Monitor
    • Monitor
    • Incidents
  • Analytics
    • Analytics
    • Value stream
    • CI/CD
    • Repository
  • Wiki
    • Wiki
  • Snippets
    • Snippets
  • Activity
  • Graph
  • Create a new issue
  • Jobs
  • Commits
  • Issue Boards
Collapse sidebar
  • Benoît Blanchon
  • ArduinoJson
  • Merge requests
  • !133

Fix ESP8266 number parsing

  • Review changes

  • Download
  • Email patches
  • Plain diff
Closed Administrator requested to merge github/fork/vshymanskyy/master into master 9 years ago
  • Overview 2
  • Commits 1
  • Pipelines 0
  • Changes 1

Created by: vshymanskyy

ESP8266 does not like NULL in conversion functions and crashes hardly... This fixes #132 (closed) .

Compare
  • master (base)

and
  • latest version
    5a0127ac
    1 commit, 2 years ago

1 file
+ 6
- 3

    Preferences

    File browser
    Compare changes
src/JsonVariant.cpp
+ 6
- 3
  • View file @ 5a0127ac


@@ -32,8 +32,10 @@ double JsonVariant::as<double>() const {
if (_type == JSON_LONG || _type == JSON_BOOLEAN)
return static_cast<double>(_content.asLong);
if ((_type == JSON_STRING || _type == JSON_UNPARSED) && _content.asString)
return strtod(_content.asString, NULL);
if ((_type == JSON_STRING || _type == JSON_UNPARSED) && _content.asString) {
char *end;
return strtod(_content.asString, &end);
}
return 0.0;
}
@@ -47,7 +49,8 @@ long JsonVariant::as<long>() const {
if ((_type == JSON_STRING || _type == JSON_UNPARSED) && _content.asString) {
if (!strcmp("true", _content.asString)) return 1;
return strtol(_content.asString, NULL, 10);
char *end;
return strtol(_content.asString, &end, 10);
}
return 0L;
0 Assignees
None
Assign to
0 Reviewers
None
Request review from
Labels
2
duplicate wontfix
2
duplicate wontfix
    Assign labels
  • Manage project labels

Milestone
No milestone
None
None
Time tracking
No estimate or time spent
Lock merge request
Unlocked
2
2 participants
Benoît Blanchon
Administrator
Reference: bblanchon/ArduinoJson!133
Source branch: github/fork/vshymanskyy/master

Menu

Explore Projects Groups Snippets