some code changes to get rid of compile warnings

This commit is contained in:
hyung-hwan 2023-01-28 00:41:44 +09:00
parent 3c46823832
commit d3fdb4bed4
8 changed files with 17 additions and 15 deletions

View File

@ -100,8 +100,9 @@ struct hio_svc_htts_task_t
HIO_SVC_HTTS_TASK_HEADER; HIO_SVC_HTTS_TASK_HEADER;
}; };
#define HIO_SVC_HTTS_TASK_REF(task, var) do { (var) = (task); ++(task)->task_refcnt; } while(0) #define HIO_SVC_HTTS_TASK_REF(task, var) do { (var) = (task); ++(task)->task_refcnt; } while(0)
#define HIO_SVC_HTTS_TASK_UNREF(task_var) do { if (--(task_var)->task_refcnt == 0) { hio_svc_htts_task_t* __task_tmp = (task_var); (task_var) = HIO_NULL; hio_svc_htts_task_kill(__task_tmp); } else { (task_var) = HIO_NULL; } } while(0) #define HIO_SVC_HTTS_TASK_UNREF(task_var) do { if (--(task_var)->task_refcnt == 0) { hio_svc_htts_task_t* __task_tmp = (hio_svc_htts_task_t*)(task_var); (task_var) = HIO_NULL; hio_svc_htts_task_kill(__task_tmp); } else { (task_var) = HIO_NULL; } } while(0)
/* -------------------------------------------------------------- */ /* -------------------------------------------------------------- */

View File

@ -233,7 +233,7 @@ HIO_EXPORT void hio_skad_set_chan (
); );
HIO_EXPORT hio_oow_t hio_skad_get_ipad_bytes ( HIO_EXPORT hio_oow_t hio_skad_get_ipad_bytes (
hio_skad_t* skad, const hio_skad_t* skad,
void* buf, void* buf,
hio_oow_t len hio_oow_t len
); );

View File

