aboutsummaryrefslogtreecommitdiffstats
path: root/src/tag_id3.c (unfollow)
Commit message (Collapse)AuthorFilesLines
2008-12-02replaced mpd_likely/mpd_unlikely by G_LIKELY/G_UNLIKELYThomas Jansen1-2/+2
We want to remove gcc.h eventually. This takes care of all the G_LIKELY/G_UNLIKELY macros.
2008-10-17Makefile.am: don't compile disabled sourcesMax Kellermann1-21/+1
If a feature is disabled, don't compile the source file at all, disable it completely in Makefile.am instead.
2008-10-15path, tag_id3: use g_convert() instead of charConv.cMax Kellermann1-5/+10
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.
2008-10-15tag_id3: fix indentationMax Kellermann1-28/+28
Indentation was broken in tag_id3.c: it used 4 spaces instead of tabs.
2008-08-29const pointersMax Kellermann1-1/+1
Yet another patch which converts pointer arguments to "const".
2008-08-29tag: moved code to tag_id3.cMax Kellermann1-374/+5
The ID3 code uses only the public tag API, but is otherwise unrelated. Move it to a separate source file.
2008-08-29tag: renamed functions, no CamelCaseMax Kellermann1-24/+24
2008-08-29tag: renamed MpdTag and MpdTagItem to struct tag, struct mpd_tag_itemMax Kellermann1-22/+23
Getting rid of CamelCase; not having typedefs also allows us to forward-declare the structures.
2008-08-28const pointersMax Kellermann1-2/+2
The usual bunch of pointer arguments which should be const.
2008-08-28unsigned integers and size_tMax Kellermann1-4/+3
Use "unsigned int" whenever negative values are not meaningful. Use size_t whenever we are going to describe buffer sizes.
2008-08-26converted MpdTagItem.type to an enumMax Kellermann1-3/+5
Don't use CPP macros when you can use C enum... this also allows better type checking.
2008-04-12clean up CPP includesMax Kellermann1-4/+0
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
2008-04-12yet more unsigned integersMax Kellermann1-2/+1
git-svn-id: https://svn.musicpd.org/mpd/trunk@7287 09075e82-0dd4-0310-85a5-a0d7c8717e4f
2008-04-12whitespace cleanupMax Kellermann1-67/+67
git-svn-id: https://svn.musicpd.org/mpd/trunk@7286 09075e82-0dd4-0310-85a5-a0d7c8717e4f
2008-03-26use size_tMax Kellermann1-4/+4
When dealing with in-memory lengths, the standard type "size_t" should be used. Missing one can be quite dangerous, because an attacker could provoke an integer under-/overflow, which may provide an attack vector. git-svn-id: https://svn.musicpd.org/mpd/trunk@7205 09075e82-0dd4-0310-85a5-a0d7c8717e4f
2008-03-26eliminated duplicate initializationMax Kellermann1-5/+5
Local variables which are never read before the first assignment don't need initialization. Saves a few bytes of text. Also don't reset variables which are never read until function return. git-svn-id: https://svn.musicpd.org/mpd/trunk@7199 09075e82-0dd4-0310-85a5-a0d7c8717e4f
2008-02-05fix -Wconst warningsMax Kellermann1-3/+4
[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
2008-01-26fixed -Wshadow warningsMax Kellermann1-14/+14
Signed-off-by: Eric Wong <normalperson@yhbt.net> git-svn-id: https://svn.musicpd.org/mpd/trunk@7143 09075e82-0dd4-0310-85a5-a0d7c8717e4f
2008-01-03Cleanup #includes of standard system headers and put them in one placeEric Wong1-7/+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
2007-12-28Merge branches/ew r7104Eric Wong1-1/+2
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
2007-11-21When parsing id3_frames take in account that there are different framesQball Cow1-40/+137
and with different field types. This fixes comments for id3v1 and id3v2 git-svn-id: https://svn.musicpd.org/mpd/trunk@7040 09075e82-0dd4-0310-85a5-a0d7c8717e4f
2007-05-26Changing all calls to ERROR() followed by exit(EXIT_FAILURE) with a singleJ. Alexander Treuman1-2/+1
call to FATAL(). git-svn-id: https://svn.musicpd.org/mpd/trunk@6276 09075e82-0dd4-0310-85a5-a0d7c8717e4f
2007-04-05The massive copyright updateAvuton Olrich1-1/+1
git-svn-id: https://svn.musicpd.org/mpd/trunk@5834 09075e82-0dd4-0310-85a5-a0d7c8717e4f
2007-03-31Adding tagtypes command to list available tag types (takes metadata_to_useJ. Alexander Treuman1-0/+10
into account). git-svn-id: https://svn.musicpd.org/mpd/trunk@5792 09075e82-0dd4-0310-85a5-a0d7c8717e4f
2007-03-20Doing those previous SONG_* commits properly. Thanks to normalperson forJ. Alexander Treuman1-1/+1
pointing it out. git-svn-id: https://svn.musicpd.org/mpd/trunk@5673 09075e82-0dd4-0310-85a5-a0d7c8717e4f
2007-03-20Use SONG_TIME instead of literal "Time: " for consistency with db code.J. Alexander Treuman1-1/+2
git-svn-id: https://svn.musicpd.org/mpd/trunk@5668 09075e82-0dd4-0310-85a5-a0d7c8717e4f
2007-03-09fix bug #1458Warren Dukes1-2/+1
git-svn-id: https://svn.musicpd.org/mpd/trunk@5589 09075e82-0dd4-0310-85a5-a0d7c8717e4f
2007-02-23Make mpd fetch the Original artist/performer tag from mp3'sQball Cow1-0/+4
git-svn-id: https://svn.musicpd.org/mpd/trunk@5418 09075e82-0dd4-0310-85a5-a0d7c8717e4f
2007-02-18Closing some parenthesis around shank's email address in copyright headers.J. Alexander Treuman1-1/+1
git-svn-id: https://svn.musicpd.org/mpd/trunk@5376 09075e82-0dd4-0310-85a5-a0d7c8717e4f
2006-11-26Check that the APE tag length is valid before allocating a buffer for it.J. Alexander Treuman1-0/+2
git-svn-id: https://svn.musicpd.org/mpd/trunk@5098 09075e82-0dd4-0310-85a5-a0d7c8717e4f
2006-09-11tag.c: remove unnecessary #includesEric Wong1-7/+0
git-svn-id: https://svn.musicpd.org/mpd/trunk@4762 09075e82-0dd4-0310-85a5-a0d7c8717e4f
2006-08-26Replace strdup and {c,re,m}alloc with x* variants to check for OOM errorsEric Wong1-7/+7
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-18Cast isostr to char * to fix yet another warningJ. Alexander Treuman1-1/+1
git-svn-id: https://svn.musicpd.org/mpd/trunk@4655 09075e82-0dd4-0310-85a5-a0d7c8717e4f
2006-08-18Change type of isostr to fix warningJ. Alexander Treuman1-1/+1
git-svn-id: https://svn.musicpd.org/mpd/trunk@4654 09075e82-0dd4-0310-85a5-a0d7c8717e4f
2006-08-15Avoid an unnecessary encoding conversion when converting id3v1 tags. Also ↵J. Alexander Treuman1-22/+17
make getID3Info static. git-svn-id: https://svn.musicpd.org/mpd/trunk@4642 09075e82-0dd4-0310-85a5-a0d7c8717e4f
2006-08-15tag.c: fix segfault on failed id3v1 character conversionEric Wong1-0/+10
convStrDup() returns NULL if character conversion fails, so make sure we check the return values and drop the tag if we can't get a conversion. This should close bug 1313: http://musicpd.org/mantis/view.php?id=1313 git-svn-id: https://svn.musicpd.org/mpd/trunk@4641 09075e82-0dd4-0310-85a5-a0d7c8717e4f
2006-08-11Spelling & GrammarAvuton Olrich1-1/+1
git-svn-id: https://svn.musicpd.org/mpd/trunk@4612 09075e82-0dd4-0310-85a5-a0d7c8717e4f
2006-08-09labels should be on the left most column, no tabbingWarren Dukes1-1/+1
git-svn-id: https://svn.musicpd.org/mpd/trunk@4605 09075e82-0dd4-0310-85a5-a0d7c8717e4f
2006-08-07rewrite getId3Tag so we can get rid of this silly ID3_TAG_BUFLEN crapJ. Alexander Treuman1-28/+21
git-svn-id: https://svn.musicpd.org/mpd/trunk@4594 09075e82-0dd4-0310-85a5-a0d7c8717e4f
2006-08-07Indent some #defines in tag.c for better readabilityJ. Alexander Treuman1-8/+8
git-svn-id: https://svn.musicpd.org/mpd/trunk@4592 09075e82-0dd4-0310-85a5-a0d7c8717e4f
2006-08-07Reformatting initCommands and fillBufferJ. Alexander Treuman1-2/+1
git-svn-id: https://svn.musicpd.org/mpd/trunk@4582 09075e82-0dd4-0310-85a5-a0d7c8717e4f
2006-08-03Our id3 tag buffer should be an array of bytes, not an array of pointers to ↵J. Alexander Treuman1-4/+4
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-03Undoing more indent sillinessJ. Alexander Treuman1-8/+4
git-svn-id: https://svn.musicpd.org/mpd/trunk@4536 09075e82-0dd4-0310-85a5-a0d7c8717e4f
2006-07-30remove clumsy strncpy useEric Wong1-3/+2
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-30gcc signedness and sparse fixesEric Wong1-3/+3
git-svn-id: https://svn.musicpd.org/mpd/trunk@4489 09075e82-0dd4-0310-85a5-a0d7c8717e4f
2006-07-30interface/connection malloc reductions from mpd-keEric Wong1-3/+3
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-20Add mpd-indent.shAvuton Olrich1-146/+198
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-17some quick hacks to avoid signedness warnings with gcc4Warren Dukes1-5/+5
git-svn-id: https://svn.musicpd.org/mpd/trunk@4387 09075e82-0dd4-0310-85a5-a0d7c8717e4f
2006-07-17sparse: ANSI-fy function declarationsEric Wong1-2/+2
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
2006-07-15De-inline non-trivial, non-performance-critical functionsEric Wong1-1/+1
Functions that should stay inlined should have an explanation attached to them. git-svn-id: https://svn.musicpd.org/mpd/trunk@4355 09075e82-0dd4-0310-85a5-a0d7c8717e4f