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
e1001491
Commit
e1001491
authored
Jan 24, 2009
by
Max Kellermann
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
locate: initialize the whole visited_types array
The declaration initialized only the first element. Initialize the whole array with memset() instead.
parent
535cf5b5
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
6 additions
and
2 deletions
+6
-2
locate.c
src/locate.c
+6
-2
No files found.
src/locate.c
View file @
e1001491
...
...
@@ -130,7 +130,7 @@ locate_tag_search(const struct song *song, enum tag_type type, const char *str)
int
i
;
char
*
duplicate
;
bool
ret
=
false
;
bool
visited_types
[
TAG_NUM_OF_ITEM_TYPES
]
=
{
false
}
;
bool
visited_types
[
TAG_NUM_OF_ITEM_TYPES
];
if
(
type
==
LOCATE_TAG_FILE_TYPE
||
type
==
LOCATE_TAG_ANY_TYPE
)
{
char
*
uri
,
*
p
;
...
...
@@ -149,6 +149,8 @@ locate_tag_search(const struct song *song, enum tag_type type, const char *str)
if
(
!
song
->
tag
)
return
false
;
memset
(
visited_types
,
0
,
sizeof
(
visited_types
));
for
(
i
=
0
;
i
<
song
->
tag
->
numOfItems
&&
!
ret
;
i
++
)
{
visited_types
[
song
->
tag
->
items
[
i
]
->
type
]
=
true
;
if
(
type
!=
LOCATE_TAG_ANY_TYPE
&&
...
...
@@ -189,7 +191,7 @@ static bool
locate_tag_match
(
const
struct
song
*
song
,
enum
tag_type
type
,
const
char
*
str
)
{
int
i
;
bool
visited_types
[
TAG_NUM_OF_ITEM_TYPES
]
=
{
false
}
;
bool
visited_types
[
TAG_NUM_OF_ITEM_TYPES
];
if
(
type
==
LOCATE_TAG_FILE_TYPE
||
type
==
LOCATE_TAG_ANY_TYPE
)
{
char
*
uri
=
song_get_uri
(
song
);
...
...
@@ -206,6 +208,8 @@ locate_tag_match(const struct song *song, enum tag_type type, const char *str)
if
(
!
song
->
tag
)
return
false
;
memset
(
visited_types
,
0
,
sizeof
(
visited_types
));
for
(
i
=
0
;
i
<
song
->
tag
->
numOfItems
;
i
++
)
{
visited_types
[
song
->
tag
->
items
[
i
]
->
type
]
=
true
;
if
(
type
!=
LOCATE_TAG_ANY_TYPE
&&
...
...
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