Skip to content
GitLab
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
  • Issues
  • #350
Something went wrong while setting issue due date.
Closed
Open
Issue created 8 years ago by Administrator@rootContributor
  • New related issue

  • Report abuse to administrator

  • New related issue

  • Report abuse to administrator

Wrong return value of JsonObject::set(key, "string")

Closed

Wrong return value of JsonObject::set(key, "string")

Created by: softerra

I may misunderstand the sense of the return value of JsonObject::set() but hope it means successfulness of the operation, doesn't it?

If so the real value the method returns for setting string values is wrong.

Just try: bool r = jso.set("key", "value");

The result will be false.

This happens because the underlying JsonObject::setNodeValue(, string) doesn't return successfulness of the operation, meaning the string allocation. Instead, it returns the value being set converted to bool.

template <> inline bool JsonObject::setNodeValue(node_type *node, String &value) { node->content.value = _buffer->strdup(value); return node->content.value; }

As I see the method (and its const String& variation) should be like that:

template <> inline bool JsonObject::setNodeValue(node_type *node, String &value) { char *dup = _buffer->strdup(value); node->content.value = dup; return dup != NULL; }

Tasks
0
server returned results with length 5, expected length of 9

Linked items
0

Link issues together to show that they're related. Learn more.

Activity


Please register or sign in to reply
0 Assignees
None
Assign to
Labels
0
None
0
None
    Assign labels
  • Manage project labels

Milestone
No milestone
None
Due date
None
None
None
Time tracking
No estimate or time spent
Confidentiality
Not confidential
Not confidential

You are going to turn on confidentiality. Only project members with at least the Reporter role, the author, and assignees can view or be notified about this issue.

Lock issue
Unlocked
0
0 participants
Reference: