Commit Graph

1225 Commits

Author SHA1 Message Date
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
J. Alexander Treuman
ce2fa2e846 conf.[ch] whitespace cleanup
git-svn-id: https://svn.musicpd.org/mpd/trunk@4477 09075e82-0dd4-0310-85a5-a0d7c8717e4f
2006-07-27 19:10:08 +00:00
J. Alexander Treuman
a48061bacf Updating compress.[ch] from AudioCompress
git-svn-id: https://svn.musicpd.org/mpd/trunk@4476 09075e82-0dd4-0310-85a5-a0d7c8717e4f
2006-07-27 03:42:42 +00:00
J. Alexander Treuman
0116c27a6b Update author of AudioCompress in AUTHORS
git-svn-id: https://svn.musicpd.org/mpd/trunk@4475 09075e82-0dd4-0310-85a5-a0d7c8717e4f
2006-07-27 02:28:51 +00:00
J. Alexander Treuman
22b16884a2 Use AudioCompress for volume normalization
git-svn-id: https://svn.musicpd.org/mpd/trunk@4474 09075e82-0dd4-0310-85a5-a0d7c8717e4f
2006-07-27 00:50:59 +00:00
J. Alexander Treuman
bf5336cebd Remove libid3tag/libmad copyright from AUTHORS, since it's no longer bundled
git-svn-id: https://svn.musicpd.org/mpd/trunk@4473 09075e82-0dd4-0310-85a5-a0d7c8717e4f
2006-07-27 00:12:14 +00:00
J. Alexander Treuman
8dcc3d31ac Remove the fifo plugin. It's currently useless for the average user, and making it more presentable isn't something I'm willing to do before 0.12. It will likely be added back after 0.12, along with some very experimental stuff to make it more usable.
git-svn-id: https://svn.musicpd.org/mpd/trunk@4472 09075e82-0dd4-0310-85a5-a0d7c8717e4f
2006-07-26 20:51:50 +00:00
Avuton Olrich
907fe56029 Remove the mp4ff directory from the root dir
git-svn-id: https://svn.musicpd.org/mpd/trunk@4471 09075e82-0dd4-0310-85a5-a0d7c8717e4f
2006-07-26 20:46:20 +00:00
Avuton Olrich
0f78a76fea Typo fix
git-svn-id: https://svn.musicpd.org/mpd/trunk@4470 09075e82-0dd4-0310-85a5-a0d7c8717e4f
2006-07-26 17:41:03 +00:00
J. Alexander Treuman
2fa3e8ab26 Silence a gcc warning... Properly.
git-svn-id: https://svn.musicpd.org/mpd/trunk@4469 09075e82-0dd4-0310-85a5-a0d7c8717e4f
2006-07-26 03:31:21 +00:00
J. Alexander Treuman
faa3debe8e Silence a gcc warning
git-svn-id: https://svn.musicpd.org/mpd/trunk@4468 09075e82-0dd4-0310-85a5-a0d7c8717e4f
2006-07-26 03:28:43 +00:00
J. Alexander Treuman
f2088bf869 jat's second tip of the day: when you change a ternary operator to an if, don't forget to take out everything after the :. And don't forget my first tip either.
git-svn-id: https://svn.musicpd.org/mpd/trunk@4467 09075e82-0dd4-0310-85a5-a0d7c8717e4f
2006-07-26 03:25:29 +00:00
Avuton Olrich
1bddcb6f92 Try to add the directory, again
git-svn-id: https://svn.musicpd.org/mpd/trunk@4466 09075e82-0dd4-0310-85a5-a0d7c8717e4f
2006-07-26 03:19:14 +00:00
J. Alexander Treuman
a570f8d9a9 Screw this found_* stuff, just wrap parse_*() in an if
git-svn-id: https://svn.musicpd.org/mpd/trunk@4465 09075e82-0dd4-0310-85a5-a0d7c8717e4f
2006-07-26 03:17:30 +00:00
J. Alexander Treuman
13cca01c7b Don't decode the first frame if it has a xing tag, not only if it has a xing tag with a frame count
git-svn-id: https://svn.musicpd.org/mpd/trunk@4464 09075e82-0dd4-0310-85a5-a0d7c8717e4f
2006-07-26 03:14:19 +00:00
Avuton Olrich
95293aadcd Now commit the actual dir
git-svn-id: https://svn.musicpd.org/mpd/trunk@4463 09075e82-0dd4-0310-85a5-a0d7c8717e4f
2006-07-26 03:13:23 +00:00
J. Alexander Treuman
b926dd100b Use the lame tag's encoder delay/padding to implement gapless mp3 playback
git-svn-id: https://svn.musicpd.org/mpd/trunk@4462 09075e82-0dd4-0310-85a5-a0d7c8717e4f
2006-07-26 03:10:19 +00:00
Avuton Olrich
bf3848ef94 Put mp4ff back into the tree
git-svn-id: https://svn.musicpd.org/mpd/trunk@4461 09075e82-0dd4-0310-85a5-a0d7c8717e4f
2006-07-26 03:05:50 +00:00
J. Alexander Treuman
1523e8a842 Parse lame tag for encoder delay/padding so we can later implement gapless
git-svn-id: https://svn.musicpd.org/mpd/trunk@4460 09075e82-0dd4-0310-85a5-a0d7c8717e4f
2006-07-25 22:49:10 +00:00
J. Alexander Treuman
a686436c77 jat's tip of the day: remember to remove your silly debug messages before committing
git-svn-id: https://svn.musicpd.org/mpd/trunk@4459 09075e82-0dd4-0310-85a5-a0d7c8717e4f
2006-07-25 22:22:48 +00:00
J. Alexander Treuman
356f16a877 Add support for mp1/2. Thanks to Stephan Beyer for the patch.
git-svn-id: https://svn.musicpd.org/mpd/trunk@4458 09075e82-0dd4-0310-85a5-a0d7c8717e4f
2006-07-25 22:08:55 +00:00
J. Alexander Treuman
073970ec4a Removing my stupid debug messages for testing xing
git-svn-id: https://svn.musicpd.org/mpd/trunk@4457 09075e82-0dd4-0310-85a5-a0d7c8717e4f
2006-07-25 20:09:24 +00:00