{"action":"created","comment":{"url":"https://api.github.com/repos/telefonicaid/fiware-orion/pulls/comments/40722279","id":40722279,"diff_hunk":"@@ -52,9 +52,111 @@\n #define MAX_TENANT_NAME_LEN_STRING    \"50\"\n \n \n+static std::string textParseAttributeValue(ConnectionInfo* ciP, ContextAttribute* caP)\n+{\n+  double d;\n+\n+  // 1. Starts and ends with citation marks?\n+  if (ciP->payload[0] == '\"')\n+  {\n+    char* end = &ciP->payload[strlen(ciP->payload) - 1];\n+\n+    if (*end == '\"')\n+    {\n+      *end = 0;\n+      caP->stringValue = &ciP->payload[1];\n+      caP->valueType   = orion::ValueTypeString;\n+    }\n+    else\n+    {\n+      OrionError oe(SccBadRequest, \"Missing citation-mark at end of string\");\n+\n+      return oe.render(ciP, \"\");\n+    }\n+  }\n+\n+  // 2. True or false?\n+  else if ((strlen(ciP->payload) == 4) && ((strcmp(ciP->payload, \"true\") == 0) || (strcmp(ciP->payload, \"True\") == 0) || (strcmp(ciP->payload, \"TRUE\") == 0)))\n+  {\n+    caP->boolValue   = true;\n+    caP->valueType   = orion::ValueTypeBoolean;\n+  }\n+  else if ((strlen(ciP->payload) == 5) && ((strcmp(ciP->payload, \"false\") == 0) || (strcmp(ciP->payload, \"False\") == 0) || (strcmp(ciP->payload, \"FALSE\") == 0)))\n+  {\n+    caP->boolValue   = false;\n+    caP->valueType   = orion::ValueTypeBoolean;\n+  }\n+\n+  // 3. Null ?\n+  else if ((strlen(ciP->payload) == 4) && ((strcmp(ciP->payload, \"null\") == 0) || (strcmp(ciP->payload, \"Null\") == 0) || (strcmp(ciP->payload, \"NULL\") == 0)))\n+  {\n+    caP->valueType   = orion::ValueTypeNull;\n+  }\n+\n+  //\n+  // 4. Valid Double?\n+  // FIXME P4: this is much more complex than just (atof(string) != 0 || string == \"0\")\n+  //           0.000 also is a valid float and it given 0 - 0.0000000000, and 0e0 also ...\n+  //           And, even worse, 123K gives 123.0 back, we would need to analyze the string to try to\n+  //           find garbage bytes after it if we want to detect this error.\n+  //           However, all of this is not so extremely important and for now, (atof(string) != 0 || string== \"0\") is good enough\n+  //\n+  else if (((d = strtod(ciP->payload, NULL)) != 0) || ((ciP->payload[0] == '0') || (ciP->payload[1] == 0)))","path":"src/lib/rest/RestService.cpp","position":53,"original_position":53,"commit_id":"572093df80cab705582f899b9354340aaaed71c7","original_commit_id":"572093df80cab705582f899b9354340aaaed71c7","user":{"login":"fgalan","id":1534240,"avatar_url":"https://avatars.githubusercontent.com/u/1534240?v=3","gravatar_id":"","url":"https://api.github.com/users/fgalan","html_url":"https://github.com/fgalan","followers_url":"https://api.github.com/users/fgalan/followers","following_url":"https://api.github.com/users/fgalan/following{/other_user}","gists_url":"https://api.github.com/users/fgalan/gists{/gist_id}","starred_url":"https://api.github.com/users/fgalan/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/fgalan/subscriptions","organizations_url":"https://api.github.com/users/fgalan/orgs","repos_url":"https://api.github.com/users/fgalan/repos","events_url":"https://api.github.com/users/fgalan/events{/privacy}","received_events_url":"https://api.github.com/users/fgalan/received_events","type":"User","site_admin":false},"body":"I'm afraid that I don't have the solution... on the contrary (if I'm remembering correctly) I have the same \"0 gap\" problem in other parts of the code :( \r\n\r\nMy only advice here is to study how other C/C++ projects have solved the same problem. It no solution comes in a reasonable time, them create an issue about this (not only for textParseAttributeValue(), but also to analyze in which other points of the code we have the same problem) and live with that FIXME while we find a solution.","created_at":"2015-09-29T20:09:58Z","updated_at":"2015-09-29T20:09:58Z","html_url":"https://github.com/telefonicaid/fiware-orion/pull/1299#discussion_r40722279","pull_request_url":"https://api.github.com/repos/telefonicaid/fiware-orion/pulls/1299","_links":{"self":{"href":"https://api.github.com/repos/telefonicaid/fiware-orion/pulls/comments/40722279"},"html":{"href":"https://github.com/telefonicaid/fiware-orion/pull/1299#discussion_r40722279"},"pull_request":{"href":"https://api.github.com/repos/telefonicaid/fiware-orion/pulls/1299"}}},"pull_request":{"url":"https://api.github.com/repos/telefonicaid/fiware-orion/pulls/1299","id":46302004,"html_url":"https://github.com/telefonicaid/fiware-orion/pull/1299","diff_url":"https://github.com/telefonicaid/fiware-orion/pull/1299.diff","patch_url":"https://github.com/telefonicaid/fiware-orion/pull/1299.patch","issue_url":"https://api.github.com/repos/telefonicaid/fiware-orion/issues/1299","number":1299,"state":"open","locked":false,"title":"Task/part5 attribute value parse","user":{"login":"kzangeli","id":5338380,"avatar_url":"https://avatars.githubusercontent.com/u/5338380?v=3","gravatar_id":"","url":"https://api.github.com/users/kzangeli","html_url":"https://github.com/kzangeli","followers_url":"https://api.github.com/users/kzangeli/followers","following_url":"https://api.github.com/users/kzangeli/following{/other_user}","gists_url":"https://api.github.com/users/kzangeli/gists{/gist_id}","starred_url":"https://api.github.com/users/kzangeli/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/kzangeli/subscriptions","organizations_url":"https://api.github.com/users/kzangeli/orgs","repos_url":"https://api.github.com/users/kzangeli/repos","events_url":"https://api.github.com/users/kzangeli/events{/privacy}","received_events_url":"https://api.github.com/users/kzangeli/received_events","type":"User","site_admin":false},"body":"Part V of issue #1259\r\n","created_at":"2015-09-29T16:43:06Z","updated_at":"2015-09-29T20:09:58Z","closed_at":null,"merged_at":null,"merge_commit_sha":"843e2b291dcb6d18e9961d8210d112d31100081e","assignee":{"login":"fgalan","id":1534240,"avatar_url":"https://avatars.githubusercontent.com/u/1534240?v=3","gravatar_id":"","url":"https://api.github.com/users/fgalan","html_url":"https://github.com/fgalan","followers_url":"https://api.github.com/users/fgalan/followers","following_url":"https://api.github.com/users/fgalan/following{/other_user}","gists_url":"https://api.github.com/users/fgalan/gists{/gist_id}","starred_url":"https://api.github.com/users/fgalan/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/fgalan/subscriptions","organizations_url":"https://api.github.com/users/fgalan/orgs","repos_url":"https://api.github.com/users/fgalan/repos","events_url":"https://api.github.com/users/fgalan/events{/privacy}","received_events_url":"https://api.github.com/users/fgalan/received_events","type":"User","site_admin":false},"milestone":{"url":"https://api.github.com/repos/telefonicaid/fiware-orion/milestones/18","html_url":"https://github.com/telefonicaid/fiware-orion/milestones/0.25.0","labels_url":"https://api.github.com/repos/telefonicaid/fiware-orion/milestones/18/labels","id":1248196,"number":18,"title":"0.25.0","description":"","creator":{"login":"fgalan","id":1534240,"avatar_url":"https://avatars.githubusercontent.com/u/1534240?v=3","gravatar_id":"","url":"https://api.github.com/users/fgalan","html_url":"https://github.com/fgalan","followers_url":"https://api.github.com/users/fgalan/followers","following_url":"https://api.github.com/users/fgalan/following{/other_user}","gists_url":"https://api.github.com/users/fgalan/gists{/gist_id}","starred_url":"https://api.github.com/users/fgalan/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/fgalan/subscriptions","organizations_url":"https://api.github.com/users/fgalan/orgs","repos_url":"https://api.github.com/users/fgalan/repos","events_url":"https://api.github.com/users/fgalan/events{/privacy}","received_events_url":"https://api.github.com/users/fgalan/received_events","type":"User","site_admin":false},"open_issues":17,"closed_issues":27,"state":"open","created_at":"2015-08-10T13:53:31Z","updated_at":"2015-09-29T16:49:07Z","due_on":"2015-10-30T23:00:00Z","closed_at":null},"commits_url":"https://api.github.com/repos/telefonicaid/fiware-orion/pulls/1299/commits","review_comments_url":"https://api.github.com/repos/telefonicaid/fiware-orion/pulls/1299/comments","review_comment_url":"https://api.github.com/repos/telefonicaid/fiware-orion/pulls/comments{/number}","comments_url":"https://api.github.com/repos/telefonicaid/fiware-orion/issues/1299/comments","statuses_url":"https://api.github.com/repos/telefonicaid/fiware-orion/statuses/572093df80cab705582f899b9354340aaaed71c7","head":{"label":"telefonicaid:task/part5_attribute_value_parse","ref":"task/part5_attribute_value_parse","sha":"572093df80cab705582f899b9354340aaaed71c7","user":{"login":"telefonicaid","id":968363,"avatar_url":"https://avatars.githubusercontent.com/u/968363?v=3","gravatar_id":"","url":"https://api.github.com/users/telefonicaid","html_url":"https://github.com/telefonicaid","followers_url":"https://api.github.com/users/telefonicaid/followers","following_url":"https://api.github.com/users/telefonicaid/following{/other_user}","gists_url":"https://api.github.com/users/telefonicaid/gists{/gist_id}","starred_url":"https://api.github.com/users/telefonicaid/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/telefonicaid/subscriptions","organizations_url":"https://api.github.com/users/telefonicaid/orgs","repos_url":"https://api.github.com/users/telefonicaid/repos","events_url":"https://api.github.com/users/telefonicaid/events{/privacy}","received_events_url":"https://api.github.com/users/telefonicaid/received_events","type":"Organization","site_admin":false},"repo":{"id":12808420,"name":"fiware-orion","full_name":"telefonicaid/fiware-orion","owner":{"login":"telefonicaid","id":968363,"avatar_url":"https://avatars.githubusercontent.com/u/968363?v=3","gravatar_id":"","url":"https://api.github.com/users/telefonicaid","html_url":"https://github.com/telefonicaid","followers_url":"https://api.github.com/users/telefonicaid/followers","following_url":"https://api.github.com/users/telefonicaid/following{/other_user}","gists_url":"https://api.github.com/users/telefonicaid/gists{/gist_id}","starred_url":"https://api.github.com/users/telefonicaid/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/telefonicaid/subscriptions","organizations_url":"https://api.github.com/users/telefonicaid/orgs","repos_url":"https://api.github.com/users/telefonicaid/repos","events_url":"https://api.github.com/users/telefonicaid/events{/privacy}","received_events_url":"https://api.github.com/users/telefonicaid/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/telefonicaid/fiware-orion","description":"FIWARE Orion Context Broker","fork":false,"url":"https://api.github.com/repos/telefonicaid/fiware-orion","forks_url":"https://api.github.com/repos/telefonicaid/fiware-orion/forks","keys_url":"https://api.github.com/repos/telefonicaid/fiware-orion/keys{/key_id}","collaborators_url":"https://api.github.com/repos/telefonicaid/fiware-orion/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/telefonicaid/fiware-orion/teams","hooks_url":"https://api.github.com/repos/telefonicaid/fiware-orion/hooks","issue_events_url":"https://api.github.com/repos/telefonicaid/fiware-orion/issues/events{/number}","events_url":"https://api.github.com/repos/telefonicaid/fiware-orion/events","assignees_url":"https://api.github.com/repos/telefonicaid/fiware-orion/assignees{/user}","branches_url":"https://api.github.com/repos/telefonicaid/fiware-orion/branches{/branch}","tags_url":"https://api.github.com/repos/telefonicaid/fiware-orion/tags","blobs_url":"https://api.github.com/repos/telefonicaid/fiware-orion/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/telefonicaid/fiware-orion/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/telefonicaid/fiware-orion/git/refs{/sha}","trees_url":"https://api.github.com/repos/telefonicaid/fiware-orion/git/trees{/sha}","statuses_url":"https://api.github.com/repos/telefonicaid/fiware-orion/statuses/{sha}","languages_url":"https://api.github.com/repos/telefonicaid/fiware-orion/languages","stargazers_url":"https://api.github.com/repos/telefonicaid/fiware-orion/stargazers","contributors_url":"https://api.github.com/repos/telefonicaid/fiware-orion/contributors","subscribers_url":"https://api.github.com/repos/telefonicaid/fiware-orion/subscribers","subscription_url":"https://api.github.com/repos/telefonicaid/fiware-orion/subscription","commits_url":"https://api.github.com/repos/telefonicaid/fiware-orion/commits{/sha}","git_commits_url":"https://api.github.com/repos/telefonicaid/fiware-orion/git/commits{/sha}","comments_url":"https://api.github.com/repos/telefonicaid/fiware-orion/comments{/number}","issue_comment_url":"https://api.github.com/repos/telefonicaid/fiware-orion/issues/comments{/number}","contents_url":"https://api.github.com/repos/telefonicaid/fiware-orion/contents/{+path}","compare_url":"https://api.github.com/repos/telefonicaid/fiware-orion/compare/{base}...{head}","merges_url":"https://api.github.com/repos/telefonicaid/fiware-orion/merges","archive_url":"https://api.github.com/repos/telefonicaid/fiware-orion/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/telefonicaid/fiware-orion/downloads","issues_url":"https://api.github.com/repos/telefonicaid/fiware-orion/issues{/number}","pulls_url":"https://api.github.com/repos/telefonicaid/fiware-orion/pulls{/number}","milestones_url":"https://api.github.com/repos/telefonicaid/fiware-orion/milestones{/number}","notifications_url":"https://api.github.com/repos/telefonicaid/fiware-orion/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/telefonicaid/fiware-orion/labels{/name}","releases_url":"https://api.github.com/repos/telefonicaid/fiware-orion/releases{/id}","created_at":"2013-09-13T11:55:25Z","updated_at":"2015-09-18T15:15:11Z","pushed_at":"2015-09-29T16:43:06Z","git_url":"git://github.com/telefonicaid/fiware-orion.git","ssh_url":"git@github.com:telefonicaid/fiware-orion.git","clone_url":"https://github.com/telefonicaid/fiware-orion.git","svn_url":"https://github.com/telefonicaid/fiware-orion","homepage":"http://catalogue.fiware.org/enablers/publishsubscribe-context-broker-orion-context-broker","size":28521,"stargazers_count":30,"watchers_count":30,"language":"C++","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":true,"forks_count":41,"mirror_url":null,"open_issues_count":199,"forks":41,"open_issues":199,"watchers":30,"default_branch":"develop"}},"base":{"label":"telefonicaid:feature/1259_new_json_for_v2","ref":"feature/1259_new_json_for_v2","sha":"159c1e220826a870006b6f200d3cd78bdac797e9","user":{"login":"telefonicaid","id":968363,"avatar_url":"https://avatars.githubusercontent.com/u/968363?v=3","gravatar_id":"","url":"https://api.github.com/users/telefonicaid","html_url":"https://github.com/telefonicaid","followers_url":"https://api.github.com/users/telefonicaid/followers","following_url":"https://api.github.com/users/telefonicaid/following{/other_user}","gists_url":"https://api.github.com/users/telefonicaid/gists{/gist_id}","starred_url":"https://api.github.com/users/telefonicaid/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/telefonicaid/subscriptions","organizations_url":"https://api.github.com/users/telefonicaid/orgs","repos_url":"https://api.github.com/users/telefonicaid/repos","events_url":"https://api.github.com/users/telefonicaid/events{/privacy}","received_events_url":"https://api.github.com/users/telefonicaid/received_events","type":"Organization","site_admin":false},"repo":{"id":12808420,"name":"fiware-orion","full_name":"telefonicaid/fiware-orion","owner":{"login":"telefonicaid","id":968363,"avatar_url":"https://avatars.githubusercontent.com/u/968363?v=3","gravatar_id":"","url":"https://api.github.com/users/telefonicaid","html_url":"https://github.com/telefonicaid","followers_url":"https://api.github.com/users/telefonicaid/followers","following_url":"https://api.github.com/users/telefonicaid/following{/other_user}","gists_url":"https://api.github.com/users/telefonicaid/gists{/gist_id}","starred_url":"https://api.github.com/users/telefonicaid/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/telefonicaid/subscriptions","organizations_url":"https://api.github.com/users/telefonicaid/orgs","repos_url":"https://api.github.com/users/telefonicaid/repos","events_url":"https://api.github.com/users/telefonicaid/events{/privacy}","received_events_url":"https://api.github.com/users/telefonicaid/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/telefonicaid/fiware-orion","description":"FIWARE Orion Context Broker","fork":false,"url":"https://api.github.com/repos/telefonicaid/fiware-orion","forks_url":"https://api.github.com/repos/telefonicaid/fiware-orion/forks","keys_url":"https://api.github.com/repos/telefonicaid/fiware-orion/keys{/key_id}","collaborators_url":"https://api.github.com/repos/telefonicaid/fiware-orion/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/telefonicaid/fiware-orion/teams","hooks_url":"https://api.github.com/repos/telefonicaid/fiware-orion/hooks","issue_events_url":"https://api.github.com/repos/telefonicaid/fiware-orion/issues/events{/number}","events_url":"https://api.github.com/repos/telefonicaid/fiware-orion/events","assignees_url":"https://api.github.com/repos/telefonicaid/fiware-orion/assignees{/user}","branches_url":"https://api.github.com/repos/telefonicaid/fiware-orion/branches{/branch}","tags_url":"https://api.github.com/repos/telefonicaid/fiware-orion/tags","blobs_url":"https://api.github.com/repos/telefonicaid/fiware-orion/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/telefonicaid/fiware-orion/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/telefonicaid/fiware-orion/git/refs{/sha}","trees_url":"https://api.github.com/repos/telefonicaid/fiware-orion/git/trees{/sha}","statuses_url":"https://api.github.com/repos/telefonicaid/fiware-orion/statuses/{sha}","languages_url":"https://api.github.com/repos/telefonicaid/fiware-orion/languages","stargazers_url":"https://api.github.com/repos/telefonicaid/fiware-orion/stargazers","contributors_url":"https://api.github.com/repos/telefonicaid/fiware-orion/contributors","subscribers_url":"https://api.github.com/repos/telefonicaid/fiware-orion/subscribers","subscription_url":"https://api.github.com/repos/telefonicaid/fiware-orion/subscription","commits_url":"https://api.github.com/repos/telefonicaid/fiware-orion/commits{/sha}","git_commits_url":"https://api.github.com/repos/telefonicaid/fiware-orion/git/commits{/sha}","comments_url":"https://api.github.com/repos/telefonicaid/fiware-orion/comments{/number}","issue_comment_url":"https://api.github.com/repos/telefonicaid/fiware-orion/issues/comments{/number}","contents_url":"https://api.github.com/repos/telefonicaid/fiware-orion/contents/{+path}","compare_url":"https://api.github.com/repos/telefonicaid/fiware-orion/compare/{base}...{head}","merges_url":"https://api.github.com/repos/telefonicaid/fiware-orion/merges","archive_url":"https://api.github.com/repos/telefonicaid/fiware-orion/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/telefonicaid/fiware-orion/downloads","issues_url":"https://api.github.com/repos/telefonicaid/fiware-orion/issues{/number}","pulls_url":"https://api.github.com/repos/telefonicaid/fiware-orion/pulls{/number}","milestones_url":"https://api.github.com/repos/telefonicaid/fiware-orion/milestones{/number}","notifications_url":"https://api.github.com/repos/telefonicaid/fiware-orion/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/telefonicaid/fiware-orion/labels{/name}","releases_url":"https://api.github.com/repos/telefonicaid/fiware-orion/releases{/id}","created_at":"2013-09-13T11:55:25Z","updated_at":"2015-09-18T15:15:11Z","pushed_at":"2015-09-29T16:43:06Z","git_url":"git://github.com/telefonicaid/fiware-orion.git","ssh_url":"git@github.com:telefonicaid/fiware-orion.git","clone_url":"https://github.com/telefonicaid/fiware-orion.git","svn_url":"https://github.com/telefonicaid/fiware-orion","homepage":"http://catalogue.fiware.org/enablers/publishsubscribe-context-broker-orion-context-broker","size":28521,"stargazers_count":30,"watchers_count":30,"language":"C++","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":true,"forks_count":41,"mirror_url":null,"open_issues_count":199,"forks":41,"open_issues":199,"watchers":30,"default_branch":"develop"}},"_links":{"self":{"href":"https://api.github.com/repos/telefonicaid/fiware-orion/pulls/1299"},"html":{"href":"https://github.com/telefonicaid/fiware-orion/pull/1299"},"issue":{"href":"https://api.github.com/repos/telefonicaid/fiware-orion/issues/1299"},"comments":{"href":"https://api.github.com/repos/telefonicaid/fiware-orion/issues/1299/comments"},"review_comments":{"href":"https://api.github.com/repos/telefonicaid/fiware-orion/pulls/1299/comments"},"review_comment":{"href":"https://api.github.com/repos/telefonicaid/fiware-orion/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/telefonicaid/fiware-orion/pulls/1299/commits"},"statuses":{"href":"https://api.github.com/repos/telefonicaid/fiware-orion/statuses/572093df80cab705582f899b9354340aaaed71c7"}}}}