From 3c0c34bcb73ac7fa761b5b685f367512bb466b97 Mon Sep 17 00:00:00 2001 From: Warren Dukes Date: Wed, 2 Jun 2004 02:07:07 +0000 Subject: '\n' are bad git-svn-id: https://svn.musicpd.org/mpd/trunk@1296 09075e82-0dd4-0310-85a5-a0d7c8717e4f --- src/directory.c | 3 +++ src/inputPlugins/flac_plugin.c | 4 ---- src/inputPlugins/ogg_plugin.c | 4 ---- src/ls.c | 4 +++- src/song.c | 6 +++++- src/tag.c | 1 + 6 files changed, 12 insertions(+), 10 deletions(-) (limited to 'src') diff --git a/src/directory.c b/src/directory.c index 0666692ae..79b3b1bb9 100644 --- a/src/directory.c +++ b/src/directory.c @@ -356,6 +356,7 @@ int removeDeletedFromDirectory(Directory * directory) { while((ent = readdir(dir))) { if(ent->d_name[0]=='.') continue; /* hide hidden stuff */ + if(strchr(ent->d_name, '\n')) continue; utf8 = fsCharsetToUtf8(ent->d_name); @@ -558,6 +559,7 @@ int updateDirectory(Directory * directory) { while((ent = readdir(dir))) { if(ent->d_name[0]=='.') continue; /* hide hidden stuff */ + if(strchr(ent->d_name, '\n')) continue; utf8 = fsCharsetToUtf8(ent->d_name); @@ -604,6 +606,7 @@ int exploreDirectory(Directory * directory) { DEBUG("explore: %s\n",dirname); while((ent = readdir(dir))) { if(ent->d_name[0]=='.') continue; /* hide hidden stuff */ + if(strchr(ent->d_name, '\n')) continue; utf8 = fsCharsetToUtf8(ent->d_name); diff --git a/src/inputPlugins/flac_plugin.c b/src/inputPlugins/flac_plugin.c index dc92b801b..8ae631a97 100644 --- a/src/inputPlugins/flac_plugin.c +++ b/src/inputPlugins/flac_plugin.c @@ -470,7 +470,6 @@ MpdTag * flacMetadataDup(char * file, int * vorbisCommentFound) { dup = malloc(len+1); memcpy(dup,&(block->data.vorbis_comment.comments[offset].entry[pos]),len); dup[len] = '\0'; - stripReturnChar(dup); ret->artist = dup; } } @@ -484,7 +483,6 @@ MpdTag * flacMetadataDup(char * file, int * vorbisCommentFound) { dup = malloc(len+1); memcpy(dup,&(block->data.vorbis_comment.comments[offset].entry[pos]),len); dup[len] = '\0'; - stripReturnChar(dup); ret->album = dup; } } @@ -498,7 +496,6 @@ MpdTag * flacMetadataDup(char * file, int * vorbisCommentFound) { dup = malloc(len+1); memcpy(dup,&(block->data.vorbis_comment.comments[offset].entry[pos]),len); dup[len] = '\0'; - stripReturnChar(dup); ret->title = dup; } } @@ -512,7 +509,6 @@ MpdTag * flacMetadataDup(char * file, int * vorbisCommentFound) { dup = malloc(len+1); memcpy(dup,&(block->data.vorbis_comment.comments[offset].entry[pos]),len); dup[len] = '\0'; - stripReturnChar(dup); ret->track = dup; } } diff --git a/src/inputPlugins/ogg_plugin.c b/src/inputPlugins/ogg_plugin.c index 8e42dec55..369939b33 100644 --- a/src/inputPlugins/ogg_plugin.c +++ b/src/inputPlugins/ogg_plugin.c @@ -174,28 +174,24 @@ MpdTag * oggCommentsParse(char ** comments) { if(!ret) ret = newMpdTag(); if(!ret->artist) { ret->artist = strdup(temp); - stripReturnChar(ret->artist); } } else if((temp = ogg_parseComment(*comments,"title"))) { if(!ret) ret = newMpdTag(); if(!ret->title) { ret->title = strdup(temp); - stripReturnChar(ret->title); } } else if((temp = ogg_parseComment(*comments,"album"))) { if(!ret) ret = newMpdTag(); if(!ret->album) { ret->album = strdup(temp); - stripReturnChar(ret->album); } } else if((temp = ogg_parseComment(*comments,"tracknumber"))) { if(!ret) ret = newMpdTag(); if(!ret->track) { ret->track = strdup(temp); - stripReturnChar(ret->track); } } diff --git a/src/ls.c b/src/ls.c index f477d7fa2..a12608894 100644 --- a/src/ls.c +++ b/src/ls.c @@ -172,7 +172,9 @@ int lsPlaylists(FILE * fp, char * utf8path) { node = list->firstNode; while(node!=NULL) { - myfprintf(fp,"playlist: %s%s\n",dup,node->key); + if(!strchr(node->key, '\n')) { + myfprintf(fp,"playlist: %s%s\n",dup,node->key); + } node = node->nextNode; } diff --git a/src/song.c b/src/song.c index c1f465177..ed88f1f60 100644 --- a/src/song.c +++ b/src/song.c @@ -51,7 +51,11 @@ Song * newNullSong() { } Song * newSong(char * utf8url, SONG_TYPE type) { - Song * song = newNullSong(); + Song * song = NULL; + + if(strchr(utf8url, '\n')) return NULL; + + song = newNullSong(); song->utf8url = strdup(utf8url); song->type = type; diff --git a/src/tag.c b/src/tag.c index 50c1dcd86..c6bd1ffa8 100644 --- a/src/tag.c +++ b/src/tag.c @@ -53,6 +53,7 @@ void printMpdTag(FILE * fp, MpdTag * tag) { temp = latin1StrToUtf8Dup(str); \ free(str); \ str = temp; \ + stripReturnChar(str); \ } \ } -- cgit v1.2.3