aboutsummaryrefslogtreecommitdiffstats
path: root/src/path.h (follow)
Commit message (Collapse)AuthorAgeFilesLines
* all: Update copyright header.Avuton Olrich2009-03-131-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.
* path: don't export path_set_fs_charset()Max Kellermann2009-02-201-2/+0
| | | | The function path_set_fs_charset() is only used in path.c.
* path: include cleanupMax Kellermann2009-01-081-1/+0
|
* path: allocate buffer in fs_charset conversion functionsMax Kellermann2009-01-081-2/+12
| | | | | Don't use fixed static buffers. GLib allocates a new string for us anyway, let's just return this one instead of copying it.
* path: removed pfx_dir()Max Kellermann2009-01-041-12/+0
| | | | Use GLib's g_build_filename() instead of pfx_dir().
* removed os_compat.hMax Kellermann2008-12-291-1/+2
| | | | | Only include headers which are really needed. os_compat.h aimed to make MPD easily portable, but was never actually made portable.
* path: no CamelCaseMax Kellermann2008-11-051-4/+4
| | | | Rename variables and functions.
* path: removed sanitizePathDup()Max Kellermann2008-10-311-3/+0
| | | | | We don't need to sanitize the path, because the mapper already checks for malformed paths.
* path: moved playlist_dir to mapper.cMax Kellermann2008-10-311-9/+0
| | | | | Added the function map_spl_utf8_to_fs() which replaces utf8_to_fs_playlist_path().
* added prefix to header macrosMax Kellermann2008-10-311-2/+2
| | | | | | | "LOG_H" is a macro which is also used by ffmpeg/log.h. This is ffmpeg's fault, because short macros should be reserved for applications, but since it's always a good idea to choose prefixed macro names, even for applications, we are going to do that in MPD.
* path: removed pathcpy_trunc()Max Kellermann2008-10-201-6/+0
| | | | There was only one user of pathcpy_trunc(), which can be eliminated.
* path: replaced parent_path() with g_path_get_dirname()Max Kellermann2008-10-201-10/+0
| | | | Again, GLib's version is more robust than ours.
* path: replaced mpd_basename() with g_path_get_basename()Max Kellermann2008-10-201-8/+0
| | | | | | GLib's g_path_get_basename() is much more reliable than mpd_basename(). The latter could be tricked into an assertion failure.
* mapper: moved musicDir initialization from path.cMax Kellermann2008-10-151-5/+0
| | | | | Moved the musicDir variable and its initialization code from path.c to mapper.c.
* path: add mpd_basename() functionEric Wong2008-09-291-0/+8
| | | | | | | This is like basename(3) but with predictable semantics independent of C library or build options used. This is also much more strict and does not account for trailing slashes (mpd should never deal with trailing slashes on internal functions).
* clean up CPP includesMax Kellermann2008-04-121-1/+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
* fix -Wconst warningsMax Kellermann2008-02-051-5/+5
| | | | | | [ew: cleaned up the dirty union hack a bit] Signed-off-by: Eric Wong <normalperson@yhbt.net> git-svn-id: https://svn.musicpd.org/mpd/trunk@7180 09075e82-0dd4-0310-85a5-a0d7c8717e4f
* Cleanup #includes of standard system headers and put them in one placeEric Wong2008-01-031-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
* document parent_path()Eric Wong2008-01-031-3/+10
| | | git-svn-id: https://svn.musicpd.org/mpd/trunk@7128 09075e82-0dd4-0310-85a5-a0d7c8717e4f
* Make utf8_to_fs_playlist_path universally accessibleEric Wong2008-01-011-1/+7
| | | git-svn-id: https://svn.musicpd.org/mpd/trunk@7115 09075e82-0dd4-0310-85a5-a0d7c8717e4f
* Merge branches/ew r7104Eric Wong2007-12-281-17/+29
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | thread-safety work in preparation for rewrite to use pthreads Expect no regressions against trunk (r7078), possibly minor performance improvements in update (due to fewer heap allocations), but increased stack usage. Applied the following patches: * maxpath_str for reentrancy (temporary fix, reverted) * path: start working on thread-safe variants of these methods * Re-entrancy work on path/character-set conversions * directory.c: exploreDirectory() use reentrant functions here * directory/update: more use of reentrant functions + cleanups * string_toupper: a strdup-less version of strDupToUpper * get_song_url: a static-variable-free version of getSongUrl() * Use reentrant/thread-safe get_song_url everywhere * replace rmp2amp with the reentrant version, rmp2amp_r * Get rid of the non-reentrant/non-thread-safe rpp2app, too. * buffer2array: assert strdup() returns a usable value in unit tests * replace utf8ToFsCharset and fsCharsetToUtf8 with thread-safe variants * fix storing playlists w/o absolute paths * parent_path(), a reentrant version of parentPath() * parentPath => parent_path for reentrancy and thread-safety * allow "make test" to automatically run embedded unit tests * remove convStrDup() and maxpath_str() * use MPD_PATH_MAX everywhere instead of MAXPATHLEN * path: get rid of appendSlash, pfx_path and just use pfx_dir * get_song_url: fix the ability to play songs in the top-level music_directory git-svn-id: https://svn.musicpd.org/mpd/trunk@7106 09075e82-0dd4-0310-85a5-a0d7c8717e4f
* The massive copyright updateAvuton Olrich2007-04-051-1/+1
| | | git-svn-id: https://svn.musicpd.org/mpd/trunk@5834 09075e82-0dd4-0310-85a5-a0d7c8717e4f
* Replace strdup and {c,re,m}alloc with x* variants to check for OOM errorsEric Wong2006-08-261-1/+1
| | | | | | | | | | | | | | | | | | | I'm checking for zero-size allocations and assert()-ing them, so we can more easily get backtraces and debug problems, but we'll also allow -DNDEBUG people to live on the edge if they wish. We do not rely on errno when checking for OOM errors because some implementations of malloc do not set it, and malloc is commonly overridden by userspace wrappers. I've spent some time looking through the source and didn't find any obvious places where we would explicitly allocate 0 bytes, so we shouldn't trip any of those assertions. We also avoid allocating zero bytes because C libraries don't handle this consistently (some return NULL, some not); and it's dangerous either way. git-svn-id: https://svn.musicpd.org/mpd/trunk@4690 09075e82-0dd4-0310-85a5-a0d7c8717e4f
* Fix warnings for -Wmissing-prototypesAvuton Olrich2006-08-201-3/+3
| | | | | | Add -Wmissing-prototypes if compiling with gcc Static where possible git-svn-id: https://svn.musicpd.org/mpd/trunk@4657 09075e82-0dd4-0310-85a5-a0d7c8717e4f
* Revert leaks from r4311, and also the leak fixes as a result of thatEric Wong2006-08-141-1/+10
| | | | | | | | | | | | | | | | | | | | | | utf8ToFsCharset() and fsCharsetToUtf8() got very broken in r4311, and resulted in several commits to fix those leaks. Unfortunately, not all of those newly introduced leaks were fixed, nor was the result pretty. Also, fixed a double-free in lsPlaylists(). This is very hard to trigger (and therefore exploit) at the moment because we check printDirectoryInfo() beforehand. Intended behavior for utf8ToFsCharset() and fsCharsetToUtf8() as God^H^H^Hshank originally intended is now documented in path.h to prevent future errors like this. mpd could still use some good valgrind testing before the 0.12.0 release. <plug>In addition to reducing heap fragmentation, malloc reductions from mpd-ke greatly reduces the chance of leaks from happening due to programming errors.</plug> git-svn-id: https://svn.musicpd.org/mpd/trunk@4639 09075e82-0dd4-0310-85a5-a0d7c8717e4f
* remove clumsy strncpy useEric Wong2006-07-301-1/+7
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | strncpy isn't really safe because it doesn't guarantee null termination, and we have had to work around it in several places. strlcpy (from OpenBSD) isn't great, either because it often leaves errors going unchecked (by truncating strings). So we'll add the pathcpy_trunc() function with is basically strlcpy with a hardcoded MAXPATHLEN as the limit, and we'll acknowledge truncation since we only work on paths and MAXPATHLEN should be set correctly by the system headers[1]. file-specific notes: inputStream_http: eyeballing the changes here, it seems to look alright but I haven't actually tested it myself. ls: don't even bother printing a file if the filename is too long (and when is it ever?) since we won't be able to read it anyways. metadataChunk: it's only metadata, and it's only for showin the user, so truncating it here souldn't be a big issue. memset to zero in init is unecessary, so lets not waste cycles [1] - If the system headers are screwed up, then we're majorly screwed regardless of what we do :x git-svn-id: https://svn.musicpd.org/mpd/trunk@4491 09075e82-0dd4-0310-85a5-a0d7c8717e4f
* Add mpd-indent.shAvuton Olrich2006-07-201-9/+9
| | | | | | Indent the entire tree, hopefully we can keep it indented. git-svn-id: https://svn.musicpd.org/mpd/trunk@4410 09075e82-0dd4-0310-85a5-a0d7c8717e4f
* Change shank's email addressJ. Alexander Treuman2006-07-141-1/+1
| | | git-svn-id: https://svn.musicpd.org/mpd/trunk@4333 09075e82-0dd4-0310-85a5-a0d7c8717e4f
* Huge header update, update the copyright and addAvuton Olrich2006-07-131-1/+1
| | | | | the GPL header where necessary git-svn-id: https://svn.musicpd.org/mpd/trunk@4317 09075e82-0dd4-0310-85a5-a0d7c8717e4f
* path.*: cleanupsAvuton Olrich2006-07-131-2/+0
| | | | | utf8.c: add some static's git-svn-id: https://svn.musicpd.org/mpd/trunk@4311 09075e82-0dd4-0310-85a5-a0d7c8717e4f
* config file change! now 'port' is optional and 'db_file' is required!Warren Dukes2005-03-061-1/+1
| | | | | | also, should have better error reporting when failing to open playlist or music directory's, or writing the db, etc git-svn-id: https://svn.musicpd.org/mpd/trunk@3027 09075e82-0dd4-0310-85a5-a0d7c8717e4f
* remove vim &*(@Warren Dukes2004-11-031-1/+0
| | | git-svn-id: https://svn.musicpd.org/mpd/trunk@2500 09075e82-0dd4-0310-85a5-a0d7c8717e4f
* clean up a little bit main() codeWarren Dukes2004-04-151-3/+4
| | | git-svn-id: https://svn.musicpd.org/mpd/trunk@771 09075e82-0dd4-0310-85a5-a0d7c8717e4f
* add vim shiznit to end of all source filesWarren Dukes2004-04-141-0/+1
| | | git-svn-id: https://svn.musicpd.org/mpd/trunk@750 09075e82-0dd4-0310-85a5-a0d7c8717e4f
* ok, finished incremental update!Warren Dukes2004-04-141-0/+3
| | | | | now just need to polish up a few things with update git-svn-id: https://svn.musicpd.org/mpd/trunk@745 09075e82-0dd4-0310-85a5-a0d7c8717e4f
* bunch of autotool cleanupsWarren Dukes2004-03-181-0/+2
| | | git-svn-id: https://svn.musicpd.org/mpd/trunk@271 09075e82-0dd4-0310-85a5-a0d7c8717e4f
* import from SF CVSWarren Dukes2004-02-231-0/+50
git-svn-id: https://svn.musicpd.org/mpd/trunk@1 09075e82-0dd4-0310-85a5-a0d7c8717e4f