Add more compiler warnings and fix a few things they pointed out worth improving/being more explicit about. This adds GCC-12 compatibility out of the box.

Signed-off-by: DL6ER <dl6er@dl6er.de>
This commit is contained in:
DL6ER
2023-01-29 14:45:38 +01:00
parent 5f593bfb3b
commit 8753a8d69b
41 changed files with 420 additions and 257 deletions
+1 -1
View File
@@ -33,7 +33,7 @@ int api_docs(struct ftl_conn *api)
(serve_index && strcmp(docs_files[i].path, "index.html") == 0))
{
// Send the file
mg_send_http_ok(api->conn, docs_files[i].mime_type, docs_files[i].content_size);
mg_send_http_ok(api->conn, docs_files[i].mime_type, (long long)docs_files[i].content_size);
return mg_write(api->conn, docs_files[i].content, docs_files[i].content_size);
}
}
+50 -50
View File
@@ -16,103 +16,103 @@
#include "webserver/json_macros.h"
#include "api/api.h"
static const char index_html[] = {
static const unsigned char index_html[] = {
#include "hex/index.html"
};
static const char index_css[] = {
static const unsigned char index_css[] = {
#include "hex/index.css"
};
static const char pi_hole_js[] = {
static const unsigned char pi_hole_js[] = {
#include "hex/pi-hole.js"
};
static const char rapidoc_min_js[] = {
static const unsigned char rapidoc_min_js[] = {
#include "hex/external/rapidoc-min.js"
};
static const char rapidoc_min_map_js[] = {
static const unsigned char rapidoc_min_map_js[] = {
#include "hex/external/rapidoc-min.js.map"
};
static const char highlight_default_min_css[] = {
static const unsigned char highlight_default_min_css[] = {
#include "hex/external/highlight-default.min.css"
};
static const char geraintluff_sha256_min_js[] = {
static const unsigned char geraintluff_sha256_min_js[] = {
#include "hex/external/geraintluff-sha256.min.js"
};
static const char highlight_min_js[] = {
static const unsigned char highlight_min_js[] = {
#include "hex/external/highlight.min.js"
};
static const char images_logo_svg[] = {
static const unsigned char images_logo_svg[] = {
#include "hex/images/logo.svg"
};
static const char specs_auth_yaml[] = {
static const unsigned char specs_auth_yaml[] = {
#include "hex/specs/auth.yaml"
};
static const char specs_clients_yaml[] = {
static const unsigned char specs_clients_yaml[] = {
#include "hex/specs/clients.yaml"
};
static const char specs_common_yaml[] = {
static const unsigned char specs_common_yaml[] = {
#include "hex/specs/common.yaml"
};
static const char specs_dns_yaml[] = {
static const unsigned char specs_dns_yaml[] = {
#include "hex/specs/dns.yaml"
};
static const char specs_domains_yaml[] = {
static const unsigned char specs_domains_yaml[] = {
#include "hex/specs/domains.yaml"
};
static const char specs_info_yaml[] = {
static const unsigned char specs_info_yaml[] = {
#include "hex/specs/info.yaml"
};
static const char specs_groups_yaml[] = {
static const unsigned char specs_groups_yaml[] = {
#include "hex/specs/groups.yaml"
};
static const char specs_history_yaml[] = {
static const unsigned char specs_history_yaml[] = {
#include "hex/specs/history.yaml"
};
static const char specs_lists_yaml[] = {
static const unsigned char specs_lists_yaml[] = {
#include "hex/specs/lists.yaml"
};
static const char specs_main_yaml[] = {
static const unsigned char specs_main_yaml[] = {
#include "hex/specs/main.yaml"
};
static const char specs_queries_yaml[] = {
static const unsigned char specs_queries_yaml[] = {
#include "hex/specs/queries.yaml"
};
static const char specs_stats_yaml[] = {
static const unsigned char specs_stats_yaml[] = {
#include "hex/specs/stats.yaml"
};
static const char specs_config_yaml[] = {
static const unsigned char specs_config_yaml[] = {
#include "hex/specs/config.yaml"
};
static const char specs_network_yaml[] = {
static const unsigned char specs_network_yaml[] = {
#include "hex/specs/network.yaml"
};
static const char specs_logs_yaml[] = {
static const unsigned char specs_logs_yaml[] = {
#include "hex/specs/logs.yaml"
};
static const char specs_endpoints_yaml[] = {
static const unsigned char specs_endpoints_yaml[] = {
#include "hex/specs/endpoints.yaml"
};
struct {
@@ -122,31 +122,31 @@ struct {
const size_t content_size;
} docs_files[] =
{
{"index.html", "text/html", index_html, sizeof(index_html)},
{"index.css", "text/css", index_css, sizeof(index_css)},
{"pi-hole.js", "application/javascript", pi_hole_js, sizeof(pi_hole_js)},
{"external/rapidoc-min.js", "application/javascript", rapidoc_min_js, sizeof(rapidoc_min_js)},
{"external/rapidoc-min.map.js", "text/plain", rapidoc_min_map_js, sizeof(rapidoc_min_map_js)},
{"external/highlight-default.min.css", "text/css", highlight_default_min_css, sizeof(highlight_default_min_css)},
{"external/highlight.min.js", "application/javascript", highlight_min_js, sizeof(highlight_min_js)},
{"external/geraintluff-sha256.min.js", "application/javascript", geraintluff_sha256_min_js, sizeof(geraintluff_sha256_min_js)},
{"images/logo.svg", "image/svg+xml", images_logo_svg, sizeof(images_logo_svg)},
{"specs/auth.yaml", "text/plain", specs_auth_yaml, sizeof(specs_auth_yaml)},
{"specs/clients.yaml", "text/plain", specs_clients_yaml, sizeof(specs_clients_yaml)},
{"specs/common.yaml", "text/plain", specs_common_yaml, sizeof(specs_common_yaml)},
{"specs/dns.yaml", "text/plain", specs_dns_yaml, sizeof(specs_dns_yaml)},
{"specs/domains.yaml", "text/plain", specs_domains_yaml, sizeof(specs_domains_yaml)},
{"specs/info.yaml", "text/plain", specs_info_yaml, sizeof(specs_info_yaml)},
{"specs/groups.yaml", "text/plain", specs_groups_yaml, sizeof(specs_groups_yaml)},
{"specs/history.yaml", "text/plain", specs_history_yaml, sizeof(specs_history_yaml)},
{"specs/lists.yaml", "text/plain", specs_lists_yaml, sizeof(specs_lists_yaml)},
{"specs/main.yaml", "text/plain", specs_main_yaml, sizeof(specs_main_yaml)},
{"specs/queries.yaml", "text/plain", specs_queries_yaml, sizeof(specs_queries_yaml)},
{"specs/stats.yaml", "text/plain", specs_stats_yaml, sizeof(specs_stats_yaml)},
{"specs/config.yaml", "text/plain", specs_config_yaml, sizeof(specs_config_yaml)},
{"specs/network.yaml", "text/plain", specs_network_yaml, sizeof(specs_network_yaml)},
{"specs/logs.yaml", "text/plain", specs_logs_yaml, sizeof(specs_logs_yaml)},
{"specs/endpoints.yaml", "text/plain", specs_endpoints_yaml, sizeof(specs_endpoints_yaml)},
{"index.html", "text/html", (const char*)index_html, sizeof(index_html)},
{"index.css", "text/css", (const char*)index_css, sizeof(index_css)},
{"pi-hole.js", "application/javascript", (const char*)pi_hole_js, sizeof(pi_hole_js)},
{"external/rapidoc-min.js", "application/javascript", (const char*)rapidoc_min_js, sizeof(rapidoc_min_js)},
{"external/rapidoc-min.map.js", "text/plain", (const char*)rapidoc_min_map_js, sizeof(rapidoc_min_map_js)},
{"external/highlight-default.min.css", "text/css", (const char*)highlight_default_min_css, sizeof(highlight_default_min_css)},
{"external/highlight.min.js", "application/javascript", (const char*)highlight_min_js, sizeof(highlight_min_js)},
{"external/geraintluff-sha256.min.js", "application/javascript", (const char*)geraintluff_sha256_min_js, sizeof(geraintluff_sha256_min_js)},
{"images/logo.svg", "image/svg+xml", (const char*)images_logo_svg, sizeof(images_logo_svg)},
{"specs/auth.yaml", "text/plain", (const char*)specs_auth_yaml, sizeof(specs_auth_yaml)},
{"specs/clients.yaml", "text/plain", (const char*)specs_clients_yaml, sizeof(specs_clients_yaml)},
{"specs/common.yaml", "text/plain", (const char*)specs_common_yaml, sizeof(specs_common_yaml)},
{"specs/dns.yaml", "text/plain", (const char*)specs_dns_yaml, sizeof(specs_dns_yaml)},
{"specs/domains.yaml", "text/plain", (const char*)specs_domains_yaml, sizeof(specs_domains_yaml)},
{"specs/info.yaml", "text/plain", (const char*)specs_info_yaml, sizeof(specs_info_yaml)},
{"specs/groups.yaml", "text/plain", (const char*)specs_groups_yaml, sizeof(specs_groups_yaml)},
{"specs/history.yaml", "text/plain", (const char*)specs_history_yaml, sizeof(specs_history_yaml)},
{"specs/lists.yaml", "text/plain", (const char*)specs_lists_yaml, sizeof(specs_lists_yaml)},
{"specs/main.yaml", "text/plain", (const char*)specs_main_yaml, sizeof(specs_main_yaml)},
{"specs/queries.yaml", "text/plain", (const char*)specs_queries_yaml, sizeof(specs_queries_yaml)},
{"specs/stats.yaml", "text/plain", (const char*)specs_stats_yaml, sizeof(specs_stats_yaml)},
{"specs/config.yaml", "text/plain", (const char*)specs_config_yaml, sizeof(specs_config_yaml)},
{"specs/network.yaml", "text/plain", (const char*)specs_network_yaml, sizeof(specs_network_yaml)},
{"specs/logs.yaml", "text/plain", (const char*)specs_logs_yaml, sizeof(specs_logs_yaml)},
{"specs/endpoints.yaml", "text/plain", (const char*)specs_endpoints_yaml, sizeof(specs_endpoints_yaml)},
};
#endif // API_DOCS_H