forked from loafle/openapi-generator-original
C overhead fixes (#20402)
* [C][Client] Remove redundant casts Don't explicitly cast void pointers as it's unnecessary in C, but leave printf arguments untouched to avoid setting off -Wformat. * [C][Client] Cosmetic: remove unnecessary parens, align some lines * [C][Client] Reduce number of unnecessary strlen() calls
This commit is contained in:
parent
536519c0ec
commit
40d4703950
@ -108,9 +108,7 @@ end:
|
|||||||
apiClient->response_code = 0;
|
apiClient->response_code = 0;
|
||||||
|
|
||||||
// create the path
|
// create the path
|
||||||
long sizeOfPath = strlen("{{{path}}}")+1;
|
char *localVarPath = strdup("{{{path}}}");
|
||||||
char *localVarPath = malloc(sizeOfPath);
|
|
||||||
snprintf(localVarPath, sizeOfPath, "{{{path}}}");
|
|
||||||
|
|
||||||
{{#pathParams}}
|
{{#pathParams}}
|
||||||
{{#isString}}
|
{{#isString}}
|
||||||
@ -126,7 +124,7 @@ end:
|
|||||||
{{#pathParams}}
|
{{#pathParams}}
|
||||||
|
|
||||||
// Path Params
|
// Path Params
|
||||||
long sizeOfPathParams_{{{paramName}}} = {{#pathParams}}{{#isLong}}sizeof({{paramName}})+3{{/isLong}}{{#isString}}strlen({{^isEnum}}{{paramName}}{{/isEnum}}{{#isEnum}}{{{operationId}}}_{{enumName}}_ToString({{paramName}}){{/isEnum}})+3{{/isString}}{{^-last}} + {{/-last}}{{/pathParams}} + strlen("{ {{baseName}} }");
|
long sizeOfPathParams_{{{paramName}}} = {{#pathParams}}{{#isLong}}sizeof({{paramName}})+3{{/isLong}}{{#isString}}strlen({{^isEnum}}{{paramName}}{{/isEnum}}{{#isEnum}}{{{operationId}}}_{{enumName}}_ToString({{paramName}}){{/isEnum}})+3{{/isString}}{{^-last}} + {{/-last}}{{/pathParams}} + sizeof("{ {{baseName}} }") - 1;
|
||||||
{{#isNumeric}}
|
{{#isNumeric}}
|
||||||
if({{paramName}} == 0){
|
if({{paramName}} == 0){
|
||||||
goto end;
|
goto end;
|
||||||
@ -254,7 +252,7 @@ end:
|
|||||||
valueQuery_{{{paramName}}} = {{#isString}}{{^isEnum}}strdup({{/isEnum}}{{/isString}}({{{paramName}}}){{#isString}}{{^isEnum}}){{/isEnum}}{{/isString}};
|
valueQuery_{{{paramName}}} = {{#isString}}{{^isEnum}}strdup({{/isEnum}}{{/isString}}({{{paramName}}}){{#isString}}{{^isEnum}}){{/isEnum}}{{/isString}};
|
||||||
{{/isBoolean}}
|
{{/isBoolean}}
|
||||||
{{/isInteger}}
|
{{/isInteger}}
|
||||||
keyPairQuery_{{paramName}} = keyValuePair_create(keyQuery_{{{paramName}}}, {{#isEnum}}(void *)strdup({{{operationId}}}_{{enumName}}_ToString(
|
keyPairQuery_{{paramName}} = keyValuePair_create(keyQuery_{{{paramName}}}, {{#isEnum}}strdup({{{operationId}}}_{{enumName}}_ToString(
|
||||||
{{/isEnum}}{{^isString}}{{^isInteger}}{{^isBoolean}}&{{/isBoolean}}{{/isInteger}}{{/isString}}valueQuery_{{{paramName}}}{{#isEnum}})){{/isEnum}});
|
{{/isEnum}}{{^isString}}{{^isInteger}}{{^isBoolean}}&{{/isBoolean}}{{/isInteger}}{{/isString}}valueQuery_{{{paramName}}}{{#isEnum}})){{/isEnum}});
|
||||||
list_addElement(localVarQueryParameters,keyPairQuery_{{paramName}});
|
list_addElement(localVarQueryParameters,keyPairQuery_{{paramName}});
|
||||||
{{/isArray}}
|
{{/isArray}}
|
||||||
|
@ -173,10 +173,11 @@ void sslConfig_free(sslConfig_t *sslConfig) {
|
|||||||
free(sslConfig);
|
free(sslConfig);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void replaceSpaceWithPlus(char *stringToProcess) {
|
static void replaceSpaceWithPlus(char *str) {
|
||||||
for(int i = 0; i < strlen(stringToProcess); i++) {
|
if (str) {
|
||||||
if(stringToProcess[i] == ' ') {
|
for (; *str; str++) {
|
||||||
stringToProcess[i] = '+';
|
if (*str == ' ')
|
||||||
|
*str = '+';
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -286,38 +287,26 @@ void apiClient_invoke(apiClient_t *apiClient,
|
|||||||
|
|
||||||
if(headerType != NULL) {
|
if(headerType != NULL) {
|
||||||
list_ForEach(listEntry, headerType) {
|
list_ForEach(listEntry, headerType) {
|
||||||
if(strstr((char *) listEntry->data,
|
if(strstr(listEntry->data, "xml") == NULL)
|
||||||
"xml") == NULL)
|
|
||||||
{
|
{
|
||||||
buffHeader = malloc(strlen(
|
buffHeader = malloc(sizeof("Accept: ") +
|
||||||
"Accept: ") +
|
strlen(listEntry->data));
|
||||||
strlen((char *)
|
sprintf(buffHeader, "Accept: %s",
|
||||||
listEntry->
|
|
||||||
data) + 1);
|
|
||||||
sprintf(buffHeader, "%s%s", "Accept: ",
|
|
||||||
(char *) listEntry->data);
|
(char *) listEntry->data);
|
||||||
headers = curl_slist_append(headers,
|
headers = curl_slist_append(headers, buffHeader);
|
||||||
buffHeader);
|
|
||||||
free(buffHeader);
|
free(buffHeader);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if(contentType != NULL) {
|
if(contentType != NULL) {
|
||||||
list_ForEach(listEntry, contentType) {
|
list_ForEach(listEntry, contentType) {
|
||||||
if(strstr((char *) listEntry->data,
|
if(strstr(listEntry->data, "xml") == NULL)
|
||||||
"xml") == NULL)
|
|
||||||
{
|
{
|
||||||
buffContent =
|
buffContent = malloc(sizeof("Content-Type: ") +
|
||||||
malloc(strlen(
|
strlen(listEntry->data));
|
||||||
"Content-Type: ") + strlen(
|
sprintf(buffContent, "Content-Type: %s",
|
||||||
(char *)
|
|
||||||
listEntry->data) +
|
|
||||||
1);
|
|
||||||
sprintf(buffContent, "%s%s",
|
|
||||||
"Content-Type: ",
|
|
||||||
(char *) listEntry->data);
|
(char *) listEntry->data);
|
||||||
headers = curl_slist_append(headers,
|
headers = curl_slist_append(headers, buffContent);
|
||||||
buffContent);
|
|
||||||
free(buffContent);
|
free(buffContent);
|
||||||
buffContent = NULL;
|
buffContent = NULL;
|
||||||
}
|
}
|
||||||
@ -594,8 +583,8 @@ void apiClient_invoke(apiClient_t *apiClient,
|
|||||||
|
|
||||||
size_t writeDataCallback(void *buffer, size_t size, size_t nmemb, void *userp) {
|
size_t writeDataCallback(void *buffer, size_t size, size_t nmemb, void *userp) {
|
||||||
size_t size_this_time = nmemb * size;
|
size_t size_this_time = nmemb * size;
|
||||||
apiClient_t *apiClient = (apiClient_t *)userp;
|
apiClient_t *apiClient = userp;
|
||||||
apiClient->dataReceived = (char *)realloc( apiClient->dataReceived, apiClient->dataReceivedLen + size_this_time + 1);
|
apiClient->dataReceived = realloc( apiClient->dataReceived, apiClient->dataReceivedLen + size_this_time + 1);
|
||||||
memcpy((char *)apiClient->dataReceived + apiClient->dataReceivedLen, buffer, size_this_time);
|
memcpy((char *)apiClient->dataReceived + apiClient->dataReceivedLen, buffer, size_this_time);
|
||||||
apiClient->dataReceivedLen += size_this_time;
|
apiClient->dataReceivedLen += size_this_time;
|
||||||
((char*)apiClient->dataReceived)[apiClient->dataReceivedLen] = '\0'; // the space size of (apiClient->dataReceived) = dataReceivedLen + 1
|
((char*)apiClient->dataReceived)[apiClient->dataReceivedLen] = '\0'; // the space size of (apiClient->dataReceived) = dataReceivedLen + 1
|
||||||
|
@ -20,7 +20,7 @@ void listEntry_free(listEntry_t *listEntry, void *additionalData) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void listEntry_printAsInt(listEntry_t *listEntry, void *additionalData) {
|
void listEntry_printAsInt(listEntry_t *listEntry, void *additionalData) {
|
||||||
printf("%i\n", *((int *) (listEntry->data)));
|
printf("%i\n", *(int *)listEntry->data);
|
||||||
}
|
}
|
||||||
|
|
||||||
list_t *list_createList() {
|
list_t *list_createList() {
|
||||||
@ -176,8 +176,8 @@ char* findStrInStrList(list_t *strList, const char *str)
|
|||||||
|
|
||||||
listEntry_t* listEntry = NULL;
|
listEntry_t* listEntry = NULL;
|
||||||
list_ForEach(listEntry, strList) {
|
list_ForEach(listEntry, strList) {
|
||||||
if (strstr((char*)listEntry->data, str) != NULL) {
|
if (strstr(listEntry->data, str) != NULL) {
|
||||||
return (char*)listEntry->data;
|
return listEntry->data;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -197,4 +197,4 @@ void clear_and_free_string_list(list_t *list)
|
|||||||
list_item = NULL;
|
list_item = NULL;
|
||||||
}
|
}
|
||||||
list_freeList(list);
|
list_freeList(list);
|
||||||
}
|
}
|
||||||
|
@ -402,7 +402,7 @@ void {{classname}}_free({{classname}}_t *{{classname}}) {
|
|||||||
{{#isMap}}
|
{{#isMap}}
|
||||||
if ({{{classname}}}->{{{name}}}) {
|
if ({{{classname}}}->{{{name}}}) {
|
||||||
list_ForEach(listEntry, {{classname}}->{{name}}) {
|
list_ForEach(listEntry, {{classname}}->{{name}}) {
|
||||||
keyValuePair_t *localKeyValue = (keyValuePair_t*) listEntry->data;
|
keyValuePair_t *localKeyValue = listEntry->data;
|
||||||
free (localKeyValue->key);
|
free (localKeyValue->key);
|
||||||
free (localKeyValue->value);
|
free (localKeyValue->value);
|
||||||
keyValuePair_free(localKeyValue);
|
keyValuePair_free(localKeyValue);
|
||||||
@ -570,7 +570,7 @@ cJSON *{{classname}}_convertToJSON({{classname}}_t *{{classname}}) {
|
|||||||
list_ForEach({{{name}}}ListEntry, {{{classname}}}->{{{name}}}) {
|
list_ForEach({{{name}}}ListEntry, {{{classname}}}->{{{name}}}) {
|
||||||
{{#items}}
|
{{#items}}
|
||||||
{{#isString}}
|
{{#isString}}
|
||||||
if(cJSON_AddStringToObject({{{name}}}, "", (char*){{{name}}}ListEntry->data) == NULL)
|
if(cJSON_AddStringToObject({{{name}}}, "", {{{name}}}ListEntry->data) == NULL)
|
||||||
{
|
{
|
||||||
goto fail;
|
goto fail;
|
||||||
}
|
}
|
||||||
@ -617,16 +617,16 @@ cJSON *{{classname}}_convertToJSON({{classname}}_t *{{classname}}) {
|
|||||||
listEntry_t *{{{name}}}ListEntry;
|
listEntry_t *{{{name}}}ListEntry;
|
||||||
if ({{{classname}}}->{{{name}}}) {
|
if ({{{classname}}}->{{{name}}}) {
|
||||||
list_ForEach({{{name}}}ListEntry, {{{classname}}}->{{{name}}}) {
|
list_ForEach({{{name}}}ListEntry, {{{classname}}}->{{{name}}}) {
|
||||||
keyValuePair_t *localKeyValue = (keyValuePair_t*){{{name}}}ListEntry->data;
|
keyValuePair_t *localKeyValue = {{{name}}}ListEntry->data;
|
||||||
{{#items}}
|
{{#items}}
|
||||||
{{#isString}}
|
{{#isString}}
|
||||||
if(cJSON_AddStringToObject(localMapObject, localKeyValue->key, (char*)localKeyValue->value) == NULL)
|
if(cJSON_AddStringToObject(localMapObject, localKeyValue->key, localKeyValue->value) == NULL)
|
||||||
{
|
{
|
||||||
goto fail;
|
goto fail;
|
||||||
}
|
}
|
||||||
{{/isString}}
|
{{/isString}}
|
||||||
{{#isByteArray}}
|
{{#isByteArray}}
|
||||||
if(cJSON_AddStringToObject(localMapObject, localKeyValue->key, (char*)localKeyValue->value) == NULL)
|
if(cJSON_AddStringToObject(localMapObject, localKeyValue->key, localKeyValue->value) == NULL)
|
||||||
{
|
{
|
||||||
goto fail;
|
goto fail;
|
||||||
}
|
}
|
||||||
@ -848,7 +848,7 @@ fail:
|
|||||||
{
|
{
|
||||||
goto end;
|
goto end;
|
||||||
}
|
}
|
||||||
double *{{{name}}}_local_value = (double *)calloc(1, sizeof(double));
|
double *{{{name}}}_local_value = calloc(1, sizeof(double));
|
||||||
if(!{{{name}}}_local_value)
|
if(!{{{name}}}_local_value)
|
||||||
{
|
{
|
||||||
goto end;
|
goto end;
|
||||||
@ -1088,7 +1088,7 @@ end:
|
|||||||
if ({{{name}}}List) {
|
if ({{{name}}}List) {
|
||||||
listEntry_t *listEntry = NULL;
|
listEntry_t *listEntry = NULL;
|
||||||
list_ForEach(listEntry, {{{name}}}List) {
|
list_ForEach(listEntry, {{{name}}}List) {
|
||||||
keyValuePair_t *localKeyValue = (keyValuePair_t*) listEntry->data;
|
keyValuePair_t *localKeyValue = listEntry->data;
|
||||||
free(localKeyValue->key);
|
free(localKeyValue->key);
|
||||||
localKeyValue->key = NULL;
|
localKeyValue->key = NULL;
|
||||||
{{#items}}
|
{{#items}}
|
||||||
|
@ -26,9 +26,7 @@ DefaultAPI_privateGet(apiClient_t *apiClient)
|
|||||||
apiClient->response_code = 0;
|
apiClient->response_code = 0;
|
||||||
|
|
||||||
// create the path
|
// create the path
|
||||||
long sizeOfPath = strlen("/private")+1;
|
char *localVarPath = strdup("/private");
|
||||||
char *localVarPath = malloc(sizeOfPath);
|
|
||||||
snprintf(localVarPath, sizeOfPath, "/private");
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@ -98,9 +96,7 @@ DefaultAPI_publicGet(apiClient_t *apiClient)
|
|||||||
apiClient->response_code = 0;
|
apiClient->response_code = 0;
|
||||||
|
|
||||||
// create the path
|
// create the path
|
||||||
long sizeOfPath = strlen("/public")+1;
|
char *localVarPath = strdup("/public");
|
||||||
char *localVarPath = malloc(sizeOfPath);
|
|
||||||
snprintf(localVarPath, sizeOfPath, "/public");
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@ -170,9 +166,7 @@ DefaultAPI_usersGet(apiClient_t *apiClient)
|
|||||||
apiClient->response_code = 0;
|
apiClient->response_code = 0;
|
||||||
|
|
||||||
// create the path
|
// create the path
|
||||||
long sizeOfPath = strlen("/users")+1;
|
char *localVarPath = strdup("/users");
|
||||||
char *localVarPath = malloc(sizeOfPath);
|
|
||||||
snprintf(localVarPath, sizeOfPath, "/users");
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@ -89,10 +89,11 @@ void sslConfig_free(sslConfig_t *sslConfig) {
|
|||||||
free(sslConfig);
|
free(sslConfig);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void replaceSpaceWithPlus(char *stringToProcess) {
|
static void replaceSpaceWithPlus(char *str) {
|
||||||
for(int i = 0; i < strlen(stringToProcess); i++) {
|
if (str) {
|
||||||
if(stringToProcess[i] == ' ') {
|
for (; *str; str++) {
|
||||||
stringToProcess[i] = '+';
|
if (*str == ' ')
|
||||||
|
*str = '+';
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -202,38 +203,26 @@ void apiClient_invoke(apiClient_t *apiClient,
|
|||||||
|
|
||||||
if(headerType != NULL) {
|
if(headerType != NULL) {
|
||||||
list_ForEach(listEntry, headerType) {
|
list_ForEach(listEntry, headerType) {
|
||||||
if(strstr((char *) listEntry->data,
|
if(strstr(listEntry->data, "xml") == NULL)
|
||||||
"xml") == NULL)
|
|
||||||
{
|
{
|
||||||
buffHeader = malloc(strlen(
|
buffHeader = malloc(sizeof("Accept: ") +
|
||||||
"Accept: ") +
|
strlen(listEntry->data));
|
||||||
strlen((char *)
|
sprintf(buffHeader, "Accept: %s",
|
||||||
listEntry->
|
|
||||||
data) + 1);
|
|
||||||
sprintf(buffHeader, "%s%s", "Accept: ",
|
|
||||||
(char *) listEntry->data);
|
(char *) listEntry->data);
|
||||||
headers = curl_slist_append(headers,
|
headers = curl_slist_append(headers, buffHeader);
|
||||||
buffHeader);
|
|
||||||
free(buffHeader);
|
free(buffHeader);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if(contentType != NULL) {
|
if(contentType != NULL) {
|
||||||
list_ForEach(listEntry, contentType) {
|
list_ForEach(listEntry, contentType) {
|
||||||
if(strstr((char *) listEntry->data,
|
if(strstr(listEntry->data, "xml") == NULL)
|
||||||
"xml") == NULL)
|
|
||||||
{
|
{
|
||||||
buffContent =
|
buffContent = malloc(sizeof("Content-Type: ") +
|
||||||
malloc(strlen(
|
strlen(listEntry->data));
|
||||||
"Content-Type: ") + strlen(
|
sprintf(buffContent, "Content-Type: %s",
|
||||||
(char *)
|
|
||||||
listEntry->data) +
|
|
||||||
1);
|
|
||||||
sprintf(buffContent, "%s%s",
|
|
||||||
"Content-Type: ",
|
|
||||||
(char *) listEntry->data);
|
(char *) listEntry->data);
|
||||||
headers = curl_slist_append(headers,
|
headers = curl_slist_append(headers, buffContent);
|
||||||
buffContent);
|
|
||||||
free(buffContent);
|
free(buffContent);
|
||||||
buffContent = NULL;
|
buffContent = NULL;
|
||||||
}
|
}
|
||||||
@ -438,8 +427,8 @@ void apiClient_invoke(apiClient_t *apiClient,
|
|||||||
|
|
||||||
size_t writeDataCallback(void *buffer, size_t size, size_t nmemb, void *userp) {
|
size_t writeDataCallback(void *buffer, size_t size, size_t nmemb, void *userp) {
|
||||||
size_t size_this_time = nmemb * size;
|
size_t size_this_time = nmemb * size;
|
||||||
apiClient_t *apiClient = (apiClient_t *)userp;
|
apiClient_t *apiClient = userp;
|
||||||
apiClient->dataReceived = (char *)realloc( apiClient->dataReceived, apiClient->dataReceivedLen + size_this_time + 1);
|
apiClient->dataReceived = realloc( apiClient->dataReceived, apiClient->dataReceivedLen + size_this_time + 1);
|
||||||
memcpy((char *)apiClient->dataReceived + apiClient->dataReceivedLen, buffer, size_this_time);
|
memcpy((char *)apiClient->dataReceived + apiClient->dataReceivedLen, buffer, size_this_time);
|
||||||
apiClient->dataReceivedLen += size_this_time;
|
apiClient->dataReceivedLen += size_this_time;
|
||||||
((char*)apiClient->dataReceived)[apiClient->dataReceivedLen] = '\0'; // the space size of (apiClient->dataReceived) = dataReceivedLen + 1
|
((char*)apiClient->dataReceived)[apiClient->dataReceivedLen] = '\0'; // the space size of (apiClient->dataReceived) = dataReceivedLen + 1
|
||||||
|
@ -20,7 +20,7 @@ void listEntry_free(listEntry_t *listEntry, void *additionalData) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void listEntry_printAsInt(listEntry_t *listEntry, void *additionalData) {
|
void listEntry_printAsInt(listEntry_t *listEntry, void *additionalData) {
|
||||||
printf("%i\n", *((int *) (listEntry->data)));
|
printf("%i\n", *(int *)listEntry->data);
|
||||||
}
|
}
|
||||||
|
|
||||||
list_t *list_createList() {
|
list_t *list_createList() {
|
||||||
@ -176,8 +176,8 @@ char* findStrInStrList(list_t *strList, const char *str)
|
|||||||
|
|
||||||
listEntry_t* listEntry = NULL;
|
listEntry_t* listEntry = NULL;
|
||||||
list_ForEach(listEntry, strList) {
|
list_ForEach(listEntry, strList) {
|
||||||
if (strstr((char*)listEntry->data, str) != NULL) {
|
if (strstr(listEntry->data, str) != NULL) {
|
||||||
return (char*)listEntry->data;
|
return listEntry->data;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -197,4 +197,4 @@ void clear_and_free_string_list(list_t *list)
|
|||||||
list_item = NULL;
|
list_item = NULL;
|
||||||
}
|
}
|
||||||
list_freeList(list);
|
list_freeList(list);
|
||||||
}
|
}
|
||||||
|
@ -67,9 +67,7 @@ PetAPI_addPet(apiClient_t *apiClient, pet_t *body)
|
|||||||
apiClient->response_code = 0;
|
apiClient->response_code = 0;
|
||||||
|
|
||||||
// create the path
|
// create the path
|
||||||
long sizeOfPath = strlen("/pet")+1;
|
char *localVarPath = strdup("/pet");
|
||||||
char *localVarPath = malloc(sizeOfPath);
|
|
||||||
snprintf(localVarPath, sizeOfPath, "/pet");
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@ -139,14 +137,12 @@ PetAPI_deletePet(apiClient_t *apiClient, long petId, char *api_key)
|
|||||||
apiClient->response_code = 0;
|
apiClient->response_code = 0;
|
||||||
|
|
||||||
// create the path
|
// create the path
|
||||||
long sizeOfPath = strlen("/pet/{petId}")+1;
|
char *localVarPath = strdup("/pet/{petId}");
|
||||||
char *localVarPath = malloc(sizeOfPath);
|
|
||||||
snprintf(localVarPath, sizeOfPath, "/pet/{petId}");
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
// Path Params
|
// Path Params
|
||||||
long sizeOfPathParams_petId = sizeof(petId)+3 + strlen("{ petId }");
|
long sizeOfPathParams_petId = sizeof(petId)+3 + sizeof("{ petId }") - 1;
|
||||||
if(petId == 0){
|
if(petId == 0){
|
||||||
goto end;
|
goto end;
|
||||||
}
|
}
|
||||||
@ -232,9 +228,7 @@ PetAPI_findPetsByStatus(apiClient_t *apiClient, list_t *status)
|
|||||||
apiClient->response_code = 0;
|
apiClient->response_code = 0;
|
||||||
|
|
||||||
// create the path
|
// create the path
|
||||||
long sizeOfPath = strlen("/pet/findByStatus")+1;
|
char *localVarPath = strdup("/pet/findByStatus");
|
||||||
char *localVarPath = malloc(sizeOfPath);
|
|
||||||
snprintf(localVarPath, sizeOfPath, "/pet/findByStatus");
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@ -325,9 +319,7 @@ PetAPI_findPetsByTags(apiClient_t *apiClient, list_t *tags)
|
|||||||
apiClient->response_code = 0;
|
apiClient->response_code = 0;
|
||||||
|
|
||||||
// create the path
|
// create the path
|
||||||
long sizeOfPath = strlen("/pet/findByTags")+1;
|
char *localVarPath = strdup("/pet/findByTags");
|
||||||
char *localVarPath = malloc(sizeOfPath);
|
|
||||||
snprintf(localVarPath, sizeOfPath, "/pet/findByTags");
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@ -416,9 +408,7 @@ PetAPI_getDaysWithoutIncident(apiClient_t *apiClient)
|
|||||||
apiClient->response_code = 0;
|
apiClient->response_code = 0;
|
||||||
|
|
||||||
// create the path
|
// create the path
|
||||||
long sizeOfPath = strlen("/store/daysWithoutIncident")+1;
|
char *localVarPath = strdup("/store/daysWithoutIncident");
|
||||||
char *localVarPath = malloc(sizeOfPath);
|
|
||||||
snprintf(localVarPath, sizeOfPath, "/store/daysWithoutIncident");
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@ -481,14 +471,12 @@ PetAPI_getPetById(apiClient_t *apiClient, long petId)
|
|||||||
apiClient->response_code = 0;
|
apiClient->response_code = 0;
|
||||||
|
|
||||||
// create the path
|
// create the path
|
||||||
long sizeOfPath = strlen("/pet/{petId}")+1;
|
char *localVarPath = strdup("/pet/{petId}");
|
||||||
char *localVarPath = malloc(sizeOfPath);
|
|
||||||
snprintf(localVarPath, sizeOfPath, "/pet/{petId}");
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
// Path Params
|
// Path Params
|
||||||
long sizeOfPathParams_petId = sizeof(petId)+3 + strlen("{ petId }");
|
long sizeOfPathParams_petId = sizeof(petId)+3 + sizeof("{ petId }") - 1;
|
||||||
if(petId == 0){
|
if(petId == 0){
|
||||||
goto end;
|
goto end;
|
||||||
}
|
}
|
||||||
@ -575,9 +563,7 @@ PetAPI_getPicture(apiClient_t *apiClient)
|
|||||||
apiClient->response_code = 0;
|
apiClient->response_code = 0;
|
||||||
|
|
||||||
// create the path
|
// create the path
|
||||||
long sizeOfPath = strlen("/pet/picture")+1;
|
char *localVarPath = strdup("/pet/picture");
|
||||||
char *localVarPath = malloc(sizeOfPath);
|
|
||||||
snprintf(localVarPath, sizeOfPath, "/pet/picture");
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@ -638,14 +624,12 @@ PetAPI_isPetAvailable(apiClient_t *apiClient, long petId)
|
|||||||
apiClient->response_code = 0;
|
apiClient->response_code = 0;
|
||||||
|
|
||||||
// create the path
|
// create the path
|
||||||
long sizeOfPath = strlen("/pet/{petId}/isAvailable")+1;
|
char *localVarPath = strdup("/pet/{petId}/isAvailable");
|
||||||
char *localVarPath = malloc(sizeOfPath);
|
|
||||||
snprintf(localVarPath, sizeOfPath, "/pet/{petId}/isAvailable");
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
// Path Params
|
// Path Params
|
||||||
long sizeOfPathParams_petId = sizeof(petId)+3 + strlen("{ petId }");
|
long sizeOfPathParams_petId = sizeof(petId)+3 + sizeof("{ petId }") - 1;
|
||||||
if(petId == 0){
|
if(petId == 0){
|
||||||
goto end;
|
goto end;
|
||||||
}
|
}
|
||||||
@ -723,9 +707,7 @@ PetAPI_sharePicture(apiClient_t *apiClient, binary_t* picture)
|
|||||||
apiClient->response_code = 0;
|
apiClient->response_code = 0;
|
||||||
|
|
||||||
// create the path
|
// create the path
|
||||||
long sizeOfPath = strlen("/pet/picture")+1;
|
char *localVarPath = strdup("/pet/picture");
|
||||||
char *localVarPath = malloc(sizeOfPath);
|
|
||||||
snprintf(localVarPath, sizeOfPath, "/pet/picture");
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@ -794,9 +776,7 @@ PetAPI_specialtyPet(apiClient_t *apiClient)
|
|||||||
apiClient->response_code = 0;
|
apiClient->response_code = 0;
|
||||||
|
|
||||||
// create the path
|
// create the path
|
||||||
long sizeOfPath = strlen("/pet/specialty")+1;
|
char *localVarPath = strdup("/pet/specialty");
|
||||||
char *localVarPath = malloc(sizeOfPath);
|
|
||||||
snprintf(localVarPath, sizeOfPath, "/pet/specialty");
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@ -865,9 +845,7 @@ PetAPI_updatePet(apiClient_t *apiClient, pet_t *body)
|
|||||||
apiClient->response_code = 0;
|
apiClient->response_code = 0;
|
||||||
|
|
||||||
// create the path
|
// create the path
|
||||||
long sizeOfPath = strlen("/pet")+1;
|
char *localVarPath = strdup("/pet");
|
||||||
char *localVarPath = malloc(sizeOfPath);
|
|
||||||
snprintf(localVarPath, sizeOfPath, "/pet");
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@ -945,14 +923,12 @@ PetAPI_updatePetWithForm(apiClient_t *apiClient, long petId, char *name, char *s
|
|||||||
apiClient->response_code = 0;
|
apiClient->response_code = 0;
|
||||||
|
|
||||||
// create the path
|
// create the path
|
||||||
long sizeOfPath = strlen("/pet/{petId}")+1;
|
char *localVarPath = strdup("/pet/{petId}");
|
||||||
char *localVarPath = malloc(sizeOfPath);
|
|
||||||
snprintf(localVarPath, sizeOfPath, "/pet/{petId}");
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
// Path Params
|
// Path Params
|
||||||
long sizeOfPathParams_petId = sizeof(petId)+3 + strlen("{ petId }");
|
long sizeOfPathParams_petId = sizeof(petId)+3 + sizeof("{ petId }") - 1;
|
||||||
if(petId == 0){
|
if(petId == 0){
|
||||||
goto end;
|
goto end;
|
||||||
}
|
}
|
||||||
@ -1058,14 +1034,12 @@ PetAPI_uploadFile(apiClient_t *apiClient, long petId, char *additionalMetadata,
|
|||||||
apiClient->response_code = 0;
|
apiClient->response_code = 0;
|
||||||
|
|
||||||
// create the path
|
// create the path
|
||||||
long sizeOfPath = strlen("/pet/{petId}/uploadImage")+1;
|
char *localVarPath = strdup("/pet/{petId}/uploadImage");
|
||||||
char *localVarPath = malloc(sizeOfPath);
|
|
||||||
snprintf(localVarPath, sizeOfPath, "/pet/{petId}/uploadImage");
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
// Path Params
|
// Path Params
|
||||||
long sizeOfPathParams_petId = sizeof(petId)+3 + strlen("{ petId }");
|
long sizeOfPathParams_petId = sizeof(petId)+3 + sizeof("{ petId }") - 1;
|
||||||
if(petId == 0){
|
if(petId == 0){
|
||||||
goto end;
|
goto end;
|
||||||
}
|
}
|
||||||
|
@ -78,16 +78,14 @@ StoreAPI_deleteOrder(apiClient_t *apiClient, char *orderId)
|
|||||||
apiClient->response_code = 0;
|
apiClient->response_code = 0;
|
||||||
|
|
||||||
// create the path
|
// create the path
|
||||||
long sizeOfPath = strlen("/store/order/{orderId}")+1;
|
char *localVarPath = strdup("/store/order/{orderId}");
|
||||||
char *localVarPath = malloc(sizeOfPath);
|
|
||||||
snprintf(localVarPath, sizeOfPath, "/store/order/{orderId}");
|
|
||||||
|
|
||||||
if(!orderId)
|
if(!orderId)
|
||||||
goto end;
|
goto end;
|
||||||
|
|
||||||
|
|
||||||
// Path Params
|
// Path Params
|
||||||
long sizeOfPathParams_orderId = strlen(orderId)+3 + strlen("{ orderId }");
|
long sizeOfPathParams_orderId = strlen(orderId)+3 + sizeof("{ orderId }") - 1;
|
||||||
if(orderId == NULL) {
|
if(orderId == NULL) {
|
||||||
goto end;
|
goto end;
|
||||||
}
|
}
|
||||||
@ -152,9 +150,7 @@ StoreAPI_getInventory(apiClient_t *apiClient)
|
|||||||
apiClient->response_code = 0;
|
apiClient->response_code = 0;
|
||||||
|
|
||||||
// create the path
|
// create the path
|
||||||
long sizeOfPath = strlen("/store/inventory")+1;
|
char *localVarPath = strdup("/store/inventory");
|
||||||
char *localVarPath = malloc(sizeOfPath);
|
|
||||||
snprintf(localVarPath, sizeOfPath, "/store/inventory");
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@ -225,14 +221,12 @@ StoreAPI_getOrderById(apiClient_t *apiClient, long orderId)
|
|||||||
apiClient->response_code = 0;
|
apiClient->response_code = 0;
|
||||||
|
|
||||||
// create the path
|
// create the path
|
||||||
long sizeOfPath = strlen("/store/order/{orderId}")+1;
|
char *localVarPath = strdup("/store/order/{orderId}");
|
||||||
char *localVarPath = malloc(sizeOfPath);
|
|
||||||
snprintf(localVarPath, sizeOfPath, "/store/order/{orderId}");
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
// Path Params
|
// Path Params
|
||||||
long sizeOfPathParams_orderId = sizeof(orderId)+3 + strlen("{ orderId }");
|
long sizeOfPathParams_orderId = sizeof(orderId)+3 + sizeof("{ orderId }") - 1;
|
||||||
if(orderId == 0){
|
if(orderId == 0){
|
||||||
goto end;
|
goto end;
|
||||||
}
|
}
|
||||||
@ -319,9 +313,7 @@ StoreAPI_placeOrder(apiClient_t *apiClient, order_t *body)
|
|||||||
apiClient->response_code = 0;
|
apiClient->response_code = 0;
|
||||||
|
|
||||||
// create the path
|
// create the path
|
||||||
long sizeOfPath = strlen("/store/order")+1;
|
char *localVarPath = strdup("/store/order");
|
||||||
char *localVarPath = malloc(sizeOfPath);
|
|
||||||
snprintf(localVarPath, sizeOfPath, "/store/order");
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@ -409,9 +401,7 @@ StoreAPI_sendFeedback(apiClient_t *apiClient, char *feedback)
|
|||||||
apiClient->response_code = 0;
|
apiClient->response_code = 0;
|
||||||
|
|
||||||
// create the path
|
// create the path
|
||||||
long sizeOfPath = strlen("/store/feedback")+1;
|
char *localVarPath = strdup("/store/feedback");
|
||||||
char *localVarPath = malloc(sizeOfPath);
|
|
||||||
snprintf(localVarPath, sizeOfPath, "/store/feedback");
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@ -477,16 +467,14 @@ StoreAPI_sendRating(apiClient_t *apiClient, openapi_petstore_sendRating_rating_e
|
|||||||
apiClient->response_code = 0;
|
apiClient->response_code = 0;
|
||||||
|
|
||||||
// create the path
|
// create the path
|
||||||
long sizeOfPath = strlen("/store/rating/{rating}")+1;
|
char *localVarPath = strdup("/store/rating/{rating}");
|
||||||
char *localVarPath = malloc(sizeOfPath);
|
|
||||||
snprintf(localVarPath, sizeOfPath, "/store/rating/{rating}");
|
|
||||||
|
|
||||||
if(!rating)
|
if(!rating)
|
||||||
goto end;
|
goto end;
|
||||||
|
|
||||||
|
|
||||||
// Path Params
|
// Path Params
|
||||||
long sizeOfPathParams_rating = strlen(sendRating_RATING_ToString(rating))+3 + strlen("{ rating }");
|
long sizeOfPathParams_rating = strlen(sendRating_RATING_ToString(rating))+3 + sizeof("{ rating }") - 1;
|
||||||
if(rating == 0) {
|
if(rating == 0) {
|
||||||
goto end;
|
goto end;
|
||||||
}
|
}
|
||||||
@ -553,9 +541,7 @@ StoreAPI_sendRecommend(apiClient_t *apiClient, int *recommend)
|
|||||||
apiClient->response_code = 0;
|
apiClient->response_code = 0;
|
||||||
|
|
||||||
// create the path
|
// create the path
|
||||||
long sizeOfPath = strlen("/store/recommend")+1;
|
char *localVarPath = strdup("/store/recommend");
|
||||||
char *localVarPath = malloc(sizeOfPath);
|
|
||||||
snprintf(localVarPath, sizeOfPath, "/store/recommend");
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@ -26,9 +26,7 @@ UserAPI_createUser(apiClient_t *apiClient, user_t *body)
|
|||||||
apiClient->response_code = 0;
|
apiClient->response_code = 0;
|
||||||
|
|
||||||
// create the path
|
// create the path
|
||||||
long sizeOfPath = strlen("/user")+1;
|
char *localVarPath = strdup("/user");
|
||||||
char *localVarPath = malloc(sizeOfPath);
|
|
||||||
snprintf(localVarPath, sizeOfPath, "/user");
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@ -96,9 +94,7 @@ UserAPI_createUsersWithArrayInput(apiClient_t *apiClient, list_t *body)
|
|||||||
apiClient->response_code = 0;
|
apiClient->response_code = 0;
|
||||||
|
|
||||||
// create the path
|
// create the path
|
||||||
long sizeOfPath = strlen("/user/createWithArray")+1;
|
char *localVarPath = strdup("/user/createWithArray");
|
||||||
char *localVarPath = malloc(sizeOfPath);
|
|
||||||
snprintf(localVarPath, sizeOfPath, "/user/createWithArray");
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@ -194,9 +190,7 @@ UserAPI_createUsersWithListInput(apiClient_t *apiClient, list_t *body)
|
|||||||
apiClient->response_code = 0;
|
apiClient->response_code = 0;
|
||||||
|
|
||||||
// create the path
|
// create the path
|
||||||
long sizeOfPath = strlen("/user/createWithList")+1;
|
char *localVarPath = strdup("/user/createWithList");
|
||||||
char *localVarPath = malloc(sizeOfPath);
|
|
||||||
snprintf(localVarPath, sizeOfPath, "/user/createWithList");
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@ -294,16 +288,14 @@ UserAPI_deleteUser(apiClient_t *apiClient, char *username)
|
|||||||
apiClient->response_code = 0;
|
apiClient->response_code = 0;
|
||||||
|
|
||||||
// create the path
|
// create the path
|
||||||
long sizeOfPath = strlen("/user/{username}")+1;
|
char *localVarPath = strdup("/user/{username}");
|
||||||
char *localVarPath = malloc(sizeOfPath);
|
|
||||||
snprintf(localVarPath, sizeOfPath, "/user/{username}");
|
|
||||||
|
|
||||||
if(!username)
|
if(!username)
|
||||||
goto end;
|
goto end;
|
||||||
|
|
||||||
|
|
||||||
// Path Params
|
// Path Params
|
||||||
long sizeOfPathParams_username = strlen(username)+3 + strlen("{ username }");
|
long sizeOfPathParams_username = strlen(username)+3 + sizeof("{ username }") - 1;
|
||||||
if(username == NULL) {
|
if(username == NULL) {
|
||||||
goto end;
|
goto end;
|
||||||
}
|
}
|
||||||
@ -366,16 +358,14 @@ UserAPI_getUserByName(apiClient_t *apiClient, char *username)
|
|||||||
apiClient->response_code = 0;
|
apiClient->response_code = 0;
|
||||||
|
|
||||||
// create the path
|
// create the path
|
||||||
long sizeOfPath = strlen("/user/{username}")+1;
|
char *localVarPath = strdup("/user/{username}");
|
||||||
char *localVarPath = malloc(sizeOfPath);
|
|
||||||
snprintf(localVarPath, sizeOfPath, "/user/{username}");
|
|
||||||
|
|
||||||
if(!username)
|
if(!username)
|
||||||
goto end;
|
goto end;
|
||||||
|
|
||||||
|
|
||||||
// Path Params
|
// Path Params
|
||||||
long sizeOfPathParams_username = strlen(username)+3 + strlen("{ username }");
|
long sizeOfPathParams_username = strlen(username)+3 + sizeof("{ username }") - 1;
|
||||||
if(username == NULL) {
|
if(username == NULL) {
|
||||||
goto end;
|
goto end;
|
||||||
}
|
}
|
||||||
@ -458,9 +448,7 @@ UserAPI_loginUser(apiClient_t *apiClient, char *username, char *password)
|
|||||||
apiClient->response_code = 0;
|
apiClient->response_code = 0;
|
||||||
|
|
||||||
// create the path
|
// create the path
|
||||||
long sizeOfPath = strlen("/user/login")+1;
|
char *localVarPath = strdup("/user/login");
|
||||||
char *localVarPath = malloc(sizeOfPath);
|
|
||||||
snprintf(localVarPath, sizeOfPath, "/user/login");
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@ -574,9 +562,7 @@ UserAPI_logoutUser(apiClient_t *apiClient)
|
|||||||
apiClient->response_code = 0;
|
apiClient->response_code = 0;
|
||||||
|
|
||||||
// create the path
|
// create the path
|
||||||
long sizeOfPath = strlen("/user/logout")+1;
|
char *localVarPath = strdup("/user/logout");
|
||||||
char *localVarPath = malloc(sizeOfPath);
|
|
||||||
snprintf(localVarPath, sizeOfPath, "/user/logout");
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@ -631,9 +617,7 @@ UserAPI_testIntAndBool(apiClient_t *apiClient, int *keep, int *keepDay)
|
|||||||
apiClient->response_code = 0;
|
apiClient->response_code = 0;
|
||||||
|
|
||||||
// create the path
|
// create the path
|
||||||
long sizeOfPath = strlen("/user/testIntAndBool")+1;
|
char *localVarPath = strdup("/user/testIntAndBool");
|
||||||
char *localVarPath = malloc(sizeOfPath);
|
|
||||||
snprintf(localVarPath, sizeOfPath, "/user/testIntAndBool");
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@ -714,16 +698,14 @@ UserAPI_updateUser(apiClient_t *apiClient, char *username, user_t *body)
|
|||||||
apiClient->response_code = 0;
|
apiClient->response_code = 0;
|
||||||
|
|
||||||
// create the path
|
// create the path
|
||||||
long sizeOfPath = strlen("/user/{username}")+1;
|
char *localVarPath = strdup("/user/{username}");
|
||||||
char *localVarPath = malloc(sizeOfPath);
|
|
||||||
snprintf(localVarPath, sizeOfPath, "/user/{username}");
|
|
||||||
|
|
||||||
if(!username)
|
if(!username)
|
||||||
goto end;
|
goto end;
|
||||||
|
|
||||||
|
|
||||||
// Path Params
|
// Path Params
|
||||||
long sizeOfPathParams_username = strlen(username)+3 + strlen("{ username }");
|
long sizeOfPathParams_username = strlen(username)+3 + sizeof("{ username }") - 1;
|
||||||
if(username == NULL) {
|
if(username == NULL) {
|
||||||
goto end;
|
goto end;
|
||||||
}
|
}
|
||||||
|
@ -88,7 +88,7 @@ cJSON *model_with_set_propertes_convertToJSON(model_with_set_propertes_t *model_
|
|||||||
|
|
||||||
listEntry_t *string_setListEntry;
|
listEntry_t *string_setListEntry;
|
||||||
list_ForEach(string_setListEntry, model_with_set_propertes->string_set) {
|
list_ForEach(string_setListEntry, model_with_set_propertes->string_set) {
|
||||||
if(cJSON_AddStringToObject(string_set, "", (char*)string_setListEntry->data) == NULL)
|
if(cJSON_AddStringToObject(string_set, "", string_setListEntry->data) == NULL)
|
||||||
{
|
{
|
||||||
goto fail;
|
goto fail;
|
||||||
}
|
}
|
||||||
|
@ -141,7 +141,7 @@ cJSON *pet_convertToJSON(pet_t *pet) {
|
|||||||
|
|
||||||
listEntry_t *photo_urlsListEntry;
|
listEntry_t *photo_urlsListEntry;
|
||||||
list_ForEach(photo_urlsListEntry, pet->photo_urls) {
|
list_ForEach(photo_urlsListEntry, pet->photo_urls) {
|
||||||
if(cJSON_AddStringToObject(photo_urls, "", (char*)photo_urlsListEntry->data) == NULL)
|
if(cJSON_AddStringToObject(photo_urls, "", photo_urlsListEntry->data) == NULL)
|
||||||
{
|
{
|
||||||
goto fail;
|
goto fail;
|
||||||
}
|
}
|
||||||
|
@ -97,7 +97,7 @@ void user_free(user_t *user) {
|
|||||||
}
|
}
|
||||||
if (user->extra) {
|
if (user->extra) {
|
||||||
list_ForEach(listEntry, user->extra) {
|
list_ForEach(listEntry, user->extra) {
|
||||||
keyValuePair_t *localKeyValue = (keyValuePair_t*) listEntry->data;
|
keyValuePair_t *localKeyValue = listEntry->data;
|
||||||
free (localKeyValue->key);
|
free (localKeyValue->key);
|
||||||
free (localKeyValue->value);
|
free (localKeyValue->value);
|
||||||
keyValuePair_free(localKeyValue);
|
keyValuePair_free(localKeyValue);
|
||||||
@ -185,7 +185,7 @@ cJSON *user_convertToJSON(user_t *user) {
|
|||||||
listEntry_t *extraListEntry;
|
listEntry_t *extraListEntry;
|
||||||
if (user->extra) {
|
if (user->extra) {
|
||||||
list_ForEach(extraListEntry, user->extra) {
|
list_ForEach(extraListEntry, user->extra) {
|
||||||
keyValuePair_t *localKeyValue = (keyValuePair_t*)extraListEntry->data;
|
keyValuePair_t *localKeyValue = extraListEntry->data;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -368,7 +368,7 @@ end:
|
|||||||
if (extraList) {
|
if (extraList) {
|
||||||
listEntry_t *listEntry = NULL;
|
listEntry_t *listEntry = NULL;
|
||||||
list_ForEach(listEntry, extraList) {
|
list_ForEach(listEntry, extraList) {
|
||||||
keyValuePair_t *localKeyValue = (keyValuePair_t*) listEntry->data;
|
keyValuePair_t *localKeyValue = listEntry->data;
|
||||||
free(localKeyValue->key);
|
free(localKeyValue->key);
|
||||||
localKeyValue->key = NULL;
|
localKeyValue->key = NULL;
|
||||||
keyValuePair_free(localKeyValue);
|
keyValuePair_free(localKeyValue);
|
||||||
|
@ -116,10 +116,11 @@ void sslConfig_free(sslConfig_t *sslConfig) {
|
|||||||
free(sslConfig);
|
free(sslConfig);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void replaceSpaceWithPlus(char *stringToProcess) {
|
static void replaceSpaceWithPlus(char *str) {
|
||||||
for(int i = 0; i < strlen(stringToProcess); i++) {
|
if (str) {
|
||||||
if(stringToProcess[i] == ' ') {
|
for (; *str; str++) {
|
||||||
stringToProcess[i] = '+';
|
if (*str == ' ')
|
||||||
|
*str = '+';
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -229,38 +230,26 @@ void apiClient_invoke(apiClient_t *apiClient,
|
|||||||
|
|
||||||
if(headerType != NULL) {
|
if(headerType != NULL) {
|
||||||
list_ForEach(listEntry, headerType) {
|
list_ForEach(listEntry, headerType) {
|
||||||
if(strstr((char *) listEntry->data,
|
if(strstr(listEntry->data, "xml") == NULL)
|
||||||
"xml") == NULL)
|
|
||||||
{
|
{
|
||||||
buffHeader = malloc(strlen(
|
buffHeader = malloc(sizeof("Accept: ") +
|
||||||
"Accept: ") +
|
strlen(listEntry->data));
|
||||||
strlen((char *)
|
sprintf(buffHeader, "Accept: %s",
|
||||||
listEntry->
|
|
||||||
data) + 1);
|
|
||||||
sprintf(buffHeader, "%s%s", "Accept: ",
|
|
||||||
(char *) listEntry->data);
|
(char *) listEntry->data);
|
||||||
headers = curl_slist_append(headers,
|
headers = curl_slist_append(headers, buffHeader);
|
||||||
buffHeader);
|
|
||||||
free(buffHeader);
|
free(buffHeader);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if(contentType != NULL) {
|
if(contentType != NULL) {
|
||||||
list_ForEach(listEntry, contentType) {
|
list_ForEach(listEntry, contentType) {
|
||||||
if(strstr((char *) listEntry->data,
|
if(strstr(listEntry->data, "xml") == NULL)
|
||||||
"xml") == NULL)
|
|
||||||
{
|
{
|
||||||
buffContent =
|
buffContent = malloc(sizeof("Content-Type: ") +
|
||||||
malloc(strlen(
|
strlen(listEntry->data));
|
||||||
"Content-Type: ") + strlen(
|
sprintf(buffContent, "Content-Type: %s",
|
||||||
(char *)
|
|
||||||
listEntry->data) +
|
|
||||||
1);
|
|
||||||
sprintf(buffContent, "%s%s",
|
|
||||||
"Content-Type: ",
|
|
||||||
(char *) listEntry->data);
|
(char *) listEntry->data);
|
||||||
headers = curl_slist_append(headers,
|
headers = curl_slist_append(headers, buffContent);
|
||||||
buffContent);
|
|
||||||
free(buffContent);
|
free(buffContent);
|
||||||
buffContent = NULL;
|
buffContent = NULL;
|
||||||
}
|
}
|
||||||
@ -475,8 +464,8 @@ void apiClient_invoke(apiClient_t *apiClient,
|
|||||||
|
|
||||||
size_t writeDataCallback(void *buffer, size_t size, size_t nmemb, void *userp) {
|
size_t writeDataCallback(void *buffer, size_t size, size_t nmemb, void *userp) {
|
||||||
size_t size_this_time = nmemb * size;
|
size_t size_this_time = nmemb * size;
|
||||||
apiClient_t *apiClient = (apiClient_t *)userp;
|
apiClient_t *apiClient = userp;
|
||||||
apiClient->dataReceived = (char *)realloc( apiClient->dataReceived, apiClient->dataReceivedLen + size_this_time + 1);
|
apiClient->dataReceived = realloc( apiClient->dataReceived, apiClient->dataReceivedLen + size_this_time + 1);
|
||||||
memcpy((char *)apiClient->dataReceived + apiClient->dataReceivedLen, buffer, size_this_time);
|
memcpy((char *)apiClient->dataReceived + apiClient->dataReceivedLen, buffer, size_this_time);
|
||||||
apiClient->dataReceivedLen += size_this_time;
|
apiClient->dataReceivedLen += size_this_time;
|
||||||
((char*)apiClient->dataReceived)[apiClient->dataReceivedLen] = '\0'; // the space size of (apiClient->dataReceived) = dataReceivedLen + 1
|
((char*)apiClient->dataReceived)[apiClient->dataReceivedLen] = '\0'; // the space size of (apiClient->dataReceived) = dataReceivedLen + 1
|
||||||
|
@ -20,7 +20,7 @@ void listEntry_free(listEntry_t *listEntry, void *additionalData) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void listEntry_printAsInt(listEntry_t *listEntry, void *additionalData) {
|
void listEntry_printAsInt(listEntry_t *listEntry, void *additionalData) {
|
||||||
printf("%i\n", *((int *) (listEntry->data)));
|
printf("%i\n", *(int *)listEntry->data);
|
||||||
}
|
}
|
||||||
|
|
||||||
list_t *list_createList() {
|
list_t *list_createList() {
|
||||||
@ -176,8 +176,8 @@ char* findStrInStrList(list_t *strList, const char *str)
|
|||||||
|
|
||||||
listEntry_t* listEntry = NULL;
|
listEntry_t* listEntry = NULL;
|
||||||
list_ForEach(listEntry, strList) {
|
list_ForEach(listEntry, strList) {
|
||||||
if (strstr((char*)listEntry->data, str) != NULL) {
|
if (strstr(listEntry->data, str) != NULL) {
|
||||||
return (char*)listEntry->data;
|
return listEntry->data;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -197,4 +197,4 @@ void clear_and_free_string_list(list_t *list)
|
|||||||
list_item = NULL;
|
list_item = NULL;
|
||||||
}
|
}
|
||||||
list_freeList(list);
|
list_freeList(list);
|
||||||
}
|
}
|
||||||
|
@ -67,9 +67,7 @@ PetAPI_addPet(apiClient_t *apiClient, pet_t *body)
|
|||||||
apiClient->response_code = 0;
|
apiClient->response_code = 0;
|
||||||
|
|
||||||
// create the path
|
// create the path
|
||||||
long sizeOfPath = strlen("/pet")+1;
|
char *localVarPath = strdup("/pet");
|
||||||
char *localVarPath = malloc(sizeOfPath);
|
|
||||||
snprintf(localVarPath, sizeOfPath, "/pet");
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@ -139,14 +137,12 @@ PetAPI_deletePet(apiClient_t *apiClient, long petId, char *api_key)
|
|||||||
apiClient->response_code = 0;
|
apiClient->response_code = 0;
|
||||||
|
|
||||||
// create the path
|
// create the path
|
||||||
long sizeOfPath = strlen("/pet/{petId}")+1;
|
char *localVarPath = strdup("/pet/{petId}");
|
||||||
char *localVarPath = malloc(sizeOfPath);
|
|
||||||
snprintf(localVarPath, sizeOfPath, "/pet/{petId}");
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
// Path Params
|
// Path Params
|
||||||
long sizeOfPathParams_petId = sizeof(petId)+3 + strlen("{ petId }");
|
long sizeOfPathParams_petId = sizeof(petId)+3 + sizeof("{ petId }") - 1;
|
||||||
if(petId == 0){
|
if(petId == 0){
|
||||||
goto end;
|
goto end;
|
||||||
}
|
}
|
||||||
@ -232,9 +228,7 @@ PetAPI_findPetsByStatus(apiClient_t *apiClient, list_t *status)
|
|||||||
apiClient->response_code = 0;
|
apiClient->response_code = 0;
|
||||||
|
|
||||||
// create the path
|
// create the path
|
||||||
long sizeOfPath = strlen("/pet/findByStatus")+1;
|
char *localVarPath = strdup("/pet/findByStatus");
|
||||||
char *localVarPath = malloc(sizeOfPath);
|
|
||||||
snprintf(localVarPath, sizeOfPath, "/pet/findByStatus");
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@ -325,9 +319,7 @@ PetAPI_findPetsByTags(apiClient_t *apiClient, list_t *tags)
|
|||||||
apiClient->response_code = 0;
|
apiClient->response_code = 0;
|
||||||
|
|
||||||
// create the path
|
// create the path
|
||||||
long sizeOfPath = strlen("/pet/findByTags")+1;
|
char *localVarPath = strdup("/pet/findByTags");
|
||||||
char *localVarPath = malloc(sizeOfPath);
|
|
||||||
snprintf(localVarPath, sizeOfPath, "/pet/findByTags");
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@ -416,9 +408,7 @@ PetAPI_getDaysWithoutIncident(apiClient_t *apiClient)
|
|||||||
apiClient->response_code = 0;
|
apiClient->response_code = 0;
|
||||||
|
|
||||||
// create the path
|
// create the path
|
||||||
long sizeOfPath = strlen("/store/daysWithoutIncident")+1;
|
char *localVarPath = strdup("/store/daysWithoutIncident");
|
||||||
char *localVarPath = malloc(sizeOfPath);
|
|
||||||
snprintf(localVarPath, sizeOfPath, "/store/daysWithoutIncident");
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@ -481,14 +471,12 @@ PetAPI_getPetById(apiClient_t *apiClient, long petId)
|
|||||||
apiClient->response_code = 0;
|
apiClient->response_code = 0;
|
||||||
|
|
||||||
// create the path
|
// create the path
|
||||||
long sizeOfPath = strlen("/pet/{petId}")+1;
|
char *localVarPath = strdup("/pet/{petId}");
|
||||||
char *localVarPath = malloc(sizeOfPath);
|
|
||||||
snprintf(localVarPath, sizeOfPath, "/pet/{petId}");
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
// Path Params
|
// Path Params
|
||||||
long sizeOfPathParams_petId = sizeof(petId)+3 + strlen("{ petId }");
|
long sizeOfPathParams_petId = sizeof(petId)+3 + sizeof("{ petId }") - 1;
|
||||||
if(petId == 0){
|
if(petId == 0){
|
||||||
goto end;
|
goto end;
|
||||||
}
|
}
|
||||||
@ -575,9 +563,7 @@ PetAPI_getPicture(apiClient_t *apiClient)
|
|||||||
apiClient->response_code = 0;
|
apiClient->response_code = 0;
|
||||||
|
|
||||||
// create the path
|
// create the path
|
||||||
long sizeOfPath = strlen("/pet/picture")+1;
|
char *localVarPath = strdup("/pet/picture");
|
||||||
char *localVarPath = malloc(sizeOfPath);
|
|
||||||
snprintf(localVarPath, sizeOfPath, "/pet/picture");
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@ -638,14 +624,12 @@ PetAPI_isPetAvailable(apiClient_t *apiClient, long petId)
|
|||||||
apiClient->response_code = 0;
|
apiClient->response_code = 0;
|
||||||
|
|
||||||
// create the path
|
// create the path
|
||||||
long sizeOfPath = strlen("/pet/{petId}/isAvailable")+1;
|
char *localVarPath = strdup("/pet/{petId}/isAvailable");
|
||||||
char *localVarPath = malloc(sizeOfPath);
|
|
||||||
snprintf(localVarPath, sizeOfPath, "/pet/{petId}/isAvailable");
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
// Path Params
|
// Path Params
|
||||||
long sizeOfPathParams_petId = sizeof(petId)+3 + strlen("{ petId }");
|
long sizeOfPathParams_petId = sizeof(petId)+3 + sizeof("{ petId }") - 1;
|
||||||
if(petId == 0){
|
if(petId == 0){
|
||||||
goto end;
|
goto end;
|
||||||
}
|
}
|
||||||
@ -723,9 +707,7 @@ PetAPI_sharePicture(apiClient_t *apiClient, binary_t* picture)
|
|||||||
apiClient->response_code = 0;
|
apiClient->response_code = 0;
|
||||||
|
|
||||||
// create the path
|
// create the path
|
||||||
long sizeOfPath = strlen("/pet/picture")+1;
|
char *localVarPath = strdup("/pet/picture");
|
||||||
char *localVarPath = malloc(sizeOfPath);
|
|
||||||
snprintf(localVarPath, sizeOfPath, "/pet/picture");
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@ -794,9 +776,7 @@ PetAPI_specialtyPet(apiClient_t *apiClient)
|
|||||||
apiClient->response_code = 0;
|
apiClient->response_code = 0;
|
||||||
|
|
||||||
// create the path
|
// create the path
|
||||||
long sizeOfPath = strlen("/pet/specialty")+1;
|
char *localVarPath = strdup("/pet/specialty");
|
||||||
char *localVarPath = malloc(sizeOfPath);
|
|
||||||
snprintf(localVarPath, sizeOfPath, "/pet/specialty");
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@ -865,9 +845,7 @@ PetAPI_updatePet(apiClient_t *apiClient, pet_t *body)
|
|||||||
apiClient->response_code = 0;
|
apiClient->response_code = 0;
|
||||||
|
|
||||||
// create the path
|
// create the path
|
||||||
long sizeOfPath = strlen("/pet")+1;
|
char *localVarPath = strdup("/pet");
|
||||||
char *localVarPath = malloc(sizeOfPath);
|
|
||||||
snprintf(localVarPath, sizeOfPath, "/pet");
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@ -945,14 +923,12 @@ PetAPI_updatePetWithForm(apiClient_t *apiClient, long petId, char *name, char *s
|
|||||||
apiClient->response_code = 0;
|
apiClient->response_code = 0;
|
||||||
|
|
||||||
// create the path
|
// create the path
|
||||||
long sizeOfPath = strlen("/pet/{petId}")+1;
|
char *localVarPath = strdup("/pet/{petId}");
|
||||||
char *localVarPath = malloc(sizeOfPath);
|
|
||||||
snprintf(localVarPath, sizeOfPath, "/pet/{petId}");
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
// Path Params
|
// Path Params
|
||||||
long sizeOfPathParams_petId = sizeof(petId)+3 + strlen("{ petId }");
|
long sizeOfPathParams_petId = sizeof(petId)+3 + sizeof("{ petId }") - 1;
|
||||||
if(petId == 0){
|
if(petId == 0){
|
||||||
goto end;
|
goto end;
|
||||||
}
|
}
|
||||||
@ -1058,14 +1034,12 @@ PetAPI_uploadFile(apiClient_t *apiClient, long petId, char *additionalMetadata,
|
|||||||
apiClient->response_code = 0;
|
apiClient->response_code = 0;
|
||||||
|
|
||||||
// create the path
|
// create the path
|
||||||
long sizeOfPath = strlen("/pet/{petId}/uploadImage")+1;
|
char *localVarPath = strdup("/pet/{petId}/uploadImage");
|
||||||
char *localVarPath = malloc(sizeOfPath);
|
|
||||||
snprintf(localVarPath, sizeOfPath, "/pet/{petId}/uploadImage");
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
// Path Params
|
// Path Params
|
||||||
long sizeOfPathParams_petId = sizeof(petId)+3 + strlen("{ petId }");
|
long sizeOfPathParams_petId = sizeof(petId)+3 + sizeof("{ petId }") - 1;
|
||||||
if(petId == 0){
|
if(petId == 0){
|
||||||
goto end;
|
goto end;
|
||||||
}
|
}
|
||||||
|
@ -78,16 +78,14 @@ StoreAPI_deleteOrder(apiClient_t *apiClient, char *orderId)
|
|||||||
apiClient->response_code = 0;
|
apiClient->response_code = 0;
|
||||||
|
|
||||||
// create the path
|
// create the path
|
||||||
long sizeOfPath = strlen("/store/order/{orderId}")+1;
|
char *localVarPath = strdup("/store/order/{orderId}");
|
||||||
char *localVarPath = malloc(sizeOfPath);
|
|
||||||
snprintf(localVarPath, sizeOfPath, "/store/order/{orderId}");
|
|
||||||
|
|
||||||
if(!orderId)
|
if(!orderId)
|
||||||
goto end;
|
goto end;
|
||||||
|
|
||||||
|
|
||||||
// Path Params
|
// Path Params
|
||||||
long sizeOfPathParams_orderId = strlen(orderId)+3 + strlen("{ orderId }");
|
long sizeOfPathParams_orderId = strlen(orderId)+3 + sizeof("{ orderId }") - 1;
|
||||||
if(orderId == NULL) {
|
if(orderId == NULL) {
|
||||||
goto end;
|
goto end;
|
||||||
}
|
}
|
||||||
@ -152,9 +150,7 @@ StoreAPI_getInventory(apiClient_t *apiClient)
|
|||||||
apiClient->response_code = 0;
|
apiClient->response_code = 0;
|
||||||
|
|
||||||
// create the path
|
// create the path
|
||||||
long sizeOfPath = strlen("/store/inventory")+1;
|
char *localVarPath = strdup("/store/inventory");
|
||||||
char *localVarPath = malloc(sizeOfPath);
|
|
||||||
snprintf(localVarPath, sizeOfPath, "/store/inventory");
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@ -225,14 +221,12 @@ StoreAPI_getOrderById(apiClient_t *apiClient, long orderId)
|
|||||||
apiClient->response_code = 0;
|
apiClient->response_code = 0;
|
||||||
|
|
||||||
// create the path
|
// create the path
|
||||||
long sizeOfPath = strlen("/store/order/{orderId}")+1;
|
char *localVarPath = strdup("/store/order/{orderId}");
|
||||||
char *localVarPath = malloc(sizeOfPath);
|
|
||||||
snprintf(localVarPath, sizeOfPath, "/store/order/{orderId}");
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
// Path Params
|
// Path Params
|
||||||
long sizeOfPathParams_orderId = sizeof(orderId)+3 + strlen("{ orderId }");
|
long sizeOfPathParams_orderId = sizeof(orderId)+3 + sizeof("{ orderId }") - 1;
|
||||||
if(orderId == 0){
|
if(orderId == 0){
|
||||||
goto end;
|
goto end;
|
||||||
}
|
}
|
||||||
@ -319,9 +313,7 @@ StoreAPI_placeOrder(apiClient_t *apiClient, order_t *body)
|
|||||||
apiClient->response_code = 0;
|
apiClient->response_code = 0;
|
||||||
|
|
||||||
// create the path
|
// create the path
|
||||||
long sizeOfPath = strlen("/store/order")+1;
|
char *localVarPath = strdup("/store/order");
|
||||||
char *localVarPath = malloc(sizeOfPath);
|
|
||||||
snprintf(localVarPath, sizeOfPath, "/store/order");
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@ -409,9 +401,7 @@ StoreAPI_sendFeedback(apiClient_t *apiClient, char *feedback)
|
|||||||
apiClient->response_code = 0;
|
apiClient->response_code = 0;
|
||||||
|
|
||||||
// create the path
|
// create the path
|
||||||
long sizeOfPath = strlen("/store/feedback")+1;
|
char *localVarPath = strdup("/store/feedback");
|
||||||
char *localVarPath = malloc(sizeOfPath);
|
|
||||||
snprintf(localVarPath, sizeOfPath, "/store/feedback");
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@ -477,16 +467,14 @@ StoreAPI_sendRating(apiClient_t *apiClient, openapi_petstore_sendRating_rating_e
|
|||||||
apiClient->response_code = 0;
|
apiClient->response_code = 0;
|
||||||
|
|
||||||
// create the path
|
// create the path
|
||||||
long sizeOfPath = strlen("/store/rating/{rating}")+1;
|
char *localVarPath = strdup("/store/rating/{rating}");
|
||||||
char *localVarPath = malloc(sizeOfPath);
|
|
||||||
snprintf(localVarPath, sizeOfPath, "/store/rating/{rating}");
|
|
||||||
|
|
||||||
if(!rating)
|
if(!rating)
|
||||||
goto end;
|
goto end;
|
||||||
|
|
||||||
|
|
||||||
// Path Params
|
// Path Params
|
||||||
long sizeOfPathParams_rating = strlen(sendRating_RATING_ToString(rating))+3 + strlen("{ rating }");
|
long sizeOfPathParams_rating = strlen(sendRating_RATING_ToString(rating))+3 + sizeof("{ rating }") - 1;
|
||||||
if(rating == 0) {
|
if(rating == 0) {
|
||||||
goto end;
|
goto end;
|
||||||
}
|
}
|
||||||
@ -553,9 +541,7 @@ StoreAPI_sendRecommend(apiClient_t *apiClient, int *recommend)
|
|||||||
apiClient->response_code = 0;
|
apiClient->response_code = 0;
|
||||||
|
|
||||||
// create the path
|
// create the path
|
||||||
long sizeOfPath = strlen("/store/recommend")+1;
|
char *localVarPath = strdup("/store/recommend");
|
||||||
char *localVarPath = malloc(sizeOfPath);
|
|
||||||
snprintf(localVarPath, sizeOfPath, "/store/recommend");
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@ -26,9 +26,7 @@ UserAPI_createUser(apiClient_t *apiClient, user_t *body)
|
|||||||
apiClient->response_code = 0;
|
apiClient->response_code = 0;
|
||||||
|
|
||||||
// create the path
|
// create the path
|
||||||
long sizeOfPath = strlen("/user")+1;
|
char *localVarPath = strdup("/user");
|
||||||
char *localVarPath = malloc(sizeOfPath);
|
|
||||||
snprintf(localVarPath, sizeOfPath, "/user");
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@ -96,9 +94,7 @@ UserAPI_createUsersWithArrayInput(apiClient_t *apiClient, list_t *body)
|
|||||||
apiClient->response_code = 0;
|
apiClient->response_code = 0;
|
||||||
|
|
||||||
// create the path
|
// create the path
|
||||||
long sizeOfPath = strlen("/user/createWithArray")+1;
|
char *localVarPath = strdup("/user/createWithArray");
|
||||||
char *localVarPath = malloc(sizeOfPath);
|
|
||||||
snprintf(localVarPath, sizeOfPath, "/user/createWithArray");
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@ -194,9 +190,7 @@ UserAPI_createUsersWithListInput(apiClient_t *apiClient, list_t *body)
|
|||||||
apiClient->response_code = 0;
|
apiClient->response_code = 0;
|
||||||
|
|
||||||
// create the path
|
// create the path
|
||||||
long sizeOfPath = strlen("/user/createWithList")+1;
|
char *localVarPath = strdup("/user/createWithList");
|
||||||
char *localVarPath = malloc(sizeOfPath);
|
|
||||||
snprintf(localVarPath, sizeOfPath, "/user/createWithList");
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@ -294,16 +288,14 @@ UserAPI_deleteUser(apiClient_t *apiClient, char *username)
|
|||||||
apiClient->response_code = 0;
|
apiClient->response_code = 0;
|
||||||
|
|
||||||
// create the path
|
// create the path
|
||||||
long sizeOfPath = strlen("/user/{username}")+1;
|
char *localVarPath = strdup("/user/{username}");
|
||||||
char *localVarPath = malloc(sizeOfPath);
|
|
||||||
snprintf(localVarPath, sizeOfPath, "/user/{username}");
|
|
||||||
|
|
||||||
if(!username)
|
if(!username)
|
||||||
goto end;
|
goto end;
|
||||||
|
|
||||||
|
|
||||||
// Path Params
|
// Path Params
|
||||||
long sizeOfPathParams_username = strlen(username)+3 + strlen("{ username }");
|
long sizeOfPathParams_username = strlen(username)+3 + sizeof("{ username }") - 1;
|
||||||
if(username == NULL) {
|
if(username == NULL) {
|
||||||
goto end;
|
goto end;
|
||||||
}
|
}
|
||||||
@ -366,16 +358,14 @@ UserAPI_getUserByName(apiClient_t *apiClient, char *username)
|
|||||||
apiClient->response_code = 0;
|
apiClient->response_code = 0;
|
||||||
|
|
||||||
// create the path
|
// create the path
|
||||||
long sizeOfPath = strlen("/user/{username}")+1;
|
char *localVarPath = strdup("/user/{username}");
|
||||||
char *localVarPath = malloc(sizeOfPath);
|
|
||||||
snprintf(localVarPath, sizeOfPath, "/user/{username}");
|
|
||||||
|
|
||||||
if(!username)
|
if(!username)
|
||||||
goto end;
|
goto end;
|
||||||
|
|
||||||
|
|
||||||
// Path Params
|
// Path Params
|
||||||
long sizeOfPathParams_username = strlen(username)+3 + strlen("{ username }");
|
long sizeOfPathParams_username = strlen(username)+3 + sizeof("{ username }") - 1;
|
||||||
if(username == NULL) {
|
if(username == NULL) {
|
||||||
goto end;
|
goto end;
|
||||||
}
|
}
|
||||||
@ -458,9 +448,7 @@ UserAPI_loginUser(apiClient_t *apiClient, char *username, char *password)
|
|||||||
apiClient->response_code = 0;
|
apiClient->response_code = 0;
|
||||||
|
|
||||||
// create the path
|
// create the path
|
||||||
long sizeOfPath = strlen("/user/login")+1;
|
char *localVarPath = strdup("/user/login");
|
||||||
char *localVarPath = malloc(sizeOfPath);
|
|
||||||
snprintf(localVarPath, sizeOfPath, "/user/login");
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@ -574,9 +562,7 @@ UserAPI_logoutUser(apiClient_t *apiClient)
|
|||||||
apiClient->response_code = 0;
|
apiClient->response_code = 0;
|
||||||
|
|
||||||
// create the path
|
// create the path
|
||||||
long sizeOfPath = strlen("/user/logout")+1;
|
char *localVarPath = strdup("/user/logout");
|
||||||
char *localVarPath = malloc(sizeOfPath);
|
|
||||||
snprintf(localVarPath, sizeOfPath, "/user/logout");
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@ -631,9 +617,7 @@ UserAPI_testIntAndBool(apiClient_t *apiClient, int *keep, int *keepDay)
|
|||||||
apiClient->response_code = 0;
|
apiClient->response_code = 0;
|
||||||
|
|
||||||
// create the path
|
// create the path
|
||||||
long sizeOfPath = strlen("/user/testIntAndBool")+1;
|
char *localVarPath = strdup("/user/testIntAndBool");
|
||||||
char *localVarPath = malloc(sizeOfPath);
|
|
||||||
snprintf(localVarPath, sizeOfPath, "/user/testIntAndBool");
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@ -714,16 +698,14 @@ UserAPI_updateUser(apiClient_t *apiClient, char *username, user_t *body)
|
|||||||
apiClient->response_code = 0;
|
apiClient->response_code = 0;
|
||||||
|
|
||||||
// create the path
|
// create the path
|
||||||
long sizeOfPath = strlen("/user/{username}")+1;
|
char *localVarPath = strdup("/user/{username}");
|
||||||
char *localVarPath = malloc(sizeOfPath);
|
|
||||||
snprintf(localVarPath, sizeOfPath, "/user/{username}");
|
|
||||||
|
|
||||||
if(!username)
|
if(!username)
|
||||||
goto end;
|
goto end;
|
||||||
|
|
||||||
|
|
||||||
// Path Params
|
// Path Params
|
||||||
long sizeOfPathParams_username = strlen(username)+3 + strlen("{ username }");
|
long sizeOfPathParams_username = strlen(username)+3 + sizeof("{ username }") - 1;
|
||||||
if(username == NULL) {
|
if(username == NULL) {
|
||||||
goto end;
|
goto end;
|
||||||
}
|
}
|
||||||
|
@ -88,7 +88,7 @@ cJSON *model_with_set_propertes_convertToJSON(model_with_set_propertes_t *model_
|
|||||||
|
|
||||||
listEntry_t *string_setListEntry;
|
listEntry_t *string_setListEntry;
|
||||||
list_ForEach(string_setListEntry, model_with_set_propertes->string_set) {
|
list_ForEach(string_setListEntry, model_with_set_propertes->string_set) {
|
||||||
if(cJSON_AddStringToObject(string_set, "", (char*)string_setListEntry->data) == NULL)
|
if(cJSON_AddStringToObject(string_set, "", string_setListEntry->data) == NULL)
|
||||||
{
|
{
|
||||||
goto fail;
|
goto fail;
|
||||||
}
|
}
|
||||||
|
@ -141,7 +141,7 @@ cJSON *pet_convertToJSON(pet_t *pet) {
|
|||||||
|
|
||||||
listEntry_t *photo_urlsListEntry;
|
listEntry_t *photo_urlsListEntry;
|
||||||
list_ForEach(photo_urlsListEntry, pet->photo_urls) {
|
list_ForEach(photo_urlsListEntry, pet->photo_urls) {
|
||||||
if(cJSON_AddStringToObject(photo_urls, "", (char*)photo_urlsListEntry->data) == NULL)
|
if(cJSON_AddStringToObject(photo_urls, "", photo_urlsListEntry->data) == NULL)
|
||||||
{
|
{
|
||||||
goto fail;
|
goto fail;
|
||||||
}
|
}
|
||||||
|
@ -97,7 +97,7 @@ void user_free(user_t *user) {
|
|||||||
}
|
}
|
||||||
if (user->extra) {
|
if (user->extra) {
|
||||||
list_ForEach(listEntry, user->extra) {
|
list_ForEach(listEntry, user->extra) {
|
||||||
keyValuePair_t *localKeyValue = (keyValuePair_t*) listEntry->data;
|
keyValuePair_t *localKeyValue = listEntry->data;
|
||||||
free (localKeyValue->key);
|
free (localKeyValue->key);
|
||||||
free (localKeyValue->value);
|
free (localKeyValue->value);
|
||||||
keyValuePair_free(localKeyValue);
|
keyValuePair_free(localKeyValue);
|
||||||
@ -185,7 +185,7 @@ cJSON *user_convertToJSON(user_t *user) {
|
|||||||
listEntry_t *extraListEntry;
|
listEntry_t *extraListEntry;
|
||||||
if (user->extra) {
|
if (user->extra) {
|
||||||
list_ForEach(extraListEntry, user->extra) {
|
list_ForEach(extraListEntry, user->extra) {
|
||||||
keyValuePair_t *localKeyValue = (keyValuePair_t*)extraListEntry->data;
|
keyValuePair_t *localKeyValue = extraListEntry->data;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -368,7 +368,7 @@ end:
|
|||||||
if (extraList) {
|
if (extraList) {
|
||||||
listEntry_t *listEntry = NULL;
|
listEntry_t *listEntry = NULL;
|
||||||
list_ForEach(listEntry, extraList) {
|
list_ForEach(listEntry, extraList) {
|
||||||
keyValuePair_t *localKeyValue = (keyValuePair_t*) listEntry->data;
|
keyValuePair_t *localKeyValue = listEntry->data;
|
||||||
free(localKeyValue->key);
|
free(localKeyValue->key);
|
||||||
localKeyValue->key = NULL;
|
localKeyValue->key = NULL;
|
||||||
keyValuePair_free(localKeyValue);
|
keyValuePair_free(localKeyValue);
|
||||||
|
@ -116,10 +116,11 @@ void sslConfig_free(sslConfig_t *sslConfig) {
|
|||||||
free(sslConfig);
|
free(sslConfig);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void replaceSpaceWithPlus(char *stringToProcess) {
|
static void replaceSpaceWithPlus(char *str) {
|
||||||
for(int i = 0; i < strlen(stringToProcess); i++) {
|
if (str) {
|
||||||
if(stringToProcess[i] == ' ') {
|
for (; *str; str++) {
|
||||||
stringToProcess[i] = '+';
|
if (*str == ' ')
|
||||||
|
*str = '+';
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -229,38 +230,26 @@ void apiClient_invoke(apiClient_t *apiClient,
|
|||||||
|
|
||||||
if(headerType != NULL) {
|
if(headerType != NULL) {
|
||||||
list_ForEach(listEntry, headerType) {
|
list_ForEach(listEntry, headerType) {
|
||||||
if(strstr((char *) listEntry->data,
|
if(strstr(listEntry->data, "xml") == NULL)
|
||||||
"xml") == NULL)
|
|
||||||
{
|
{
|
||||||
buffHeader = malloc(strlen(
|
buffHeader = malloc(sizeof("Accept: ") +
|
||||||
"Accept: ") +
|
strlen(listEntry->data));
|
||||||
strlen((char *)
|
sprintf(buffHeader, "Accept: %s",
|
||||||
listEntry->
|
|
||||||
data) + 1);
|
|
||||||
sprintf(buffHeader, "%s%s", "Accept: ",
|
|
||||||
(char *) listEntry->data);
|
(char *) listEntry->data);
|
||||||
headers = curl_slist_append(headers,
|
headers = curl_slist_append(headers, buffHeader);
|
||||||
buffHeader);
|
|
||||||
free(buffHeader);
|
free(buffHeader);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if(contentType != NULL) {
|
if(contentType != NULL) {
|
||||||
list_ForEach(listEntry, contentType) {
|
list_ForEach(listEntry, contentType) {
|
||||||
if(strstr((char *) listEntry->data,
|
if(strstr(listEntry->data, "xml") == NULL)
|
||||||
"xml") == NULL)
|
|
||||||
{
|
{
|
||||||
buffContent =
|
buffContent = malloc(sizeof("Content-Type: ") +
|
||||||
malloc(strlen(
|
strlen(listEntry->data));
|
||||||
"Content-Type: ") + strlen(
|
sprintf(buffContent, "Content-Type: %s",
|
||||||
(char *)
|
|
||||||
listEntry->data) +
|
|
||||||
1);
|
|
||||||
sprintf(buffContent, "%s%s",
|
|
||||||
"Content-Type: ",
|
|
||||||
(char *) listEntry->data);
|
(char *) listEntry->data);
|
||||||
headers = curl_slist_append(headers,
|
headers = curl_slist_append(headers, buffContent);
|
||||||
buffContent);
|
|
||||||
free(buffContent);
|
free(buffContent);
|
||||||
buffContent = NULL;
|
buffContent = NULL;
|
||||||
}
|
}
|
||||||
@ -475,8 +464,8 @@ void apiClient_invoke(apiClient_t *apiClient,
|
|||||||
|
|
||||||
size_t writeDataCallback(void *buffer, size_t size, size_t nmemb, void *userp) {
|
size_t writeDataCallback(void *buffer, size_t size, size_t nmemb, void *userp) {
|
||||||
size_t size_this_time = nmemb * size;
|
size_t size_this_time = nmemb * size;
|
||||||
apiClient_t *apiClient = (apiClient_t *)userp;
|
apiClient_t *apiClient = userp;
|
||||||
apiClient->dataReceived = (char *)realloc( apiClient->dataReceived, apiClient->dataReceivedLen + size_this_time + 1);
|
apiClient->dataReceived = realloc( apiClient->dataReceived, apiClient->dataReceivedLen + size_this_time + 1);
|
||||||
memcpy((char *)apiClient->dataReceived + apiClient->dataReceivedLen, buffer, size_this_time);
|
memcpy((char *)apiClient->dataReceived + apiClient->dataReceivedLen, buffer, size_this_time);
|
||||||
apiClient->dataReceivedLen += size_this_time;
|
apiClient->dataReceivedLen += size_this_time;
|
||||||
((char*)apiClient->dataReceived)[apiClient->dataReceivedLen] = '\0'; // the space size of (apiClient->dataReceived) = dataReceivedLen + 1
|
((char*)apiClient->dataReceived)[apiClient->dataReceivedLen] = '\0'; // the space size of (apiClient->dataReceived) = dataReceivedLen + 1
|
||||||
|
@ -20,7 +20,7 @@ void listEntry_free(listEntry_t *listEntry, void *additionalData) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void listEntry_printAsInt(listEntry_t *listEntry, void *additionalData) {
|
void listEntry_printAsInt(listEntry_t *listEntry, void *additionalData) {
|
||||||
printf("%i\n", *((int *) (listEntry->data)));
|
printf("%i\n", *(int *)listEntry->data);
|
||||||
}
|
}
|
||||||
|
|
||||||
list_t *list_createList() {
|
list_t *list_createList() {
|
||||||
@ -176,8 +176,8 @@ char* findStrInStrList(list_t *strList, const char *str)
|
|||||||
|
|
||||||
listEntry_t* listEntry = NULL;
|
listEntry_t* listEntry = NULL;
|
||||||
list_ForEach(listEntry, strList) {
|
list_ForEach(listEntry, strList) {
|
||||||
if (strstr((char*)listEntry->data, str) != NULL) {
|
if (strstr(listEntry->data, str) != NULL) {
|
||||||
return (char*)listEntry->data;
|
return listEntry->data;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -197,4 +197,4 @@ void clear_and_free_string_list(list_t *list)
|
|||||||
list_item = NULL;
|
list_item = NULL;
|
||||||
}
|
}
|
||||||
list_freeList(list);
|
list_freeList(list);
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user