Fossil SCM
Misuse of a potentially unsigned value, caught by clang. Only affected platforms where char is unsigned by default.
Commit
5c92bbfca7e36751b81ee28ce52de05d432028e0a05ae33604239084594c1538
Parent
22ba9a41e416988…
1 file changed
+2
-2
+2
-2
| --- src/json_user.c | ||
| +++ src/json_user.c | ||
| @@ -398,11 +398,11 @@ | ||
| 398 | 398 | static cson_value * json_user_save(){ |
| 399 | 399 | /* try to get user info from GET/CLI args and construct |
| 400 | 400 | a JSON form of it... */ |
| 401 | 401 | cson_object * u = cson_new_object(); |
| 402 | 402 | char const * str = NULL; |
| 403 | - char b = -1; | |
| 403 | + int b = -1; | |
| 404 | 404 | int i = -1; |
| 405 | 405 | int uid = -1; |
| 406 | 406 | cson_value * payload = NULL; |
| 407 | 407 | /* String properties... */ |
| 408 | 408 | #define PROP(LK,SK) str = json_find_option_cstr(LK,NULL,SK); \ |
| @@ -412,11 +412,11 @@ | ||
| 412 | 412 | PROP("info","i"); |
| 413 | 413 | PROP("capabilities","c"); |
| 414 | 414 | #undef PROP |
| 415 | 415 | /* Boolean properties... */ |
| 416 | 416 | #define PROP(LK,DFLT) b = json_find_option_bool(LK,NULL,NULL,DFLT); \ |
| 417 | - if(DFLT!=b){ cson_object_set(u, LK, cson_value_new_bool(b)); } (void)0 | |
| 417 | + if(DFLT!=b){ cson_object_set(u, LK, cson_value_new_bool(b ? 1 : 0)); } (void)0 | |
| 418 | 418 | PROP("forceLogout",-1); |
| 419 | 419 | #undef PROP |
| 420 | 420 | |
| 421 | 421 | #define PROP(LK,DFLT) i = json_find_option_int(LK,NULL,NULL,DFLT); \ |
| 422 | 422 | if(DFLT != i){ cson_object_set(u, LK, cson_value_new_integer(i)); } (void)0 |
| 423 | 423 |
| --- src/json_user.c | |
| +++ src/json_user.c | |
| @@ -398,11 +398,11 @@ | |
| 398 | static cson_value * json_user_save(){ |
| 399 | /* try to get user info from GET/CLI args and construct |
| 400 | a JSON form of it... */ |
| 401 | cson_object * u = cson_new_object(); |
| 402 | char const * str = NULL; |
| 403 | char b = -1; |
| 404 | int i = -1; |
| 405 | int uid = -1; |
| 406 | cson_value * payload = NULL; |
| 407 | /* String properties... */ |
| 408 | #define PROP(LK,SK) str = json_find_option_cstr(LK,NULL,SK); \ |
| @@ -412,11 +412,11 @@ | |
| 412 | PROP("info","i"); |
| 413 | PROP("capabilities","c"); |
| 414 | #undef PROP |
| 415 | /* Boolean properties... */ |
| 416 | #define PROP(LK,DFLT) b = json_find_option_bool(LK,NULL,NULL,DFLT); \ |
| 417 | if(DFLT!=b){ cson_object_set(u, LK, cson_value_new_bool(b)); } (void)0 |
| 418 | PROP("forceLogout",-1); |
| 419 | #undef PROP |
| 420 | |
| 421 | #define PROP(LK,DFLT) i = json_find_option_int(LK,NULL,NULL,DFLT); \ |
| 422 | if(DFLT != i){ cson_object_set(u, LK, cson_value_new_integer(i)); } (void)0 |
| 423 |
| --- src/json_user.c | |
| +++ src/json_user.c | |
| @@ -398,11 +398,11 @@ | |
| 398 | static cson_value * json_user_save(){ |
| 399 | /* try to get user info from GET/CLI args and construct |
| 400 | a JSON form of it... */ |
| 401 | cson_object * u = cson_new_object(); |
| 402 | char const * str = NULL; |
| 403 | int b = -1; |
| 404 | int i = -1; |
| 405 | int uid = -1; |
| 406 | cson_value * payload = NULL; |
| 407 | /* String properties... */ |
| 408 | #define PROP(LK,SK) str = json_find_option_cstr(LK,NULL,SK); \ |
| @@ -412,11 +412,11 @@ | |
| 412 | PROP("info","i"); |
| 413 | PROP("capabilities","c"); |
| 414 | #undef PROP |
| 415 | /* Boolean properties... */ |
| 416 | #define PROP(LK,DFLT) b = json_find_option_bool(LK,NULL,NULL,DFLT); \ |
| 417 | if(DFLT!=b){ cson_object_set(u, LK, cson_value_new_bool(b ? 1 : 0)); } (void)0 |
| 418 | PROP("forceLogout",-1); |
| 419 | #undef PROP |
| 420 | |
| 421 | #define PROP(LK,DFLT) i = json_find_option_int(LK,NULL,NULL,DFLT); \ |
| 422 | if(DFLT != i){ cson_object_set(u, LK, cson_value_new_integer(i)); } (void)0 |
| 423 |