aboutsummaryrefslogtreecommitdiffstats
path: root/src/stored_playlist.c (unfollow)
Commit message (Collapse)AuthorFilesLines
2009-11-12include config.h in all sourcesMax Kellermann1-0/+1
After we've been hit by Large File Support problems several times in the past week (which only occur on 32 bit platforms, which I don't have), this is yet another attempt to fix the issue.
2009-04-24stored_playlist: don't close NULL file on errorMax Kellermann1-5/+1
spl_append_song() can crash when fopen() fails, because it attempts to close the invalid file handle (NULL) in the error handler.
2009-03-13all: Update copyright header.Avuton Olrich1-6/+7
This updates the copyright header to all be the same, which is pretty much an update of where to mail request for a copy of the GPL and the years of the MPD project. This also puts all committers under 'The Music Player Project' umbrella. These entries should go individually in the AUTHORS file, for consistancy.
2009-02-25ls: moved generic URI utilities to uri.cMax Kellermann1-1/+1
"ls" is a bad name for a library which parses URIs. We'll move the rest of the "ls" library later.
2009-01-25playlist: moved is_valid_playlist_name() to stored_playlist.cMax Kellermann1-5/+23
2009-01-25stored_playlist: moved configuration variables from playlist.cMax Kellermann1-0/+15
Don't declare and export variables specific to stored playlists in playlist.c/playlist.h.
2009-01-25mapper: added dot to PLAYLIST_FILE_SUFFIXMax Kellermann1-7/+4
Some code will be a little bit simpler if the dot is part of the string literal.
2009-01-18mapper: make the playlist directory optionalMax Kellermann1-1/+18
2009-01-08path: allocate buffer in fs_charset conversion functionsMax Kellermann1-3/+3
Don't use fixed static buffers. GLib allocates a new string for us anyway, let's just return this one instead of copying it.
2009-01-04path: removed pfx_dir()Max Kellermann1-6/+4
Use GLib's g_build_filename() instead of pfx_dir().
2009-01-04song: allocate the result of song_get_url()Max Kellermann1-4/+4
2009-01-04mapper: allocate the result of map_fs_to_utf8()Max Kellermann1-2/+3
2009-01-04playlist: use uri_has_scheme() instead of isRemoteUrl()Max Kellermann1-12/+11
For internal checks (i.e. not in command.c), we need to check whether an URI is in the databse, in the local file system or a remote URI with a scheme.
2009-01-02playlist: use GLib instead of utils.hMax Kellermann1-2/+2
2009-01-01playlist: use g_file_test() instead of stat()Max Kellermann1-4/+2
To find out whether a file exists, use g_file_test() instead of stat(), because it is more portable and easier to use.
2009-01-01mapper: allocate playlist path from heapMax Kellermann1-28/+41
Don't pass a static buffer to map_spl_utf8_to_fs().
2008-12-29removed os_compat.hMax Kellermann1-1/+7
Only include headers which are really needed. os_compat.h aimed to make MPD easily portable, but was never actually made portable.
2008-12-28utils: removed myFgets()Max Kellermann1-1/+3
Replaced myFgets() with fgets() + g_strchomp().
2008-12-24stored_playlist: fix integer overflow in length estimationMax Kellermann1-1/+1
With a large maximum playlist length, the integer multiplication "playlist_max_length * MPD_PATH_MAX" may overflow. Change that to a division. This was not a dangerous bug, since it was only used for a quick estimate.
2008-12-16ls: removed isValidRemoteUtf8Url()Max Kellermann1-2/+2
The function didn't do anything useful, it was just several lines obfuscating that it was only forwarding isRemoteUrl()'s return value.
2008-10-31path: moved playlist_dir to mapper.cMax Kellermann1-17/+24
Added the function map_spl_utf8_to_fs() which replaces utf8_to_fs_playlist_path().
2008-10-26stored_playlist: fixed signed comparison warningMax Kellermann1-1/+1
Cast playlist_max_length to off_t before comparing it to stat.st_size.
2008-10-23stored_playlist: emit idle event on deleteMax Kellermann1-0/+1
The "rm" command did not send notifications to idle clients. Add it.
2008-10-23stored_playlist: renamed and moved spl_delete() to stored_playlist.cMax Kellermann1-0/+15
The function deletePlaylist() shouldn't be in playlist.c.
2008-10-23stored_playlist: spl_load() returns GPtrArrayMax Kellermann1-128/+62
Don't use our deprecated linked list library, use GLib's GPtrArray instead.
2008-10-23stored_playlist: unsigned index argumentsMax Kellermann1-4/+4
Pass index arguments as unsigned integers. They must not be negative, and even if some caller accidently passes -1, it won't pass the bound checks (since it's now 2**32-1).
2008-10-22stored_playlist: added spl_list()Max Kellermann1-0/+79
spl_list() provides an interface for enumerating all stored playlists. This separates the internal playlist logic from the protocol specific function lsPlaylists().
2008-10-22stored_playlist: spl_append_uri() returns enum playlist_resultMax Kellermann1-4/+3
The return value of spl_append_uri() was somewhat buggy: some branches returned ACK_* values, and some an enum playlist_result. Unify this.
2008-10-22stored_playlist: de-CamelCase moved functionMax Kellermann1-1/+2
Rename addToStoredPlaylist() to spl_append_uri(), and remove the clearStoredPlaylist() macro.
2008-10-22stored_playlist: moved functions from playlist.cMax Kellermann1-0/+22
The two functions clearStoredPlaylist() and addToStoredPlaylist() don't belong into playlist.c. clearStoredPlaylist() was a wrapper for spl_clear(), and is converted into a CPP macro for now.
2008-10-22stored_playlist: no CamelCaseMax Kellermann1-19/+23
Renamed all public functions, prefix is "spl_".
2008-10-22renamed storedPlaylist.c to stored_playlist.cMax Kellermann1-1/+1
No CamelCase in file names.
2008-10-14command: added command "idle"Max Kellermann1-0/+11
"idle" waits until something noteworthy happens on the server, e.g. song change, playlist modified, database updated. This allows clients to keep up to date without polling.
2008-10-14mapper: new song-to-filesystem mapper libraryMax Kellermann1-9/+17
The mapper library maps directory and song objects to file system paths. With this central library, the code mixture in path.c should be cleaned up, and we will be able to add neat features like aliasing.
2008-10-14playlist: moved code to playlist_save.cMax Kellermann1-14/+3
playlist_print_song() and playlist_print_uri() handle charset conversion and (optional) music directory prefixing.
2008-10-09database: renamed get_get_song() to db_get_song()Max Kellermann1-1/+1
Search'n'replace typo..
2008-10-08database: renamed functions, "db_" prefix and no CamelCaseMax Kellermann1-1/+1
Yet another CamelCase removal patch.
2008-10-08directory: moved code to database.cMax Kellermann1-1/+1
Taming the directory.c monster, part II: move the database management stuff to database. directory.c should only contain code which works on directory objects.
2008-10-08song: removed CamelCaseMax Kellermann1-2/+3
CamelCase is ugly... rename all functions.
2008-10-08song: converted typedef Song to struct songMax Kellermann1-2/+3
Again, a data type which can be forward-declared.
2008-10-06song: stop storing song_typeEric Wong1-1/+1
We already know if a song is a URL or not based on whether it has parentDir defined or not. Hopefully one day in the future we can drop HTTP support from MPD entirely when an HTTP filesystem comes along and we can access streams via open(2).
2008-09-09storedPlaylist: correctly expand path when writingEric Wong1-5/+6
Otherwise we'd be writing to whatever directory that mpd is running in.
2008-09-07playlist: don't pass "fd" to storedPlaylist.c functionsMax Kellermann1-94/+65
Return an "enum playlist_result" value instead of calling commandError() in storedPlaylist.c.
2008-09-07playlist: fix FILE* leak in appendSongToStoredPlaylistByPath()Max Kellermann1-0/+2
When an error occurs after the file has been opened, the function will never close the FILE object.
2008-09-07playlist: replaced run-time check with assertionMax Kellermann1-2/+1
The "fspath" argument of writeStoredPlaylistToPath() must never be NULL. There should be an assertion on that, instead of a run-time check.
2008-04-12clean up CPP includesMax Kellermann1-2/+0
Try to only include headers which are really needed. We should particularly check all "headers including other headers". The long-term goal is to have a manageable, small API for plugins (decoders, output) without so many mpd internals cluttering the namespace. git-svn-id: https://svn.musicpd.org/mpd/trunk@7319 09075e82-0dd4-0310-85a5-a0d7c8717e4f
2008-01-29storedPlaylist: faster, but less accurate check for maximum sizesEric Wong1-7/+7
There are still other ways to run the mpd server out of disk-space, so permissions are still recommended to protect against malicious users. git-svn-id: https://svn.musicpd.org/mpd/trunk@7179 09075e82-0dd4-0310-85a5-a0d7c8717e4f
2008-01-26storedPlaylist: prevent potential DoS from stored playlist commandsEric Wong1-1/+15
While mpd has always protected against the infinite expansion of the main playlist by limiting its size in memory, however the new storedPlaylist code has never checked for this limit. Malicious (or clumsy) users could repeatedly append songs to stored playlists, causing files to grow increasingly large on disk. Attempting to load extremely large files into memory will require mpd to slurp that all into memory, and ultimately the file would be unusable by mpd because of the configurable playlist size limit. Now we limit stored playlists to the max_playlist_length configuration variable set by the user (default is 16384). We will refuse to append to playlist files if they hit that limit; and also refuse to load more than the specified amount of songs into memory. git-svn-id: https://svn.musicpd.org/mpd/trunk@7154 09075e82-0dd4-0310-85a5-a0d7c8717e4f
2008-01-26fixed -Wshadow warningsMax Kellermann1-4/+4
Signed-off-by: Eric Wong <normalperson@yhbt.net> git-svn-id: https://svn.musicpd.org/mpd/trunk@7143 09075e82-0dd4-0310-85a5-a0d7c8717e4f
2008-01-03Cleanup #includes of standard system headers and put them in one placeEric Wong1-3/+1
This will make refactoring features easier, especially now that pthreads support and larger refactorings are on the horizon. Hopefully, this will make porting to other platforms (even non-UNIX-like ones for masochists) easier, too. os_compat.h will house all the #includes for system headers considered to be the "core" of MPD. Headers for optional features will be left to individual source files. git-svn-id: https://svn.musicpd.org/mpd/trunk@7130 09075e82-0dd4-0310-85a5-a0d7c8717e4f