mirror of
https://github.com/open5gs/open5gs.git
synced 2026-05-05 07:08:11 +00:00
Upgrade SBI(Service-based Interface)
* OpenAPI Generator version: 4.3.1 ==> 5.5.1 * Specification : r16.8.0 (20210629)
This commit is contained in:
parent
2aaa8200c2
commit
f278d58a69
1914 changed files with 91329 additions and 57361 deletions
504
lib/sbi/openapi/external/cJSON.c
vendored
504
lib/sbi/openapi/external/cJSON.c
vendored
|
|
@ -1,24 +1,24 @@
|
|||
/*
|
||||
Copyright (c) 2009-2017 Dave Gamble and cJSON contributors
|
||||
Copyright (c) 2009-2017 Dave Gamble and cJSON contributors
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in
|
||||
all copies or substantial portions of the Software.
|
||||
The above copyright notice and this permission notice shall be included in
|
||||
all copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
THE SOFTWARE.
|
||||
*/
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
THE SOFTWARE.
|
||||
*/
|
||||
|
||||
/* cJSON */
|
||||
/* JSON parser in C. */
|
||||
|
|
@ -299,29 +299,29 @@ static cJSON_bool parse_number(cJSON * const item, parse_buffer * const input_bu
|
|||
{
|
||||
switch (buffer_at_offset(input_buffer)[i])
|
||||
{
|
||||
case '0':
|
||||
case '1':
|
||||
case '2':
|
||||
case '3':
|
||||
case '4':
|
||||
case '5':
|
||||
case '6':
|
||||
case '7':
|
||||
case '8':
|
||||
case '9':
|
||||
case '+':
|
||||
case '-':
|
||||
case 'e':
|
||||
case 'E':
|
||||
number_c_string[i] = buffer_at_offset(input_buffer)[i];
|
||||
break;
|
||||
case '0':
|
||||
case '1':
|
||||
case '2':
|
||||
case '3':
|
||||
case '4':
|
||||
case '5':
|
||||
case '6':
|
||||
case '7':
|
||||
case '8':
|
||||
case '9':
|
||||
case '+':
|
||||
case '-':
|
||||
case 'e':
|
||||
case 'E':
|
||||
number_c_string[i] = buffer_at_offset(input_buffer)[i];
|
||||
break;
|
||||
|
||||
case '.':
|
||||
number_c_string[i] = decimal_point;
|
||||
break;
|
||||
case '.':
|
||||
number_c_string[i] = decimal_point;
|
||||
break;
|
||||
|
||||
default:
|
||||
goto loop_end;
|
||||
default:
|
||||
goto loop_end;
|
||||
}
|
||||
}
|
||||
loop_end:
|
||||
|
|
@ -776,39 +776,39 @@ static cJSON_bool parse_string(cJSON * const item, parse_buffer * const input_bu
|
|||
|
||||
switch (input_pointer[1])
|
||||
{
|
||||
case 'b':
|
||||
*output_pointer++ = '\b';
|
||||
break;
|
||||
case 'f':
|
||||
*output_pointer++ = '\f';
|
||||
break;
|
||||
case 'n':
|
||||
*output_pointer++ = '\n';
|
||||
break;
|
||||
case 'r':
|
||||
*output_pointer++ = '\r';
|
||||
break;
|
||||
case 't':
|
||||
*output_pointer++ = '\t';
|
||||
break;
|
||||
case '\"':
|
||||
case '\\':
|
||||
case '/':
|
||||
*output_pointer++ = input_pointer[1];
|
||||
break;
|
||||
case 'b':
|
||||
*output_pointer++ = '\b';
|
||||
break;
|
||||
case 'f':
|
||||
*output_pointer++ = '\f';
|
||||
break;
|
||||
case 'n':
|
||||
*output_pointer++ = '\n';
|
||||
break;
|
||||
case 'r':
|
||||
*output_pointer++ = '\r';
|
||||
break;
|
||||
case 't':
|
||||
*output_pointer++ = '\t';
|
||||
break;
|
||||
case '\"':
|
||||
case '\\':
|
||||
case '/':
|
||||
*output_pointer++ = input_pointer[1];
|
||||
break;
|
||||
|
||||
/* UTF-16 literal */
|
||||
case 'u':
|
||||
sequence_length = utf16_literal_to_utf8(input_pointer, input_end, &output_pointer);
|
||||
if (sequence_length == 0)
|
||||
{
|
||||
/* failed to convert UTF16-literal to UTF-8 */
|
||||
/* UTF-16 literal */
|
||||
case 'u':
|
||||
sequence_length = utf16_literal_to_utf8(input_pointer, input_end, &output_pointer);
|
||||
if (sequence_length == 0)
|
||||
{
|
||||
/* failed to convert UTF16-literal to UTF-8 */
|
||||
goto fail;
|
||||
}
|
||||
break;
|
||||
|
||||
default:
|
||||
goto fail;
|
||||
}
|
||||
break;
|
||||
|
||||
default:
|
||||
goto fail;
|
||||
}
|
||||
input_pointer += sequence_length;
|
||||
}
|
||||
|
|
@ -872,23 +872,23 @@ static cJSON_bool print_string_ptr(const unsigned char * const input, printbuffe
|
|||
{
|
||||
switch (*input_pointer)
|
||||
{
|
||||
case '\"':
|
||||
case '\\':
|
||||
case '\b':
|
||||
case '\f':
|
||||
case '\n':
|
||||
case '\r':
|
||||
case '\t':
|
||||
/* one character escape sequence */
|
||||
escape_characters++;
|
||||
break;
|
||||
default:
|
||||
if (*input_pointer < 32)
|
||||
{
|
||||
/* UTF-16 escape sequence uXXXX */
|
||||
escape_characters += 5;
|
||||
}
|
||||
break;
|
||||
case '\"':
|
||||
case '\\':
|
||||
case '\b':
|
||||
case '\f':
|
||||
case '\n':
|
||||
case '\r':
|
||||
case '\t':
|
||||
/* one character escape sequence */
|
||||
escape_characters++;
|
||||
break;
|
||||
default:
|
||||
if (*input_pointer < 32)
|
||||
{
|
||||
/* UTF-16 escape sequence uXXXX */
|
||||
escape_characters += 5;
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
output_length = (size_t)(input_pointer - input) + escape_characters;
|
||||
|
|
@ -926,32 +926,32 @@ static cJSON_bool print_string_ptr(const unsigned char * const input, printbuffe
|
|||
*output_pointer++ = '\\';
|
||||
switch (*input_pointer)
|
||||
{
|
||||
case '\\':
|
||||
*output_pointer = '\\';
|
||||
break;
|
||||
case '\"':
|
||||
*output_pointer = '\"';
|
||||
break;
|
||||
case '\b':
|
||||
*output_pointer = 'b';
|
||||
break;
|
||||
case '\f':
|
||||
*output_pointer = 'f';
|
||||
break;
|
||||
case '\n':
|
||||
*output_pointer = 'n';
|
||||
break;
|
||||
case '\r':
|
||||
*output_pointer = 'r';
|
||||
break;
|
||||
case '\t':
|
||||
*output_pointer = 't';
|
||||
break;
|
||||
default:
|
||||
/* escape and print as unicode codepoint */
|
||||
sprintf((char*)output_pointer, "u%04x", *input_pointer);
|
||||
output_pointer += 4;
|
||||
break;
|
||||
case '\\':
|
||||
*output_pointer = '\\';
|
||||
break;
|
||||
case '\"':
|
||||
*output_pointer = '\"';
|
||||
break;
|
||||
case '\b':
|
||||
*output_pointer = 'b';
|
||||
break;
|
||||
case '\f':
|
||||
*output_pointer = 'f';
|
||||
break;
|
||||
case '\n':
|
||||
*output_pointer = 'n';
|
||||
break;
|
||||
case '\r':
|
||||
*output_pointer = 'r';
|
||||
break;
|
||||
case '\t':
|
||||
*output_pointer = 't';
|
||||
break;
|
||||
default:
|
||||
/* escape and print as unicode codepoint */
|
||||
sprintf((char*)output_pointer, "u%04x", *input_pointer);
|
||||
output_pointer += 4;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -985,7 +985,7 @@ static parse_buffer *buffer_skip_whitespace(parse_buffer * const buffer)
|
|||
|
||||
while (can_access_at_index(buffer, 0) && (buffer_at_offset(buffer)[0] <= 32))
|
||||
{
|
||||
buffer->offset++;
|
||||
buffer->offset++;
|
||||
}
|
||||
|
||||
if (buffer->offset == buffer->length)
|
||||
|
|
@ -1291,65 +1291,65 @@ static cJSON_bool print_value(const cJSON * const item, printbuffer * const outp
|
|||
|
||||
switch ((item->type) & 0xFF)
|
||||
{
|
||||
case cJSON_NULL:
|
||||
output = ensure(output_buffer, 5);
|
||||
if (output == NULL)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
strcpy((char*)output, "null");
|
||||
return true;
|
||||
case cJSON_NULL:
|
||||
output = ensure(output_buffer, 5);
|
||||
if (output == NULL)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
strcpy((char*)output, "null");
|
||||
return true;
|
||||
|
||||
case cJSON_False:
|
||||
output = ensure(output_buffer, 6);
|
||||
if (output == NULL)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
strcpy((char*)output, "false");
|
||||
return true;
|
||||
case cJSON_False:
|
||||
output = ensure(output_buffer, 6);
|
||||
if (output == NULL)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
strcpy((char*)output, "false");
|
||||
return true;
|
||||
|
||||
case cJSON_True:
|
||||
output = ensure(output_buffer, 5);
|
||||
if (output == NULL)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
strcpy((char*)output, "true");
|
||||
return true;
|
||||
case cJSON_True:
|
||||
output = ensure(output_buffer, 5);
|
||||
if (output == NULL)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
strcpy((char*)output, "true");
|
||||
return true;
|
||||
|
||||
case cJSON_Number:
|
||||
return print_number(item, output_buffer);
|
||||
case cJSON_Number:
|
||||
return print_number(item, output_buffer);
|
||||
|
||||
case cJSON_Raw:
|
||||
{
|
||||
size_t raw_length = 0;
|
||||
if (item->valuestring == NULL)
|
||||
case cJSON_Raw:
|
||||
{
|
||||
return false;
|
||||
size_t raw_length = 0;
|
||||
if (item->valuestring == NULL)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
raw_length = strlen(item->valuestring) + sizeof("");
|
||||
output = ensure(output_buffer, raw_length);
|
||||
if (output == NULL)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
memcpy(output, item->valuestring, raw_length);
|
||||
return true;
|
||||
}
|
||||
|
||||
raw_length = strlen(item->valuestring) + sizeof("");
|
||||
output = ensure(output_buffer, raw_length);
|
||||
if (output == NULL)
|
||||
{
|
||||
case cJSON_String:
|
||||
return print_string(item, output_buffer);
|
||||
|
||||
case cJSON_Array:
|
||||
return print_array(item, output_buffer);
|
||||
|
||||
case cJSON_Object:
|
||||
return print_object(item, output_buffer);
|
||||
|
||||
default:
|
||||
return false;
|
||||
}
|
||||
memcpy(output, item->valuestring, raw_length);
|
||||
return true;
|
||||
}
|
||||
|
||||
case cJSON_String:
|
||||
return print_string(item, output_buffer);
|
||||
|
||||
case cJSON_Array:
|
||||
return print_array(item, output_buffer);
|
||||
|
||||
case cJSON_Object:
|
||||
return print_object(item, output_buffer);
|
||||
|
||||
default:
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -2504,7 +2504,7 @@ CJSON_PUBLIC(cJSON *) cJSON_CreateDoubleArray(const double *numbers, int count)
|
|||
|
||||
a = cJSON_CreateArray();
|
||||
|
||||
for(i = 0; a && (i < (size_t)count); i++)
|
||||
for(i = 0;a && (i < (size_t)count); i++)
|
||||
{
|
||||
n = cJSON_CreateNumber(numbers[i]);
|
||||
if(!n)
|
||||
|
|
@ -2822,18 +2822,18 @@ CJSON_PUBLIC(cJSON_bool) cJSON_Compare(const cJSON * const a, const cJSON * cons
|
|||
/* check if type is valid */
|
||||
switch (a->type & 0xFF)
|
||||
{
|
||||
case cJSON_False:
|
||||
case cJSON_True:
|
||||
case cJSON_NULL:
|
||||
case cJSON_Number:
|
||||
case cJSON_String:
|
||||
case cJSON_Raw:
|
||||
case cJSON_Array:
|
||||
case cJSON_Object:
|
||||
break;
|
||||
case cJSON_False:
|
||||
case cJSON_True:
|
||||
case cJSON_NULL:
|
||||
case cJSON_Number:
|
||||
case cJSON_String:
|
||||
case cJSON_Raw:
|
||||
case cJSON_Array:
|
||||
case cJSON_Object:
|
||||
break;
|
||||
|
||||
default:
|
||||
return false;
|
||||
default:
|
||||
return false;
|
||||
}
|
||||
|
||||
/* identical objects are equal */
|
||||
|
|
@ -2844,96 +2844,96 @@ CJSON_PUBLIC(cJSON_bool) cJSON_Compare(const cJSON * const a, const cJSON * cons
|
|||
|
||||
switch (a->type & 0xFF)
|
||||
{
|
||||
/* in these cases and equal type is enough */
|
||||
case cJSON_False:
|
||||
case cJSON_True:
|
||||
case cJSON_NULL:
|
||||
return true;
|
||||
|
||||
case cJSON_Number:
|
||||
if (a->valuedouble == b->valuedouble)
|
||||
{
|
||||
/* in these cases and equal type is enough */
|
||||
case cJSON_False:
|
||||
case cJSON_True:
|
||||
case cJSON_NULL:
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
|
||||
case cJSON_String:
|
||||
case cJSON_Raw:
|
||||
if ((a->valuestring == NULL) || (b->valuestring == NULL))
|
||||
{
|
||||
case cJSON_Number:
|
||||
if (a->valuedouble == b->valuedouble)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
if (strcmp(a->valuestring, b->valuestring) == 0)
|
||||
|
||||
case cJSON_String:
|
||||
case cJSON_Raw:
|
||||
if ((a->valuestring == NULL) || (b->valuestring == NULL))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
if (strcmp(a->valuestring, b->valuestring) == 0)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
|
||||
case cJSON_Array:
|
||||
{
|
||||
cJSON *a_element = a->child;
|
||||
cJSON *b_element = b->child;
|
||||
|
||||
for (; (a_element != NULL) && (b_element != NULL);)
|
||||
{
|
||||
if (!cJSON_Compare(a_element, b_element, case_sensitive))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
a_element = a_element->next;
|
||||
b_element = b_element->next;
|
||||
}
|
||||
|
||||
/* one of the arrays is longer than the other */
|
||||
if (a_element != b_element) {
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
|
||||
case cJSON_Array:
|
||||
{
|
||||
cJSON *a_element = a->child;
|
||||
cJSON *b_element = b->child;
|
||||
|
||||
for (; (a_element != NULL) && (b_element != NULL);)
|
||||
case cJSON_Object:
|
||||
{
|
||||
if (!cJSON_Compare(a_element, b_element, case_sensitive))
|
||||
cJSON *a_element = NULL;
|
||||
cJSON *b_element = NULL;
|
||||
cJSON_ArrayForEach(a_element, a)
|
||||
{
|
||||
return false;
|
||||
/* TODO This has O(n^2) runtime, which is horrible! */
|
||||
b_element = get_object_item(b, a_element->string, case_sensitive);
|
||||
if (b_element == NULL)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
if (!cJSON_Compare(a_element, b_element, case_sensitive))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
a_element = a_element->next;
|
||||
b_element = b_element->next;
|
||||
/* doing this twice, once on a and b to prevent true comparison if a subset of b
|
||||
* TODO: Do this the proper way, this is just a fix for now */
|
||||
cJSON_ArrayForEach(b_element, b)
|
||||
{
|
||||
a_element = get_object_item(a, b_element->string, case_sensitive);
|
||||
if (a_element == NULL)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
if (!cJSON_Compare(b_element, a_element, case_sensitive))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
/* one of the arrays is longer than the other */
|
||||
if (a_element != b_element) {
|
||||
default:
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
case cJSON_Object:
|
||||
{
|
||||
cJSON *a_element = NULL;
|
||||
cJSON *b_element = NULL;
|
||||
cJSON_ArrayForEach(a_element, a)
|
||||
{
|
||||
/* TODO This has O(n^2) runtime, which is horrible! */
|
||||
b_element = get_object_item(b, a_element->string, case_sensitive);
|
||||
if (b_element == NULL)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
if (!cJSON_Compare(a_element, b_element, case_sensitive))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
/* doing this twice, once on a and b to prevent true comparison if a subset of b
|
||||
* TODO: Do this the proper way, this is just a fix for now */
|
||||
cJSON_ArrayForEach(b_element, b)
|
||||
{
|
||||
a_element = get_object_item(a, b_element->string, case_sensitive);
|
||||
if (a_element == NULL)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
if (!cJSON_Compare(b_element, a_element, case_sensitive))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
default:
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue