Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
V
vlc-2-2
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-2-2
Commits
d6aa3d36
Commit
d6aa3d36
authored
Aug 02, 2010
by
Rémi Denis-Courmont
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
subtitles: do not use scandir as sorting is not required
parent
351d62a8
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
17 additions
and
18 deletions
+17
-18
src/input/subtitles.c
src/input/subtitles.c
+17
-18
No files found.
src/input/subtitles.c
View file @
d6aa3d36
...
...
@@ -302,23 +302,26 @@ char **subtitles_Detect( input_thread_t *p_this, char *psz_path,
subdirs
=
paths_to_list
(
f_dir
,
psz_path
);
for
(
j
=
-
1
,
i_sub_count
=
0
;
(
j
==
-
1
)
||
(
j
>=
0
&&
subdirs
!=
NULL
&&
subdirs
[
j
]
!=
NULL
);
j
++
)
{
const
char
*
psz_dir
=
j
<
0
?
f_dir
:
subdirs
[
j
];
char
**
ppsz_dir_content
;
int
i_dir_content
;
const
char
*
psz_dir
=
(
j
<
0
)
?
f_dir
:
subdirs
[
j
];
if
(
psz_dir
==
NULL
||
(
j
>=
0
&&
!
strcmp
(
psz_dir
,
f_dir
)
)
)
continue
;
/* parse psz_src dir */
i_dir_content
=
vlc_scandir
(
psz_dir
,
&
ppsz_dir_content
,
subtitles_Filter
,
NULL
);
if
(
i_dir_content
<
0
)
DIR
*
dir
=
vlc_opendir
(
psz_dir
);
if
(
dir
==
NULL
)
continue
;
msg_Dbg
(
p_this
,
"looking for a subtitle file in %s"
,
psz_dir
);
for
(
int
a
=
0
;
a
<
i_dir_content
&&
i_sub_count
<
MAX_SUBTITLE_FILES
;
a
++
)
char
*
psz_name
;
while
(
(
psz_name
=
vlc_readdir
(
dir
))
&&
i_sub_count
<
MAX_SUBTITLE_FILES
)
{
char
*
psz_name
=
ppsz_dir_content
[
a
];
if
(
psz_name
[
0
]
==
'.'
||
!
subtitles_Filter
(
psz_name
)
)
{
free
(
psz_name
);
continue
;
}
char
tmp_fname_noext
[
strlen
(
psz_name
)
+
1
];
char
tmp_fname_trim
[
strlen
(
psz_name
)
+
1
];
char
tmp_fname_ext
[
strlen
(
psz_name
)
+
1
];
...
...
@@ -326,9 +329,6 @@ char **subtitles_Detect( input_thread_t *p_this, char *psz_path,
int
i_prio
;
if
(
psz_name
==
NULL
||
psz_name
[
0
]
==
'.'
)
continue
;
/* retrieve various parts of the filename */
strcpy_strip_ext
(
tmp_fname_noext
,
psz_name
);
strcpy_get_ext
(
tmp_fname_ext
,
psz_name
);
...
...
@@ -370,7 +370,10 @@ char **subtitles_Detect( input_thread_t *p_this, char *psz_path,
sprintf
(
psz_path
,
"%s"
DIR_SEP
"%s"
,
psz_dir
,
psz_name
);
if
(
!
strcmp
(
psz_path
,
psz_fname
)
)
{
free
(
psz_name
);
continue
;
}
if
(
!
vlc_stat
(
psz_path
,
&
st
)
&&
S_ISREG
(
st
.
st_mode
)
&&
result
)
{
...
...
@@ -388,13 +391,9 @@ char **subtitles_Detect( input_thread_t *p_this, char *psz_path,
psz_path
,
i_prio
);
}
}
free
(
psz_name
);
}
if
(
ppsz_dir_content
)
{
for
(
int
a
=
0
;
a
<
i_dir_content
;
a
++
)
free
(
ppsz_dir_content
[
a
]
);
free
(
ppsz_dir_content
);
}
closedir
(
dir
);
}
if
(
subdirs
)
{
...
...
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