Commit Graph

1246 Commits

Author SHA1 Message Date
J. Alexander Treuman
7c9d3c4186 Reformatting initCommands and fillBuffer
git-svn-id: https://svn.musicpd.org/mpd/trunk@4582 09075e82-0dd4-0310-85a5-a0d7c8717e4f
2006-08-07 15:46:35 +00:00
Warren Dukes
b9f13d568a remove overzealous asserts (wait for np to clean up his COMMAND_MAX_ARGS stuff)
git-svn-id: https://svn.musicpd.org/mpd/trunk@4575 09075e82-0dd4-0310-85a5-a0d7c8717e4f
2006-08-06 14:41:11 +00:00
Warren Dukes
8e53406774 renamce cstrtok to buffer2array. please don't rename functions; especially to names that look extremely std-lib-ish. also, don't use isspace, apparently it's local dependent and potentially consideres ' ' or '\t' not to be a space, or considers other characters to be a space.
git-svn-id: https://svn.musicpd.org/mpd/trunk@4574 09075e82-0dd4-0310-85a5-a0d7c8717e4f
2006-08-06 13:53:53 +00:00
Warren Dukes
31de97a42b merge changes from mpd-tree:
-use tree for tagTracker
-eliminate the master process

git-svn-id: https://svn.musicpd.org/mpd/trunk@4571 09075e82-0dd4-0310-85a5-a0d7c8717e4f
2006-08-06 06:40:11 +00:00
Eric Wong
a8393d3937 buffer2array: more unit tests
git-svn-id: https://svn.musicpd.org/mpd/trunk@4570 09075e82-0dd4-0310-85a5-a0d7c8717e4f
2006-08-05 22:13:54 +00:00
Eric Wong
dd4c6d45f2 buffer2array: fix for trailing sub-quoted text inside a quoted context
Also added a unit test to check for errors/bugs to make sure we
don't have regressions.

Bug found by Qball.

git-svn-id: https://svn.musicpd.org/mpd/trunk@4569 09075e82-0dd4-0310-85a5-a0d7c8717e4f
2006-08-05 22:06:12 +00:00
Eric Wong
8e8d4fc6fd configure.ac: fix a typo
git-svn-id: https://svn.musicpd.org/mpd/trunk@4542 09075e82-0dd4-0310-85a5-a0d7c8717e4f
2006-08-04 07:40:53 +00:00
J. Alexander Treuman
c0036bcb45 Our id3 tag buffer should be an array of bytes, not an array of pointers to bytes. Now I know where those warnings came from...
git-svn-id: https://svn.musicpd.org/mpd/trunk@4540 09075e82-0dd4-0310-85a5-a0d7c8717e4f
2006-08-03 04:34:51 +00:00
Eric Wong
055e166619 buffer2array: oops, we forgot to take into account that \ is escaped, too
Any escaped instances of \ must already be inside an already
quoted string, though.

git-svn-id: https://svn.musicpd.org/mpd/trunk@4539 09075e82-0dd4-0310-85a5-a0d7c8717e4f
2006-08-03 04:20:25 +00:00
Eric Wong
31a81e2bcf log: oops, brain fart caused a segfault
git-svn-id: https://svn.musicpd.org/mpd/trunk@4538 09075e82-0dd4-0310-85a5-a0d7c8717e4f
2006-08-03 03:38:39 +00:00
Eric Wong
057a483710 log: switch to using FILE * for logging, since fdprintf isn't reentrant
(and fdprintf was never meant to be reentrant, either)

A huge thanks to welshbyte for reporting the bug and being very
helpful in helping me fix it.

git-svn-id: https://svn.musicpd.org/mpd/trunk@4537 09075e82-0dd4-0310-85a5-a0d7c8717e4f
2006-08-03 03:29:02 +00:00
J. Alexander Treuman
15c2aa765a Undoing more indent silliness
git-svn-id: https://svn.musicpd.org/mpd/trunk@4536 09075e82-0dd4-0310-85a5-a0d7c8717e4f
2006-08-03 02:45:23 +00:00
Warren Dukes
7ad533cca5 remove tree.[ch] from trunk, it will be added back once the mpd-tree branch is
merged back into trunk

