Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[C][Client] Remove broken intToStr() macro, update samples #20383

Merged
merged 1 commit into from
Jan 2, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,6 @@

#define MAX_NUMBER_LENGTH 16
#define MAX_BUFFER_LENGTH 4096
#define intToStr(dst, src) \
do {\
char dst[256];\
snprintf(dst, 256, "%ld", (long int)(src));\
}while(0)

{{#operations}}
{{#operation}}
Expand Down Expand Up @@ -140,7 +135,7 @@ end:
snprintf(localVarToReplace_{{paramName}}, sizeOfPathParams_{{paramName}}, "{%s}", "{{baseName}}");

char localVarBuff_{{paramName}}[256];
intToStr(localVarBuff_{{paramName}}, {{paramName}});
snprintf(localVarBuff_{{paramName}}, sizeof localVarBuff_{{paramName}}, "%ld", (long){{paramName}});

localVarPath = strReplace(localVarPath, localVarToReplace_{{paramName}}, localVarBuff_{{paramName}});

Expand All @@ -153,7 +148,7 @@ end:
snprintf(localVarToReplace_{{paramName}}, sizeOfPathParams_{{paramName}}, "{%s}", "{{baseName}}");

char localVarBuff_{{paramName}}[256];
intToStr(localVarBuff_{{paramName}}, *{{paramName}});
snprintf(localVarBuff_{{paramName}}, sizeof localVarBuff_{{paramName}}, "%ld", (long)*{{paramName}});

localVarPath = strReplace(localVarPath, localVarToReplace_{{paramName}}, localVarBuff_{{paramName}});

Expand All @@ -166,7 +161,7 @@ end:
snprintf(localVarToReplace_{{paramName}}, sizeOfPathParams_{{paramName}}, "{%s}", "{{baseName}}");

char localVarBuff_{{paramName}}[256];
intToStr(localVarBuff_{{paramName}}, {{paramName}});
snprintf(localVarBuff_{{paramName}}, sizeof localVarBuff_{{paramName}}, "%ld", (long){{paramName}});

localVarPath = strReplace(localVarPath, localVarToReplace_{{paramName}}, localVarBuff_{{paramName}});
imaami marked this conversation as resolved.
Show resolved Hide resolved

Expand All @@ -179,7 +174,7 @@ end:
snprintf(localVarToReplace_{{paramName}}, sizeOfPathParams_{{paramName}}, "{%s}", "{{baseName}}");

char localVarBuff_{{paramName}}[256];
intToStr(localVarBuff_{{paramName}}, {{paramName}});
snprintf(localVarBuff_{{paramName}}, sizeof localVarBuff_{{paramName}}, "%ld", {{paramName}});

localVarPath = strReplace(localVarPath, localVarToReplace_{{paramName}}, localVarBuff_{{paramName}});

Expand Down
5 changes: 0 additions & 5 deletions samples/client/others/c/bearerAuth/api/DefaultAPI.c
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,6 @@

#define MAX_NUMBER_LENGTH 16
#define MAX_BUFFER_LENGTH 4096
#define intToStr(dst, src) \
do {\
char dst[256];\
snprintf(dst, 256, "%ld", (long int)(src));\
}while(0)


// Returns private information.
Expand Down
15 changes: 5 additions & 10 deletions samples/client/petstore/c-useJsonUnformatted/api/PetAPI.c
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,6 @@

#define MAX_NUMBER_LENGTH 16
#define MAX_BUFFER_LENGTH 4096
#define intToStr(dst, src) \
do {\
char dst[256];\
snprintf(dst, 256, "%ld", (long int)(src));\
}while(0)

// Functions for enum STATUS for PetAPI_findPetsByStatus

Expand Down Expand Up @@ -159,7 +154,7 @@ PetAPI_deletePet(apiClient_t *apiClient, long petId, char *api_key)
snprintf(localVarToReplace_petId, sizeOfPathParams_petId, "{%s}", "petId");

char localVarBuff_petId[256];
intToStr(localVarBuff_petId, petId);
snprintf(localVarBuff_petId, sizeof localVarBuff_petId, "%ld", petId);

localVarPath = strReplace(localVarPath, localVarToReplace_petId, localVarBuff_petId);

Expand Down Expand Up @@ -501,7 +496,7 @@ PetAPI_getPetById(apiClient_t *apiClient, long petId)
snprintf(localVarToReplace_petId, sizeOfPathParams_petId, "{%s}", "petId");

char localVarBuff_petId[256];
intToStr(localVarBuff_petId, petId);
snprintf(localVarBuff_petId, sizeof localVarBuff_petId, "%ld", petId);

localVarPath = strReplace(localVarPath, localVarToReplace_petId, localVarBuff_petId);

Expand Down Expand Up @@ -658,7 +653,7 @@ PetAPI_isPetAvailable(apiClient_t *apiClient, long petId)
snprintf(localVarToReplace_petId, sizeOfPathParams_petId, "{%s}", "petId");

char localVarBuff_petId[256];
intToStr(localVarBuff_petId, petId);
snprintf(localVarBuff_petId, sizeof localVarBuff_petId, "%ld", petId);

localVarPath = strReplace(localVarPath, localVarToReplace_petId, localVarBuff_petId);

Expand Down Expand Up @@ -965,7 +960,7 @@ PetAPI_updatePetWithForm(apiClient_t *apiClient, long petId, char *name, char *s
snprintf(localVarToReplace_petId, sizeOfPathParams_petId, "{%s}", "petId");

char localVarBuff_petId[256];
intToStr(localVarBuff_petId, petId);
snprintf(localVarBuff_petId, sizeof localVarBuff_petId, "%ld", petId);

localVarPath = strReplace(localVarPath, localVarToReplace_petId, localVarBuff_petId);

Expand Down Expand Up @@ -1078,7 +1073,7 @@ PetAPI_uploadFile(apiClient_t *apiClient, long petId, char *additionalMetadata,
snprintf(localVarToReplace_petId, sizeOfPathParams_petId, "{%s}", "petId");

char localVarBuff_petId[256];
intToStr(localVarBuff_petId, petId);
snprintf(localVarBuff_petId, sizeof localVarBuff_petId, "%ld", petId);

localVarPath = strReplace(localVarPath, localVarToReplace_petId, localVarBuff_petId);

Expand Down
7 changes: 1 addition & 6 deletions samples/client/petstore/c-useJsonUnformatted/api/StoreAPI.c
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,6 @@

#define MAX_NUMBER_LENGTH 16
#define MAX_BUFFER_LENGTH 4096
#define intToStr(dst, src) \
do {\
char dst[256];\
snprintf(dst, 256, "%ld", (long int)(src));\
}while(0)

// Functions for enum RATING for StoreAPI_sendRating

Expand Down Expand Up @@ -245,7 +240,7 @@ StoreAPI_getOrderById(apiClient_t *apiClient, long orderId)
snprintf(localVarToReplace_orderId, sizeOfPathParams_orderId, "{%s}", "orderId");

char localVarBuff_orderId[256];
intToStr(localVarBuff_orderId, orderId);
snprintf(localVarBuff_orderId, sizeof localVarBuff_orderId, "%ld", orderId);

localVarPath = strReplace(localVarPath, localVarToReplace_orderId, localVarBuff_orderId);

Expand Down
5 changes: 0 additions & 5 deletions samples/client/petstore/c-useJsonUnformatted/api/UserAPI.c
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,6 @@

#define MAX_NUMBER_LENGTH 16
#define MAX_BUFFER_LENGTH 4096
#define intToStr(dst, src) \
do {\
char dst[256];\
snprintf(dst, 256, "%ld", (long int)(src));\
}while(0)


// Create user
Expand Down
15 changes: 5 additions & 10 deletions samples/client/petstore/c/api/PetAPI.c
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,6 @@

#define MAX_NUMBER_LENGTH 16
#define MAX_BUFFER_LENGTH 4096
#define intToStr(dst, src) \
do {\
char dst[256];\
snprintf(dst, 256, "%ld", (long int)(src));\
}while(0)

// Functions for enum STATUS for PetAPI_findPetsByStatus

Expand Down Expand Up @@ -159,7 +154,7 @@ PetAPI_deletePet(apiClient_t *apiClient, long petId, char *api_key)
snprintf(localVarToReplace_petId, sizeOfPathParams_petId, "{%s}", "petId");

char localVarBuff_petId[256];
intToStr(localVarBuff_petId, petId);
snprintf(localVarBuff_petId, sizeof localVarBuff_petId, "%ld", petId);

localVarPath = strReplace(localVarPath, localVarToReplace_petId, localVarBuff_petId);

Expand Down Expand Up @@ -501,7 +496,7 @@ PetAPI_getPetById(apiClient_t *apiClient, long petId)
snprintf(localVarToReplace_petId, sizeOfPathParams_petId, "{%s}", "petId");

char localVarBuff_petId[256];
intToStr(localVarBuff_petId, petId);
snprintf(localVarBuff_petId, sizeof localVarBuff_petId, "%ld", petId);

localVarPath = strReplace(localVarPath, localVarToReplace_petId, localVarBuff_petId);

Expand Down Expand Up @@ -658,7 +653,7 @@ PetAPI_isPetAvailable(apiClient_t *apiClient, long petId)
snprintf(localVarToReplace_petId, sizeOfPathParams_petId, "{%s}", "petId");

char localVarBuff_petId[256];
intToStr(localVarBuff_petId, petId);
snprintf(localVarBuff_petId, sizeof localVarBuff_petId, "%ld", petId);

localVarPath = strReplace(localVarPath, localVarToReplace_petId, localVarBuff_petId);

Expand Down Expand Up @@ -965,7 +960,7 @@ PetAPI_updatePetWithForm(apiClient_t *apiClient, long petId, char *name, char *s
snprintf(localVarToReplace_petId, sizeOfPathParams_petId, "{%s}", "petId");

char localVarBuff_petId[256];
intToStr(localVarBuff_petId, petId);
snprintf(localVarBuff_petId, sizeof localVarBuff_petId, "%ld", petId);

localVarPath = strReplace(localVarPath, localVarToReplace_petId, localVarBuff_petId);

Expand Down Expand Up @@ -1078,7 +1073,7 @@ PetAPI_uploadFile(apiClient_t *apiClient, long petId, char *additionalMetadata,
snprintf(localVarToReplace_petId, sizeOfPathParams_petId, "{%s}", "petId");

char localVarBuff_petId[256];
intToStr(localVarBuff_petId, petId);
snprintf(localVarBuff_petId, sizeof localVarBuff_petId, "%ld", petId);

localVarPath = strReplace(localVarPath, localVarToReplace_petId, localVarBuff_petId);

Expand Down
7 changes: 1 addition & 6 deletions samples/client/petstore/c/api/StoreAPI.c
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,6 @@

#define MAX_NUMBER_LENGTH 16
#define MAX_BUFFER_LENGTH 4096
#define intToStr(dst, src) \
do {\
char dst[256];\
snprintf(dst, 256, "%ld", (long int)(src));\
}while(0)

// Functions for enum RATING for StoreAPI_sendRating

Expand Down Expand Up @@ -245,7 +240,7 @@ StoreAPI_getOrderById(apiClient_t *apiClient, long orderId)
snprintf(localVarToReplace_orderId, sizeOfPathParams_orderId, "{%s}", "orderId");

char localVarBuff_orderId[256];
intToStr(localVarBuff_orderId, orderId);
snprintf(localVarBuff_orderId, sizeof localVarBuff_orderId, "%ld", orderId);

localVarPath = strReplace(localVarPath, localVarToReplace_orderId, localVarBuff_orderId);

Expand Down
5 changes: 0 additions & 5 deletions samples/client/petstore/c/api/UserAPI.c
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,6 @@

#define MAX_NUMBER_LENGTH 16
#define MAX_BUFFER_LENGTH 4096
#define intToStr(dst, src) \
do {\
char dst[256];\
snprintf(dst, 256, "%ld", (long int)(src));\
}while(0)


// Create user
Expand Down