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
3ef4b196
Commit
3ef4b196
authored
Nov 27, 2007
by
Rémi Denis-Courmont
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix EOF check and remove fprintf
parent
956c05ba
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
15 additions
and
12 deletions
+15
-12
modules/access/file.c
modules/access/file.c
+15
-12
No files found.
modules/access/file.c
View file @
3ef4b196
...
@@ -343,7 +343,6 @@ static void mmapRelease (block_t *block)
...
@@ -343,7 +343,6 @@ static void mmapRelease (block_t *block)
{
{
block_sys_t
*
p_sys
=
(
block_sys_t
*
)
block
;
block_sys_t
*
p_sys
=
(
block_sys_t
*
)
block
;
fprintf
(
stderr
,
"munmap (%p, %u)
\n
"
,
p_sys
->
base_addr
,
MMAP_SIZE
);
munmap
(
p_sys
->
base_addr
,
p_sys
->
length
);
munmap
(
p_sys
->
base_addr
,
p_sys
->
length
);
//vlc_object_release (p_sys->owner);
//vlc_object_release (p_sys->owner);
free
(
p_sys
);
free
(
p_sys
);
...
@@ -360,30 +359,34 @@ static block_t *mmapBlock (access_t *p_access)
...
@@ -360,30 +359,34 @@ static block_t *mmapBlock (access_t *p_access)
size_t
length
=
(
MMAP_SIZE
>
pagesize
)
?
MMAP_SIZE
:
pagesize
;
size_t
length
=
(
MMAP_SIZE
>
pagesize
)
?
MMAP_SIZE
:
pagesize
;
void
*
addr
;
void
*
addr
;
/* File grown while being played? */
if
(
p_access
->
info
.
i_pos
>=
p_access
->
info
.
i_size
)
if
(
offset
+
length
>=
p_access
->
info
.
i_size
)
{
{
/* End of file - check that file size hasn't change... */
struct
stat
st
;
struct
stat
st
;
if
((
fstat
(
p_sys
->
fd
,
&
st
)
==
0
)
if
((
fstat
(
p_sys
->
fd
,
&
st
)
==
0
)
&&
(
st
.
st_size
>
p_access
->
info
.
i_size
))
&&
(
st
.
st_size
!=
p_access
->
info
.
i_size
))
{
{
p_access
->
info
.
i_size
=
st
.
st_size
;
p_access
->
info
.
i_size
=
st
.
st_size
;
p_access
->
info
.
i_update
|=
INPUT_UPDATE_SIZE
;
p_access
->
info
.
i_update
|=
INPUT_UPDATE_SIZE
;
}
}
}
/* Really at end of file?
*/
/* Really at end of file then
*/
if
(
offset
>=
p_access
->
info
.
i_size
)
if
(
p_access
->
info
.
i_pos
>=
p_access
->
info
.
i_size
)
{
{
p_access
->
info
.
b_eof
=
VLC_TRUE
;
p_access
->
info
.
b_eof
=
VLC_TRUE
;
msg_Dbg
(
p_access
,
"at end of memory mapped file"
);
msg_Dbg
(
p_access
,
"at end of memory mapped file"
);
return
NULL
;
return
NULL
;
}
}
}
if
(
offset
+
length
>
p_access
->
info
.
i_size
)
if
(
offset
+
length
>
p_access
->
info
.
i_size
)
/* Don't mmap paste end of file */
length
=
p_access
->
info
.
i_size
-
offset
;
length
=
p_access
->
info
.
i_size
-
offset
;
assert
(
offset
<=
p_access
->
info
.
i_pos
);
/* and */
assert
(
p_access
->
info
.
i_pos
<
p_access
->
info
.
i_size
);
/* imply */
assert
(
offset
<
p_access
->
info
.
i_size
);
/* imply */
assert
(
length
>
0
);
assert
(
length
>
0
);
addr
=
mmap
(
NULL
,
length
,
PROT_READ
,
flags
,
p_sys
->
fd
,
offset
);
addr
=
mmap
(
NULL
,
length
,
PROT_READ
,
flags
,
p_sys
->
fd
,
offset
);
...
@@ -394,7 +397,7 @@ static block_t *mmapBlock (access_t *p_access)
...
@@ -394,7 +397,7 @@ static block_t *mmapBlock (access_t *p_access)
return
NULL
;
return
NULL
;
}
}
p_access
->
info
.
i_pos
+=
length
;
p_access
->
info
.
i_pos
=
offset
+
length
;
msg_Dbg
(
p_access
,
"mapped %lu bytes at %p from offset %lu"
,
msg_Dbg
(
p_access
,
"mapped %lu bytes at %p from offset %lu"
,
(
unsigned
long
)
length
,
addr
,
(
unsigned
long
)
offset
);
(
unsigned
long
)
length
,
addr
,
(
unsigned
long
)
offset
);
...
...
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