aboutsummaryrefslogtreecommitdiffstats
path: root/src/decode.c (unfollow)
Commit message (Collapse)AuthorFilesLines
2006-08-26Replace strdup and {c,re,m}alloc with x* variants to check for OOM errorsEric Wong1-2/+2
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
2006-08-20Fix warnings for -Wmissing-prototypesAvuton Olrich1-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
2006-08-14Revert leaks from r4311, and also the leak fixes as a result of thatEric Wong1-7/+3
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
2006-08-08more sparse cleanupsEric Wong1-1/+1
* less-commonly compiled things like ao/mvp outputs * Adding -Wno-transparent-union to SPARSE_FLAGS makes it check inside decode.c, directory.c, player.c, and sig_handlers.c * remove unused variables leftover from the master process in sig_handlers.c git-svn-id: https://svn.musicpd.org/mpd/trunk@4598 09075e82-0dd4-0310-85a5-a0d7c8717e4f
2006-08-01logging cleanupsEric Wong1-2/+2
* Moved all logging-related stuff into log.c (and not myfprintf.c) * ISO C90-compliant strftime usage: %e and %R replaced with %d and %H:%M respectively * Got rid of variadic macros since some old-school compilers don't like them * compiling with -DNDEBUG disables the DEBUG() macro git-svn-id: https://svn.musicpd.org/mpd/trunk@4512 09075e82-0dd4-0310-85a5-a0d7c8717e4f
2006-07-30remove clumsy strncpy useEric Wong1-18/+8
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
2006-07-20Add mpd-indent.shAvuton Olrich1-258/+253
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
2006-07-16Fixing a whopping 4 memory leaksJ. Alexander Treuman1-1/+6
git-svn-id: https://svn.musicpd.org/mpd/trunk@4371 09075e82-0dd4-0310-85a5-a0d7c8717e4f
2006-07-14[CLEANUP] Cleanup spaces->tabsAvuton Olrich1-87/+87
Make functions static where it makes sense git-svn-id: https://svn.musicpd.org/mpd/trunk@4335 09075e82-0dd4-0310-85a5-a0d7c8717e4f
2006-07-14Change shank's email addressJ. Alexander Treuman1-1/+1
git-svn-id: https://svn.musicpd.org/mpd/trunk@4333 09075e82-0dd4-0310-85a5-a0d7c8717e4f
2006-07-14Remove test on a local variable that won't have been modified yetJ. Alexander Treuman1-1/+0
git-svn-id: https://svn.musicpd.org/mpd/trunk@4324 09075e82-0dd4-0310-85a5-a0d7c8717e4f
2006-07-14Remove unused playSilenceOrSleep macroJ. Alexander Treuman1-6/+0
git-svn-id: https://svn.musicpd.org/mpd/trunk@4323 09075e82-0dd4-0310-85a5-a0d7c8717e4f
2006-07-14Remove some misleading comments, fix shanks terrible spellingJ. Alexander Treuman1-6/+1
git-svn-id: https://svn.musicpd.org/mpd/trunk@4322 09075e82-0dd4-0310-85a5-a0d7c8717e4f
2006-07-13Huge header update, update the copyright and addAvuton Olrich1-1/+1
the GPL header where necessary git-svn-id: https://svn.musicpd.org/mpd/trunk@4317 09075e82-0dd4-0310-85a5-a0d7c8717e4f
2006-03-16merge with mpd/trunk up to r3925Eric Wong1-21/+60
git-svn-id: https://svn.musicpd.org/mpd/trunk@3926 09075e82-0dd4-0310-85a5-a0d7c8717e4f
2005-12-17call dropBufferedAudio() when pausingWarren Dukes1-1/+4
git-svn-id: https://svn.musicpd.org/mpd/trunk@3732 09075e82-0dd4-0310-85a5-a0d7c8717e4f
2005-11-19gcc 2.95 fixesEric Wong1-1/+1
audioOutput_osx.c, aac_decode.c, mp4_decode.c have NOT been thoroughly checked, but I nevertheless managed to eyeball and fix one incompatibility in audioOutput_osx.c All other files have been build successfully with gcc 2.95 git-svn-id: https://svn.musicpd.org/mpd/trunk@3688 09075e82-0dd4-0310-85a5-a0d7c8717e4f
2005-11-16DJWLindenaar balanced tree and master process patchQball Cow1-1/+1
git-svn-id: https://svn.musicpd.org/mpd/trunk@3669 09075e82-0dd4-0310-85a5-a0d7c8717e4f
2005-08-20"&", not "&&" (the bug itself was harmless, but a bug nevertheless)Eric Wong1-1/+1
git-svn-id: https://svn.musicpd.org/mpd/trunk@3445 09075e82-0dd4-0310-85a5-a0d7c8717e4f
2005-03-21drop the current audio buffer when seekingWarren Dukes1-0/+1
git-svn-id: https://svn.musicpd.org/mpd/trunk@3107 09075e82-0dd4-0310-85a5-a0d7c8717e4f
2005-03-19fix some signal handlingWarren Dukes1-9/+1
git-svn-id: https://svn.musicpd.org/mpd/trunk@3101 09075e82-0dd4-0310-85a5-a0d7c8717e4f
2005-03-10todo update, and remove a potentially gratutious playSilence() callWarren Dukes1-1/+6
git-svn-id: https://svn.musicpd.org/mpd/trunk@3051 09075e82-0dd4-0310-85a5-a0d7c8717e4f
2005-03-09*) add support for pid filesWarren Dukes1-36/+39
*) we now require pid_file to specified in the config *) new prefered method for killing mpd: mpd --kill *) cleaned up some nastiness with decode_pid handling git-svn-id: https://svn.musicpd.org/mpd/trunk@3042 09075e82-0dd4-0310-85a5-a0d7c8717e4f
2005-03-08undo fix for killall not preserving the current format properly, it causes ↵Warren Dukes1-2/+5
problems for alsa and other things that spawn extra process w/o us knowing git-svn-id: https://svn.musicpd.org/mpd/trunk@3039 09075e82-0dd4-0310-85a5-a0d7c8717e4f
2005-03-08now player and decoder processes should only exit() when receiving term ↵Warren Dukes1-2/+3
signal from their respective parent processes git-svn-id: https://svn.musicpd.org/mpd/trunk@3034 09075e82-0dd4-0310-85a5-a0d7c8717e4f
2005-03-05implemented dropping of current buffered audio, works for oss, but there seemsWarren Dukes1-0/+1
to be a "blip" for alsa devices, needs more work git-svn-id: https://svn.musicpd.org/mpd/trunk@3011 09075e82-0dd4-0310-85a5-a0d7c8717e4f
2004-11-10merge changes from metadata-rewrite branchWarren Dukes1-4/+0
git-svn-id: https://svn.musicpd.org/mpd/trunk@2589 09075e82-0dd4-0310-85a5-a0d7c8717e4f
2004-11-03forgot a '\n' at the end of a error statementWarren Dukes1-2/+2
git-svn-id: https://svn.musicpd.org/mpd/trunk@2490 09075e82-0dd4-0310-85a5-a0d7c8717e4f
2004-10-28when sending metadata to audiodevice, put filename in title if no tag data ↵Warren Dukes1-0/+4
is found git-svn-id: https://svn.musicpd.org/mpd/trunk@2381 09075e82-0dd4-0310-85a5-a0d7c8717e4f
2004-10-26undo last changesWarren Dukes1-21/+11
git-svn-id: https://svn.musicpd.org/mpd/trunk@2345 09075e82-0dd4-0310-85a5-a0d7c8717e4f
2004-10-26try to fix metadata on initially playing (metadata being sent before device ↵Warren Dukes1-12/+22
is open) git-svn-id: https://svn.musicpd.org/mpd/trunk@2344 09075e82-0dd4-0310-85a5-a0d7c8717e4f
2004-10-25parse metadata and send to output when playing another streamWarren Dukes1-2/+8
git-svn-id: https://svn.musicpd.org/mpd/trunk@2338 09075e82-0dd4-0310-85a5-a0d7c8717e4f
2004-10-25fix a big time bug in metadataChunk (off by one in an array assignment)Warren Dukes1-1/+9
also, now we have metadata in our streams git-svn-id: https://svn.musicpd.org/mpd/trunk@2337 09075e82-0dd4-0310-85a5-a0d7c8717e4f
2004-10-16#1) Fix a potential security hole, where mpd sends a line from a playlist to ↵Warren Dukes1-1/+5
a client if the line is too long. But this is a rare circumstance, since the file would need to have a .m3u suffix and the line would need to be very long. #2) Fix qball's bug, basically when we try todo initial buffering in decodeStart(), sleep for a few seconds after each attempt to finish init'ing the connection and begin buffering. git-svn-id: https://svn.musicpd.org/mpd/trunk@2236 09075e82-0dd4-0310-85a5-a0d7c8717e4f
2004-08-09fix a spelling error in messageWarren Dukes1-2/+2
git-svn-id: https://svn.musicpd.org/mpd/trunk@1993 09075e82-0dd4-0310-85a5-a0d7c8717e4f
2004-07-12report error to error log when unable to open audio deviceWarren Dukes1-0/+2
git-svn-id: https://svn.musicpd.org/mpd/trunk@1852 09075e82-0dd4-0310-85a5-a0d7c8717e4f
2004-06-20fix qball's bug, crossfading playing with funny samplerateWarren Dukes1-1/+3
git-svn-id: https://svn.musicpd.org/mpd/trunk@1585 09075e82-0dd4-0310-85a5-a0d7c8717e4f
2004-06-19fix a few bugs in mp3_decode and minimize alsa underruns by playing silence ↵Warren Dukes1-3/+8
when switch songs git-svn-id: https://svn.musicpd.org/mpd/trunk@1572 09075e82-0dd4-0310-85a5-a0d7c8717e4f
2004-06-19uber minor tweaksWarren Dukes1-2/+3
git-svn-id: https://svn.musicpd.org/mpd/trunk@1563 09075e82-0dd4-0310-85a5-a0d7c8717e4f
2004-06-10minor little cleanupsWarren Dukes1-17/+24
git-svn-id: https://svn.musicpd.org/mpd/trunk@1439 09075e82-0dd4-0310-85a5-a0d7c8717e4f
2004-06-09fix some streaming metadata issuesWarren Dukes1-1/+3
git-svn-id: https://svn.musicpd.org/mpd/trunk@1416 09075e82-0dd4-0310-85a5-a0d7c8717e4f
2004-06-08remove "wrap" from buffering control, its not needed, and could potentiallyWarren Dukes1-11/+6
create a race condition (but hasn't happened in the last 10 months since this code was written) git-svn-id: https://svn.musicpd.org/mpd/trunk@1397 09075e82-0dd4-0310-85a5-a0d7c8717e4f
2004-06-07remove metadata debugging codeWarren Dukes1-2/+0
git-svn-id: https://svn.musicpd.org/mpd/trunk@1378 09075e82-0dd4-0310-85a5-a0d7c8717e4f
2004-06-07some fixes to metadata stuffWarren Dukes1-11/+0
git-svn-id: https://svn.musicpd.org/mpd/trunk@1370 09075e82-0dd4-0310-85a5-a0d7c8717e4f
2004-06-07potential bugfixes for handling metadata in player/decoderWarren Dukes1-14/+43
git-svn-id: https://svn.musicpd.org/mpd/trunk@1369 09075e82-0dd4-0310-85a5-a0d7c8717e4f
2004-06-07icy metadata! wahooWarren Dukes1-3/+3
still lots some debug code with print out's, so don't bitch about it! git-svn-id: https://svn.musicpd.org/mpd/trunk@1364 09075e82-0dd4-0310-85a5-a0d7c8717e4f
2004-06-06harden metadatabufferWarren Dukes1-1/+4
git-svn-id: https://svn.musicpd.org/mpd/trunk@1362 09075e82-0dd4-0310-85a5-a0d7c8717e4f
2004-06-06mechanism for updating metadata while decodingWarren Dukes1-59/+29
vorbis comments are updated on the fly for streams need to decode icy metadata buffering of metadata needs to be hardened, to ensure that player has already read a particular metachunk or passed over it git-svn-id: https://svn.musicpd.org/mpd/trunk@1358 09075e82-0dd4-0310-85a5-a0d7c8717e4f
2004-06-06todo updateWarren Dukes1-49/+73
git-svn-id: https://svn.musicpd.org/mpd/trunk@1352 09075e82-0dd4-0310-85a5-a0d7c8717e4f
2004-06-03in decodeStart(), on switch for getting type of file, swtich on dc->utf8url, ↵Warren Dukes1-1/+1
not pc->utf8url git-svn-id: https://svn.musicpd.org/mpd/trunk@1320 09075e82-0dd4-0310-85a5-a0d7c8717e4f