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
3cc4799c
Commit
3cc4799c
authored
Oct 25, 2010
by
Rafaël Carré
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
ncurses: factorize ReadDir()
parent
96c44901
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
19 additions
and
35 deletions
+19
-35
modules/gui/ncurses.c
modules/gui/ncurses.c
+19
-35
No files found.
modules/gui/ncurses.c
View file @
3cc4799c
...
...
@@ -252,52 +252,36 @@ static void ReadDir(intf_thread_t *p_intf)
struct
stat
stat_data
;
#endif
struct
dir_entry_t
*
p_dir_entry
;
char
*
psz_uri
;
char
*
psz_uri
=
NULL
;
if
(
p_sys
->
b_show_hidden_files
==
false
&&
(
strlen
(
psz_entry
)
&&
psz_entry
[
0
]
==
'.'
)
&&
strcmp
(
psz_entry
,
".."
))
{
free
(
psz_entry
);
continue
;
}
if
(
!
p_sys
->
b_show_hidden_files
)
if
(
*
psz_entry
==
'.'
&&
strcmp
(
psz_entry
,
".."
))
goto
next
;
if
(
asprintf
(
&
psz_uri
,
"%s/%s"
,
p_sys
->
psz_current_dir
,
psz_entry
)
==
-
1
)
if
(
asprintf
(
&
psz_uri
,
"%s/%s"
,
p_sys
->
psz_current_dir
,
psz_entry
)
==
-
1
)
{
free
(
psz_entry
)
;
continue
;
psz_uri
=
NULL
;
goto
next
;
}
if
(
!
(
p_dir_entry
=
malloc
(
sizeof
(
struct
dir_entry_t
))))
{
free
(
psz_uri
);
free
(
psz_entry
);
continue
;
}
if
(
!
(
p_dir_entry
=
malloc
(
sizeof
*
p_dir_entry
)))
goto
next
;
p_dir_entry
->
b_file
=
#if defined(S_ISDIR)
if
(
!
vlc_stat
(
psz_uri
,
&
stat_data
)
&&
S_ISDIR
(
stat_data
.
st_mode
))
vlc_stat
(
psz_uri
,
&
stat_data
)
||
!
S_ISDIR
(
stat_data
.
st_mode
)
/*#elif defined(DT_DIR)
if
(p_dir_content->d_type & DT_DIR)*/
!
(p_dir_content->d_type & DT_DIR)*/
#else
if
(
0
)
false
#endif
{
p_dir_entry
->
psz_path
=
strdup
(
psz_entry
);
p_dir_entry
->
b_file
=
false
;
INSERT_ELEM
(
p_sys
->
pp_dir_entries
,
p_sys
->
i_dir_entries
,
p_sys
->
i_dir_entries
,
p_dir_entry
);
}
else
{
p_dir_entry
->
psz_path
=
strdup
(
psz_entry
);
p_dir_entry
->
b_file
=
true
;
INSERT_ELEM
(
p_sys
->
pp_dir_entries
,
p_sys
->
i_dir_entries
,
p_sys
->
i_dir_entries
,
p_dir_entry
);
}
;
p_dir_entry
->
psz_path
=
strdup
(
psz_entry
);
INSERT_ELEM
(
p_sys
->
pp_dir_entries
,
p_sys
->
i_dir_entries
,
p_sys
->
i_dir_entries
,
p_dir_entry
);
next:
free
(
psz_uri
);
free
(
psz_entry
);
}
...
...
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