'\n' are bad

git-svn-id: https://svn.musicpd.org/mpd/trunk@1296 09075e82-0dd4-0310-85a5-a0d7c8717e4f
This commit is contained in:
Warren Dukes 2004-06-02 02:07:07 +00:00
parent 48dce62e4f
commit 3c0c34bcb7
6 changed files with 12 additions and 10 deletions

View File

@ -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);

View File

@ -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;
}
}

View File

@ -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);
}
}

View File

@ -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;
}

View File

@ -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;

View File

@ -53,6 +53,7 @@ void printMpdTag(FILE * fp, MpdTag * tag) {
temp = latin1StrToUtf8Dup(str); \
free(str); \
str = temp; \
stripReturnChar(str); \
} \
}