mirror of
https://github.com/SuperBFG7/ympd
synced 2024-06-22 04:43:15 +00:00
Fix: remove warnings add secure compiler flags
Add secure compiler flags to all source Add more warning compiler flags to myMPD source Remove warning compiler flags to reduce warnings for mongoose and frozen source
This commit is contained in:
parent
4c196c7633
commit
a7bf4aa2bf
|
@ -24,18 +24,14 @@ endif()
|
|||
|
||||
find_package(LibMPDClient REQUIRED)
|
||||
find_package(Threads REQUIRED)
|
||||
find_package(OpenSSL REQUIRED)
|
||||
|
||||
configure_file(src/global.h.in ${PROJECT_BINARY_DIR}/global.h)
|
||||
include_directories(${PROJECT_BINARY_DIR} ${PROJECT_SOURCE_DIR} ${LIBMPDCLIENT_INCLUDE_DIR})
|
||||
include_directories(${PROJECT_BINARY_DIR} ${PROJECT_SOURCE_DIR} ${LIBMPDCLIENT_INCLUDE_DIR} ${OPENSSL_INCLUDE_DIR})
|
||||
|
||||
include(CheckCSourceCompiles)
|
||||
|
||||
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -std=gnu99 -O2 -Wall -Wextra -pedantic -Wformat=2 -Wno-unused-parameter -Wshadow \
|
||||
-Wwrite-strings -Wstrict-prototypes -Wold-style-definition -Wredundant-decls -Wnested-externs -Wmissing-include-dirs \
|
||||
-fstack-protector -D_FORTIFY_SOURCE=2 -pie -fPIE \
|
||||
-D MG_ENABLE_SSL -D MG_ENABLE_THREADS -D MG_ENABLE_IPV6 -D MG_DISABLE_MQTT -D MG_DISABLE_MQTT_BROKER \
|
||||
-D CS_NDEBUG \
|
||||
-D MG_DISABLE_DNS_SERVER -D MG_DISABLE_COAP -D MG_DISABLE_HTTP_CGI -D MG_DISABLE_HTTP_SSI -D MG_DISABLE_HTTP_WEBDAV")
|
||||
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -std=gnu99 -O2 -Wall -fstack-protector -D_FORTIFY_SOURCE=2 -pie -fPIE -DMG_ENABLE_SSL")
|
||||
|
||||
set(CMAKE_C_FLAGS_DEBUG "${CMAKE_C_FLAGS_DEBUG} -ggdb -fsanitize=address \
|
||||
-fsanitize=undefined -fsanitize=shift -fsanitize=integer-divide-by-zero -fsanitize=unreachable -fsanitize=vla-bound \
|
||||
|
@ -43,11 +39,14 @@ set(CMAKE_C_FLAGS_DEBUG "${CMAKE_C_FLAGS_DEBUG} -ggdb -fsanitize=address \
|
|||
-fsanitize=alignment -fsanitize=object-size -fsanitize=float-divide-by-zero -fsanitize=float-cast-overflow \
|
||||
-fsanitize=nonnull-attribute -fsanitize=returns-nonnull-attribute -fsanitize=bool -fsanitize=enum -fsanitize=vptr -static-libasan")
|
||||
|
||||
file(GLOB MYMPD_SRC_FILES "src/*.c")
|
||||
set_property(SOURCE ${MYMPD_SRC_FILES} PROPERTY COMPILE_FLAGS "-Wextra -pedantic -Wformat=2 -Wno-unused-parameter -Wshadow -Wwrite-strings -Wstrict-prototypes -Wold-style-definition -Wredundant-decls -Wnested-externs -Wmissing-include-dirs")
|
||||
|
||||
#set_source_files_properties(dist/src/mongoose/mongoose.c PROPERTIES COMPILE_FLAGS " -DMG_ENABLE_THREADS -DMG_ENABLE_IPV6 -DMG_DISABLE_MQTT -DMG_DISABLE_MQTT_BROKER -DCS_NDEBUG -DMG_DISABLE_DNS_SERVER -DMG_DISABLE_COAP -DMG_DISABLE_HTTP_CGI -DMG_DISABLE_HTTP_SSI -DMG_DISABLE_HTTP_WEBDAV")
|
||||
|
||||
set (CMAKE_EXE_LINKER_FLAGS "-Wl,-z,relro -Wl,-z,now")
|
||||
|
||||
find_package(OpenSSL REQUIRED)
|
||||
include_directories(${OPENSSL_INCLUDE_DIR})
|
||||
set_property(DIRECTORY APPEND PROPERTY COMPILE_DEFINITIONS NS_ENABLE_SSL)
|
||||
#set_property(DIRECTORY APPEND PROPERTY COMPILE_DEFINITIONS NS_ENABLE_SSL)
|
||||
|
||||
set(SOURCES
|
||||
src/main.c
|
||||
|
|
2
dist/src/mongoose/mongoose.c
vendored
2
dist/src/mongoose/mongoose.c
vendored
|
@ -4589,7 +4589,7 @@ struct mg_ssl_if_ctx {
|
|||
size_t identity_len;
|
||||
};
|
||||
|
||||
void mg_ssl_if_init() {
|
||||
void mg_ssl_if_init(void) {
|
||||
SSL_library_init();
|
||||
}
|
||||
|
||||
|
|
4
dist/src/mongoose/mongoose.h
vendored
4
dist/src/mongoose/mongoose.h
vendored
|
@ -428,7 +428,7 @@ unsigned int sleep(unsigned int seconds);
|
|||
*/
|
||||
#if !(defined(__cplusplus) && __cplusplus >= 201103L) && \
|
||||
!(defined(__DARWIN_C_LEVEL) && __DARWIN_C_LEVEL >= 200809L)
|
||||
long long strtoll(const char *, char **, int);
|
||||
//long long strtoll(const char *, char **, int);
|
||||
#endif
|
||||
|
||||
typedef int sock_t;
|
||||
|
@ -3747,7 +3747,7 @@ extern "C" {
|
|||
struct mg_ssl_if_ctx;
|
||||
struct mg_connection;
|
||||
|
||||
void mg_ssl_if_init();
|
||||
void mg_ssl_if_init(void);
|
||||
|
||||
enum mg_ssl_if_result {
|
||||
MG_SSL_OK = 0,
|
||||
|
|
|
@ -23,4 +23,4 @@ echo "Linking pics directory"
|
|||
[ -d debug ] || mkdir debug
|
||||
cd debug
|
||||
cmake -DCMAKE_INSTALL_PREFIX:PATH=/usr -DCMAKE_BUILD_TYPE=DEBUG ..
|
||||
make
|
||||
make VERBOSE=1
|
||||
|
|
|
@ -231,14 +231,6 @@ static void mpd_client_api(t_config *config, t_mpd_state *mpd_state, void *arg_r
|
|||
clock_gettime(CLOCK_MONOTONIC_RAW, &start);
|
||||
#endif
|
||||
switch(request->cmd_id) {
|
||||
case MYMPD_API_SYSCMD:
|
||||
case MYMPD_API_COLS_SAVE:
|
||||
case MYMPD_API_SETTINGS_GET:
|
||||
//are handled in mympd_api.c
|
||||
case MPD_API_UNKNOWN:
|
||||
len = snprintf(buffer, MAX_SIZE, "{\"type\": \"error\", \"data\": \"Unknown request\"}");
|
||||
printf("Unknown API request: %.*s\n", request->length, request->data);
|
||||
break;
|
||||
case MPD_API_LIKE:
|
||||
if (mpd_state->feat_sticker) {
|
||||
je = json_scanf(request->data, request->length, "{data: {uri: %Q, like: %d}}", &p_charbuf1, &uint_buf1);
|
||||
|
|
Loading…
Reference in New Issue
Block a user