Commit 3c0c34bc authored by Warren Dukes's avatar Warren Dukes

'\n' are bad

git-svn-id: https://svn.musicpd.org/mpd/trunk@1296 09075e82-0dd4-0310-85a5-a0d7c8717e4f
parent 48dce62e
......@@ -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);
......
......@@ -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;
}
}
......
......@@ -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);
}
}
......
......@@ -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;
}
......
......@@ -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;
......
......@@ -53,6 +53,7 @@ void printMpdTag(FILE * fp, MpdTag * tag) {
temp = latin1StrToUtf8Dup(str); \
free(str); \
str = temp; \
stripReturnChar(str); \
} \
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment