aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMax Kellermann <max@duempel.org>2009-11-01 15:27:55 +0100
committerMax Kellermann <max@duempel.org>2009-11-01 15:27:55 +0100
commitb242175e181b4d9cbcd4087a38c9601ffba7ddc7 (patch)
treead5d4424e3c4b57cecb8c796d07b1596212972c6
parent3de912e2b956821782bd77acc6e12f66086c1926 (diff)
downloadmpd-b242175e181b4d9cbcd4087a38c9601ffba7ddc7.tar.gz
mpd-b242175e181b4d9cbcd4087a38c9601ffba7ddc7.tar.xz
mpd-b242175e181b4d9cbcd4087a38c9601ffba7ddc7.zip
song_save: increased maximum line length to 32 kB
The line buffer had a fixed size of 5 kB, and was allocated on the stack. This was too small for some users. As a hotfix, we're increasing the buffer size to 32 kB now, allocated on the heap. In MPD 0.16, we'll switch to dynamic allocation.
Diffstat (limited to '')
-rw-r--r--NEWS1
-rw-r--r--src/song_save.c10
2 files changed, 8 insertions, 3 deletions
diff --git a/NEWS b/NEWS
index 4969dc91b..2e314295a 100644
--- a/NEWS
+++ b/NEWS
@@ -3,6 +3,7 @@ ver 0.15.6 (2009/??/??)
- ffmpeg: convert metadata
* output_thread: check again if output is open on PAUSE
* update: delete ignored symlinks from database
+* database: increased maximum line length to 32 kB
ver 0.15.5 (2009/10/18)
diff --git a/src/song_save.c b/src/song_save.c
index 8f4e1614d..2d6297f3e 100644
--- a/src/song_save.c
+++ b/src/song_save.c
@@ -21,7 +21,6 @@
#include "song.h"
#include "tag_save.h"
#include "directory.h"
-#include "path.h"
#include "tag.h"
#include <glib.h>
@@ -113,12 +112,15 @@ matchesAnMpdTagItemKey(char *buffer, enum tag_type *itemType)
void readSongInfoIntoList(FILE *fp, struct songvec *sv,
struct directory *parent)
{
- char buffer[MPD_PATH_MAX + 1024];
+ enum {
+ buffer_size = 32768,
+ };
+ char *buffer = g_malloc(buffer_size);
struct song *song = NULL;
enum tag_type itemType;
const char *value;
- while (fgets(buffer, sizeof(buffer), fp) &&
+ while (fgets(buffer, buffer_size, fp) &&
!g_str_has_prefix(buffer, SONG_END)) {
g_strchomp(buffer);
@@ -156,6 +158,8 @@ void readSongInfoIntoList(FILE *fp, struct songvec *sv,
g_error("unknown line in db: %s", buffer);
}
+ g_free(buffer);
+
if (song)
insertSongIntoList(sv, song);
}