thttpd:fix Coding Style Check Failed issue

error: Mixed case identifier found

Signed-off-by: wanggang26 <wanggang26@xiaomi.com>
This commit is contained in:
wanggang26 2023-11-24 11:12:00 +08:00 committed by Xiang Xiao
parent 44d2250b6e
commit 2de1fdcebd
6 changed files with 50 additions and 49 deletions

View File

@ -1854,7 +1854,7 @@ static int ls(httpd_conn *hc)
char arg[16]; char arg[16];
char *argv[1]; char *argv[1];
#if CONFIG_THTTPD_CGI_TIMELIMIT > 0 #if CONFIG_THTTPD_CGI_TIMELIMIT > 0
ClientData client_data; clientdata client_data;
#endif #endif
dirp = opendir(hc->expnfilename); dirp = opendir(hc->expnfilename);

View File

@ -96,8 +96,8 @@ struct connect_s
int conn_state; int conn_state;
httpd_conn *hc; httpd_conn *hc;
time_t active_at; time_t active_at;
Timer *wakeup_timer; timer *wakeup_timer;
Timer *linger_timer; timer *linger_timer;
off_t end_offset; /* The final offset+1 of the file to send */ off_t end_offset; /* The final offset+1 of the file to send */
off_t offset; /* The current offset into the file to send */ off_t offset; /* The current offset into the file to send */
bool eof; /* Set true when length==0 read from file */ bool eof; /* Set true when length==0 read from file */
@ -128,10 +128,10 @@ static void handle_linger(struct connect_s *conn, struct timeval *tv);
static void finish_connection(struct connect_s *conn, struct timeval *tv); static void finish_connection(struct connect_s *conn, struct timeval *tv);
static void clear_connection(struct connect_s *conn, struct timeval *tv); static void clear_connection(struct connect_s *conn, struct timeval *tv);
static void really_clear_connection(struct connect_s *conn); static void really_clear_connection(struct connect_s *conn);
static void idle(ClientData client_data, struct timeval *nowp); static void idle(clientdata client_data, struct timeval *nowp);
static void linger_clear_connection(ClientData client_data, static void linger_clear_connection(clientdata client_data,
struct timeval *nowp); struct timeval *nowp);
static void occasional(ClientData client_data, struct timeval *nowp); static void occasional(clientdata client_data, struct timeval *nowp);
/**************************************************************************** /****************************************************************************
* Private Functions * Private Functions
@ -524,7 +524,7 @@ static void finish_connection(struct connect_s *conn, struct timeval *tv)
static void clear_connection(struct connect_s *conn, struct timeval *tv) static void clear_connection(struct connect_s *conn, struct timeval *tv)
{ {
ClientData client_data; clientdata client_data;
if (conn->wakeup_timer != NULL) if (conn->wakeup_timer != NULL)
{ {
@ -594,7 +594,7 @@ static void really_clear_connection(struct connect_s *conn)
free_connections = conn; free_connections = conn;
} }
static void idle(ClientData client_data, struct timeval *nowp) static void idle(clientdata client_data, struct timeval *nowp)
{ {
int cnum; int cnum;
struct connect_s *conn; struct connect_s *conn;
@ -629,7 +629,7 @@ static void idle(ClientData client_data, struct timeval *nowp)
} }
} }
static void linger_clear_connection(ClientData client_data, static void linger_clear_connection(clientdata client_data,
struct timeval *nowp) struct timeval *nowp)
{ {
struct connect_s *conn; struct connect_s *conn;
@ -640,7 +640,7 @@ static void linger_clear_connection(ClientData client_data,
really_clear_connection(conn); really_clear_connection(conn);
} }
static void occasional(ClientData client_data, struct timeval *nowp) static void occasional(clientdata client_data, struct timeval *nowp)
{ {
tmr_cleanup(); tmr_cleanup();
} }
@ -727,7 +727,7 @@ int thttpd_main(int argc, char **argv)
/* Set up the occasional timer */ /* Set up the occasional timer */
if (tmr_create(NULL, occasional, JunkClientData, if (tmr_create(NULL, occasional, junkclientdata,
CONFIG_THTTPD_OCCASIONAL_MSEC * 1000L, 1) == NULL) CONFIG_THTTPD_OCCASIONAL_MSEC * 1000L, 1) == NULL)
{ {
nerr("ERROR: tmr_create(occasional) failed\n"); nerr("ERROR: tmr_create(occasional) failed\n");
@ -736,7 +736,7 @@ int thttpd_main(int argc, char **argv)
/* Set up the idle timer */ /* Set up the idle timer */
if (tmr_create(NULL, idle, JunkClientData, 5 * 1000L, 1) == NULL) if (tmr_create(NULL, idle, junkclientdata, 5 * 1000L, 1) == NULL)
{ {
nerr("ERROR: tmr_create(idle) failed\n"); nerr("ERROR: tmr_create(idle) failed\n");
exit(1); exit(1);

View File

@ -717,7 +717,7 @@ static int cgi_child(int argc, char **argv)
{ {
FAR httpd_conn *hc = (FAR httpd_conn *)strtoul(argv[1], NULL, 16); FAR httpd_conn *hc = (FAR httpd_conn *)strtoul(argv[1], NULL, 16);
#if CONFIG_THTTPD_CGI_TIMELIMIT > 0 #if CONFIG_THTTPD_CGI_TIMELIMIT > 0
ClientData client_data; clientdata client_data;
#endif #endif
FAR char **argp; FAR char **argp;
FAR struct cgi_conn_s *cc; FAR struct cgi_conn_s *cc;
@ -1096,7 +1096,7 @@ errout_with_sem:
} }
#if CONFIG_THTTPD_CGI_TIMELIMIT > 0 #if CONFIG_THTTPD_CGI_TIMELIMIT > 0
static void cgi_kill(ClientData client_data, struct timeval *nowp) static void cgi_kill(clientdata client_data, struct timeval *nowp)
{ {
pid_t pid = (pid_t)client_data.i; pid_t pid = (pid_t)client_data.i;

View File

@ -7,7 +7,8 @@
* *
* Derived from the file libhttpd.c in the original THTTPD package: * Derived from the file libhttpd.c in the original THTTPD package:
* *
* Copyright (C) 1995,1998,1999,2000,2001 by Jef Poskanzer <jef@mail.acme.com>. * Copyright (C) 1995,1998,1999,2000,2001 by Jef Poskanzer
* <jef@mail.acme.com>.
* All rights reserved. * All rights reserved.
* *
* Redistribution and use in source and binary forms, with or without * Redistribution and use in source and binary forms, with or without
@ -55,7 +56,7 @@
extern int cgi(httpd_conn *hc); extern int cgi(httpd_conn *hc);
#if CONFIG_THTTPD_CGI_TIMELIMIT > 0 #if CONFIG_THTTPD_CGI_TIMELIMIT > 0
struct timeval; struct timeval;
static void cgi_kill(ClientData client_data, struct timeval *now); static void cgi_kill(clientdata client_data, struct timeval *now);
#endif #endif
#endif /* CONFIG_THTTPD && CONFIG_THTTPD_CGI_PATTERN */ #endif /* CONFIG_THTTPD && CONFIG_THTTPD_CGI_PATTERN */

View File

@ -57,20 +57,20 @@
* Private Data * Private Data
****************************************************************************/ ****************************************************************************/
static Timer *timers[HASH_SIZE]; static timer *timers[HASH_SIZE];
static Timer *free_timers; static timer *free_timers;
/**************************************************************************** /****************************************************************************
* Public Data * Public Data
****************************************************************************/ ****************************************************************************/
ClientData JunkClientData; clientdata junkclientdata;
/**************************************************************************** /****************************************************************************
* Private Functions * Private Functions
****************************************************************************/ ****************************************************************************/
static unsigned int hash(Timer *tmr) static unsigned int hash(timer *tmr)
{ {
/* We can hash on the trigger time, even though it can change over the /* We can hash on the trigger time, even though it can change over the
* life of a timer via the periodic bit. * life of a timer via the periodic bit.
@ -82,11 +82,11 @@ static unsigned int hash(Timer *tmr)
(unsigned int)tmr->time.tv_usec) % HASH_SIZE; (unsigned int)tmr->time.tv_usec) % HASH_SIZE;
} }
static void l_add(Timer *tmr) static void l_add(timer *tmr)
{ {
int h = tmr->hash; int h = tmr->hash;
register Timer *tmr2; register timer *tmr2;
register Timer *tmr2prev; register timer *tmr2prev;
tmr2 = timers[h]; tmr2 = timers[h];
if (tmr2 == NULL) if (tmr2 == NULL)
@ -139,7 +139,7 @@ static void l_add(Timer *tmr)
} }
} }
static void l_remove(Timer *tmr) static void l_remove(timer *tmr)
{ {
int h = tmr->hash; int h = tmr->hash;
@ -158,7 +158,7 @@ static void l_remove(Timer *tmr)
} }
} }
static void l_resort(Timer *tmr) static void l_resort(timer *tmr)
{ {
/* Remove the timer from its old list. */ /* Remove the timer from its old list. */
@ -189,10 +189,10 @@ void tmr_init(void)
free_timers = NULL; free_timers = NULL;
} }
Timer *tmr_create(struct timeval *now, TimerProc *timer_proc, timer *tmr_create(struct timeval *now, timerproc *timer_proc,
ClientData client_data, long msecs, int periodic) clientdata client_data, long msecs, int periodic)
{ {
Timer *tmr; timer *tmr;
if (free_timers != NULL) if (free_timers != NULL)
{ {
@ -201,7 +201,7 @@ Timer *tmr_create(struct timeval *now, TimerProc *timer_proc,
} }
else else
{ {
tmr = (Timer*)httpd_malloc(sizeof(Timer)); tmr = (timer *)httpd_malloc(sizeof(timer));
if (!tmr) if (!tmr)
{ {
return NULL; return NULL;
@ -244,7 +244,7 @@ long tmr_mstimeout(struct timeval *now)
int gotone; int gotone;
long msecs; long msecs;
long m; long m;
register Timer *tmr; register timer *tmr;
gotone = 0; gotone = 0;
msecs = 0; msecs = 0;
@ -288,8 +288,8 @@ long tmr_mstimeout(struct timeval *now)
void tmr_run(struct timeval *now) void tmr_run(struct timeval *now)
{ {
int h; int h;
Timer *tmr; timer *tmr;
Timer *next; timer *next;
for (h = 0; h < HASH_SIZE; ++h) for (h = 0; h < HASH_SIZE; ++h)
{ {
@ -331,7 +331,7 @@ void tmr_run(struct timeval *now)
} }
} }
void tmr_cancel(Timer *tmr) void tmr_cancel(timer *tmr)
{ {
/* Remove it from its active list. */ /* Remove it from its active list. */
@ -346,13 +346,13 @@ void tmr_cancel(Timer *tmr)
void tmr_cleanup(void) void tmr_cleanup(void)
{ {
Timer *tmr; timer *tmr;
while (free_timers != NULL) while (free_timers != NULL)
{ {
tmr = free_timers; tmr = free_timers;
free_timers = tmr->next; free_timers = tmr->next;
httpd_free((void*)tmr); httpd_free((void *)tmr);
} }
} }

View File

@ -65,34 +65,34 @@ typedef union
void *p; void *p;
int i; int i;
long l; long l;
} ClientData; } clientdata;
/* The TimerProc gets called when the timer expires. It gets passed /* The Timerproc gets called when the timer expires. It gets passed
* the ClientData associated with the timer, and a timeval in case * the ClientData associated with the timer, and a timeval in case
* it wants to schedule another timer. * it wants to schedule another timer.
*/ */
typedef void TimerProc(ClientData client_data, struct timeval *nowp); typedef void timerproc(clientdata client_data, struct timeval *nowp);
/* The Timer struct. */ /* The Timer struct. */
typedef struct TimerStruct typedef struct timerstruct
{ {
TimerProc *timer_proc; timerproc *timer_proc;
ClientData client_data; clientdata client_data;
long msecs; long msecs;
int periodic; int periodic;
struct timeval time; struct timeval time;
struct TimerStruct *prev; struct timerstruct *prev;
struct TimerStruct *next; struct timerstruct *next;
int hash; int hash;
} Timer; } timer;
/**************************************************************************** /****************************************************************************
* Public Data * Public Data
****************************************************************************/ ****************************************************************************/
extern ClientData JunkClientData; /* For use when you don't care */ extern clientdata junkclientdata; /* For use when you don't care */
/**************************************************************************** /****************************************************************************
* Public Function Prototypes * Public Function Prototypes
@ -103,11 +103,11 @@ extern ClientData JunkClientData; /* For use when you don't care */
extern void tmr_init(void); extern void tmr_init(void);
/* Set up a timer, either periodic or one-shot. /* Set up a timer, either periodic or one-shot.
* Returns (Timer *)0 on errors. * Returns (timer *)0 on errors.
*/ */
extern Timer *tmr_create(struct timeval *nowp, TimerProc *timer_proc, extern timer *tmr_create(struct timeval *nowp, timerproc *timer_proc,
ClientData client_data, long msecs, int periodic); clientdata client_data, long msecs, int periodic);
/* Returns a timeout in milliseconds indicating how long until the next timer /* Returns a timeout in milliseconds indicating how long until the next timer
* triggers. You can just put the call to this routine right in your poll(). * triggers. You can just put the call to this routine right in your poll().
@ -126,7 +126,7 @@ extern void tmr_run(struct timeval *nowp);
* descheduled when they run, so you don't have to call this on them. * descheduled when they run, so you don't have to call this on them.
*/ */
extern void tmr_cancel(Timer *timer); extern void tmr_cancel(timer *timer);
/* Clean up the timers package, freeing any unused storage. */ /* Clean up the timers package, freeing any unused storage. */