mirror of
https://github.com/open5gs/open5gs.git
synced 2026-05-05 15:24:14 +00:00
[SBI] Crash occurs when ENUM in the MAP (#2103)
This commit is contained in:
parent
ce668c556c
commit
969c116e77
1097 changed files with 266728 additions and 42047 deletions
|
|
@ -22,22 +22,33 @@ OpenAPI_scheduled_communication_time_rm_t *OpenAPI_scheduled_communication_time_
|
|||
|
||||
void OpenAPI_scheduled_communication_time_rm_free(OpenAPI_scheduled_communication_time_rm_t *scheduled_communication_time_rm)
|
||||
{
|
||||
OpenAPI_lnode_t *node = NULL;
|
||||
|
||||
if (NULL == scheduled_communication_time_rm) {
|
||||
return;
|
||||
}
|
||||
OpenAPI_lnode_t *node;
|
||||
OpenAPI_list_for_each(scheduled_communication_time_rm->days_of_week, node) {
|
||||
ogs_free(node->data);
|
||||
if (scheduled_communication_time_rm->days_of_week) {
|
||||
OpenAPI_list_for_each(scheduled_communication_time_rm->days_of_week, node) {
|
||||
ogs_free(node->data);
|
||||
}
|
||||
OpenAPI_list_free(scheduled_communication_time_rm->days_of_week);
|
||||
scheduled_communication_time_rm->days_of_week = NULL;
|
||||
}
|
||||
if (scheduled_communication_time_rm->time_of_day_start) {
|
||||
ogs_free(scheduled_communication_time_rm->time_of_day_start);
|
||||
scheduled_communication_time_rm->time_of_day_start = NULL;
|
||||
}
|
||||
if (scheduled_communication_time_rm->time_of_day_end) {
|
||||
ogs_free(scheduled_communication_time_rm->time_of_day_end);
|
||||
scheduled_communication_time_rm->time_of_day_end = NULL;
|
||||
}
|
||||
OpenAPI_list_free(scheduled_communication_time_rm->days_of_week);
|
||||
ogs_free(scheduled_communication_time_rm->time_of_day_start);
|
||||
ogs_free(scheduled_communication_time_rm->time_of_day_end);
|
||||
ogs_free(scheduled_communication_time_rm);
|
||||
}
|
||||
|
||||
cJSON *OpenAPI_scheduled_communication_time_rm_convertToJSON(OpenAPI_scheduled_communication_time_rm_t *scheduled_communication_time_rm)
|
||||
{
|
||||
cJSON *item = NULL;
|
||||
OpenAPI_lnode_t *node = NULL;
|
||||
|
||||
if (scheduled_communication_time_rm == NULL) {
|
||||
ogs_error("OpenAPI_scheduled_communication_time_rm_convertToJSON() failed [ScheduledCommunicationTimeRm]");
|
||||
|
|
@ -46,19 +57,17 @@ cJSON *OpenAPI_scheduled_communication_time_rm_convertToJSON(OpenAPI_scheduled_c
|
|||
|
||||
item = cJSON_CreateObject();
|
||||
if (scheduled_communication_time_rm->days_of_week) {
|
||||
cJSON *days_of_week = cJSON_AddArrayToObject(item, "daysOfWeek");
|
||||
if (days_of_week == NULL) {
|
||||
cJSON *days_of_weekList = cJSON_AddArrayToObject(item, "daysOfWeek");
|
||||
if (days_of_weekList == NULL) {
|
||||
ogs_error("OpenAPI_scheduled_communication_time_rm_convertToJSON() failed [days_of_week]");
|
||||
goto end;
|
||||
}
|
||||
|
||||
OpenAPI_lnode_t *days_of_week_node;
|
||||
OpenAPI_list_for_each(scheduled_communication_time_rm->days_of_week, days_of_week_node) {
|
||||
if (cJSON_AddNumberToObject(days_of_week, "", *(double *)days_of_week_node->data) == NULL) {
|
||||
ogs_error("OpenAPI_scheduled_communication_time_rm_convertToJSON() failed [days_of_week]");
|
||||
goto end;
|
||||
OpenAPI_list_for_each(scheduled_communication_time_rm->days_of_week, node) {
|
||||
if (cJSON_AddNumberToObject(days_of_weekList, "", (uintptr_t)node->data) == NULL) {
|
||||
ogs_error("OpenAPI_scheduled_communication_time_rm_convertToJSON() failed [days_of_week]");
|
||||
goto end;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (scheduled_communication_time_rm->time_of_day_start) {
|
||||
|
|
@ -82,39 +91,49 @@ end:
|
|||
OpenAPI_scheduled_communication_time_rm_t *OpenAPI_scheduled_communication_time_rm_parseFromJSON(cJSON *scheduled_communication_time_rmJSON)
|
||||
{
|
||||
OpenAPI_scheduled_communication_time_rm_t *scheduled_communication_time_rm_local_var = NULL;
|
||||
cJSON *days_of_week = cJSON_GetObjectItemCaseSensitive(scheduled_communication_time_rmJSON, "daysOfWeek");
|
||||
|
||||
OpenAPI_list_t *days_of_weekList;
|
||||
OpenAPI_lnode_t *node = NULL;
|
||||
cJSON *days_of_week = NULL;
|
||||
OpenAPI_list_t *days_of_weekList = NULL;
|
||||
cJSON *time_of_day_start = NULL;
|
||||
cJSON *time_of_day_end = NULL;
|
||||
days_of_week = cJSON_GetObjectItemCaseSensitive(scheduled_communication_time_rmJSON, "daysOfWeek");
|
||||
if (days_of_week) {
|
||||
cJSON *days_of_week_local;
|
||||
if (!cJSON_IsArray(days_of_week)) {
|
||||
ogs_error("OpenAPI_scheduled_communication_time_rm_parseFromJSON() failed [days_of_week]");
|
||||
goto end;
|
||||
}
|
||||
days_of_weekList = OpenAPI_list_create();
|
||||
cJSON *days_of_week_local = NULL;
|
||||
if (!cJSON_IsArray(days_of_week)) {
|
||||
ogs_error("OpenAPI_scheduled_communication_time_rm_parseFromJSON() failed [days_of_week]");
|
||||
goto end;
|
||||
}
|
||||
|
||||
cJSON_ArrayForEach(days_of_week_local, days_of_week) {
|
||||
if (!cJSON_IsNumber(days_of_week_local)) {
|
||||
ogs_error("OpenAPI_scheduled_communication_time_rm_parseFromJSON() failed [days_of_week]");
|
||||
goto end;
|
||||
}
|
||||
OpenAPI_list_add(days_of_weekList, &days_of_week_local->valuedouble);
|
||||
}
|
||||
days_of_weekList = OpenAPI_list_create();
|
||||
|
||||
cJSON_ArrayForEach(days_of_week_local, days_of_week) {
|
||||
double *localDouble = NULL;
|
||||
int *localInt = NULL;
|
||||
if (!cJSON_IsNumber(days_of_week_local)) {
|
||||
ogs_error("OpenAPI_scheduled_communication_time_rm_parseFromJSON() failed [days_of_week]");
|
||||
goto end;
|
||||
}
|
||||
localDouble = (double *)ogs_calloc(1, sizeof(double));
|
||||
if (!localDouble) {
|
||||
ogs_error("OpenAPI_scheduled_communication_time_rm_parseFromJSON() failed [days_of_week]");
|
||||
goto end;
|
||||
}
|
||||
*localDouble = days_of_week_local->valuedouble;
|
||||
OpenAPI_list_add(days_of_weekList, localDouble);
|
||||
}
|
||||
}
|
||||
|
||||
cJSON *time_of_day_start = cJSON_GetObjectItemCaseSensitive(scheduled_communication_time_rmJSON, "timeOfDayStart");
|
||||
|
||||
time_of_day_start = cJSON_GetObjectItemCaseSensitive(scheduled_communication_time_rmJSON, "timeOfDayStart");
|
||||
if (time_of_day_start) {
|
||||
if (!cJSON_IsString(time_of_day_start)) {
|
||||
if (!cJSON_IsString(time_of_day_start) && !cJSON_IsNull(time_of_day_start)) {
|
||||
ogs_error("OpenAPI_scheduled_communication_time_rm_parseFromJSON() failed [time_of_day_start]");
|
||||
goto end;
|
||||
}
|
||||
}
|
||||
|
||||
cJSON *time_of_day_end = cJSON_GetObjectItemCaseSensitive(scheduled_communication_time_rmJSON, "timeOfDayEnd");
|
||||
|
||||
time_of_day_end = cJSON_GetObjectItemCaseSensitive(scheduled_communication_time_rmJSON, "timeOfDayEnd");
|
||||
if (time_of_day_end) {
|
||||
if (!cJSON_IsString(time_of_day_end)) {
|
||||
if (!cJSON_IsString(time_of_day_end) && !cJSON_IsNull(time_of_day_end)) {
|
||||
ogs_error("OpenAPI_scheduled_communication_time_rm_parseFromJSON() failed [time_of_day_end]");
|
||||
goto end;
|
||||
}
|
||||
|
|
@ -122,12 +141,19 @@ OpenAPI_scheduled_communication_time_rm_t *OpenAPI_scheduled_communication_time_
|
|||
|
||||
scheduled_communication_time_rm_local_var = OpenAPI_scheduled_communication_time_rm_create (
|
||||
days_of_week ? days_of_weekList : NULL,
|
||||
time_of_day_start ? ogs_strdup(time_of_day_start->valuestring) : NULL,
|
||||
time_of_day_end ? ogs_strdup(time_of_day_end->valuestring) : NULL
|
||||
time_of_day_start && !cJSON_IsNull(time_of_day_start) ? ogs_strdup(time_of_day_start->valuestring) : NULL,
|
||||
time_of_day_end && !cJSON_IsNull(time_of_day_end) ? ogs_strdup(time_of_day_end->valuestring) : NULL
|
||||
);
|
||||
|
||||
return scheduled_communication_time_rm_local_var;
|
||||
end:
|
||||
if (days_of_weekList) {
|
||||
OpenAPI_list_for_each(days_of_weekList, node) {
|
||||
ogs_free(node->data);
|
||||
}
|
||||
OpenAPI_list_free(days_of_weekList);
|
||||
days_of_weekList = NULL;
|
||||
}
|
||||
return NULL;
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue