mirror of
https://github.com/SuperBFG7/ympd
synced 2024-11-14 18:14:47 +00:00
Feat: add valingrid build
Fix: first errors reported by valingrid
This commit is contained in:
parent
38398ee100
commit
33c490a1d7
@ -31,13 +31,17 @@ include_directories(${PROJECT_BINARY_DIR} ${PROJECT_SOURCE_DIR} ${LIBMPDCLIENT_I
|
||||
|
||||
include(CheckCSourceCompiles)
|
||||
|
||||
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 "${CMAKE_C_FLAGS} -std=gnu99 -O1 -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 \
|
||||
-fsanitize=null -fsanitize=return -fsanitize=signed-integer-overflow -fsanitize=bounds -fsanitize=bounds-strict \
|
||||
-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")
|
||||
#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 \
|
||||
# -fsanitize=null -fsanitize=return -fsanitize=signed-integer-overflow -fsanitize=bounds -fsanitize=bounds-strict \
|
||||
# -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")
|
||||
|
||||
#for use with valgrind, disable above 2 set commands and enable the following set commands
|
||||
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -std=gnu99 -Wall -DMG_ENABLE_SSL")
|
||||
set(CMAKE_C_FLAGS_DEBUG "${CMAKE_C_FLAGS_DEBUG} -ggdb")
|
||||
|
||||
#compiler flags for mympd src
|
||||
file(GLOB MYMPD_SRC_FILES "src/*.c")
|
||||
|
@ -35,7 +35,7 @@
|
||||
|
||||
bool state_file_read(t_config *config, const char *name, char *value) {
|
||||
char cfg_file[400];
|
||||
char *line;
|
||||
char *line = NULL;
|
||||
size_t n = 0;
|
||||
ssize_t read;
|
||||
|
||||
@ -51,6 +51,7 @@ bool state_file_read(t_config *config, const char *name, char *value) {
|
||||
snprintf(value, 400, "%s", line);
|
||||
LOG_DEBUG() fprintf(stderr, "DEBUG: State %s: %s\n", name, value);
|
||||
fclose(fp);
|
||||
free(line);
|
||||
if (read > 0)
|
||||
return true;
|
||||
else
|
||||
|
@ -174,13 +174,23 @@ void *mpd_client_loop(void *arg_config) {
|
||||
t_mpd_state mpd_state;
|
||||
mpd_state.conn_state = MPD_DISCONNECTED;
|
||||
mpd_state.timeout = 3000;
|
||||
mpd_state.last_update_sticker_song_id = -1;
|
||||
mpd_state.song_id = -1;
|
||||
mpd_state.next_song_id = -1;
|
||||
mpd_state.last_song_id = -1;
|
||||
mpd_state.queue_version = 0;
|
||||
mpd_state.queue_length = 0;
|
||||
mpd_state.last_update_sticker_song_id = -1;
|
||||
mpd_state.last_last_played_id = -1;
|
||||
mpd_state.feat_sticker = false;
|
||||
mpd_state.feat_playlists = false;
|
||||
mpd_state.feat_tags = false;
|
||||
mpd_state.feat_library = false;
|
||||
mpd_state.feat_advsearch = false;
|
||||
mpd_state.feat_smartpls = false;
|
||||
mpd_state.jukeboxMode = JUKEBOX_OFF;
|
||||
mpd_state.jukeboxPlaylist = strdup("Database");
|
||||
mpd_state.jukeboxQueueLength = 1;
|
||||
mpd_state.autoPlay = false;
|
||||
list_init(&mpd_state.mpd_tags);
|
||||
list_init(&mpd_state.mympd_tags);
|
||||
list_init(&mpd_state.mympd_searchtags);
|
||||
@ -2889,7 +2899,7 @@ static bool mpd_client_smartpls_update_newest(t_config *config, t_mpd_state *mpd
|
||||
|
||||
static int mpd_client_read_last_played(t_config *config, t_mpd_state *mpd_state) {
|
||||
char cfgfile[400];
|
||||
char *line;
|
||||
char *line = NULL;
|
||||
char *data;
|
||||
char *crap;
|
||||
size_t n = 0;
|
||||
@ -2914,5 +2924,6 @@ static int mpd_client_read_last_played(t_config *config, t_mpd_state *mpd_state)
|
||||
}
|
||||
}
|
||||
fclose(fp);
|
||||
free(line);
|
||||
return mpd_state->last_played.length;;
|
||||
}
|
||||
|
@ -278,7 +278,7 @@ static bool mympd_api_read_syscmds(t_config *config, t_mympd_state *mympd_state)
|
||||
static int mympd_api_syscmd(t_config *config, t_mympd_state *mympd_state, char *buffer, const char *cmd) {
|
||||
int len;
|
||||
char filename[400];
|
||||
char *line;
|
||||
char *line = NULL;
|
||||
char *crap;
|
||||
size_t n = 0;
|
||||
ssize_t read;
|
||||
@ -314,6 +314,7 @@ static int mympd_api_syscmd(t_config *config, t_mympd_state *mympd_state, char *
|
||||
len = snprintf(buffer, MAX_SIZE, "{\"type\": \"error\", \"data\": \"Can't execute cmd %s.\"}", cmd);
|
||||
printf("ERROR: Can't execute syscmd \"%s\"\n", cmd);
|
||||
}
|
||||
free(line);
|
||||
CHECK_RETURN_LEN();
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user