| Commit message (Collapse) | Author | Files | Lines |
|
spl_append_song() can crash when fopen() fails, because it attempts to
close the invalid file handle (NULL) in the error handler.
|
|
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.
|
|
"ls" is a bad name for a library which parses URIs. We'll move the
rest of the "ls" library later.
|
|
|
|
Don't declare and export variables specific to stored playlists in
playlist.c/playlist.h.
|
|
Some code will be a little bit simpler if the dot is part of the
string literal.
|
|
|
|
Don't use fixed static buffers. GLib allocates a new string for us
anyway, let's just return this one instead of copying it.
|
|
Use GLib's g_build_filename() instead of pfx_dir().
|
|
|
|
|
|
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.
|
|
|
|
To find out whether a file exists, use g_file_test() instead of
stat(), because it is more portable and easier to use.
|
|
Don't pass a static buffer to map_spl_utf8_to_fs().
|
|
Only include headers which are really needed. os_compat.h aimed to
make MPD easily portable, but was never actually made portable.
|
|
Replaced myFgets() with fgets() + g_strchomp().
|
|
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.
|
|
The function didn't do anything useful, it was just several lines
obfuscating that it was only forwarding isRemoteUrl()'s return value.
|
|
Added the function map_spl_utf8_to_fs() which replaces
utf8_to_fs_playlist_path().
|
|
Cast playlist_max_length to off_t before comparing it to stat.st_size.
|
|
The "rm" command did not send notifications to idle clients. Add it.
|
|
The function deletePlaylist() shouldn't be in playlist.c.
|
|
Don't use our deprecated linked list library, use GLib's GPtrArray
instead.
|
|
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).
|
|
spl_list() provides an interface for enumerating all stored playlists.
This separates the internal playlist logic from the protocol specific
function lsPlaylists().
|
|
The return value of spl_append_uri() was somewhat buggy: some branches
returned ACK_* values, and some an enum playlist_result. Unify this.
|
|
Rename addToStoredPlaylist() to spl_append_uri(), and remove the
clearStoredPlaylist() macro.
|
|
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.
|
|
Renamed all public functions, prefix is "spl_".
|
|
No CamelCase in file names.
|
|
"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.
|
|
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.
|
|
playlist_print_song() and playlist_print_uri() handle charset
conversion and (optional) music directory prefixing.
|
|
Search'n'replace typo..
|
|
Yet another CamelCase removal patch.
|
|
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.
|
|
CamelCase is ugly... rename all functions.
|
|
Again, a data type which can be forward-declared.
|
|
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).
|
|
Otherwise we'd be writing to whatever directory that mpd is
running in.
|
|
Return an "enum playlist_result" value instead of calling
commandError() in storedPlaylist.c.
|
|
When an error occurs after the file has been opened, the function will
never close the FILE object.
|
|
The "fspath" argument of writeStoredPlaylistToPath() must never be
NULL. There should be an assertion on that, instead of a run-time
check.
|
|
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
|
|
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
|
|
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
|
|
Signed-off-by: Eric Wong <normalperson@yhbt.net>
git-svn-id: https://svn.musicpd.org/mpd/trunk@7143 09075e82-0dd4-0310-85a5-a0d7c8717e4f
|
|
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
|
|
Abstractions should reduce the amount of code and make things
easier to follow. The StoredPlaylist struct did not do that, so
get rid of it and just use our standard linked list
implementation instead.
diffstat agrees with me that the abstraction is pointless:
3 files changed, 60 insertions(+), 90 deletions(-)
git-svn-id: https://svn.musicpd.org/mpd/trunk@7120 09075e82-0dd4-0310-85a5-a0d7c8717e4f
|