| 540 | } |
| 541 | |
| 542 | int try_get_mi_arr_param_string(const mi_item_t *array, int pos, |
| 543 | char **value, int *value_len) |
| 544 | { |
| 545 | mi_item_t *s; |
| 546 | |
| 547 | if (!array) { |
| 548 | param_err_type = MI_PARAM_ERR_MISSING; |
| 549 | return MI_PARAM_ERR_MISSING; |
| 550 | } |
| 551 | |
| 552 | s = cJSON_GetArrayItem(array, pos); |
| 553 | if (!s) { |
| 554 | param_err_type = MI_PARAM_ERR_MISSING; |
| 555 | return MI_PARAM_ERR_MISSING; |
| 556 | } |
| 557 | |
| 558 | if (!(s->type & (cJSON_Number|cJSON_String))) { |
| 559 | param_err_type = MI_PARAM_ERR_ARR_BAD_TYPE; |
| 560 | return MI_PARAM_ERR_ARR_BAD_TYPE; |
| 561 | } |
| 562 | |
| 563 | if (s->type & cJSON_String) { |
| 564 | *value = s->valuestring; |
| 565 | *value_len = strlen(s->valuestring); |
| 566 | } else { |
| 567 | *value = sint2str(s->valueint, value_len); |
| 568 | } |
| 569 | |
| 570 | return 0; |
| 571 | } |
| 572 | |
| 573 | int get_mi_arr_param_string(const mi_item_t *array, int pos, |
| 574 | char **value, int *value_len) |
no test coverage detected