mirror of
https://github.com/SuperBFG7/ympd
synced 2025-01-28 18:04:53 +00:00
Fix: remove compiler warnings
This commit is contained in:
parent
ffd7caece6
commit
47ce3114a7
@ -11,7 +11,7 @@ int list_init(struct list *l) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
int list_get_value(const struct list *l, char *data) {
|
||||
int list_get_value(const struct list *l, const char *data) {
|
||||
int value = -1;
|
||||
struct node *current = l->list;
|
||||
while (current != NULL) {
|
||||
@ -108,7 +108,7 @@ int list_sort_by_value(struct list *l, bool order) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
int list_replace(struct list *l, int pos, char *data, int value) {
|
||||
int list_replace(struct list *l, int pos, const char *data, int value) {
|
||||
int i = 0;
|
||||
struct node *current = l->list;
|
||||
while (current->next != NULL) {
|
||||
@ -125,7 +125,7 @@ int list_replace(struct list *l, int pos, char *data, int value) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
int list_push(struct list *l, char *data, int value) {
|
||||
int list_push(struct list *l, const char *data, int value) {
|
||||
struct node *n = malloc(sizeof(struct node));
|
||||
n->value = value;
|
||||
n->data = strdup(data);
|
||||
|
@ -12,10 +12,10 @@ struct list {
|
||||
|
||||
|
||||
int list_init(struct list *l);
|
||||
int list_push(struct list *l, char *data, int value);
|
||||
int list_replace(struct list *l, int pos, char *data, int value);
|
||||
int list_push(struct list *l, const char *data, int value);
|
||||
int list_replace(struct list *l, int pos, const char *data, int value);
|
||||
int list_free(struct list *l);
|
||||
int list_get_value(const struct list *l, char *data);
|
||||
int list_get_value(const struct list *l, const char *data);
|
||||
int list_shuffle(struct list *l);
|
||||
int list_sort_by_value(struct list *l, bool order);
|
||||
int list_swap_item(struct node *n1, struct node *n2);
|
||||
|
@ -1206,7 +1206,7 @@ bool mympd_state_get(char *name, char *value) {
|
||||
return false;
|
||||
}
|
||||
|
||||
bool mympd_state_set(char *name, char *value) {
|
||||
bool mympd_state_set(const char *name, const char *value) {
|
||||
char tmpfile[400];
|
||||
char cfgfile[400];
|
||||
snprintf(cfgfile, 400, "%s/state/%s", config.varlibdir, name);
|
||||
@ -1238,9 +1238,13 @@ int mympd_syscmd(char *buffer, char *cmd, int order) {
|
||||
}
|
||||
read = getline(&line, &n, fp);
|
||||
fclose(fp);
|
||||
strtok(line, "\n");
|
||||
system(line);
|
||||
len = snprintf(buffer, MAX_SIZE, "{\"type\": \"result\", \"data\": \"Executed cmd %s\"}", line);
|
||||
if (read > 0) {
|
||||
strtok(line, "\n");
|
||||
system(line);
|
||||
len = snprintf(buffer, MAX_SIZE, "{\"type\": \"result\", \"data\": \"Executed cmd %s\"}", line);
|
||||
} else {
|
||||
len = snprintf(buffer, MAX_SIZE, "{\"type\": \"error\", \"data\": \"Can't execute cmd %s\"}", cmd);
|
||||
}
|
||||
CHECK_RETURN_LEN();
|
||||
return len;
|
||||
}
|
||||
@ -1412,11 +1416,9 @@ int mympd_put_current_song(char *buffer) {
|
||||
|
||||
mympd_get_cover(mpd_song_get_uri(song), cover, 500);
|
||||
|
||||
len = json_printf(&out, "{type: song_change, data: {pos: %d, uri: %Q, currentSongId: %d, duration: %d, cover: %Q, ",
|
||||
len = json_printf(&out, "{type: song_change, data: {pos: %d, currentSongId: %d, cover: %Q, ",
|
||||
mpd_song_get_pos(song),
|
||||
mpd_song_get_uri(song),
|
||||
mpd.song_id,
|
||||
mpd_song_get_duration(song),
|
||||
cover
|
||||
);
|
||||
PUT_SONG_TAGS();
|
||||
@ -1453,11 +1455,7 @@ int mympd_put_songdetails(char *buffer, char *uri) {
|
||||
if ((entity = mpd_recv_entity(mpd.conn)) != NULL) {
|
||||
song = mpd_entity_get_song(entity);
|
||||
mympd_get_cover(uri, cover, 500);
|
||||
len += json_printf(&out, "duration: %d, cover: %Q, uri: %Q, ",
|
||||
mpd_song_get_duration(song),
|
||||
cover,
|
||||
uri
|
||||
);
|
||||
len += json_printf(&out, "cover: %Q, ", cover);
|
||||
PUT_SONG_TAGS();
|
||||
mpd_entity_free(entity);
|
||||
}
|
||||
@ -1507,11 +1505,9 @@ int mympd_put_queue(char *buffer, unsigned int offset, unsigned *queue_version,
|
||||
entity_count ++;
|
||||
if (entities_returned ++)
|
||||
len += json_printf(&out, ",");
|
||||
len += json_printf(&out, "{id: %d, pos: %d, duration: %d, uri: %Q, ",
|
||||
len += json_printf(&out, "{id: %d, pos: %d, ",
|
||||
mpd_song_get_id(song),
|
||||
mpd_song_get_pos(song),
|
||||
mpd_song_get_duration(song),
|
||||
mpd_song_get_uri(song)
|
||||
mpd_song_get_pos(song)
|
||||
);
|
||||
PUT_SONG_TAGS();
|
||||
len += json_printf(&out, "}");
|
||||
@ -1568,11 +1564,7 @@ int mympd_put_browse(char *buffer, char *path, unsigned int offset, char *filter
|
||||
) {
|
||||
if (entities_returned ++)
|
||||
len += json_printf(&out, ",");
|
||||
len += json_printf(&out, "{type: song, uri: %Q, duration: %d, name: %Q, ",
|
||||
mpd_song_get_uri(song),
|
||||
mpd_song_get_duration(song),
|
||||
entityName
|
||||
);
|
||||
len += json_printf(&out, "{type: song, ");
|
||||
PUT_SONG_TAGS();
|
||||
len += json_printf(&out, "}");
|
||||
} else {
|
||||
@ -1846,11 +1838,7 @@ int mympd_put_playlist_list(char *buffer, char *uri, unsigned int offset, char *
|
||||
) {
|
||||
if (entities_returned ++)
|
||||
len += json_printf(&out, ",");
|
||||
len += json_printf(&out, "{type: song, uri: %Q, duration: %d, name: %Q, ",
|
||||
mpd_song_get_uri(song),
|
||||
mpd_song_get_duration(song),
|
||||
entityName
|
||||
);
|
||||
len += json_printf(&out, "{type: song, ");
|
||||
PUT_SONG_TAGS();
|
||||
len += json_printf(&out, "}");
|
||||
} else {
|
||||
@ -1904,11 +1892,7 @@ int mympd_search(char *buffer, char *searchstr, char *filter, char *plist, unsig
|
||||
if (entity_count > offset && entity_count <= offset + config.max_elements_per_page) {
|
||||
if (entities_returned ++)
|
||||
len += json_printf(&out, ", ");
|
||||
len += json_printf(&out, "{type: song, uri: %Q, duration: %d, name: %Q, ",
|
||||
mpd_song_get_uri(song),
|
||||
mpd_song_get_duration(song),
|
||||
mympd_get_tag(song, MPD_TAG_TITLE)
|
||||
);
|
||||
len += json_printf(&out, "{type: song, ");
|
||||
PUT_SONG_TAGS();
|
||||
len += json_printf(&out, "}");
|
||||
}
|
||||
@ -1991,10 +1975,9 @@ int mympd_search_queue(char *buffer, char *mpdtagtype, unsigned int offset, char
|
||||
if (entity_count > offset && entity_count <= offset + config.max_elements_per_page) {
|
||||
if (entities_returned ++)
|
||||
len += json_printf(&out, ", ");
|
||||
len += json_printf(&out, "{type: song, id: %d, pos: %d, duration: %d, ",
|
||||
len += json_printf(&out, "{type: song, id: %d, pos: %d, ",
|
||||
mpd_song_get_id(song),
|
||||
mpd_song_get_pos(song),
|
||||
mpd_song_get_duration(song)
|
||||
mpd_song_get_pos(song)
|
||||
);
|
||||
PUT_SONG_TAGS();
|
||||
len += json_printf(&out, "}");
|
||||
|
@ -59,6 +59,7 @@
|
||||
len += json_printf(&out, "%Q: %Q", current->data, mympd_get_tag(song, mpd_tag_name_parse(current->data))); \
|
||||
current = current->next; \
|
||||
} \
|
||||
len += json_printf(&out, ", duration: %d, uri: %Q", mpd_song_get_duration(song), mpd_song_get_uri(song)); \
|
||||
} while (0)
|
||||
|
||||
|
||||
@ -183,7 +184,7 @@ typedef struct {
|
||||
bool smartpls;
|
||||
const char* varlibdir;
|
||||
const char* etcdir;
|
||||
long max_elements_per_page;
|
||||
unsigned long max_elements_per_page;
|
||||
} t_config;
|
||||
|
||||
t_config config;
|
||||
@ -222,7 +223,7 @@ void mympd_last_played_song_id(int song_id);
|
||||
void mympd_get_sticker(const char *uri, t_sticker *sticker);
|
||||
void mympd_jukebox();
|
||||
bool mympd_state_get(char *name, char *value);
|
||||
bool mympd_state_set(char *name, char *value);
|
||||
bool mympd_state_set(const char *name, const char *value);
|
||||
int mympd_syscmd(char *buffer, char *cmd, int order);
|
||||
int mympd_smartpls_save(char *smartpltype, char *playlist, char *tag, char *searchstr, int maxentries, int timerange);
|
||||
int mympd_smartpls_put(char *buffer, char *playlist);
|
||||
|
Loading…
Reference in New Issue
Block a user