git-svn-id: https://svn.musicpd.org/mpd/trunk@4535 09075e82-0dd4-0310-85a5-a0d7c8717e4f
2006-08-03 02:42:27 +00:00
Eric Wong
980c717749 main.c: initialize the verbose flag correctly
git-svn-id: https://svn.musicpd.org/mpd/trunk@4533 09075e82-0dd4-0310-85a5-a0d7c8717e4f
2006-08-03 01:57:52 +00:00
Warren Dukes
954dcec273 tree optimization: reduce the number of compares required for insertion and deletion by storing the position in the parent node of each child
git-svn-id: https://svn.musicpd.org/mpd/trunk@4532 09075e82-0dd4-0310-85a5-a0d7c8717e4f
2006-08-02 02:06:00 +00:00
Eric Wong
682fe8cee6 audioOutput_oss: cleanups (stolen from -ke)
git-svn-id: https://svn.musicpd.org/mpd/trunk@4518 09075e82-0dd4-0310-85a5-a0d7c8717e4f
2006-08-01 12:39:10 +00:00
Eric Wong
83b619e997 charConv: optimize away a boatload of strdups during update (try #2)
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
2006-08-01 12:02:47 +00:00
Eric Wong
468c9900ca audio: pause/resume-from-statefile bugfixes,
Oops, I broke pause/resuming from a statefile r4514
Everything should be fixed out.

Also we now avoid opening the audio device until we have a
playable audio_format set.  This is a long-standing bug that got
exposed more blatantly with the single array.

Thanks to MattD in #mpd for reporting my breakage.

git-svn-id: https://svn.musicpd.org/mpd/trunk@4516 09075e82-0dd4-0310-85a5-a0d7c8717e4f
2006-08-01 12:00:17 +00:00
Eric Wong
eb537f84f1 audio: malloc reductions
Just malloc all of the audioOutput array in one shot
to avoid fragmentation and to improve cache locality
when iterating through the array.

We also know name and type members of the AudioOutput
struct won't change in the config, so there's no
need to strdup them.

newAudioOutput => initAudioOutput

git-svn-id: https://svn.musicpd.org/mpd/trunk@4515 09075e82-0dd4-0310-85a5-a0d7c8717e4f
2006-08-01 10:07:16 +00:00
Eric Wong
b0965c317b audio: get rid of the myAudioDevicesEnabled array
It just made things more confusing.  We'll just store
the states in playerData_pd->audioDevicesStates and be
done with it (it's a unsigned byte now).

git-svn-id: https://svn.musicpd.org/mpd/trunk@4514 09075e82-0dd4-0310-85a5-a0d7c8717e4f
2006-08-01 10:07:12 +00:00
Eric Wong
c22a53d373 audio: remove AUDIO_MAX_DEVICES limit
Some people have more than 8 devices (the old limit).  It's
pretty easy to support as many as our hardware and OS allows
so we might as well.

git-svn-id: https://svn.musicpd.org/mpd/trunk@4513 09075e82-0dd4-0310-85a5-a0d7c8717e4f
2006-08-01 10:07:07 +00:00
Eric Wong
89073cfbba logging cleanups
* 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-08-01 04:18:53 +00:00
Eric Wong
2532bc36d2 playerData: move player_pid into the main playerData structure
No point in doing all that extra work for one variable...

git-svn-id: https://svn.musicpd.org/mpd/trunk@4511 09075e82-0dd4-0310-85a5-a0d7c8717e4f
2006-08-01 04:18:48 +00:00
Eric Wong
5aca21a502 Several fixes uncovered with -pedantic
playerData.c:
proper error checking

directory.c:
properly check myFgets() for errors
(it returns NULL on error)

inputPlugins/mp3_plugin.c
get rid of commas at the end of enums

interface.c:
we weren't using long long, so strtoll isn't needed
get rid of void-pointer arithmetic

sllist.c:
get rid of void-pointer arithmetic

compress.c:
get rid of C++ comments, some compilers don't accept them

Note that I personally like void pointer arithmetic, but some
ancient compilers don't support them :(

git-svn-id: https://svn.musicpd.org/mpd/trunk@4510 09075e82-0dd4-0310-85a5-a0d7c8717e4f
2006-08-01 04:18:41 +00:00
Eric Wong
9ccf40b242 src/listen.c: replace bcopy with memcpy
bcopy is old-school, yo

git-svn-id: https://svn.musicpd.org/mpd/trunk@4509 09075e82-0dd4-0310-85a5-a0d7c8717e4f
2006-08-01 04:18:37 +00:00
Warren Dukes
4ff98a9a94 fix a bug when deleting node and CHILDREN_PER_NODE is even
git-svn-id: https://svn.musicpd.org/mpd/trunk@4508 09075e82-0dd4-0310-85a5-a0d7c8717e4f
2006-08-01 03:34:56 +00:00
Warren Dukes
42390c5e3b fix a bug when deleting songs and CHILDREN_PER_NODE > 3
git-svn-id: https://svn.musicpd.org/mpd/trunk@4507 09075e82-0dd4-0310-85a5-a0d7c8717e4f
2006-08-01 03:29:13 +00:00
Warren Dukes
6f695b8d74 a couple of small cleanups
git-svn-id: https://svn.musicpd.org/mpd/trunk@4506 09075e82-0dd4-0310-85a5-a0d7c8717e4f
2006-08-01 01:12:21 +00:00
Warren Dukes
c5cab16509 deletion of tree nodes now works.
next is to clean up the code and make obvious optimizations

git-svn-id: https://svn.musicpd.org/mpd/trunk@4502 09075e82-0dd4-0310-85a5-a0d7c8717e4f
2006-08-01 00:31:09 +00:00
Warren Dukes
03fdf503f4 some tree bugfixes
git-svn-id: https://svn.musicpd.org/mpd/trunk@4498 09075e82-0dd4-0310-85a5-a0d7c8717e4f
2006-07-31 06:54:49 +00:00
Avuton Olrich
60a7abc1f3 No code change, just add headers
git-svn-id: https://svn.musicpd.org/mpd/trunk@4497 09075e82-0dd4-0310-85a5-a0d7c8717e4f
2006-07-31 03:37:34 +00:00
Warren Dukes
43fbf992e2 tree updates:
*) add copyright notice
*) implemented node deletion, but not yet tested

git-svn-id: https://svn.musicpd.org/mpd/trunk@4496 09075e82-0dd4-0310-85a5-a0d7c8717e4f
2006-07-31 02:20:44 +00:00
Eric Wong
44f9e16922 software volume can now be saved and read from the state file
git-svn-id: https://svn.musicpd.org/mpd/trunk@4495 09075e82-0dd4-0310-85a5-a0d7c8717e4f
2006-07-30 23:32:54 +00:00
Eric Wong
12aec5738b Standardize state_file handling routines.
This way it's easier to manage and extend.

git-svn-id: https://svn.musicpd.org/mpd/trunk@4494 09075e82-0dd4-0310-85a5-a0d7c8717e4f
2006-07-30 23:32:47 +00:00
Eric Wong
381d7232a0 remove deprecated myfprintf wrapper
This shaves another 5-6k because we've removed the paranoid
fflush() calls after every fprintf.  Now we only fflush()
when we need to

git-svn-id: https://svn.musicpd.org/mpd/trunk@4493 09075e82-0dd4-0310-85a5-a0d7c8717e4f
2006-07-30 23:32:39 +00:00
Warren Dukes
71fe871908 tree updates:
*) when CHILDREN_PER_NODE is large, use binary search
*) add a iterator implementation
*) some code cleanup

git-svn-id: https://svn.musicpd.org/mpd/trunk@4492 09075e82-0dd4-0310-85a5-a0d7c8717e4f
2006-07-30 18:43:13 +00:00
Eric Wong
263a9d583a remove clumsy strncpy use
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-30 10:31:41 +00:00
Avuton Olrich
4144afe551 Now fix the mp4 plugin warnings to what they were before the dynamic linking
git-svn-id: https://svn.musicpd.org/mpd/trunk@4490 09075e82-0dd4-0310-85a5-a0d7c8717e4f
2006-07-30 09:13:01 +00:00
Eric Wong
a80168a15b gcc signedness and sparse fixes
git-svn-id: https://svn.musicpd.org/mpd/trunk@4489 09075e82-0dd4-0310-85a5-a0d7c8717e4f
2006-07-30 08:56:55 +00:00
Eric Wong
e86fd65c81 commandError() cleanups, fixup gcc checks
stripped binary size reduced by 9k on my machine from making
commandError a function.  We'll print out error messages slightly
slower before, but the smaller binary is more than worth it.

