Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
M
mpd
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Иван Мажукин
mpd
Commits
53e712ac
Commit
53e712ac
authored
Jan 24, 2009
by
Max Kellermann
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
locate: renamed LocateTagItem to "struct locate_item"
No CamelCase and no typedefs.
parent
627d590c
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
70 additions
and
60 deletions
+70
-60
command.c
src/command.c
+7
-9
dbUtils.c
src/dbUtils.c
+18
-14
dbUtils.h
src/dbUtils.h
+13
-10
locate.c
src/locate.c
+13
-11
locate.h
src/locate.h
+11
-9
playlist.c
src/playlist.c
+5
-4
playlist.h
src/playlist.h
+3
-3
No files found.
src/command.c
View file @
53e712ac
...
...
@@ -34,6 +34,7 @@
#include "stored_playlist.h"
#include "ack.h"
#include "audio.h"
#include "locate.h"
#include "dbUtils.h"
#include "tag.h"
#include "client.h"
...
...
@@ -832,8 +833,7 @@ static enum command_return
handle_find
(
struct
client
*
client
,
int
argc
,
char
*
argv
[])
{
int
ret
;
LocateTagItem
*
items
;
struct
locate_item
*
items
;
int
numItems
=
newLocateTagItemArrayFromArgArray
(
argv
+
1
,
argc
-
1
,
&
items
);
...
...
@@ -857,8 +857,7 @@ static enum command_return
handle_search
(
struct
client
*
client
,
int
argc
,
char
*
argv
[])
{
int
ret
;
LocateTagItem
*
items
;
struct
locate_item
*
items
;
int
numItems
=
newLocateTagItemArrayFromArgArray
(
argv
+
1
,
argc
-
1
,
&
items
);
...
...
@@ -882,8 +881,7 @@ static enum command_return
handle_count
(
struct
client
*
client
,
int
argc
,
char
*
argv
[])
{
int
ret
;
LocateTagItem
*
items
;
struct
locate_item
*
items
;
int
numItems
=
newLocateTagItemArrayFromArgArray
(
argv
+
1
,
argc
-
1
,
&
items
);
...
...
@@ -906,7 +904,7 @@ handle_count(struct client *client, int argc, char *argv[])
static
enum
command_return
handle_playlistfind
(
struct
client
*
client
,
int
argc
,
char
*
argv
[])
{
LocateTagI
tem
*
items
;
struct
locate_i
tem
*
items
;
int
numItems
=
newLocateTagItemArrayFromArgArray
(
argv
+
1
,
argc
-
1
,
&
items
);
...
...
@@ -926,7 +924,7 @@ handle_playlistfind(struct client *client, int argc, char *argv[])
static
enum
command_return
handle_playlistsearch
(
struct
client
*
client
,
int
argc
,
char
*
argv
[])
{
LocateTagI
tem
*
items
;
struct
locate_i
tem
*
items
;
int
numItems
=
newLocateTagItemArrayFromArgArray
(
argv
+
1
,
argc
-
1
,
&
items
);
...
...
@@ -1114,7 +1112,7 @@ static enum command_return
handle_list
(
struct
client
*
client
,
int
argc
,
char
*
argv
[])
{
int
numConditionals
;
LocateTagI
tem
*
conditionals
=
NULL
;
struct
locate_i
tem
*
conditionals
=
NULL
;
int
tagType
=
getLocateTagItemType
(
argv
[
1
]);
int
ret
;
...
...
src/dbUtils.c
View file @
53e712ac
...
...
@@ -17,7 +17,7 @@
*/
#include "dbUtils.h"
#include "locate.h"
#include "directory.h"
#include "database.h"
#include "client.h"
...
...
@@ -36,12 +36,12 @@
typedef
struct
_ListCommandItem
{
int8_t
tagType
;
int
numConditionals
;
const
LocateTagI
tem
*
conditionals
;
const
struct
locate_i
tem
*
conditionals
;
}
ListCommandItem
;
typedef
struct
_LocateTagItemArray
{
int
numItems
;
const
LocateTagI
tem
*
items
;
const
struct
locate_i
tem
*
items
;
}
LocateTagItemArray
;
typedef
struct
_SearchStats
{
...
...
@@ -86,13 +86,14 @@ searchInDirectory(struct song *song, void *_data)
return
0
;
}
int
searchForSongsIn
(
struct
client
*
client
,
const
char
*
name
,
int
numItems
,
const
LocateTagItem
*
items
)
int
searchForSongsIn
(
struct
client
*
client
,
const
char
*
name
,
int
numItems
,
const
struct
locate_item
*
items
)
{
int
ret
;
int
i
;
LocateTagI
tem
*
new_items
=
g_memdup
(
items
,
sizeof
(
LocateTagItem
)
*
numItems
);
struct
locate_i
tem
*
new_items
=
g_memdup
(
items
,
sizeof
(
items
[
0
]
)
*
numItems
);
struct
search_data
data
;
for
(
i
=
0
;
i
<
numItems
;
i
++
)
...
...
@@ -121,8 +122,9 @@ findInDirectory(struct song *song, void *_data)
return
0
;
}
int
findSongsIn
(
struct
client
*
client
,
const
char
*
name
,
int
numItems
,
const
LocateTagItem
*
items
)
int
findSongsIn
(
struct
client
*
client
,
const
char
*
name
,
int
numItems
,
const
struct
locate_item
*
items
)
{
struct
search_data
data
;
...
...
@@ -154,8 +156,9 @@ searchStatsInDirectory(struct song *song, void *data)
return
0
;
}
int
searchStatsForSongsIn
(
struct
client
*
client
,
const
char
*
name
,
int
numItems
,
const
LocateTagItem
*
items
)
int
searchStatsForSongsIn
(
struct
client
*
client
,
const
char
*
name
,
int
numItems
,
const
struct
locate_item
*
items
)
{
SearchStats
stats
;
int
ret
;
...
...
@@ -226,8 +229,9 @@ int printInfoForAllIn(struct client *client, const char *name)
printDirectoryInDirectory
,
client
);
}
static
ListCommandItem
*
newListCommandItem
(
int
tagType
,
int
numConditionals
,
const
LocateTagItem
*
conditionals
)
static
ListCommandItem
*
newListCommandItem
(
int
tagType
,
int
numConditionals
,
const
struct
locate_item
*
conditionals
)
{
ListCommandItem
*
item
=
g_new
(
ListCommandItem
,
1
);
...
...
@@ -288,7 +292,7 @@ listUniqueTagsInDirectory(struct song *song, void *_data)
}
int
listAllUniqueTags
(
struct
client
*
client
,
int
type
,
int
numConditionals
,
const
LocateTagI
tem
*
conditionals
)
const
struct
locate_i
tem
*
conditionals
)
{
int
ret
;
ListCommandItem
*
item
=
newListCommandItem
(
type
,
numConditionals
,
...
...
src/dbUtils.h
View file @
53e712ac
...
...
@@ -19,9 +19,8 @@
#ifndef MPD_DB_UTILS_H
#define MPD_DB_UTILS_H
#include "locate.h"
struct
client
;
struct
locate_item
;
int
printAllIn
(
struct
client
*
client
,
const
char
*
name
);
...
...
@@ -31,19 +30,23 @@ int addAllInToStoredPlaylist(const char *name, const char *utf8file);
int
printInfoForAllIn
(
struct
client
*
client
,
const
char
*
name
);
int
searchForSongsIn
(
struct
client
*
client
,
const
char
*
name
,
int
numItems
,
const
LocateTagItem
*
items
);
int
searchForSongsIn
(
struct
client
*
client
,
const
char
*
name
,
int
numItems
,
const
struct
locate_item
*
items
);
int
findSongsIn
(
struct
client
*
client
,
const
char
*
name
,
int
numItems
,
const
LocateTagItem
*
items
);
int
findSongsIn
(
struct
client
*
client
,
const
char
*
name
,
int
numItems
,
const
struct
locate_item
*
items
);
int
searchStatsForSongsIn
(
struct
client
*
client
,
const
char
*
name
,
int
numItems
,
const
LocateTagItem
*
items
);
int
searchStatsForSongsIn
(
struct
client
*
client
,
const
char
*
name
,
int
numItems
,
const
struct
locate_item
*
items
);
unsigned
long
sumSongTimesIn
(
const
char
*
name
);
int
listAllUniqueTags
(
struct
client
*
client
,
int
type
,
int
numConditiionals
,
const
LocateTagItem
*
conditionals
);
int
listAllUniqueTags
(
struct
client
*
client
,
int
type
,
int
numConditiionals
,
const
struct
locate_item
*
conditionals
);
void
printSavedMemoryFromFilenames
(
void
);
...
...
src/locate.c
View file @
53e712ac
...
...
@@ -53,7 +53,7 @@ int getLocateTagItemType(const char *str)
return
-
1
;
}
static
int
initLocateTagItem
(
LocateTagItem
*
item
,
static
int
initLocateTagItem
(
struct
locate_item
*
item
,
const
char
*
typeStr
,
const
char
*
needle
)
{
item
->
tagType
=
getLocateTagItemType
(
typeStr
);
...
...
@@ -66,9 +66,10 @@ static int initLocateTagItem(LocateTagItem * item,
return
0
;
}
LocateTagItem
*
newLocateTagItem
(
const
char
*
typeStr
,
const
char
*
needle
)
struct
locate_item
*
newLocateTagItem
(
const
char
*
typeStr
,
const
char
*
needle
)
{
LocateTagItem
*
ret
=
g_new
(
LocateTagI
tem
,
1
);
struct
locate_item
*
ret
=
g_new
(
struct
locate_i
tem
,
1
);
if
(
initLocateTagItem
(
ret
,
typeStr
,
needle
)
<
0
)
{
free
(
ret
);
...
...
@@ -78,7 +79,7 @@ LocateTagItem *newLocateTagItem(const char *typeStr, const char *needle)
return
ret
;
}
void
freeLocateTagItemArray
(
int
count
,
LocateTagItem
*
array
)
void
freeLocateTagItemArray
(
int
count
,
struct
locate_item
*
array
)
{
int
i
;
...
...
@@ -88,11 +89,12 @@ void freeLocateTagItemArray(int count, LocateTagItem * array)
free
(
array
);
}
int
newLocateTagItemArrayFromArgArray
(
char
*
argArray
[],
int
numArgs
,
LocateTagItem
**
arrayRet
)
int
newLocateTagItemArrayFromArgArray
(
char
*
argArray
[],
int
numArgs
,
struct
locate_item
**
arrayRet
)
{
int
i
,
j
;
LocateTagI
tem
*
item
;
struct
locate_i
tem
*
item
;
if
(
numArgs
==
0
)
return
0
;
...
...
@@ -100,7 +102,7 @@ int newLocateTagItemArrayFromArgArray(char *argArray[],
if
(
numArgs
%
2
!=
0
)
return
-
1
;
*
arrayRet
=
g_new
(
LocateTagI
tem
,
numArgs
/
2
);
*
arrayRet
=
g_new
(
struct
locate_i
tem
,
numArgs
/
2
);
for
(
i
=
0
,
item
=
*
arrayRet
;
i
<
numArgs
/
2
;
i
++
,
item
++
)
{
if
(
initLocateTagItem
...
...
@@ -120,7 +122,7 @@ fail:
return
-
1
;
}
void
freeLocateTagItem
(
LocateTagItem
*
item
)
void
freeLocateTagItem
(
struct
locate_item
*
item
)
{
free
(
item
->
needle
);
free
(
item
);
...
...
@@ -178,7 +180,7 @@ strstrSearchTag(const struct song *song, enum tag_type type, const char *str)
int
strstrSearchTags
(
const
struct
song
*
song
,
int
numItems
,
const
LocateTagI
tem
*
items
)
const
struct
locate_i
tem
*
items
)
{
int
i
;
...
...
@@ -240,7 +242,7 @@ tagItemFoundAndMatches(const struct song *song, enum tag_type type,
int
tagItemsFoundAndMatches
(
const
struct
song
*
song
,
int
numItems
,
const
LocateTagItem
*
items
)
const
struct
locate_item
*
items
)
{
int
i
;
...
...
src/locate.h
View file @
53e712ac
...
...
@@ -27,31 +27,33 @@
struct
song
;
/* struct used for search, find, list queries */
typedef
struct
_LocateTagI
tem
{
struct
locate_i
tem
{
int8_t
tagType
;
/* what we are looking for */
char
*
needle
;
}
LocateTagItem
;
};
int
getLocateTagItemType
(
const
char
*
str
);
/* returns NULL if not a known type */
LocateTagItem
*
newLocateTagItem
(
const
char
*
typeString
,
const
char
*
needle
);
struct
locate_item
*
newLocateTagItem
(
const
char
*
typeString
,
const
char
*
needle
);
/* return number of items or -1 on error */
int
newLocateTagItemArrayFromArgArray
(
char
*
argArray
[],
int
numArgs
,
LocateTagItem
**
arrayRet
);
int
newLocateTagItemArrayFromArgArray
(
char
*
argArray
[],
int
numArgs
,
struct
locate_item
**
arrayRet
);
void
freeLocateTagItemArray
(
int
count
,
LocateTagItem
*
array
);
void
freeLocateTagItemArray
(
int
count
,
struct
locate_item
*
array
);
void
freeLocateTagItem
(
LocateTagItem
*
item
);
void
freeLocateTagItem
(
struct
locate_item
*
item
);
int
strstrSearchTags
(
const
struct
song
*
song
,
int
numItems
,
const
LocateTagItem
*
items
);
const
struct
locate_item
*
items
);
int
tagItemsFoundAndMatches
(
const
struct
song
*
song
,
int
numItems
,
const
LocateTagItem
*
items
);
const
struct
locate_item
*
items
);
#endif
src/playlist.c
View file @
53e712ac
...
...
@@ -20,6 +20,7 @@
#include "playlist_save.h"
#include "queue_print.h"
#include "queue_save.h"
#include "locate.h"
#include "player_control.h"
#include "command.h"
#include "ls.h"
...
...
@@ -1178,11 +1179,11 @@ enum playlist_result loadPlaylist(const char *utf8file)
void
searchForSongsInPlaylist
(
struct
client
*
client
,
unsigned
numItems
,
const
LocateTagI
tem
*
items
)
unsigned
numItems
,
const
struct
locate_i
tem
*
items
)
{
unsigned
i
;
LocateTagI
tem
*
new_items
=
g_memdup
(
items
,
sizeof
(
LocateTagItem
)
*
numItems
);
struct
locate_i
tem
*
new_items
=
g_memdup
(
items
,
sizeof
(
items
[
0
]
)
*
numItems
);
for
(
i
=
0
;
i
<
numItems
;
i
++
)
new_items
[
i
].
needle
=
g_utf8_casefold
(
new_items
[
i
].
needle
,
-
1
);
...
...
@@ -1199,7 +1200,7 @@ searchForSongsInPlaylist(struct client *client,
void
findSongsInPlaylist
(
struct
client
*
client
,
unsigned
numItems
,
const
LocateTagI
tem
*
items
)
unsigned
numItems
,
const
struct
locate_i
tem
*
items
)
{
for
(
unsigned
i
=
0
;
i
<
queue_length
(
&
playlist
.
queue
);
i
++
)
{
const
struct
song
*
song
=
queue_get
(
&
playlist
.
queue
,
i
);
...
...
src/playlist.h
View file @
53e712ac
...
...
@@ -19,7 +19,6 @@
#ifndef MPD_PLAYLIST_H
#define MPD_PLAYLIST_H
#include "locate.h"
#include "queue.h"
#include <stdbool.h>
...
...
@@ -28,6 +27,7 @@
#define PLAYLIST_COMMENT '#'
struct
client
;
struct
locate_item
;
enum
playlist_result
{
PLAYLIST_RESULT_SUCCESS
,
...
...
@@ -177,11 +177,11 @@ void playlistVersionChange(void);
void
searchForSongsInPlaylist
(
struct
client
*
client
,
unsigned
numItems
,
const
LocateTagI
tem
*
items
);
unsigned
numItems
,
const
struct
locate_i
tem
*
items
);
void
findSongsInPlaylist
(
struct
client
*
client
,
unsigned
numItems
,
const
LocateTagI
tem
*
items
);
unsigned
numItems
,
const
struct
locate_i
tem
*
items
);
int
is_valid_playlist_name
(
const
char
*
utf8path
);
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment