| 3372 | } |
| 3373 | |
| 3374 | static bool compare_parse_bounded_integer(yyjson_val *root, const char *key, int64_t default_value, |
| 3375 | int64_t maximum, uint64_t *out, |
| 3376 | const char **error_message) { |
| 3377 | yyjson_val *value = yyjson_obj_get(root, key); |
| 3378 | int64_t parsed = default_value; |
| 3379 | if (value) { |
| 3380 | if (!yyjson_is_int(value)) { |
| 3381 | *error_message = "limit values must be integers"; |
| 3382 | return false; |
| 3383 | } |
| 3384 | parsed = yyjson_get_int(value); |
| 3385 | } |
| 3386 | if (parsed < 1 || parsed > maximum) { |
| 3387 | *error_message = strcmp(key, "limit") == 0 ? "limit must be between 1 and 1000" |
| 3388 | : "scan_limit must be between 1 and 10000000"; |
| 3389 | return false; |
| 3390 | } |
| 3391 | *out = (uint64_t)parsed; |
| 3392 | return true; |
| 3393 | } |
| 3394 | |
| 3395 | static bool compare_parse_arguments(const char *args, char **base_project, char **target_project, |
| 3396 | uint64_t *limit, uint64_t *scan_limit, |
no outgoing calls
no test coverage detected