Commit b242175e authored by Max Kellermann's avatar Max Kellermann

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.
parent 3de912e2
...@@ -3,6 +3,7 @@ ver 0.15.6 (2009/??/??) ...@@ -3,6 +3,7 @@ ver 0.15.6 (2009/??/??)
- ffmpeg: convert metadata - ffmpeg: convert metadata
* output_thread: check again if output is open on PAUSE * output_thread: check again if output is open on PAUSE
* update: delete ignored symlinks from database * update: delete ignored symlinks from database
* database: increased maximum line length to 32 kB
ver 0.15.5 (2009/10/18) ver 0.15.5 (2009/10/18)
......
...@@ -21,7 +21,6 @@ ...@@ -21,7 +21,6 @@
#include "song.h" #include "song.h"
#include "tag_save.h" #include "tag_save.h"
#include "directory.h" #include "directory.h"
#include "path.h"
#include "tag.h" #include "tag.h"
#include <glib.h> #include <glib.h>
...@@ -113,12 +112,15 @@ matchesAnMpdTagItemKey(char *buffer, enum tag_type *itemType) ...@@ -113,12 +112,15 @@ matchesAnMpdTagItemKey(char *buffer, enum tag_type *itemType)
void readSongInfoIntoList(FILE *fp, struct songvec *sv, void readSongInfoIntoList(FILE *fp, struct songvec *sv,
struct directory *parent) struct directory *parent)
{ {
char buffer[MPD_PATH_MAX + 1024]; enum {
buffer_size = 32768,
};
char *buffer = g_malloc(buffer_size);
struct song *song = NULL; struct song *song = NULL;
enum tag_type itemType; enum tag_type itemType;
const char *value; const char *value;
while (fgets(buffer, sizeof(buffer), fp) && while (fgets(buffer, buffer_size, fp) &&
!g_str_has_prefix(buffer, SONG_END)) { !g_str_has_prefix(buffer, SONG_END)) {
g_strchomp(buffer); g_strchomp(buffer);
...@@ -156,6 +158,8 @@ void readSongInfoIntoList(FILE *fp, struct songvec *sv, ...@@ -156,6 +158,8 @@ void readSongInfoIntoList(FILE *fp, struct songvec *sv,
g_error("unknown line in db: %s", buffer); g_error("unknown line in db: %s", buffer);
} }
g_free(buffer);
if (song) if (song)
insertSongIntoList(sv, song); insertSongIntoList(sv, song);
} }
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