From 859aac7242fe3767c19c1bfff73d5e6159cbad31 Mon Sep 17 00:00:00 2001 From: Max Kellermann Date: Sun, 28 Dec 2008 19:54:49 +0100 Subject: utils: removed myFgets() Replaced myFgets() with fgets() + g_strchomp(). --- src/playlist.c | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) (limited to 'src/playlist.c') diff --git a/src/playlist.c b/src/playlist.c index ba69844de..18068b77c 100644 --- a/src/playlist.c +++ b/src/playlist.c @@ -268,9 +268,11 @@ static void loadPlaylistFromStateFile(FILE *fp, char *buffer, char *temp; int song; - if (!myFgets(buffer, PLAYLIST_BUFFER_SIZE, fp)) + if (!fgets(buffer, PLAYLIST_BUFFER_SIZE, fp)) state_file_fatal(); - while (strcmp(buffer, PLAYLIST_STATE_FILE_PLAYLIST_END)) { + while (!g_str_has_prefix(buffer, PLAYLIST_STATE_FILE_PLAYLIST_END)) { + g_strchomp(buffer); + temp = strtok(buffer, ":"); if (temp == NULL) state_file_fatal(); @@ -290,7 +292,8 @@ static void loadPlaylistFromStateFile(FILE *fp, char *buffer, seek_time); } } - if (!myFgets(buffer, PLAYLIST_BUFFER_SIZE, fp)) + + if (!fgets(buffer, PLAYLIST_BUFFER_SIZE, fp)) state_file_fatal(); } } @@ -302,7 +305,9 @@ void readPlaylistState(FILE *fp) int state = PLAYER_STATE_STOP; char buffer[PLAYLIST_BUFFER_SIZE]; - while (myFgets(buffer, PLAYLIST_BUFFER_SIZE, fp)) { + while (fgets(buffer, sizeof(buffer), fp)) { + g_strchomp(buffer); + if (g_str_has_prefix(buffer, PLAYLIST_STATE_FILE_STATE)) { if (strcmp(&(buffer[strlen(PLAYLIST_STATE_FILE_STATE)]), PLAYLIST_STATE_FILE_STATE_PLAY) == 0) { -- cgit v1.2.3