From patchwork Sat Dec 26 11:20:05 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Stefano Babic X-Patchwork-Id: 1420674 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=googlegroups.com (client-ip=2a00:1450:4864:20::43e; helo=mail-wr1-x43e.google.com; envelope-from=swupdate+bncbcxploxj6ikrb4fytt7qkgqexpueiqa@googlegroups.com; receiver=) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=denx.de Authentication-Results: ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=googlegroups.com header.i=@googlegroups.com header.a=rsa-sha256 header.s=20161025 header.b=gJw6Luer; dkim-atps=neutral Received: from mail-wr1-x43e.google.com (mail-wr1-x43e.google.com [IPv6:2a00:1450:4864:20::43e]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 4D31ZD2bdJz9sWc for ; Sat, 26 Dec 2020 22:20:20 +1100 (AEDT) Received: by mail-wr1-x43e.google.com with SMTP id w8sf2714632wrv.18 for ; Sat, 26 Dec 2020 03:20:20 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1608981616; cv=pass; d=google.com; s=arc-20160816; b=HRyBcs3sdYl/h32fpRE6GIjRywFI0e0ZY9Fz+9Y6q5cxE/M6ARJSjnmvia1Qbf8J2G oNmn+MXTXuNDNZw8vDZh3WZHfja4NBW0cvXgjIW+CxiqPlDBuS4B9by11KJVIH+gjNR5 9W/yelSnwV+x4tyqAedKaNey7ma03SlUgrjPRuOgwpU44KxWDBnm0aN/uMx/bdNVgcnZ KiZX7Q49d0AzSnn6jhp0K8rHR3WQsy9GKG5zpjZcJSHnKU7VU4z5YAYnDNjpUxUkpM3W YBxzNidkdgwTl4I1sPB5vaTskLj3P3DFi/RyXX5/k15wBnT3LzeOTRCl+2IdgPvRL8pM jPJg== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-unsubscribe:list-subscribe:list-archive:list-help:list-post :list-id:mailing-list:precedence:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:sender:dkim-signature; bh=gAMmxzRt28Hsf4C5/IQZ4PHy37dFfYWFye2YxRVKNbk=; b=NbKlK1jv2hBj0Z8tYs2GVcndlxWjZNmLFj1sR3QUpMCP3mU3bRJeMSCYSmLx/Kr3vs lnwaCmv09MMojzgJQxNhWJMv3U6nK2sLKr30x7c9WsdZh1X4BWzMpFwmkBOZ2fbh6bCa ZnyqYzU4JIadMp3sUQHL/A7MScp00nOz/aH4qksif9FL61vdMddpDNuPz8r4eTOz7tUQ hgZkyFmLvFrerZ1mUrWnjl+wJvhqhJEXgvYhWMpNCwH5wU43xV7uNa4fwAOTbJj3V9kv QCtl86fM7JyIdV0Yj63Ql7Y48x19IJTkhndKwcWfTQ7PJAkuCY7J6FV9rwQYdc9/sB0V 6iJw== ARC-Authentication-Results: i=2; gmr-mx.google.com; spf=neutral (google.com: 212.18.0.9 is neither permitted nor denied by best guess record for domain of sbabic@denx.de) smtp.mailfrom=sbabic@denx.de DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=googlegroups.com; s=20161025; h=sender:from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:x-original-sender:x-original-authentication-results :precedence:mailing-list:list-id:list-post:list-help:list-archive :list-subscribe:list-unsubscribe; bh=gAMmxzRt28Hsf4C5/IQZ4PHy37dFfYWFye2YxRVKNbk=; b=gJw6Luer5uSn5KLGiPy2U44ReUa2qGwPYBcVE39ITXwM2gVAPO+meRoIr9HyBp6XcN 0dmHTwf5E15gyRlGa2rqg+rHeNHILmxmgJ8bwWE/FWe1lQ30pvhEPkLXA58FbwDV9CMf kPPeCjElGoOnxaxvCv+ZjM4FXEn9cEhisamJMIqay35QPtTjrEgKeIloVRLVBlq3tHhg VoZNsMYoJnfNxAjDUpdJuwAOC5hy6F8a5/GkP8fonq2fmmr2nDi9b1EFUFlqaLuM+HTr LPXUu2BtLeSNo+f9rsaPacICnB8ctK25oiKLpFX7fcGWujNg4bcmXg2YoS4BLrytIqCz VeDQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=sender:x-gm-message-state:from:to:cc:subject:date:message-id :in-reply-to:references:mime-version:x-original-sender :x-original-authentication-results:precedence:mailing-list:list-id :x-spam-checked-in-group:list-post:list-help:list-archive :list-subscribe:list-unsubscribe; bh=gAMmxzRt28Hsf4C5/IQZ4PHy37dFfYWFye2YxRVKNbk=; b=ME2VVC1PPns9879Gu1d+ih2MLAHoZL5ic5/QgpeHoCw1GIEZrWOCHivQudst1LtqoS IF+oa8vIhGa8JhqCRhIbw6NHW/sOBtFuI1otMxr4SKBlVyzReMwJW34v3eNmgDvMQ8/S Br6l5ndW7J0fdSAIxuS8U3rIwRlox6dBWa0UrEF8Hoa3OEp/MnUQRHFJWjNRfDtIfOgu x0Iehtoxghn3puNi6u0W98gdPGaC88SziC44VSEZhJm/CHWWIFNy1QWNfcQVOw4OmUst WPPGFea8xhb0n1kd2Bwf/ei/bEgOnLpy/noDzJq+NuyfWMjSnHr86XRcab1/0Q/vzT+c sAgQ== Sender: swupdate@googlegroups.com X-Gm-Message-State: AOAM533Jn6HlSyaiBii+2C+XhlVpTwKCt62TL31f7ikLulCD6409dQ4+ wovysBunn4L3rhOVbpMyIxk= X-Google-Smtp-Source: ABdhPJwD+FDHEyrneHrV9DMgn6n8wReJiBPVwbuUnhXwJdgJlbBJ89Td8UiMBOSciC8mbUXfal0AeQ== X-Received: by 2002:adf:c109:: with SMTP id r9mr30409182wre.261.1608981616678; Sat, 26 Dec 2020 03:20:16 -0800 (PST) X-BeenThere: swupdate@googlegroups.com Received: by 2002:a5d:6812:: with SMTP id w18ls16424532wru.1.gmail; Sat, 26 Dec 2020 03:20:15 -0800 (PST) X-Received: by 2002:a5d:6902:: with SMTP id t2mr41866683wru.214.1608981615581; Sat, 26 Dec 2020 03:20:15 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1608981615; cv=none; d=google.com; s=arc-20160816; b=ulLF8xm8ul0SMpstD/Clas3mAex/GIabDjHWj45p36HvJ9IE/avP8pIZyQrkkVq5Uo 3RQ3QkMGaBJC5ns4fy9olYcheii++FKOliSGD0qW9/w0+3+tHxSTraj33+VuogVpeLZD BvqE7YQKqYbS/GcPHHK4UjiPnYdPVug66pJQ8XeF4ApqUZFsb4ED+STCv+BWMfOOoA5j IC5X5+CdHYBUVN6252RHHF0hf3KYsvJ7SKw15JuJ8nwgUrVVNqUoKfryiFqHpwL2WuKJ lo3DGIIzJ9TqxQ6c/mvTEw/afgb/6VdVg9ufKBAdulUC8N7awUHcJkD8LnJWLrSUqVuD ukjw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from; bh=NjtNQV0S1WD0dG129b3iC4ckkj7wx8RzZjUvRQ8K3No=; b=Eq1MIgdcu+xgvHbZjDEu9L9bsY9fakGiyNCRVGpkLWSFjBFoT9ek90qWfi3FBH1NLm IZ7tjVnt8ZX828z3uNk7g4fKCdAkJ4GVyrfvLKOSeKDZBmo2mNYBE50H3DoyRfsBrln3 BIyqOXRKmhitXJzPyj+JV0Tond6IRfNKu2MgEtQEuI2qodWPbjxwOav031M4v7DiOTXw tCYPkWMwP4bsj+P+S0jx8qcRoUnITA7jz32mYPUBA7XsPGaJaucAea6IxRmE6wb/p38D w8haxo7viKVzr1v51Nf070HDc4JwPFQWJNfLnxv0VF3A6X8YAxstOjBbxe9zdNqmuYaV 8Q3Q== ARC-Authentication-Results: i=1; gmr-mx.google.com; spf=neutral (google.com: 212.18.0.9 is neither permitted nor denied by best guess record for domain of sbabic@denx.de) smtp.mailfrom=sbabic@denx.de Received: from mail-out.m-online.net (mail-out.m-online.net. [212.18.0.9]) by gmr-mx.google.com with ESMTPS id n8si1168623wrr.0.2020.12.26.03.20.15 for (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Sat, 26 Dec 2020 03:20:15 -0800 (PST) Received-SPF: neutral (google.com: 212.18.0.9 is neither permitted nor denied by best guess record for domain of sbabic@denx.de) client-ip=212.18.0.9; Received: from frontend01.mail.m-online.net (unknown [192.168.8.182]) by mail-out.m-online.net (Postfix) with ESMTP id 4D31Z72VgDz1qs0Z; Sat, 26 Dec 2020 12:20:15 +0100 (CET) Received: from localhost (dynscan1.mnet-online.de [192.168.6.70]) by mail.m-online.net (Postfix) with ESMTP id 4D31Z72Kqwz1qr4k; Sat, 26 Dec 2020 12:20:15 +0100 (CET) X-Virus-Scanned: amavisd-new at mnet-online.de Received: from mail.mnet-online.de ([192.168.8.182]) by localhost (dynscan1.mail.m-online.net [192.168.6.70]) (amavisd-new, port 10024) with ESMTP id sqexeDnzVlQv; Sat, 26 Dec 2020 12:20:13 +0100 (CET) Received: from babic.homelinux.org (host-88-217-136-221.customer.m-online.net [88.217.136.221]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.mnet-online.de (Postfix) with ESMTPS; Sat, 26 Dec 2020 12:20:13 +0100 (CET) Received: from localhost (mail.babic.homelinux.org [127.0.0.1]) by babic.homelinux.org (Postfix) with ESMTP id D1EEB4540360; Sat, 26 Dec 2020 12:20:12 +0100 (CET) X-Virus-Scanned: Debian amavisd-new at babic.homelinux.org Received: from babic.homelinux.org ([127.0.0.1]) by localhost (mail.babic.homelinux.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id hips86lgXsc0; Sat, 26 Dec 2020 12:20:09 +0100 (CET) Received: from paperino.fritz.box (paperino.fritz.box [192.168.178.64]) by babic.homelinux.org (Postfix) with ESMTP id 0BD2245405C4; Sat, 26 Dec 2020 12:20:07 +0100 (CET) From: Stefano Babic To: swupdate@googlegroups.com Cc: Stefano Babic Subject: [swupdate] [PATCH 3/3] Fix warnings in mongoose code Date: Sat, 26 Dec 2020 12:20:05 +0100 Message-Id: <20201226112005.14553-3-sbabic@denx.de> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20201226112005.14553-1-sbabic@denx.de> References: <20201226112005.14553-1-sbabic@denx.de> MIME-Version: 1.0 X-Original-Sender: sbabic@denx.de X-Original-Authentication-Results: gmr-mx.google.com; spf=neutral (google.com: 212.18.0.9 is neither permitted nor denied by best guess record for domain of sbabic@denx.de) smtp.mailfrom=sbabic@denx.de Precedence: list Mailing-list: list swupdate@googlegroups.com; contact swupdate+owners@googlegroups.com List-ID: X-Spam-Checked-In-Group: swupdate@googlegroups.com X-Google-Group-Id: 605343134186 List-Post: , List-Help: , List-Archive: , List-Unsubscribe: , - Add SPDX header - Add missing void parameter type to function declarations - Use internal linkage for local functions (add static) - Remove second declaration of a variable inside sub block (variable is shadowed) Signed-off-by: Stefano Babic --- mongoose/mongoose.c | 74 +++++++++++++++++++++++---------------------- mongoose/mongoose.h | 6 ++-- 2 files changed, 42 insertions(+), 38 deletions(-) diff --git a/mongoose/mongoose.c b/mongoose/mongoose.c index fde66de..aa23471 100644 --- a/mongoose/mongoose.c +++ b/mongoose/mongoose.c @@ -3,6 +3,8 @@ * Copyright (c) 2013-2020 Cesanta Software Limited * All rights reserved * + * SPDX-License-Identifier: GPL-2.0 + * * This software is dual-licensed: you can redistribute it and/or modify * it under the terms of the GNU General Public License version 2 as * published by the Free Software Foundation. For the terms of this @@ -625,9 +627,9 @@ int cs_log_print_prefix(enum cs_log_level level, const char *file, int ln) { if (s_file_level != NULL) { enum cs_log_level pll = cs_log_level; - struct mg_str fl = mg_mk_str(s_file_level), ps = MG_MK_STR_N(prefix, pl); + struct mg_str mgfl = mg_mk_str(s_file_level), ps = MG_MK_STR_N(prefix, pl); struct mg_str k, v; - while ((fl = mg_next_comma_list_entry_n(fl, &k, &v)).p != NULL) { + while ((mgfl = mg_next_comma_list_entry_n(mgfl, &k, &v)).p != NULL) { bool yes = !(!mg_str_starts_with(ps, k) || v.len == 0); if (!yes) continue; pll = (enum cs_log_level)(*v.p - '0'); @@ -1201,7 +1203,7 @@ static uint32_t blk0(union char64long16 *block, int i) { z += (w ^ x ^ y) + blk(i) + 0xCA62C1D6 + rol(v, 5); \ w = rol(w, 30); -void cs_sha1_transform(uint32_t state[5], const unsigned char buffer[64]) { +static void cs_sha1_transform(uint32_t state[5], const unsigned char buffer[64]) { uint32_t a, b, c, d, e; union char64long16 block[1]; @@ -2367,7 +2369,7 @@ int mg_if_poll(struct mg_connection *nc, double now) { return 1; } -void mg_destroy_conn(struct mg_connection *conn, int destroy_if) { +static void mg_destroy_conn(struct mg_connection *conn, int destroy_if) { if (conn->sock != INVALID_SOCKET) { /* Don't print timer-only conns */ LOG(LL_DEBUG, ("%p 0x%lx %d", conn, conn->flags, destroy_if)); } @@ -3083,7 +3085,7 @@ struct mg_connection *mg_connect(struct mg_mgr *mgr, const char *address, return mg_connect_opt(mgr, address, MG_CB(callback, user_data), opts); } -void mg_ev_handler_empty(struct mg_connection *c, int ev, +static void mg_ev_handler_empty(struct mg_connection *c, int ev, void *ev_data MG_UD_ARG(void *user_data)) { (void) c; (void) ev; @@ -3376,13 +3378,13 @@ double mg_set_timer(struct mg_connection *c, double timestamp) { return result; } -void mg_sock_set(struct mg_connection *nc, sock_t sock) { +static void mg_sock_set(struct mg_connection *nc, sock_t sock) { if (sock != INVALID_SOCKET) { nc->iface->vtable->sock_set(nc, sock); } } -void mg_if_get_conn_addr(struct mg_connection *nc, int remote, +static void mg_if_get_conn_addr(struct mg_connection *nc, int remote, union socket_address *sa) { nc->iface->vtable->get_conn_addr(nc, remote, sa); } @@ -3559,14 +3561,14 @@ static int mg_null_if_udp_send(struct mg_connection *c, const void *buf, return -1; } -int mg_null_if_tcp_recv(struct mg_connection *c, void *buf, size_t len) { +static int mg_null_if_tcp_recv(struct mg_connection *c, void *buf, size_t len) { (void) c; (void) buf; (void) len; return -1; } -int mg_null_if_udp_recv(struct mg_connection *c, void *buf, size_t len, +static int mg_null_if_udp_recv(struct mg_connection *c, void *buf, size_t len, union socket_address *sa, size_t *sa_len) { (void) c; (void) buf; @@ -3655,7 +3657,7 @@ const struct mg_iface_vtable mg_default_iface_vtable = MG_NULL_IFACE_VTABLE; static sock_t mg_open_listening_socket(union socket_address *sa, int type, int proto); -void mg_set_non_blocking_mode(sock_t sock) { +static void mg_set_non_blocking_mode(sock_t sock) { #ifdef _WIN32 unsigned long on = 1; ioctlsocket(sock, FIONBIO, &on); @@ -3677,7 +3679,7 @@ static int mg_is_error(void) { ; } -void mg_socket_if_connect_tcp(struct mg_connection *nc, +static void mg_socket_if_connect_tcp(struct mg_connection *nc, const union socket_address *sa) { int rc, proto = 0; nc->sock = socket(AF_INET, SOCK_STREAM, proto); @@ -3694,7 +3696,7 @@ void mg_socket_if_connect_tcp(struct mg_connection *nc, mg_get_errno(), nc->err)); } -void mg_socket_if_connect_udp(struct mg_connection *nc) { +static void mg_socket_if_connect_udp(struct mg_connection *nc) { nc->sock = socket(AF_INET, SOCK_DGRAM, 0); if (nc->sock == INVALID_SOCKET) { nc->err = mg_get_errno() ? mg_get_errno() : 1; @@ -3711,7 +3713,7 @@ void mg_socket_if_connect_udp(struct mg_connection *nc) { nc->err = 0; } -int mg_socket_if_listen_tcp(struct mg_connection *nc, +static int mg_socket_if_listen_tcp(struct mg_connection *nc, union socket_address *sa) { int proto = 0; sock_t sock = mg_open_listening_socket(sa, SOCK_STREAM, proto); @@ -3766,12 +3768,12 @@ static int mg_socket_if_udp_recv(struct mg_connection *nc, void *buf, return n; } -int mg_socket_if_create_conn(struct mg_connection *nc) { +static int mg_socket_if_create_conn(struct mg_connection *nc) { (void) nc; return 1; } -void mg_socket_if_destroy_conn(struct mg_connection *nc) { +static void mg_socket_if_destroy_conn(struct mg_connection *nc) { if (nc->sock == INVALID_SOCKET) return; if (!(nc->flags & MG_F_UDP)) { closesocket(nc->sock); @@ -3857,7 +3859,7 @@ static sock_t mg_open_listening_socket(union socket_address *sa, int type, #define _MG_F_FD_CAN_WRITE 1 << 1 #define _MG_F_FD_ERROR 1 << 2 -void mg_mgr_handle_conn(struct mg_connection *nc, int fd_flags, double now) { +static void mg_mgr_handle_conn(struct mg_connection *nc, int fd_flags, double now) { int worth_logging = fd_flags != 0 || (nc->flags & (MG_F_WANT_READ | MG_F_WANT_WRITE)); if (worth_logging) { @@ -3937,14 +3939,14 @@ static void mg_mgr_handle_ctl_sock(struct mg_mgr *mgr) { #endif /* Associate a socket to a connection. */ -void mg_socket_if_sock_set(struct mg_connection *nc, sock_t sock) { +static void mg_socket_if_sock_set(struct mg_connection *nc, sock_t sock) { mg_set_non_blocking_mode(sock); mg_set_close_on_exec(sock); nc->sock = sock; DBG(("%p %d", nc, (int) sock)); } -void mg_socket_if_init(struct mg_iface *iface) { +static void mg_socket_if_init(struct mg_iface *iface) { (void) iface; DBG(("%p using select()", iface->mgr)); #if MG_ENABLE_BROADCAST @@ -3952,19 +3954,19 @@ void mg_socket_if_init(struct mg_iface *iface) { #endif } -void mg_socket_if_free(struct mg_iface *iface) { +static void mg_socket_if_free(struct mg_iface *iface) { (void) iface; } -void mg_socket_if_add_conn(struct mg_connection *nc) { +static void mg_socket_if_add_conn(struct mg_connection *nc) { (void) nc; } -void mg_socket_if_remove_conn(struct mg_connection *nc) { +static void mg_socket_if_remove_conn(struct mg_connection *nc) { (void) nc; } -void mg_add_to_set(sock_t sock, fd_set *set, sock_t *max_fd) { +static void mg_add_to_set(sock_t sock, fd_set *set, sock_t *max_fd) { if (sock != INVALID_SOCKET #ifdef __unix__ && sock < (sock_t) FD_SETSIZE @@ -3977,7 +3979,7 @@ void mg_add_to_set(sock_t sock, fd_set *set, sock_t *max_fd) { } } -time_t mg_socket_if_poll(struct mg_iface *iface, int timeout_ms) { +static time_t mg_socket_if_poll(struct mg_iface *iface, int timeout_ms) { struct mg_mgr *mgr = iface->mgr; double now = mg_time(); double min_timer; @@ -4184,7 +4186,7 @@ void mg_sock_to_str(sock_t sock, char *buf, size_t len, int flags) { mg_sock_addr_to_str(&sa, buf, len, flags); } -void mg_socket_if_get_conn_addr(struct mg_connection *nc, int remote, +static void mg_socket_if_get_conn_addr(struct mg_connection *nc, int remote, union socket_address *sa) { if ((nc->flags & MG_F_UDP) && remote) { memcpy(sa, &nc->sa, sizeof(*sa)); @@ -6198,12 +6200,12 @@ static void mg_http_transfer_file_data(struct mg_connection *nc) { } else if (pd->file.type == DATA_PUT) { struct mbuf *io = &nc->recv_mbuf; size_t to_write = left <= 0 ? 0 : left < io->len ? (size_t) left : io->len; - size_t n = mg_fwrite(io->buf, 1, to_write, pd->file.fp); - if (n > 0) { - mbuf_remove(io, n); - pd->file.sent += n; + size_t n1 = mg_fwrite(io->buf, 1, to_write, pd->file.fp); + if (n1 > 0) { + mbuf_remove(io, n1); + pd->file.sent += n1; } - if (n == 0 || pd->file.sent >= pd->file.cl) { + if (n1 == 0 || pd->file.sent >= pd->file.cl) { if (!pd->file.keepalive) nc->flags |= MG_F_SEND_AND_CLOSE; mg_http_free_proto_data_file(&pd->file); } @@ -6320,7 +6322,7 @@ MG_INTERNAL size_t mg_handle_chunked(struct mg_connection *nc, return body_len; } -struct mg_http_endpoint *mg_http_get_endpoint_handler(struct mg_connection *nc, +static struct mg_http_endpoint *mg_http_get_endpoint_handler(struct mg_connection *nc, struct mg_str *uri_path) { struct mg_http_proto_data *pd; struct mg_http_endpoint *ret = NULL; @@ -6390,7 +6392,7 @@ static void mg_http_handler2(struct mg_connection *nc, int ev, void *ev_data MG_UD_ARG(void *user_data), struct http_message *hm) { #else /* !__XTENSA__ */ -void mg_http_handler(struct mg_connection *nc, int ev, +static void mg_http_handler(struct mg_connection *nc, int ev, void *ev_data MG_UD_ARG(void *user_data)) { struct http_message shm, *hm = &shm; #endif /* __XTENSA__ */ @@ -6897,7 +6899,7 @@ void mg_set_protocol_http_websocket(struct mg_connection *nc) { nc->proto_handler = mg_http_handler; } -const char *mg_status_message(int status_code) { +static const char *mg_status_message(int status_code) { switch (status_code) { case 206: return "Partial Content"; @@ -7028,7 +7030,7 @@ const char *mg_status_message(int status_code) { } } -void mg_send_response_line_s(struct mg_connection *nc, int status_code, +static void mg_send_response_line_s(struct mg_connection *nc, int status_code, const struct mg_str extra_headers) { mg_printf(nc, "HTTP/1.1 %d %s\r\n", status_code, mg_status_message(status_code)); @@ -7120,7 +7122,7 @@ static int mg_http_parse_range_header(const struct mg_str *header, int64_t *a, return result; } -void mg_http_serve_file_internal(struct mg_connection *nc, +static void mg_http_serve_file_internal(struct mg_connection *nc, struct http_message *hm, const char *path, struct mg_str mime_type, struct mg_str encoding, @@ -7508,7 +7510,7 @@ extern void mg_hash_md5_v(size_t num_msgs, const uint8_t *msgs[], const size_t *msg_lens, uint8_t *digest); #endif -void cs_md5(char buf[33], ...) { +static void cs_md5(char buf[33], ...) { unsigned char hash[16]; const uint8_t *msgs[20], *p; size_t msg_lens[20]; @@ -14574,7 +14576,7 @@ struct mg_ssl_if_ctx { char *ssl_server_name; }; -void mg_ssl_if_init() { +void mg_ssl_if_init(void) { } enum mg_ssl_if_result mg_ssl_if_conn_init( diff --git a/mongoose/mongoose.h b/mongoose/mongoose.h index 3d5d2cb..5ee502d 100644 --- a/mongoose/mongoose.h +++ b/mongoose/mongoose.h @@ -15,6 +15,8 @@ * * Alternatively, you can license this software under a commercial * license, as set out in . + * + * SPDX-License-Identifier: GPL-2.0 */ #ifdef MG_MODULE_LINES @@ -2815,7 +2817,7 @@ struct { \ if (LIST_NEXT((elm), field) != NULL && \ LIST_NEXT((elm), field)->field.le_prev != \ &((elm)->field.le_next)) \ - panic("Bad link elm %p next->prev != elm", (elm)); \ + panic("Bad link elm %p next->prev != elm", (elm)); \ } while (0) #define QMD_LIST_CHECK_PREV(elm, field) do { \ @@ -2958,7 +2960,7 @@ struct { \ #define QMD_TAILQ_CHECK_TAIL(head, field) do { \ if (*(head)->tqh_last != NULL) \ - panic("Bad tailq NEXT(%p->tqh_last) != NULL", (head)); \ + panic("Bad tailq NEXT(%p->tqh_last) != NULL", (head)); \ } while (0) #define QMD_TAILQ_CHECK_NEXT(elm, field) do { \