git-svn-id: https://svn.musicpd.org/mpd/trunk@4488 09075e82-0dd4-0310-85a5-a0d7c8717e4f
2006-07-30 08:47:50 +00:00
Warren Dukes
a0c8e3656b beginnings of a B-tree, currently insertion has been implemented and test
git-svn-id: https://svn.musicpd.org/mpd/trunk@4487 09075e82-0dd4-0310-85a5-a0d7c8717e4f
2006-07-30 07:58:56 +00:00
Eric Wong
b38c3fa1bb command: fix find/search commands from the malloc reduction patch
The most we ever use is for search/find, and that limits it to the
number of tags we can have.  Add one for the command, and one extra
to catch errors clients may send us.

Thanks to Qball for reporting this bug

git-svn-id: https://svn.musicpd.org/mpd/trunk@4486 09075e82-0dd4-0310-85a5-a0d7c8717e4f
2006-07-30 05:00:56 +00:00
Eric Wong
da2d7e0c41 myfprintf: parse paths so we can reopen log files correctly
git-svn-id: https://svn.musicpd.org/mpd/trunk@4485 09075e82-0dd4-0310-85a5-a0d7c8717e4f
2006-07-30 04:38:36 +00:00
Eric Wong
a331939d65 fix some warnings introduced in the big malloc-reduction patch
The myfprintf bugs that are fixed here were NOT introduced in the
last patch, it's just that the stricter warning checks from moving
to fprintf caused string format bugs to actually be checked by gcc

git-svn-id: https://svn.musicpd.org/mpd/trunk@4484 09075e82-0dd4-0310-85a5-a0d7c8717e4f
2006-07-30 03:57:29 +00:00
Eric Wong
4cf5d04ca1 interface/connection malloc reductions from mpd-ke
This patch massively reduces the amount of heap allocations at
the interface/command layer.  Most commands with minimal output
should not allocate memory from the heap at all.  Things like
repeatedly polling status, currentsong, and volume changes
should be faster as a result, and more importantly, not a source
of memory fragmentation.

These changes should be safe in that there's no way for a
remote-client to corrupt memory or otherwise do bad stuff to
MPD, but an extra set of eyes to review would be good.  Of
course there's never any warranty :)

No longer do we use FILE * structures in the interface, which means
we don't have to allocate any new memory for most connections.

Now, before you go on about losing the buffering that FILE *
+implies+, remember that myfprintf() never took advantage of
any of the stdio buffering features.

To reduce the diff and make bugs easier to spot in the diff,
I've kept myfprintf in places where we write to files (and not
network interfaces).  Expect myfprintf to go away entirely soon
(we'll use fprintf for writing regular files).

git-svn-id: https://svn.musicpd.org/mpd/trunk@4483 09075e82-0dd4-0310-85a5-a0d7c8717e4f
2006-07-30 03:43:38 +00:00
Eric Wong
4d5b8509eb conf.c: bugfix: print out the number, not the address
git-svn-id: https://svn.musicpd.org/mpd/trunk@4482 09075e82-0dd4-0310-85a5-a0d7c8717e4f
2006-07-30 03:43:34 +00:00
Eric Wong
f08342c11f replace buffer2array() with cstrtok() from mpd-ke
This modifies the string in place, and does not allocate any memory from
the heap.  This is considerably smaller than the function it replaces,
and will be instrumental in getting the commands/conf malloc reductions
done.

git-svn-id: https://svn.musicpd.org/mpd/trunk@4481 09075e82-0dd4-0310-85a5-a0d7c8717e4f
2006-07-29 18:55:00 +00:00
Eric Wong
f05166a6a0 command.c: shorten common variable names to argc and argv
Any C programmer with half a clue knows they mean argArrayLength
and argArray, and I find the code much easier to read and work with.

git-svn-id: https://svn.musicpd.org/mpd/trunk@4480 09075e82-0dd4-0310-85a5-a0d7c8717e4f
2006-07-29 18:54:56 +00:00
J. Alexander Treuman
49d580b9ae "a" -> ) in ChangeLog
git-svn-id: https://svn.musicpd.org/mpd/trunk@4479 09075e82-0dd4-0310-85a5-a0d7c8717e4f
2006-07-27 21:37:22 +00:00
J. Alexander Treuman
a741ee8638 Document which parameters may be specified multiple times in mpd.conf.5
git-svn-id: https://svn.musicpd.org/mpd/trunk@4478 09075e82-0dd4-0310-85a5-a0d7c8717e4f
2006-07-27 19:23:37 +00:00