aboutsummaryrefslogtreecommitdiffstats
path: root/src/path.c (follow)
Commit message (Collapse)AuthorAgeFilesLines
* path: convert to C++Max Kellermann2013-01-171-131/+0
|
* path: move code to IsSupportedCharset()Max Kellermann2013-01-101-6/+15
|
* path: make the "win_charset" buffer staticMax Kellermann2013-01-101-1/+1
| | | | It is illegal to use it after going out of scope.
* Merge branch 'v0.16.x'Max Kellermann2011-11-281-0/+16
|\ | | | | | | | | | | | | | | | | | | Conflicts: Makefile.am NEWS configure.ac src/encoder/flac_encoder.c src/log.c src/pcm_buffer.c
| * path: autodetect filesystem encoding on Win32Denis Krjuchkov2011-10-231-0/+16
| | | | | | | | | | | | | | WinAPI explicitly declares filesystem encoding. It can be determined by GetACP(). Use that instead of Glib routine that always "detects" UTF-8 on Win32, which is incorrect for MPD case.
* | copyright year 2011Max Kellermann2011-01-291-1/+1
|/
* eliminate g_error() usageThomas Jansen2010-09-251-1/+2
| | | | | | | | | | | | | | Replaced all occurrences of g_error() with MPD_ERROR() located in a new header file 'mpd_error.h'. This macro uses g_critical() to print the error message and then exits gracefully in contrast to g_error() which would internally call abort() to produce a core dump. The macro name is distinctive and allows to find all places with dubious error handling. The long-term goal is to get rid of MPD_ERROR() altogether. To facilitate the eventual removal of this macro it was added in a new header file rather than to an existing header file. This fixes #2995 and #3007.
* Update copyright notices.Avuton Olrich2009-12-311-1/+1
|
* include config.h in all sourcesMax Kellermann2009-11-121-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.
* 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-1/+2
| | | | The function path_set_fs_charset() is only used in path.c.
* path: validate configured character setMax Kellermann2009-02-201-0/+11
|
* use config_get_string() instead of config_get_param()Max Kellermann2009-01-251-5/+2
| | | | | config_get_string() is easier to use than config_get_param() because it unpacks the config_param struct.
* conf: no CamelCase, part IMax Kellermann2009-01-171-1/+2
| | | | Renamed functions, types, variables.
* path: include cleanupMax Kellermann2009-01-081-1/+0
|
* path: allocate buffer in fs_charset conversion functionsMax Kellermann2009-01-081-19/+10
| | | | | 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, tag: don't allocate GError for charset conversionMax Kellermann2009-01-041-10/+4
| | | | | Pass NULL instead of &error to g_convert(). We're not interested in the error object.
* path: removed pfx_dir()Max Kellermann2009-01-041-17/+0
| | | | Use GLib's g_build_filename() instead of pfx_dir().
* don't include utils.h when it isn't usedMax Kellermann2009-01-031-1/+0
|
* path: use GLib loggingMax Kellermann2008-12-291-5/+7
|
* 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.
* replaced mpd_likely/mpd_unlikely by G_LIKELY/G_UNLIKELYThomas Jansen2008-12-021-1/+1
| | | | | We want to remove gcc.h eventually. This takes care of all the G_LIKELY/G_UNLIKELY macros.
* path: fix g_convert() argument orderKonstantin Sobolev2008-11-201-2/+2
| | | | | g_convert() wants the destination character set first. This was mixed up.
* path: removed superfluous error check in path_set_fs_charset()Max Kellermann2008-11-051-8/+0
| | | | The code which had a possible error condition had been removed.
* path: don't allocate charset twiceMax Kellermann2008-11-051-5/+3
| | | | | Make the local variable "charset" const, and don't duplicate its value. It is already duplicated by path_set_fs_charset().
* path: get filesystem charset from GLibMax Kellermann2008-11-051-39/+6
| | | | | | GLib provides the function g_get_filename_charsets() which determines the file system character set. This changes MPD's fallback: GLib prefers UTF-8 as a fallback. MPD used to fall back to ISO Latin 1.
* path: no CamelCaseMax Kellermann2008-11-051-22/+19
| | | | Rename variables and functions.
* path: removed sanitizePathDup()Max Kellermann2008-10-311-40/+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-28/+0
| | | | | Added the function map_spl_utf8_to_fs() which replaces utf8_to_fs_playlist_path().
* removed UTF-8 library, use GLib insteadMax Kellermann2008-10-311-1/+0
| | | | Removed duplicated code.
* path: free GLib error in fs_charset_to_utf8()Max Kellermann2008-10-311-1/+3
| | | | g_error_free() was missing in case g_convert() failed.
* path: removed pathcpy_trunc()Max Kellermann2008-10-201-13/+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-28/+0
| | | | Again, GLib's version is more robust than ours.
* path: replaced mpd_basename() with g_path_get_basename()Max Kellermann2008-10-201-12/+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-20/+0
| | | | | Moved the musicDir variable and its initialization code from path.c to mapper.c.
* path: allow starting MPD with non-existing music directoryMax Kellermann2008-10-151-6/+6
| | | | When the music directory is not mounted yet, let MPD start anyway.
* path, tag_id3: use g_convert() instead of charConv.cMax Kellermann2008-10-151-24/+30
| | | | | | | GLib provides an easier API for character set conversion than iconv(). Use g_convert() / g_convert_with_fallback() for all character conversions. We should optimize the path.h API later to return a newly allocated buffer, so we can just pass GLib's return value.
* path: add mpd_basename() functionEric Wong2008-09-291-0/+12
| | | | | | | 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).
* added "length" parameter to validUtf8String()Max Kellermann2008-08-291-1/+1
| | | | | | | At several places, we create temporary copies of non-null-terminated strings, just to use them in functions like validUtf8String(). We can save this temporary allocation and avoid heap fragmentation if we add a length parameter instead of expecting a null-terminated string.
* fix -Wconst warningsMax Kellermann2008-02-051-7/+8
| | | | | | [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-8/+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-0/+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-0/+8
| | | git-svn-id: https://svn.musicpd.org/mpd/trunk@7115 09075e82-0dd4-0310-85a5-a0d7c8717e4f
* Merge branches/ew r7104Eric Wong2007-12-281-74/+44
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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
* adding \n to a bunch of error message stringsJ. Alexander Treuman2007-08-271-1/+1
| | | git-svn-id: https://svn.musicpd.org/mpd/trunk@6826 09075e82-0dd4-0310-85a5-a0d7c8717e4f
* Changing all calls to ERROR() followed by exit(EXIT_FAILURE) with a singleJ. Alexander Treuman2007-05-261-4/+2
| | | | | call to FATAL(). git-svn-id: https://svn.musicpd.org/mpd/trunk@6276 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
* Reverting all of my localization changes. It was a horribleJ. Alexander Treuman2007-02-181-6/+50
| | | | | | implementation, and fixing it is a big enough job that I don't know when I'll get around to it. Probably best just starting from scratch anyhow. git-svn-id: https://svn.musicpd.org/mpd/trunk@5373 09075e82-0dd4-0310-85a5-a0d7c8717e4f
* Don't initialize globals to zero (or NULL)Eric Wong2007-01-141-3/+3
| | | | | | | | Some compilers and linkers aren't smart enough to optimize this, as global variables are implictly initialized to zero. As a result, binaries are a bit smaller as more goes in the .bss and less in the text section. git-svn-id: https://svn.musicpd.org/mpd/trunk@5254 09075e82-0dd4-0310-85a5-a0d7c8717e4f
* Convert log messages sent to stdout to the current locale's charset.J. Alexander Treuman2007-01-081-7/+3
| | | git-svn-id: https://svn.musicpd.org/mpd/trunk@5227 09075e82-0dd4-0310-85a5-a0d7c8717e4f