Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
V
vlc
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Redmine
Redmine
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Operations
Operations
Metrics
Environments
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
videolan
vlc
Commits
167d5d5d
Commit
167d5d5d
authored
Jun 18, 2015
by
Rémi Denis-Courmont
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
lib: fix pointer misused as integer and simplify
parent
3cc31666
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
18 additions
and
32 deletions
+18
-32
lib/media_player.c
lib/media_player.c
+18
-32
No files found.
lib/media_player.c
View file @
167d5d5d
...
@@ -1340,57 +1340,43 @@ int libvlc_media_player_get_full_title_descriptions( libvlc_media_player_t *p_mi
...
@@ -1340,57 +1340,43 @@ int libvlc_media_player_get_full_title_descriptions( libvlc_media_player_t *p_mi
if
(
!
p_input_thread
)
if
(
!
p_input_thread
)
return
-
1
;
return
-
1
;
input_title_t
**
p_input_title
=
NULL
;
input_title_t
**
p_input_title
;
int
*
i_titles
=
0
;
int
count
;
/* fetch data */
/* fetch data */
int
ret
=
input_Control
(
p_input_thread
,
INPUT_GET_FULL_TITLE_INFO
,
&
p_input_title
,
&
i_titles
);
int
ret
=
input_Control
(
p_input_thread
,
INPUT_GET_FULL_TITLE_INFO
,
&
p_input_title
,
&
count
);
vlc_object_release
(
p_input_thread
);
vlc_object_release
(
p_input_thread
);
if
(
ret
!=
VLC_SUCCESS
)
if
(
ret
!=
VLC_SUCCESS
||
p_input_title
==
NULL
)
{
return
-
1
;
return
-
1
;
}
if
(
i_titles
==
0
)
{
return
0
;
}
const
int
ci_title_count
=
(
const
int
)
i_titles
;
libvlc_title_description_t
**
titles
=
malloc
(
count
*
sizeof
(
*
titles
)
);
if
(
count
>
0
&&
unlikely
(
titles
==
NULL
)
)
*
pp_titles
=
calloc
(
ci_title_count
,
sizeof
(
**
pp_titles
)
);
if
(
!*
pp_titles
)
{
return
-
1
;
return
-
1
;
}
/* fill array */
/* fill array */
for
(
int
i
=
0
;
i
<
c
i_title_c
ount
;
i
++
)
for
(
int
i
=
0
;
i
<
count
;
i
++
)
{
{
libvlc_title_description_t
*
p_title
=
malloc
(
sizeof
(
*
p_
title
)
);
libvlc_title_description_t
*
title
=
malloc
(
sizeof
(
*
title
)
);
if
(
unlikely
(
p_
title
==
NULL
)
)
if
(
unlikely
(
title
==
NULL
)
)
{
{
libvlc_title_descriptions_release
(
*
pp_titles
,
ci_title_
count
);
libvlc_title_descriptions_release
(
titles
,
count
);
return
-
1
;
return
-
1
;
}
}
(
*
pp_titles
)[
i
]
=
p_
title
;
titles
[
i
]
=
title
;
/* we want to return milliseconds to match the rest of the API */
/* we want to return milliseconds to match the rest of the API */
p_
title
->
i_duration
=
p_input_title
[
i
]
->
i_length
/
1000
;
title
->
i_duration
=
p_input_title
[
i
]
->
i_length
/
1000
;
p_
title
->
b_menu
=
p_input_title
[
i
]
->
b_menu
;
title
->
b_menu
=
p_input_title
[
i
]
->
b_menu
;
if
(
p_input_title
[
i
]
->
psz_name
)
if
(
p_input_title
[
i
]
->
psz_name
)
{
title
->
psz_name
=
strdup
(
p_input_title
[
i
]
->
psz_name
);
p_title
->
psz_name
=
strdup
(
p_input_title
[
i
]
->
psz_name
);
}
else
else
{
title
->
psz_name
=
NULL
;
p_title
->
psz_name
=
NULL
;
}
vlc_input_title_Delete
(
p_input_title
[
i
]
);
vlc_input_title_Delete
(
p_input_title
[
i
]
);
}
}
return
ci_title_count
;
*
pp_titles
=
titles
;
return
count
;
}
}
void
libvlc_title_descriptions_release
(
libvlc_title_description_t
**
p_titles
,
void
libvlc_title_descriptions_release
(
libvlc_title_description_t
**
p_titles
,
...
...
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