aboutsummaryrefslogtreecommitdiffstats
path: root/src/charConv.c (follow)
Commit message (Collapse)AuthorAgeFilesLines
* path, tag_id3: use g_convert() instead of charConv.cMax Kellermann2008-10-151-177/+0
| | | | | | | 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.
* assume stdint.h and stddef.h are availableMax Kellermann2008-09-291-1/+0
| | | | | | Since we use a C99 compiler now, we can assert that the C99 standard headers are available, no need for complicated compile time checks. Kill mpd_types.h.
* Switch to C99 types (retaining compat with old compilers)Eric Wong2008-09-291-3/+3
| | | | | | | | | | | | | | | Seeing the "mpd_" prefix _everywhere_ is mind-numbing as the mind needs to retrain itself to skip over the first 4 tokens of a type to get to its meaning. So avoid having extra characters on my terminal to make it easier to follow code at 2:30 am in the morning. Please report any new issues you may come across on Free toolchains. I realize how difficult it can be to build/maintain cross-compiling toolchains and I have no intention of forcing people to upgrade their toolchains to build mpd. Tested with gcc 2.95.4 and and gcc 4.3.1 on x86-32.
* clean up CPP includesMax Kellermann2008-04-121-0/+2
| | | | | | | | | 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
* deconstify input buffer for iconv()Max Kellermann2008-04-121-2/+18
| | | | | | | | Unfortunately, the function iconv() wants a non-const input buffer. In this context, we only have a const pointer, which emits a correct gcc warning. Work around this ugliness with an union-deconst hack. This is optimized away in the binary. git-svn-id: https://svn.musicpd.org/mpd/trunk@7229 09075e82-0dd4-0310-85a5-a0d7c8717e4f
* fix "unreachable code" warningMax Kellermann2008-03-261-2/+2
| | | | | | There is unreachable code at several positions, e.g. after an #if/#end, or after an endless loop. Remove that. git-svn-id: https://svn.musicpd.org/mpd/trunk@7197 09075e82-0dd4-0310-85a5-a0d7c8717e4f
* fix -Wconst warningsMax Kellermann2008-02-051-2/+2
| | | | | | [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
* fixed "comparison between signed and unsigned"Max Kellermann2008-01-261-1/+1
| | | | | Signed-off-by: Eric Wong <normalperson@yhbt.net> git-svn-id: https://svn.musicpd.org/mpd/trunk@7146 09075e82-0dd4-0310-85a5-a0d7c8717e4f
* Cleanup #includes of standard system headers and put them in one placeEric Wong2008-01-031-4/+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
* charConv: tie the buffer size for iconv() to our PATH_MAX constantEric Wong2008-01-011-1/+2
| | | | | | | Although most PATH_MAX is higher than the 1k buffer we set, some implementations will set a 256 (or even 64) byte PATH_MAX, so we should be prepared for that. git-svn-id: https://svn.musicpd.org/mpd/trunk@7121 09075e82-0dd4-0310-85a5-a0d7c8717e4f
* Merge branches/ew r7104Eric Wong2007-12-281-15/+9
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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
* Removing a global initialization to 0.J. Alexander Treuman2007-02-181-1/+1
| | | git-svn-id: https://svn.musicpd.org/mpd/trunk@5378 09075e82-0dd4-0310-85a5-a0d7c8717e4f
* Reverting all of my localization changes. It was a horribleJ. Alexander Treuman2007-02-181-7/+0
| | | | | | 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
* More sparse fixes now that we've re-enabled -Wmissing-prototypesEric Wong2007-01-141-6/+6
| | | git-svn-id: https://svn.musicpd.org/mpd/trunk@5260 09075e82-0dd4-0310-85a5-a0d7c8717e4f
* Moving pathConvCharset to charConv.c so it can be reused for localization.J. Alexander Treuman2007-01-081-0/+7
| | | git-svn-id: https://svn.musicpd.org/mpd/trunk@5226 09075e82-0dd4-0310-85a5-a0d7c8717e4f
* Replace strdup and {c,re,m}alloc with x* variants to check for OOM errorsEric Wong2006-08-261-9/+10
| | | | | | | | | | | | | | | | | | | 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
* This fixes 5 potential bugs where the conditional would always be true.Avuton Olrich2006-08-201-1/+1
| | | git-svn-id: https://svn.musicpd.org/mpd/trunk@4659 09075e82-0dd4-0310-85a5-a0d7c8717e4f
* Fix warnings for -Wmissing-prototypesAvuton Olrich2006-08-201-1/+1
| | | | | | 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
* charConv: optimize away a boatload of strdups during update (try #2)Eric Wong2006-08-011-4/+13
| | | | | | | This was originally introduced in r3718, but reverted r3859 since the original r3718 commit was incorrect (and I was too excited about the speedup and also lacking in UTF-8 files to notice :x) git-svn-id: https://svn.musicpd.org/mpd/trunk@4517 09075e82-0dd4-0310-85a5-a0d7c8717e4f
* Add mpd-indent.shAvuton Olrich2006-07-201-30/+37
| | | | | | 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
* sparse: ANSI-fy function declarationsEric Wong2006-07-171-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | These are just warnings from sparse, but it makes the output easier to read. I ran this through a quick perl script, but of course verified the output by looking at the diff and making sure the thing still compiles. here's the quick perl script I wrote to generate this patch: ----------- 8< ----------- use Tie::File; defined(my $pid = open my $fh, '-|') or die $!; if (!$pid) { open STDERR, '>&STDOUT' or die $!; exec 'sparse', @ARGV or die $!; } my $na = 'warning: non-ANSI function declaration of function'; while (<$fh>) { print STDERR $_; if (/^(.+?\.[ch]):(\d+):(\d+): $na '(\w+)'/o) { my ($f, $l, $pos, $func) = ($1, $2, $3, $4); $l--; tie my @x, 'Tie::File', $f or die "$!: $f"; print '-', $x[$l], "\n"; $x[$l] =~ s/\b($func\s*)\(\s*\)/$1(void)/; print '+', $x[$l], "\n"; untie @x; } } git-svn-id: https://svn.musicpd.org/mpd/trunk@4378 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
* [CLEANUP] Remove closeCharSetConversion from theAvuton Olrich2006-07-141-2/+4
| | | | | | header, there's no need to export it. Static it. git-svn-id: https://svn.musicpd.org/mpd/trunk@4330 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
* fix bug 544Warren Dukes2006-01-251-11/+4
| | | git-svn-id: https://svn.musicpd.org/mpd/trunk@3859 09075e82-0dd4-0310-85a5-a0d7c8717e4f
* optimize away a boatload of strdups during updateEric Wong2005-12-051-4/+11
| | | git-svn-id: https://svn.musicpd.org/mpd/trunk@3718 09075e82-0dd4-0310-85a5-a0d7c8717e4f
* todo updateWarren Dukes2004-11-031-1/+0
| | | git-svn-id: https://svn.musicpd.org/mpd/trunk@2499 09075e82-0dd4-0310-85a5-a0d7c8717e4f
* actually, scratch the last changeWarren Dukes2004-06-171-1/+1
| | | git-svn-id: https://svn.musicpd.org/mpd/trunk@1524 09075e82-0dd4-0310-85a5-a0d7c8717e4f
* check in configure script if iconv() needs CONSTWarren Dukes2004-06-171-1/+1
| | | git-svn-id: https://svn.musicpd.org/mpd/trunk@1523 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
* rename all ascii/utf8 stuff to latin1/utf8Warren Dukes2004-04-131-11/+11
| | | git-svn-id: https://svn.musicpd.org/mpd/trunk@718 09075e82-0dd4-0310-85a5-a0d7c8717e4f
* lots of fsCharset, utf8/ascii converting clean-up and robustness stuffWarren Dukes2004-04-131-29/+78
| | | | | | | Also, if fsCharsetToUtf8 can't convert to valid UTF-8, then don't add it to the db, this way clients don't have to worry about weirdness and it will force ppl to convert it. git-svn-id: https://svn.musicpd.org/mpd/trunk@711 09075e82-0dd4-0310-85a5-a0d7c8717e4f
* few cleanupsWarren Dukes2004-02-251-2/+3
| | | git-svn-id: https://svn.musicpd.org/mpd/trunk@57 09075e82-0dd4-0310-85a5-a0d7c8717e4f
* a few more cleanups, use memcpy instead of strncpyWarren Dukes2004-02-251-2/+2
| | | git-svn-id: https://svn.musicpd.org/mpd/trunk@55 09075e82-0dd4-0310-85a5-a0d7c8717e4f
* import from SF CVSWarren Dukes2004-02-231-0/+99
git-svn-id: https://svn.musicpd.org/mpd/trunk@1 09075e82-0dd4-0310-85a5-a0d7c8717e4f