1
0
mirror of https://github.com/lammertb/libhttp.git synced 2025-09-03 01:21:16 +03:00

Autoformat *.inl

This commit is contained in:
bel
2015-05-21 23:15:10 +02:00
parent d51c38a5cb
commit 10372ce328
3 changed files with 34 additions and 19 deletions

View File

@@ -151,7 +151,7 @@ static void die(const char *fmt, ...)
} }
#ifdef WIN32 #ifdef WIN32
static int MakeConsole(); static int MakeConsole(void);
#endif #endif
static void show_server_name(void) static void show_server_name(void)
@@ -1115,7 +1115,7 @@ static BOOL CALLBACK InputDlgProc(HWND hDlg, UINT msg, WPARAM wParam, LPARAM lP)
return FALSE; return FALSE;
} }
void suggest_passwd(char *passwd) static void suggest_passwd(char *passwd)
{ {
unsigned u; unsigned u;
char *p; char *p;
@@ -1953,7 +1953,7 @@ WindowProc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam)
return DefWindowProc(hWnd, msg, wParam, lParam); return DefWindowProc(hWnd, msg, wParam, lParam);
} }
static int MakeConsole() static int MakeConsole(void)
{ {
DWORD err; DWORD err;
int ok = (GetConsoleWindow() != NULL); int ok = (GetConsoleWindow() != NULL);

View File

@@ -65,8 +65,8 @@ extern "C" {
MD5_STATIC void md5_init(md5_state_t *pms); MD5_STATIC void md5_init(md5_state_t *pms);
/* Append a string to the message. */ /* Append a string to the message. */
MD5_STATIC void md5_append(md5_state_t *pms, const md5_byte_t *data, MD5_STATIC void
size_t nbytes); md5_append(md5_state_t *pms, const md5_byte_t *data, size_t nbytes);
/* Finish the message and return the digest. */ /* Finish the message and return the digest. */
MD5_STATIC void md5_finish(md5_state_t *pms, md5_byte_t digest[16]); MD5_STATIC void md5_finish(md5_state_t *pms, md5_byte_t digest[16]);
@@ -207,7 +207,8 @@ MD5_STATIC void md5_finish(md5_state_t *pms, md5_byte_t digest[16]);
#define T63 (0x2ad7d2bb) #define T63 (0x2ad7d2bb)
#define T64 /* 0xeb86d391 */ (T_MASK ^ 0x14792c6e) #define T64 /* 0xeb86d391 */ (T_MASK ^ 0x14792c6e)
static void md5_process(md5_state_t *pms, const md5_byte_t *data /*[64]*/) { static void md5_process(md5_state_t *pms, const md5_byte_t *data /*[64]*/)
{
md5_word_t a = pms->abcd[0], b = pms->abcd[1], c = pms->abcd[2], md5_word_t a = pms->abcd[0], b = pms->abcd[1], c = pms->abcd[2],
d = pms->abcd[3]; d = pms->abcd[3];
md5_word_t t; md5_word_t t;
@@ -394,7 +395,8 @@ static void md5_process(md5_state_t *pms, const md5_byte_t *data /*[64]*/) {
pms->abcd[3] += d; pms->abcd[3] += d;
} }
MD5_STATIC void md5_init(md5_state_t *pms) { MD5_STATIC void md5_init(md5_state_t *pms)
{
pms->count[0] = pms->count[1] = 0; pms->count[0] = pms->count[1] = 0;
pms->abcd[0] = 0x67452301; pms->abcd[0] = 0x67452301;
pms->abcd[1] = /*0xefcdab89*/ T_MASK ^ 0x10325476; pms->abcd[1] = /*0xefcdab89*/ T_MASK ^ 0x10325476;
@@ -402,8 +404,9 @@ MD5_STATIC void md5_init(md5_state_t *pms) {
pms->abcd[3] = 0x10325476; pms->abcd[3] = 0x10325476;
} }
MD5_STATIC void md5_append(md5_state_t *pms, const md5_byte_t *data, MD5_STATIC void
size_t nbytes) { md5_append(md5_state_t *pms, const md5_byte_t *data, size_t nbytes)
{
const md5_byte_t *p = data; const md5_byte_t *p = data;
size_t left = nbytes; size_t left = nbytes;
size_t offset = (pms->count[0] >> 3) & 63; size_t offset = (pms->count[0] >> 3) & 63;
@@ -439,7 +442,8 @@ MD5_STATIC void md5_append(md5_state_t *pms, const md5_byte_t *data,
memcpy(pms->buf, p, left); memcpy(pms->buf, p, left);
} }
MD5_STATIC void md5_finish(md5_state_t *pms, md5_byte_t digest[16]) { MD5_STATIC void md5_finish(md5_state_t *pms, md5_byte_t digest[16])
{
static const md5_byte_t pad[64] = { static const md5_byte_t pad[64] = {
0x80, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0x80, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,

View File

@@ -19,8 +19,13 @@ struct ttimers {
unsigned timer_count; /* Current size of timer list */ unsigned timer_count; /* Current size of timer list */
}; };
static int timer_add(struct mg_context *ctx, double next_time, double period, static int timer_add(struct mg_context *ctx,
int is_relative, taction action, void *arg) { double next_time,
double period,
int is_relative,
taction action,
void *arg)
{
unsigned u, v; unsigned u, v;
int error = 0; int error = 0;
struct timespec now; struct timespec now;
@@ -57,7 +62,8 @@ static int timer_add(struct mg_context *ctx, double next_time, double period,
return error; return error;
} }
static void timer_thread_run(void *thread_func_param) { static void timer_thread_run(void *thread_func_param)
{
struct mg_context *ctx = (struct mg_context *)thread_func_param; struct mg_context *ctx = (struct mg_context *)thread_func_param;
struct timespec now; struct timespec now;
double d; double d;
@@ -67,8 +73,9 @@ static void timer_thread_run(void *thread_func_param) {
#if defined(HAVE_CLOCK_NANOSLEEP) /* Linux with librt */ #if defined(HAVE_CLOCK_NANOSLEEP) /* Linux with librt */
/* TODO */ /* TODO */
while (clock_nanosleep(CLOCK_MONOTONIC, TIMER_ABSTIME, &request, while (
&request) == EINTR) { /*nop*/ clock_nanosleep(CLOCK_MONOTONIC, TIMER_ABSTIME, &request, &request) ==
EINTR) { /*nop*/
; ;
} }
#else #else
@@ -99,18 +106,21 @@ static void timer_thread_run(void *thread_func_param) {
} }
#ifdef _WIN32 #ifdef _WIN32
static unsigned __stdcall timer_thread(void *thread_func_param) { static unsigned __stdcall timer_thread(void *thread_func_param)
{
timer_thread_run(thread_func_param); timer_thread_run(thread_func_param);
return 0; return 0;
} }
#else #else
static void *timer_thread(void *thread_func_param) { static void *timer_thread(void *thread_func_param)
{
timer_thread_run(thread_func_param); timer_thread_run(thread_func_param);
return NULL; return NULL;
} }
#endif /* _WIN32 */ #endif /* _WIN32 */
static int timers_init(struct mg_context *ctx) { static int timers_init(struct mg_context *ctx)
{
ctx->timers = (struct ttimers *)mg_calloc(sizeof(struct ttimers), 1); ctx->timers = (struct ttimers *)mg_calloc(sizeof(struct ttimers), 1);
(void)pthread_mutex_init(&ctx->timers->mutex, NULL); (void)pthread_mutex_init(&ctx->timers->mutex, NULL);
@@ -120,7 +130,8 @@ static int timers_init(struct mg_context *ctx) {
return 0; return 0;
} }
static void timers_exit(struct mg_context *ctx) { static void timers_exit(struct mg_context *ctx)
{
if (ctx->timers) { if (ctx->timers) {
(void)pthread_mutex_destroy(&ctx->timers->mutex); (void)pthread_mutex_destroy(&ctx->timers->mutex);
mg_free(ctx->timers); mg_free(ctx->timers);