This website works better with JavaScript.
Home
Issues
Pull Requests
Milestones
AI流水线
Repositories
Datasets
Forum
实训
竞赛
大数据
Register
Sign In
jdk-build-libs
/
json-c
Not watched
Unwatch
Watch all
Watch but not notify
1
Star
0
Fork
0
Code
Releases
11
Wiki
evaluate
Activity
Issues
0
Pull Requests
0
Datasets
Model
Cloudbrain
HPC
Browse Source
Merge pull request
#346
from schwehr/get_int
Clamp double to int32 when narrowing in json_object_get_int.
tags/json-c-0.13-20171207
Eric Haszlakiewicz
GitHub
8 years ago
parent
474376f30a
ef7b08ce7f
commit
256ebcd827
1 changed files
with
4 additions
and
0 deletions
Split View
Diff Options
Show Stats
Download Patch File
Download Diff File
+4
-0
json_object.c
+ 4
- 0
json_object.c
View File
@@ -635,6 +635,10 @@ int32_t json_object_get_int(const struct json_object *jso)
return INT32_MAX;
return (int32_t) cint64;
case json_type_double:
if (jso->o.c_double <= INT32_MIN)
return INT32_MIN;
if (jso->o.c_double >= INT32_MAX)
return INT32_MAX;
return (int32_t)jso->o.c_double;
case json_type_boolean:
return jso->o.c_boolean;
Write
Preview
Loading…
Cancel
Save