Commit Graph

29 Commits

Author SHA1 Message Date
Max Kellermann a45922cd66 use g_free() instead of free()
On some platforms, g_free() must be used for memory allocated by
GLib.  This patch intends to correct a lot of occurrences, but is
probably not complete.
2009-01-25 18:47:21 +01:00
Qball Cow 16796b1209 Fix tag not being set when casefolding the locate_item_list 2009-01-25 12:20:47 +01:00
Max Kellermann e6cb939a82 locate: added locate_item_list_casefold()
Merged casefolding code from two locations into this one library
function.
2009-01-24 15:56:34 +01:00
Max Kellermann 6a2118d04c queue_print, dbUtils: use struct locate_item_list
Changed the function prototypes to get locate_item_list objects
instead of num_items/items.
2009-01-24 15:56:34 +01:00
Max Kellermann ba7c996266 locate: added struct locate_item_list
Instead of passing two parameters around (number of items, array of
items), combine both in a variable size struct.
2009-01-24 15:56:30 +01:00
Max Kellermann e100149124 locate: initialize the whole visited_types array
The declaration initialized only the first element.  Initialize the
whole array with memset() instead.
2009-01-24 15:27:09 +01:00
Max Kellermann 535cf5b5c9 locate: use bool instead of int
Use the C99 bool type instead of integer values (1/0 or 0/-1).
2009-01-24 15:27:05 +01:00
Max Kellermann 3582977e01 locate: no CamelCase
Renamed functions and variables.
2009-01-24 15:26:59 +01:00
Max Kellermann 53e712aca4 locate: renamed LocateTagItem to "struct locate_item"
No CamelCase and no typedefs.
2009-01-24 14:52:05 +01:00
Max Kellermann 1e6a26b6ca locate: use const pointers
Pass const pointers where no writes are performed.
2009-01-22 16:12:34 +01:00
Max Kellermann 493f661fa4 locate: fix strcmp() return value check
Yesterday's patch set changed tagItemFoundAndMatches() and moved the
strcmp() return value into a bool, but forgot to add the ==0 check.
2009-01-05 12:50:04 +01:00
Max Kellermann fed719197c song: allocate the result of song_get_url() 2009-01-04 19:09:34 +01:00
Max Kellermann 8cf9138541 locate: use GLib instead of utils.h 2009-01-02 16:24:16 +01:00
Max Kellermann dedaf7033b locate: ignore case when searching in song paths
The function strstrSearchTag() used g_utf8_casefold() to generate the
(pseudo-)lowercase version of the song's URL, but it never used the
variable.
2008-12-13 01:54:11 +01:00
Max Kellermann 047043d2a8 locate: use g_utf8_casefold() instead of string_toupper()
string_toupper() and strDupToUpper() were not able to deal with
character sets other than US-ASCII.  Use GLib's g_utf8_casefold()
for strings.
2008-10-15 19:36:37 +02:00
Max Kellermann 5e7b18f874 song: removed CamelCase
CamelCase is ugly...  rename all functions.
2008-10-08 11:05:34 +02:00
Max Kellermann d562ba5fbb song: converted typedef Song to struct song
Again, a data type which can be forward-declared.
2008-10-08 10:49:11 +02:00
Eric Wong 0352766dca Switch to C99 types (retaining compat with old compilers)
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.
2008-09-29 13:29:33 +02:00
Eric Wong a4019f7d21 allow searching for albums with an empty tag
tfing wrote:
> I have quite some files with an empty album tag as they do not come
> from a particular album.
>
> If I want to look for those files and browse them, this happens:
> :: nc localhost 6600
> OK MPD 0.12.0
> find album ""
> ACK [2@0] {find} too few arguments for "find"
>
> I'd like to be able to browse those files in a client like gmpc.
> So these 2 items would have to be developed:
> - list album should report that some files have an empty tag
> - it should be possible to search for an empty tag with the find command

Patch-by: Marc Pavot
ref: http://musicpd.org/mantis/view.php?id=464
2008-09-29 13:18:49 +02:00
Max Kellermann a34e1d2b84 include cleanup
As usual, include only headers which are really needed.
2008-09-06 20:28:31 +02:00
Max Kellermann ad0e09b2db tag: converted MpdTag.items to a pointer list
This prepares the following patches, which aim to reduce MPD's memory
usage: we plan to share tag_item instances, instead of just their
values.
2008-08-29 09:38:29 +02:00
Max Kellermann 0fc2422cd0 converted MpdTagItem.type to an enum
Don't use CPP macros when you can use C enum... this also allows
better type checking.
2008-08-26 08:27:09 +02:00
Max Kellermann c89b358c8a clean up CPP includes
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-12 04:19:26 +00:00
Max Kellermann 6fbdc721d9 fix -Wconst warnings
[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-02-05 10:17:33 +00:00
Max Kellermann 07adb14e3c fixed -Wshadow warnings
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-26 12:46:21 +00:00
Eric Wong b79f6b882a Merge branches/ew r7104
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-12-28 02:56:25 +00:00
J. Alexander Treuman 28c2a1e433 Use "file" instead of SONG_INFO (literally "file: ") for
LOCATE_TAG_KEY_FILE.  Specifying "file: " as an argument to
search/find/list wasn't the point of that patch...

git-svn-id: https://svn.musicpd.org/mpd/trunk@5670 09075e82-0dd4-0310-85a5-a0d7c8717e4f
2007-03-20 20:22:23 +00:00
J. Alexander Treuman 7ca84d3166 Adding copyright headers to locate.[ch].
git-svn-id: https://svn.musicpd.org/mpd/trunk@5422 09075e82-0dd4-0310-85a5-a0d7c8717e4f
2007-02-24 03:14:00 +00:00
J. Alexander Treuman 1ae3bdb7e6 Moving a bunch of the LocateTagItem code to locate.[ch] so that it can
later be used for playlist searching.

git-svn-id: https://svn.musicpd.org/mpd/trunk@5419 09075e82-0dd4-0310-85a5-a0d7c8717e4f
2007-02-24 00:54:54 +00:00