@ -1022,7 +1022,7 @@ int hio_svc_htts_docgi (hio_svc_htts_t* htts, hio_dev_sck_t* csck, hio_htre_t* r
cgi->peer = hio_dev_pro_make(hio, HIO_SIZEOF(*peer_xtn), &mi); cgi->peer = hio_dev_pro_make(hio, HIO_SIZEOF(*peer_xtn), &mi);
if (HIO_UNLIKELY(!cgi->peer)) goto oops; if (HIO_UNLIKELY(!cgi->peer)) goto oops;
peer_xtn = hio_dev_pro_getxtn(cgi->peer); peer_xtn = hio_dev_pro_getxtn(cgi->peer);
HIO_SVC_HTTS_TASK_REF ((hio_svc_htts_task_t*)cgi, peer_xtn->cgi); /* peer->cgi in pro = cgi */ HIO_SVC_HTTS_TASK_REF (cgi, peer_xtn->cgi); /* peer->cgi in pro = cgi */
cgi->peer_htrd = hio_htrd_open(hio, HIO_SIZEOF(*peer_xtn)); cgi->peer_htrd = hio_htrd_open(hio, HIO_SIZEOF(*peer_xtn));
if (HIO_UNLIKELY(!cgi->peer_htrd)) goto oops; if (HIO_UNLIKELY(!cgi->peer_htrd)) goto oops;
@ -1030,7 +1030,7 @@ int hio_svc_htts_docgi (hio_svc_htts_t* htts, hio_dev_sck_t* csck, hio_htre_t* r
hio_htrd_setrecbs (cgi->peer_htrd, &peer_htrd_recbs); hio_htrd_setrecbs (cgi->peer_htrd, &peer_htrd_recbs);
peer_xtn = hio_htrd_getxtn(cgi->peer_htrd); peer_xtn = hio_htrd_getxtn(cgi->peer_htrd);
HIO_SVC_HTTS_TASK_REF ((hio_svc_htts_task_t*)cgi, peer_xtn->cgi); /* peer->cgi in htrd = cgi */ HIO_SVC_HTTS_TASK_REF (cgi, peer_xtn->cgi); /* peer->cgi in htrd = cgi */
#if !defined(CGI_ALLOW_UNLIMITED_REQ_CONTENT_LENGTH) #if !defined(CGI_ALLOW_UNLIMITED_REQ_CONTENT_LENGTH)
if (cgi->req_content_length_unlimited) if (cgi->req_content_length_unlimited)
@ -1129,7 +1129,7 @@ int hio_svc_htts_docgi (hio_svc_htts_t* htts, hio_dev_sck_t* csck, hio_htre_t* r
if (hio_dev_sck_read(csck, !(cgi->over & CGI_OVER_READ_FROM_CLIENT)) <= -1) goto oops; if (hio_dev_sck_read(csck, !(cgi->over & CGI_OVER_READ_FROM_CLIENT)) <= -1) goto oops;
hio_freemem (hio, fc.actual_script); hio_freemem (hio, fc.actual_script);
HIO_SVC_HTTS_TASKL_APPEND_TASK (&htts->task, cgi); HIO_SVC_HTTS_TASKL_APPEND_TASK (&htts->task, (hio_svc_htts_task_t*)cgi);
return 0; return 0;
oops: oops:

View File

@ -2,6 +2,7 @@
#include <hio-fmt.h> #include <hio-fmt.h>
#include <hio-chr.h> #include <hio-chr.h>
#include <hio-fcgi.h> #include <hio-fcgi.h>
#include <unistd.h>
#define FCGI_ALLOW_UNLIMITED_REQ_CONTENT_LENGTH #define FCGI_ALLOW_UNLIMITED_REQ_CONTENT_LENGTH
@ -526,7 +527,7 @@ oops:
return 0; return 0;
} }
static int fcgi_peer_on_untie (hio_svc_fcgic_sess_t* peer, void* ctx) static void fcgi_peer_on_untie (hio_svc_fcgic_sess_t* peer, void* ctx)
{ {
fcgi_t* fcgi = (fcgi_t*)ctx; fcgi_t* fcgi = (fcgi_t*)ctx;
if (fcgi->peer) fcgi->peer = HIO_NULL; /* in case this untie event originates from the fcgi client itself */ if (fcgi->peer) fcgi->peer = HIO_NULL; /* in case this untie event originates from the fcgi client itself */
@ -795,7 +796,7 @@ int hio_svc_htts_dofcgi (hio_svc_htts_t* htts, hio_dev_sck_t* csck, hio_htre_t*
hio_htrd_setoption (fcgi->peer_htrd, HIO_HTRD_SKIP_INITIAL_LINE | HIO_HTRD_RESPONSE); hio_htrd_setoption (fcgi->peer_htrd, HIO_HTRD_SKIP_INITIAL_LINE | HIO_HTRD_RESPONSE);
hio_htrd_setrecbs (fcgi->peer_htrd, &peer_htrd_recbs); hio_htrd_setrecbs (fcgi->peer_htrd, &peer_htrd_recbs);
pxtn = hio_htrd_getxtn(fcgi->peer_htrd); pxtn = hio_htrd_getxtn(fcgi->peer_htrd);
HIO_SVC_HTTS_TASK_REF ((hio_svc_htts_task_t*)fcgi, pxtn->fcgi); /* peer->fcgi in htrd = fcgi */ HIO_SVC_HTTS_TASK_REF (fcgi, pxtn->fcgi); /* peer->fcgi in htrd = fcgi */
/* create a session in in the fcgi client service */ /* create a session in in the fcgi client service */
fcgi->peer = hio_svc_fcgic_tie(htts->fcgic, fcgis_addr, fcgi_peer_on_read, fcgi_peer_on_untie, fcgi); fcgi->peer = hio_svc_fcgic_tie(htts->fcgic, fcgis_addr, fcgi_peer_on_read, fcgi_peer_on_untie, fcgi);
@ -903,7 +904,7 @@ int hio_svc_htts_dofcgi (hio_svc_htts_t* htts, hio_dev_sck_t* csck, hio_htre_t*
/* TODO: store current input watching state and use it when destroying the fcgi data */ /* TODO: store current input watching state and use it when destroying the fcgi data */
if (hio_dev_sck_read(csck, !(fcgi->over & FCGI_OVER_READ_FROM_CLIENT)) <= -1) goto oops; if (hio_dev_sck_read(csck, !(fcgi->over & FCGI_OVER_READ_FROM_CLIENT)) <= -1) goto oops;
HIO_SVC_HTTS_TASKL_APPEND_TASK (&htts->task, fcgi); HIO_SVC_HTTS_TASKL_APPEND_TASK (&htts->task, (hio_svc_htts_task_t*)fcgi);
return 0; return 0;
oops: oops:

View File

@ -995,7 +995,7 @@ int hio_svc_htts_dofile (hio_svc_htts_t* htts, hio_dev_sck_t* csck, hio_htre_t*
if (hio_dev_sck_read(csck, !(file->over & FILE_OVER_READ_FROM_CLIENT)) <= -1) goto oops; if (hio_dev_sck_read(csck, !(file->over & FILE_OVER_READ_FROM_CLIENT)) <= -1) goto oops;
hio_freemem (hio, actual_file); hio_freemem (hio, actual_file);
HIO_SVC_HTTS_TASKL_APPEND_TASK (&htts->task, file); HIO_SVC_HTTS_TASKL_APPEND_TASK (&htts->task, (hio_svc_htts_task_t*)file);
return 0; return 0;
oops: oops:

View File

@ -209,7 +209,7 @@ static int thr_task_write_to_peer (thr_task_t* thr_task, const void* data, hio_i
/* TODO: check if it's already finished or something.. */ /* TODO: check if it's already finished or something.. */
if (thr_task->num_pending_writes_to_peer > THR_TASK_PENDING_IO_THRESHOLD) if (thr_task->num_pending_writes_to_peer > THR_TASK_PENDING_IO_THRESHOLD)
{ {
if (thr_task->csck, hio_dev_sck_read(thr_task->csck, 0) <= -1) return -1; if (thr_task->csck && hio_dev_sck_read(thr_task->csck, 0) <= -1) return -1;
} }
} }
return 0; return 0;
@ -957,7 +957,7 @@ int hio_svc_htts_dothr (hio_svc_htts_t* htts, hio_dev_sck_t* csck, hio_htre_t* r
/* attach the thr task to the peer thread device */ /* attach the thr task to the peer thread device */
thr_peer = hio_dev_thr_getxtn(thr_task->peer); thr_peer = hio_dev_thr_getxtn(thr_task->peer);
HIO_SVC_HTTS_TASK_REF ((hio_svc_htts_task_t*)thr_task, thr_peer->task); HIO_SVC_HTTS_TASK_REF (thr_task, thr_peer->task);
thr_task->peer_htrd = hio_htrd_open(hio, HIO_SIZEOF(*thr_peer)); thr_task->peer_htrd = hio_htrd_open(hio, HIO_SIZEOF(*thr_peer));
if (HIO_UNLIKELY(!thr_task->peer_htrd)) goto oops; if (HIO_UNLIKELY(!thr_task->peer_htrd)) goto oops;
@ -966,7 +966,7 @@ int hio_svc_htts_dothr (hio_svc_htts_t* htts, hio_dev_sck_t* csck, hio_htre_t* r
/* attach the thr task to the htrd parser set on the peer thread device */ /* attach the thr task to the htrd parser set on the peer thread device */
thr_peer = hio_htrd_getxtn(thr_task->peer_htrd); thr_peer = hio_htrd_getxtn(thr_task->peer_htrd);
HIO_SVC_HTTS_TASK_REF ((hio_svc_htts_task_t*)thr_task, thr_peer->task); HIO_SVC_HTTS_TASK_REF (thr_task, thr_peer->task);
#if !defined(THR_ALLOW_UNLIMITED_REQ_CONTENT_LENGTH) #if !defined(THR_ALLOW_UNLIMITED_REQ_CONTENT_LENGTH)
if (thr_task->req_content_length_unlimited) if (thr_task->req_content_length_unlimited)
@ -1054,7 +1054,7 @@ int hio_svc_htts_dothr (hio_svc_htts_t* htts, hio_dev_sck_t* csck, hio_htre_t* r
/* TODO: store current input watching state and use it when destroying the thr_task data */ /* TODO: store current input watching state and use it when destroying the thr_task data */
if (hio_dev_sck_read(csck, !(thr_task->over & THR_TASK_OVER_READ_FROM_CLIENT)) <= -1) goto oops; if (hio_dev_sck_read(csck, !(thr_task->over & THR_TASK_OVER_READ_FROM_CLIENT)) <= -1) goto oops;
HIO_SVC_HTTS_TASKL_APPEND_TASK (&htts->task, thr_task); HIO_SVC_HTTS_TASKL_APPEND_TASK (&htts->task, (hio_svc_htts_task_t*)thr_task);
return 0; return 0;
oops: oops:

View File

@ -390,7 +390,7 @@ int hio_svc_htts_dotxt (hio_svc_htts_t* htts, hio_dev_sck_t* csck, hio_htre_t* r
if (txt_send_final_status_to_client(txt, status_code, content_type, content_text, 0) <= -1) goto oops; if (txt_send_final_status_to_client(txt, status_code, content_type, content_text, 0) <= -1) goto oops;
HIO_SVC_HTTS_TASKL_APPEND_TASK (&htts->task, txt); HIO_SVC_HTTS_TASKL_APPEND_TASK (&htts->task, (hio_svc_htts_task_t*)txt);
return 0; return 0;
oops: oops:

View File

@ -1506,7 +1506,7 @@ void hio_skad_set_chan (hio_skad_t* _skad, hio_uint16_t chan)
} }
} }
hio_oow_t hio_skad_get_ipad_bytes (hio_skad_t* _skad, void* buf, hio_oow_t len) hio_oow_t hio_skad_get_ipad_bytes (const hio_skad_t* _skad, void* buf, hio_oow_t len)
{ {
hio_skad_alt_t* skad = (hio_skad_alt_t*)_skad; hio_skad_alt_t* skad = (hio_skad_alt_t*)_skad;
hio_oow_t outlen = 0; hio_oow_t outlen = 0;