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
5c745329
Commit
5c745329
authored
Nov 15, 2010
by
Rémi Denis-Courmont
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
directory: small simplification
parent
70cf9406
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
26 additions
and
36 deletions
+26
-36
modules/access/directory.c
modules/access/directory.c
+26
-36
No files found.
modules/access/directory.c
View file @
5c745329
...
...
@@ -81,10 +81,9 @@ struct directory_t
struct
access_sys_t
{
directory_t
*
current
;
DIR
*
handle
;
char
*
uri
;
char
*
ignored_exts
;
int
mode
;
char
mode
;
bool
header
;
int
i_item_count
;
char
*
psz_xspf_extension
;
};
...
...
@@ -123,11 +122,30 @@ int DirInit (access_t *p_access, DIR *handle)
if
(
unlikely
(
uri
==
NULL
))
goto
error
;
/* "Open" the base directory */
directory_t
*
root
=
malloc
(
sizeof
(
*
root
));
if
(
unlikely
(
root
==
NULL
))
{
free
(
uri
);
goto
error
;
}
root
->
parent
=
NULL
;
root
->
handle
=
handle
;
root
->
uri
=
uri
;
#ifndef HAVE_OPENAT
root
->
path
=
strdup
(
p_access
->
psz_filepath
);
#endif
if
(
fstat
(
dirfd
(
handle
),
&
root
->
st
))
{
free
(
root
);
free
(
uri
);
goto
error
;
}
p_access
->
p_sys
=
p_sys
;
p_sys
->
current
=
NULL
;
p_sys
->
handle
=
handle
;
p_sys
->
uri
=
uri
;
p_sys
->
current
=
root
;
p_sys
->
ignored_exts
=
var_InheritString
(
p_access
,
"ignore-filetypes"
);
p_sys
->
header
=
true
;
p_sys
->
i_item_count
=
0
;
p_sys
->
psz_xspf_extension
=
strdup
(
""
);
...
...
@@ -178,11 +196,6 @@ void DirClose( vlc_object_t * p_this )
free
(
current
);
}
/* corner case: Block() not called ever */
if
(
p_sys
->
handle
!=
NULL
)
closedir
(
p_sys
->
handle
);
free
(
p_sys
->
uri
);
free
(
p_sys
->
psz_xspf_extension
);
free
(
p_sys
->
ignored_exts
);
free
(
p_sys
);
...
...
@@ -214,7 +227,7 @@ block_t *DirBlock (access_t *p_access)
if
(
p_access
->
info
.
b_eof
)
return
NULL
;
if
(
current
==
NULL
)
if
(
p_sys
->
header
)
{
/* Startup: send the XSPF header */
static
const
char
header
[]
=
"<?xml version=
\"
1.0
\"
encoding=
\"
UTF-8
\"
?>
\n
"
...
...
@@ -224,30 +237,7 @@ block_t *DirBlock (access_t *p_access)
if
(
!
block
)
goto
fatal
;
memcpy
(
block
->
p_buffer
,
header
,
sizeof
(
header
)
-
1
);
/* "Open" the base directory */
current
=
malloc
(
sizeof
(
*
current
));
if
(
current
==
NULL
)
{
block_Release
(
block
);
goto
fatal
;
}
current
->
parent
=
NULL
;
current
->
handle
=
p_sys
->
handle
;
#ifndef HAVE_OPENAT
current
->
path
=
strdup
(
p_access
->
psz_filepath
);
#endif
current
->
uri
=
p_sys
->
uri
;
if
(
fstat
(
dirfd
(
current
->
handle
),
&
current
->
st
))
{
free
(
current
);
block_Release
(
block
);
goto
fatal
;
}
p_sys
->
handle
=
NULL
;
p_sys
->
uri
=
NULL
;
p_sys
->
current
=
current
;
p_sys
->
header
=
false
;
return
block
;
}
...
...
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