Skip to content

Commit

Permalink
Fix clang warnings
Browse files Browse the repository at this point in the history
  • Loading branch information
babelouest committed Feb 6, 2023
1 parent 7be573a commit c8065c4
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 4 deletions.
13 changes: 11 additions & 2 deletions src/u_response.c
Original file line number Diff line number Diff line change
Expand Up @@ -153,7 +153,12 @@ static char * ulfius_generate_cookie_header(const struct _u_cookie * cookie) {
int ulfius_set_response_header(struct MHD_Response * response, const struct _u_map * response_map_header) {
const char ** header_keys = u_map_enum_keys(response_map_header);
const char * header_value;
int i = -1, ret;
int i = -1;
#if MHD_VERSION >= 0x00097002
enum MHD_Result ret = MHD_NO;
#else
int ret = MHD_NO;
#endif
if (header_keys != NULL && response != NULL && response_map_header != NULL) {
for (i=0; header_keys != NULL && header_keys[i] != NULL; i++) {
header_value = u_map_get(response_map_header, header_keys[i]);
Expand All @@ -170,7 +175,11 @@ int ulfius_set_response_header(struct MHD_Response * response, const struct _u_m
}

int ulfius_set_response_cookie(struct MHD_Response * mhd_response, const struct _u_response * response) {
int ret;
#if MHD_VERSION >= 0x00097002
enum MHD_Result ret = MHD_NO;
#else
int ret = MHD_NO;
#endif
int i;
char * header;
if (mhd_response != NULL && response != NULL) {
Expand Down
2 changes: 1 addition & 1 deletion src/u_websocket.c
Original file line number Diff line number Diff line change
Expand Up @@ -1082,7 +1082,7 @@ static int ulfius_open_websocket_tls(struct _u_request * request, struct yuarel
struct sockaddr_in server;
struct hostent * he;
gnutls_datum_t out;
int type;
gnutls_certificate_type_t type;
unsigned status;

if (gnutls_global_init() >= 0) {
Expand Down
7 changes: 6 additions & 1 deletion src/ulfius.c
Original file line number Diff line number Diff line change
Expand Up @@ -444,7 +444,12 @@ static int ulfius_webservice_dispatcher (void * cls,
{
struct _u_endpoint * endpoint_list = ((struct _u_instance *)cls)->endpoint_list, ** current_endpoint_list = NULL, * current_endpoint = NULL;
struct connection_info_struct * con_info = * con_cls;
int mhd_ret = MHD_NO, callback_ret = U_OK, i, close_loop = 0, inner_error = U_OK, mhd_response_flag;
#if MHD_VERSION >= 0x00097002
enum MHD_Result mhd_ret = MHD_NO;
#else
int mhd_ret = MHD_NO;
#endif
int callback_ret = U_OK, i, close_loop = 0, inner_error = U_OK, mhd_response_flag;
#ifndef U_DISABLE_WEBSOCKET
// Websocket variables
int upgrade_protocol = 0;
Expand Down

0 comments on commit c8065c4

Please sign in to comment.